Cline rules
.clinerules/debug-harness.mdCline rules
Quality
85/100
Scores the file, not the repository.Length
857 words
19 headings · 4 code blocksRepository
66k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# Debug Harness23HTTP-controlled debugger for the VSCode extension at `src/dev/debug-harness/server.ts`.45## Quick start67```bash8# Build extension first if needed (protos + esbuild):9bun run protos && IS_DEV=true bun esbuild.mjs1011# Launch (skip-build if already built). Run with node, NOT bun — Playwright's12# Electron launch times out under bun:13node src/dev/debug-harness/server.ts --skip-build --auto-launch1415# In another terminal:16curl localhost:19229/api -d '{"method":"status"}'17```1819## Data Isolation2021The debugee runs with `CLINE_DIR=~/.cline2` by default, separate from your real `~/.cline`.22This prevents the debugee's logout from logging out the debugger, and vice versa.23Override with `--cline-dir /tmp/test-dir`. Check with `status()` → `clineDir`.2425## Browser Capture & OAuth2627The debugee runs with `CLINE_CAPTURE_BROWSER=1`, which intercepts `openExternal()` in28`src/utils/env.ts`. URLs are captured instead of opening a real browser:2930- Logged to `$CLINE_DIR/data/debug-captured-urls.jsonl`31- POSTed in real-time to `/captured-url` on the harness server32- Queryable via `oauth.captured_urls`3334### OAuth API3536- **`oauth.captured_urls`** `{clear?}` — URLs the debugee tried to open37- **`oauth.read_stored_token`** — Check auth token presence in secrets.json38- **`oauth.simulate_callback`** `{path, code?, state?, provider?, token?}` — Build vscode:// callback URI39- **`oauth.read_captured_urls_file`** — Read on-disk JSONL of captured URLs4041### OAuth testing flow4243For **Cline OAuth** (SDK local callback): The SDK starts a local HTTP server, the auth URL44is captured. To complete: open the captured URL in a real browser (it redirects back to the45SDK's callback server), OR extract the callback port and `curl http://127.0.0.1:PORT/callback?code=...`.4647For **MCP/Provider OAuth** (vscode:// URI): The redirect goes to a vscode:// URI.48`oauth.simulate_callback` only *builds* the URI — it does not deliver it, and the ESM49extension host can't `require()` the handler. To actually deliver the callback, call the50debug-only hook via `ext.evaluate` (with `awaitPromise: true`):51`globalThis.__clineHandleUri("vscode://saoudrizwan.claude-dev/...?code=...&state=...")`.52It runs the same `SharedUriHandler.handleUri` as VSCode's real URI handler and exists only53when `CLINE_CAPTURE_BROWSER` is set (the harness always sets it; never ships in prod).54For end-to-end MCP OAuth, get a real `code` from the local MCP OAuth test server55(`bun run dev:mcp-oauth-test-server`).5657## Navigating Views — Use Commands, Not Clicks5859Don't try to find/click small sidebar icons. Use VSCode commands via command palette.60Registered in `src/registry.ts`:6162| Command | View |63|---------|------|64| `cline.accountButtonClicked` | Account / sign-in |65| `cline.historyButtonClicked` | Task history |66| `cline.settingsButtonClicked` | Settings |67| `cline.mcpButtonClicked` | MCP servers |68| `cline.plusButtonClicked` | New task (chat) |69| `cline.worktreesButtonClicked` | Worktrees |7071```bash72curl localhost:19229/api -d '{"method":"ui.command_palette","params":{"command":"cline.accountButtonClicked"}}'73```7475## Key commands7677All via `POST localhost:19229/api` with `{"method":"...", "params":{...}}`:7879- **`launch`** / **`shutdown`** — lifecycle80- **`ui.screenshot`** — screenshot to `/tmp/cline-debug/`; returns `{path}` — **use `read_file` on the path to examine, do NOT `open` the file** (Preview.app covers the VSCode window)81- **`ui.open_sidebar`** — open the Cline sidebar82- **`ext.set_breakpoint`** `{file, line, condition?}` — breakpoint by source file (sourcemap-resolved)83- **`ext.evaluate`** `{expression, callFrameId?}` — eval in extension host84- **`ext.resume`** / **`ext.step_over`** / **`ext.step_into`** — stepping85- **`ext.call_stack`** — inspect when paused86- **`web.evaluate`** `{expression}` — eval in webview87- **`web.post_message`** `{message}` — send postMessage to extension host via exposed vsCodeApi88- **`wait_for_pause`** `{timeout?}` — block until breakpoint hit89- **`ui.locator`** `{role?, testId?, text?, frame?}` — Playwright locator (auto-retries on stale sidebar frame)90- **`ui.react_input`** `{text, selector?, clear?, submit?}` — set React textarea value via `execCommand('insertText')`; works reliably across multiple tasks91- **`ui.send_message`** `{text, images?, files?, responseType?}` — send chat message bypassing the textarea entirely (via gRPC postMessage)92- **`ui.command_palette`** `{command}` — run VSCode command9394## Typical Session9596```bash97# 1. Launch98curl localhost:19229/api -d '{"method":"launch","params":{"skipBuild":true}}'99100# 2. Open sidebar + dismiss overlays (ALWAYS do this first)101curl localhost:19229/api -d '{"method":"ui.open_sidebar"}'102curl localhost:19229/api -d '{"method":"web.evaluate","params":{"expression":"document.querySelectorAll(\".sr-only\").forEach(el => el.parentElement?.click())"}}'103104# 3. Navigate to view105curl localhost:19229/api -d '{"method":"ui.command_palette","params":{"command":"cline.accountButtonClicked"}}'106107# 4. Check captured OAuth URLs if testing auth108curl localhost:19229/api -d '{"method":"oauth.captured_urls"}'109110# 5. Verify111curl localhost:19229/api -d '{"method":"ui.screenshot"}'112```113114## Caveats115116- **⚠️ Dismiss promotional overlays FIRST**: On fresh launches, full-screen promo overlays block the sidebar. **Dismiss immediately after `ui.open_sidebar`**, before any other interaction or screenshot. May need to run twice:117```bash118 curl localhost:19229/api -d '{"method": "ui.open_sidebar"}'119 curl localhost:19229/api -d '{"method": "web.evaluate", "params": {"expression": "document.querySelectorAll(\".sr-only\").forEach(el => el.parentElement?.click())"}}'120```121- **Screenshots — don't open the file**: `ui.screenshot` and `ui.sidebar_screenshot` save PNGs to `/tmp/cline-debug/` and return the `{path}`. Use `read_file` on that path to examine screenshots. Running `open <path>` launches Preview.app on macOS which covers the VSCode window.122- **Scripts count = 0 after launch**: CDP connects after extension host starts, so scripts parsed during startup aren't tracked. Breakpoints still work via sourcemap resolution.123- **Port 9230**: Extension host inspector. If another VSCode instance uses this port, the harness will fail to connect. Kill other debug instances first.124- **macOS only** for now (Playwright Electron launch behavior).125- **Webview CDP**: `connect_webview` may fail depending on Electron version. `web.evaluate` still works via Playwright's `frame.evaluate()` fallback.126- **Sourcemap paths**: esbuild outputs relative paths like `../src/extension.ts` in the sourcemap. The resolver handles this, but if a file isn't found, use `ext.source_files` to see exact paths.127- **OAuth with fake codes**: Browser capture intercepts the URL but doesn't provide a valid auth code. For real OAuth testing, open the captured URL in a browser. For unit testing, mock the token exchange.128129See `src/dev/debug-harness/README.md` for full API reference.130
Also in cline/cline
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| cline/cline.clinerules/bun-and-node.md · 66k | Cline rules | setuptestmonorepodo-not | 74/100 | 3 days ago | |
| cline/cline.clinerules/cline-overview.md · 66k | Cline rules | archtypesapi | 54/100 | 3 days ago | |
| cline/cline.clinerules/sdk-migration.md · 66k | Cline rules | style | 59/100 | 3 days ago | |
| cline/cline.clinerules/storage.md · 66k | Cline rules | stylearchdatabasedo-not | 65/100 | 3 days ago | |
| cline/cline.clinerules/general.md · 66k | Cline rules | setupbuildstylearch+2 | 86/100 | 3 days ago | |
| cline/cline.clinerules/network.md · 66k | Cline rules | styletesting-strategydependencies | 54/100 | 3 days ago | |
| cline/cline.clinerules/protobuf-development.md · 66k | Cline rules | buildstylearchapi+1 | 74/100 | 3 days ago | |
| cline/cline.github/copilot-instructions.md · 66k | Copilot instructions | buildteststyleapi+1 | 75/100 | 3 days ago | |
| cline/clineAGENTS.md · 66k | AGENTS.md | buildtestlint-formatstyle+2 | 83/100 | 3 days ago | |
| cline/clinesdk/AGENTS.md · 66k | AGENTS.md | setupbuildteststyle+5 | 89/100 | 3 days ago | |
| cline/clinesdk/packages/llms/AGENTS.md · 66k | AGENTS.md | no sections | 45/100 | 3 days ago |
Diff against .clinerules/bun-and-node.md Diff against .clinerules/cline-overview.md Diff against .clinerules/sdk-migration.md Diff against .clinerules/storage.md Diff against .clinerules/general.md Diff against .clinerules/network.md Diff against .clinerules/protobuf-development.md Diff against .github/copilot-instructions.md Diff against AGENTS.md Diff against sdk/AGENTS.md Diff against sdk/packages/llms/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bashdeban/fastmind.clinerules/.project-consistency-keeper2.md · 5 | Cline rules | setupbuildtestlint-format+11 | 100/100 | 3 days ago | |
| JCodesMore/ai-website-cloner-template.clinerules · 31k | Cline rules | buildlint-formatstylearch+3 | 97/100 | 2 days ago | |
| BryaanF/LiantPortfolio.clinerules/project-guidelines.md · 0 | Cline rules | buildstylearchgit+2 | 96/100 | 3 days ago | |
| u9401066/zotero-keeper.clinerules/50-pubmed-project.md · 7 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| u9401066/zotero-keepervscode-extension/resources/repo-assets/pubmed-search-mcp/.clinerules/50-pubmed-project.md · 7 | Cline rules | testlint-formatstylearch+1 | 94/100 | 3 days ago | |
| VaillerTeeter/HoshimiNest.clinerules/project-identity.md · 1 | Cline rules | setuparchtypesdo-not | 93/100 | yesterday | |
| HerringtonDarkholme/megarepo.clinerules/02-development.md · 17 | Cline rules | setupbuildteststyle+3 | 92/100 | 3 days ago | |
| blendsdk/codeops-mcp.clinerules/project.md · 0 | Cline rules | buildteststylearch+7 | 91/100 | 3 days ago |
