DingCode
by hoverwr-bit
README.md
# DingCode
**Point AI coding agents directly at any UI bug — without pasting full-screen screenshots.**
DingCode is a lightweight native UI pin and handoff tool (**885 KB** Swift + AppKit on macOS, native WPF on Windows, plus Linux) built for **Claude Code, Cursor, Codex, and Gemini CLI**. Press `⌥⌘A` (`Ctrl+Alt+A` on Windows), click any UI element, and send exact pixel coordinates, on-device OCR text, app/window metadata, and DOM selectors via clipboard or a built-in zero-dependency stdio MCP server (`dingcode mcp`) — with screenshots **OFF by default** to save context tokens.
> **中文简介**:给写代码的 AI 用的屏幕定位钉。在任意 App 或网页按 `⌥⌘A` 点一下,直接把像素坐标、本地 OCR 文字与网页 DOM 锚点打包成结构化 JSON / MCP 交给 Claude Code、Cursor、Codex 或 Gemini CLI,告别“把左上角第二个按钮往下挪一点”。
>
> Website: [dingcode.dingkit.dev](https://dingcode.dingkit.dev) · License: MIT (Community) · Privacy: Zero telemetry, on-device OCR · Latest: [v0.1.2](https://github.com/hoverwr-bit/DingCode/releases/tag/v0.1.2)
## Why DingCode instead of pasting screenshots?
| Approach | Context / Token Footprint | Spatial Precision | Agent Scope Discipline | Runtime Overhead |
| :--- | :--- | :--- | :--- | :--- |
| **Full-screen PNG screenshots** | High (base64 images accumulate in context) | Visual guesswork | Agent often edits unrelated files | Manual capture + drag/drop |
| **Browser DevTools only** | Low | DOM only (web pages only) | None built-in | Web-only; manual copy |
| **DingCode (default mode)** | **Minimal (screenshots OFF by default)** | **Exact pixel coords + local OCR + DOM** | **5 built-in handoff rules** | **885 KB native overlay (`⌥⌘A`)** |
## What Every Pin Sends to Your AI Agent
1. **Structured target context**: app & window title, exact click coordinates, nearby local OCR text (Apple Vision on macOS / Windows OCR), and DOM selector when pinning web pages.
2. **5 anti-drift handoff rules**:
- Smallest change that fixes the pin
- Follow repo conventions first
- Touch only pinned element code
- No new dependencies unless explained
- Explain diff & verification
## Native Stdio MCP Server (`dingcode mcp`)
DingCode ships a built-in stdio MCP server written in **pure Python standard library** (zero `pip install` dependencies), exposing UI pins, handoff payloads, and fix status updates across **Claude Code, Cursor, Codex, and Gemini CLI** (plus git scope checks and Team batch pulls in Pro/Team).
This repository is **DingCode Community**: free and open source under the MIT license.
## Editions / 版本
| | Community(本仓库,MIT) | Pro | Team |
|---|:-:|:-:|:-:|
| 定位钉(macOS / Windows / Linux / 网页),bug / change / question 类型 | ✅ | ✅ | ✅ |
| 复制 JSON + handoff 规则给 agent | ✅ | ✅ | ✅ |
| CLI + MCP 服务器(`pins` / `mark-fixed` / `handoff`) | ✅ | ✅ | ✅ |
| 中 / 英 / 越 界面、浏览器扩展 | ✅ | ✅ | ✅ |
| 箭头 / 方框 / 椭圆 / 聚光 / 文字标注 | | ✅ | ✅ |
| 改动范围检查 + 一键回退、记录页 + 逐颗撤回 | | ✅ | ✅ |
| agent 自动修复(Claude / Codex / Cursor / Gemini / Kimi / pi) | | ✅ | ✅ |
| 发布评审、会话冲突检测 | | ✅ | ✅ |
| 语音备注、截图脱敏、步骤录制、前后对比验证、导出器、共享目录同步 | | ✅ | ✅ |
| 自托管团队服务端 + 看板 + 账号 + 席位 | | | ✅ |
Pro and Team are commercial builds. See https://dingcode.dingkit.dev for pricing.
## Layout / 目录
| Path | What |
|---|---|
| `tools/dingcode/macos/` | Menu-bar app (Swift, AppKit, ScreenCaptureKit, Vision). Live overlay: the app underneath stays usable |
| `tools/dingcode/windows/` | Windows app (.NET 8, WPF). Live overlay, UI Automation anchors, same JSON contract |
| `tools/dingcode/linux/` | Linux session. X11 toolbar, optional grim / Tesseract / AT-SPI |
| `tools/dingcode/web/anno.js` | In-page pin layer. Pins anchor to DOM elements and follow scrolling. Localhost bridge to the desktop app |
| `tools/dingcode/extension/` | Browser extension that injects the page layer |
| `tools/dingcode/handoff.py`, `tools/dingcode/dingcode` | CLI and stdio MCP server. Python standard library only |
| `tools/dingcode/core/` | Note schema, label placement, paths, i18n |
| `skills/dingcode/` | Agent skill for agents without an MCP client |
## Build / 构建
- **macOS 14+**: `bash tools/dingcode/macos/build.sh` → `DingCode.app`. Needs Screen Recording permission.
- **Windows**: `dotnet build tools/dingcode/windows/DingCodeWin.csproj -c Release`. `Ctrl+Alt+A` starts a session.
- **Linux**: `python3 tools/dingcode/linux/dingcode_linux.py` (`--check` lists available helpers).
- **Web**: load `tools/dingcode/web/anno.js`, enable with `?anno=1`.
- **Tests**: `cd tools/dingcode && python3 -m unittest core.test_core handoff_test linux.test_linux`
The step-by-step guide is [tools/dingcode/docs/TUTORIAL.md](tools/dingcode/docs/TUTORIAL.md); the design is [tools/dingcode/ARCHITECTURE.md](tools/dingcode/ARCHITECTURE.md).
## Using it / 使用
`⌥⌘A` (macOS) or `Ctrl+Alt+A` (Windows) starts a session on the display under the pointer. Click to drop a pin, type a note, B / C / Q set the pin type. Esc writes the JSON note and a PNG and copies a handoff prompt to the clipboard.
```
python3 tools/dingcode/dingcode pins # list pins
python3 tools/dingcode/dingcode prompt note.json # build the handoff prompt
python3 tools/dingcode/dingcode mcp # stdio MCP server for your agent
```
Every clipboard export is a prompt: the handoff rules, then the JSON note. Override the rules per project in `.dingcode/handoff-rules.md`, or user-wide in `~/DingCode/handoff-rules.md`.
## Privacy
Everything stays on your machine. The macOS app listens on `127.0.0.1:8763` only, for the page bridge. The update check runs only when `DINGCODE_UPDATE=1`. No telemetry.
## JSON contract
Desktop notes use `schema: "dingcode-desktop-v1"`. `pins[].x_px` / `y_px` are screenshot pixels with a top-left origin, plus `window_nx` / `window_ny`, `ocr_nearby`, optional `note`, `window`, `page` (from the browser bridge), `pin_type` (`bug` | `change` | `question`) and `status` (`open` | `ai-fixed` | `confirmed`). Details in [ARCHITECTURE.md](tools/dingcode/ARCHITECTURE.md).
## FAQ
- **Why are screenshots OFF by default?** Most UI alignment, copy, and layout fixes only need coordinates, nearby text, and DOM selector — keeping screenshots optional (toggleable per session on the toolbar) avoids context-window bloat.
- **Does DingCode phone home or collect analytics?** No. OCR runs locally on-device, telemetry is zero, and optional Pro ($19 one-time) uses offline Ed25519 signed license keys (`DC2`) with no phone-home DRM.
- **Can small teams use it for staging reviews?** Yes. Team mode ($9/seat, self-hosted) uses 1-click `DCT1` invite codes so PM/QA can pin staging bugs and lead engineers can pull batched pins via CLI/MCP and close them with the fix commit SHA.
## License
MIT, see [LICENSE](LICENSE). DingCode Pro and Team are separate commercial products and are not part of this repository.
This server cannot be deployed
Maintenance
ActivityNo data
ResponsivenessOutdated data