claude-ide-bridge 2.11.3 → 2.11.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/README.md +38 -17
  2. package/dist/automation.d.ts +208 -0
  3. package/dist/automation.js +549 -0
  4. package/dist/automation.js.map +1 -1
  5. package/dist/bridge.js +3 -3
  6. package/dist/bridge.js.map +1 -1
  7. package/dist/config.d.ts +2 -0
  8. package/dist/config.js +19 -0
  9. package/dist/config.js.map +1 -1
  10. package/dist/extensionClient.d.ts +7 -1
  11. package/dist/extensionClient.js +84 -33
  12. package/dist/extensionClient.js.map +1 -1
  13. package/dist/index.js +30 -20
  14. package/dist/index.js.map +1 -1
  15. package/dist/instructionsUtils.js +1 -1
  16. package/dist/instructionsUtils.js.map +1 -1
  17. package/dist/oauth.js +37 -10
  18. package/dist/oauth.js.map +1 -1
  19. package/dist/streamableHttp.js +62 -11
  20. package/dist/streamableHttp.js.map +1 -1
  21. package/dist/tools/activityLog.d.ts +16 -0
  22. package/dist/tools/activityLog.js +11 -2
  23. package/dist/tools/activityLog.js.map +1 -1
  24. package/dist/tools/auditDependencies.d.ts +41 -2
  25. package/dist/tools/auditDependencies.js +30 -7
  26. package/dist/tools/auditDependencies.js.map +1 -1
  27. package/dist/tools/batchLsp.d.ts +137 -0
  28. package/dist/tools/batchLsp.js +181 -0
  29. package/dist/tools/batchLsp.js.map +1 -0
  30. package/dist/tools/bridgeDoctor.d.ts +65 -0
  31. package/dist/tools/bridgeDoctor.js +351 -0
  32. package/dist/tools/bridgeDoctor.js.map +1 -0
  33. package/dist/tools/bridgeStatus.d.ts +7 -0
  34. package/dist/tools/bridgeStatus.js +15 -0
  35. package/dist/tools/bridgeStatus.js.map +1 -1
  36. package/dist/tools/cancelClaudeTask.d.ts +19 -0
  37. package/dist/tools/cancelClaudeTask.js +10 -2
  38. package/dist/tools/cancelClaudeTask.js.map +1 -1
  39. package/dist/tools/codeLens.d.ts +50 -0
  40. package/dist/tools/codeLens.js +50 -0
  41. package/dist/tools/codeLens.js.map +1 -0
  42. package/dist/tools/detectUnusedCode.d.ts +50 -2
  43. package/dist/tools/detectUnusedCode.js +47 -5
  44. package/dist/tools/detectUnusedCode.js.map +1 -1
  45. package/dist/tools/documentLinks.d.ts +62 -0
  46. package/dist/tools/documentLinks.js +58 -0
  47. package/dist/tools/documentLinks.js.map +1 -0
  48. package/dist/tools/explainSymbol.d.ts +9 -0
  49. package/dist/tools/explainSymbol.js +29 -1
  50. package/dist/tools/explainSymbol.js.map +1 -1
  51. package/dist/tools/foldingRanges.d.ts +22 -0
  52. package/dist/tools/foldingRanges.js +14 -3
  53. package/dist/tools/foldingRanges.js.map +1 -1
  54. package/dist/tools/generateTests.d.ts +40 -0
  55. package/dist/tools/generateTests.js +37 -2
  56. package/dist/tools/generateTests.js.map +1 -1
  57. package/dist/tools/getBufferContent.d.ts +35 -0
  58. package/dist/tools/getBufferContent.js +27 -3
  59. package/dist/tools/getBufferContent.js.map +1 -1
  60. package/dist/tools/getChangeImpact.d.ts +76 -0
  61. package/dist/tools/getChangeImpact.js +186 -0
  62. package/dist/tools/getChangeImpact.js.map +1 -0
  63. package/dist/tools/getClaudeTaskStatus.d.ts +37 -0
  64. package/dist/tools/getClaudeTaskStatus.js +16 -2
  65. package/dist/tools/getClaudeTaskStatus.js.map +1 -1
  66. package/dist/tools/getGitDiff.d.ts +15 -0
  67. package/dist/tools/getGitDiff.js +17 -3
  68. package/dist/tools/getGitDiff.js.map +1 -1
  69. package/dist/tools/getGitHotspots.d.ts +43 -0
  70. package/dist/tools/getGitHotspots.js +39 -2
  71. package/dist/tools/getGitHotspots.js.map +1 -1
  72. package/dist/tools/getImportTree.js +2 -4
  73. package/dist/tools/getImportTree.js.map +1 -1
  74. package/dist/tools/getImportedSignatures.d.ts +62 -0
  75. package/dist/tools/getImportedSignatures.js +255 -0
  76. package/dist/tools/getImportedSignatures.js.map +1 -0
  77. package/dist/tools/getPRTemplate.d.ts +37 -0
  78. package/dist/tools/getPRTemplate.js +16 -3
  79. package/dist/tools/getPRTemplate.js.map +1 -1
  80. package/dist/tools/getProjectInfo.d.ts +31 -0
  81. package/dist/tools/getProjectInfo.js +16 -2
  82. package/dist/tools/getProjectInfo.js.map +1 -1
  83. package/dist/tools/getToolCapabilities.d.ts +43 -0
  84. package/dist/tools/getToolCapabilities.js +45 -2
  85. package/dist/tools/getToolCapabilities.js.map +1 -1
  86. package/dist/tools/gitWrite.d.ts +20 -3
  87. package/dist/tools/gitWrite.js +18 -8
  88. package/dist/tools/gitWrite.js.map +1 -1
  89. package/dist/tools/github/pr.d.ts +8 -1
  90. package/dist/tools/github/pr.js +13 -1
  91. package/dist/tools/github/pr.js.map +1 -1
  92. package/dist/tools/handoffNote.d.ts +41 -0
  93. package/dist/tools/handoffNote.js +29 -15
  94. package/dist/tools/handoffNote.js.map +1 -1
  95. package/dist/tools/hoverAtCursor.d.ts +31 -0
  96. package/dist/tools/hoverAtCursor.js +21 -3
  97. package/dist/tools/hoverAtCursor.js.map +1 -1
  98. package/dist/tools/index.d.ts +1 -1
  99. package/dist/tools/index.js +43 -7
  100. package/dist/tools/index.js.map +1 -1
  101. package/dist/tools/inlayHints.d.ts +43 -0
  102. package/dist/tools/inlayHints.js +24 -2
  103. package/dist/tools/inlayHints.js.map +1 -1
  104. package/dist/tools/listClaudeTasks.d.ts +49 -0
  105. package/dist/tools/listClaudeTasks.js +26 -2
  106. package/dist/tools/listClaudeTasks.js.map +1 -1
  107. package/dist/tools/lsp.d.ts +347 -0
  108. package/dist/tools/lsp.js +235 -29
  109. package/dist/tools/lsp.js.map +1 -1
  110. package/dist/tools/notifyCwdChanged.d.ts +39 -0
  111. package/dist/tools/notifyCwdChanged.js +40 -0
  112. package/dist/tools/notifyCwdChanged.js.map +1 -0
  113. package/dist/tools/refactorExtractFunction.d.ts +17 -2
  114. package/dist/tools/refactorExtractFunction.js +17 -7
  115. package/dist/tools/refactorExtractFunction.js.map +1 -1
  116. package/dist/tools/refactorPreview.d.ts +31 -0
  117. package/dist/tools/refactorPreview.js +16 -2
  118. package/dist/tools/refactorPreview.js.map +1 -1
  119. package/dist/tools/resumeClaudeTask.d.ts +25 -0
  120. package/dist/tools/resumeClaudeTask.js +12 -2
  121. package/dist/tools/resumeClaudeTask.js.map +1 -1
  122. package/dist/tools/runClaudeTask.d.ts +22 -0
  123. package/dist/tools/runClaudeTask.js +12 -3
  124. package/dist/tools/runClaudeTask.js.map +1 -1
  125. package/dist/tools/runCommand.d.ts +22 -0
  126. package/dist/tools/runCommand.js +13 -2
  127. package/dist/tools/runCommand.js.map +1 -1
  128. package/dist/tools/runTests.d.ts +104 -1
  129. package/dist/tools/runTests.js +96 -6
  130. package/dist/tools/runTests.js.map +1 -1
  131. package/dist/tools/searchWorkspace.d.ts +40 -0
  132. package/dist/tools/searchWorkspace.js +32 -3
  133. package/dist/tools/searchWorkspace.js.map +1 -1
  134. package/dist/tools/selectionRanges.d.ts +22 -0
  135. package/dist/tools/selectionRanges.js +14 -3
  136. package/dist/tools/selectionRanges.js.map +1 -1
  137. package/dist/tools/semanticTokens.d.ts +87 -0
  138. package/dist/tools/semanticTokens.js +91 -0
  139. package/dist/tools/semanticTokens.js.map +1 -0
  140. package/dist/tools/typeHierarchy.d.ts +31 -0
  141. package/dist/tools/typeHierarchy.js +19 -3
  142. package/dist/tools/typeHierarchy.js.map +1 -1
  143. package/dist/transport.js +36 -9
  144. package/dist/transport.js.map +1 -1
  145. package/package.json +1 -1
  146. package/templates/bridge-tools.md +17 -0
package/README.md CHANGED
@@ -74,12 +74,12 @@ This appends the bridge section to your existing `CLAUDE.md` and writes `.claude
74
74
 
75
75
  ## Slim Mode vs Full Mode
76
76
 
77
- By default, the bridge starts in **slim mode** — 38 IDE-exclusive tools that Claude can't replicate with its built-in `Read`/`Write`/`Bash` tools: LSP intelligence, debugger, editor decorations, diagnostics, refactoring, and editor state. This is the right default for most workflows because Claude already has file editing and shell access built in.
77
+ By default, the bridge starts in **slim mode** — 48 IDE-exclusive tools that Claude can't replicate with its built-in `Read`/`Write`/`Bash` tools: LSP intelligence, debugger, editor decorations, diagnostics, refactoring, impact analysis, and editor state. This is the right default for most workflows because Claude already has file editing and shell access built in.
78
78
 
79
79
  If you need Claude to use the bridge's **git, terminal, file ops, HTTP client, or GitHub** tools instead of its built-in equivalents, start in full mode:
80
80
 
81
81
  ```bash
82
- claude-ide-bridge --watch --full # all ~95 tools
82
+ claude-ide-bridge --watch --full # all ~130 tools
83
83
  ```
84
84
 
85
85
  Or set it permanently in your config file (`claude-ide-bridge.config.json`):
@@ -169,7 +169,7 @@ See [docs/multi-ide-review.md](docs/multi-ide-review.md) for the staged review w
169
169
 
170
170
  | Doc | What it covers |
171
171
  |-----|----------------|
172
- | **[Platform Docs](documents/platform-docs.md)** | Complete tool reference (95+ tools), parameters, examples |
172
+ | **[Platform Docs](documents/platform-docs.md)** | Complete tool reference (130+ tools), parameters, examples |
173
173
  | **[Data Reference](documents/data-reference.md)** | Data flows, state management, protocol details |
174
174
  | **[Plugin Authoring](documents/plugin-authoring.md)** | Writing custom plugins — manifest schema, entrypoint API |
175
175
  | **[Use Cases](documents/use-cases.md)** | Real-world workflows and scenarios |
@@ -278,15 +278,16 @@ claude --plugin-dir ./claude-ide-bridge-plugin
278
278
 
279
279
  The bridge exposes tools in two modes:
280
280
 
281
- - **Slim mode (default)** — 38 IDE-exclusive tools. Only tools that require a live VS Code extension and have no native Claude equivalent. This is what you get with `claude-ide-bridge --watch`.
282
- - **Full mode (`--full`)** — all ~95 tools, adding git, terminal, file ops, HTTP, and GitHub. Use this for large projects or workflows that rely on those integrations.
281
+ - **Slim mode (default)** — 48 IDE-exclusive tools. Only tools that require a live VS Code extension and have no native Claude equivalent. This is what you get with `claude-ide-bridge --watch`.
282
+ - **Full mode (`--full`)** — all ~130 tools, adding git, terminal, file ops, HTTP, and GitHub. Use this for large projects or workflows that rely on those integrations.
283
283
 
284
- ### Slim mode — 38 IDE tools (default)
284
+ ### Slim mode — 48 IDE tools (default)
285
285
 
286
286
  | Category | Tools |
287
287
  |----------|-------|
288
- | LSP / Code Intelligence | `getDiagnostics` · `watchDiagnostics` · `goToDefinition` · `findReferences` · `getHover` · `getCodeActions` · `applyCodeAction` · `renameSymbol` · `searchWorkspaceSymbols` · `getDocumentSymbols` · `getCallHierarchy` |
289
- | Refactor & Navigation | `refactorAnalyze` · `refactorPreview` · `refactorExtractFunction` · `renameSymbol` · `prepareRename` · `selectionRanges` · `foldingRanges` · `signatureHelp` · `explainSymbol` · `getImportTree` |
288
+ | LSP / Code Intelligence | `getDiagnostics` · `watchDiagnostics` · `goToDefinition` · `findReferences` · `getHover` · `getCodeActions` · `applyCodeAction` · `renameSymbol` · `searchWorkspaceSymbols` · `getDocumentSymbols` · `getCallHierarchy` · `getSemanticTokens` · `getCodeLens` · `getDocumentLinks` · `batchGetHover` · `batchGoToDefinition` |
289
+ | Impact Analysis | `getChangeImpact` · `getImportedSignatures` |
290
+ | Refactor & Navigation | `refactorAnalyze` · `refactorPreview` · `refactorExtractFunction` · `prepareRename` · `selectionRanges` · `foldingRanges` · `signatureHelp` · `explainSymbol` · `getImportTree` |
290
291
  | Editor Decorations | `setEditorDecorations` · `clearEditorDecorations` |
291
292
  | Debugger | `startDebugging` · `stopDebugging` · `setDebugBreakpoints` · `evaluateInDebugger` · `getDebugState` |
292
293
  | Editor State | `getOpenEditors` · `getCurrentSelection` · `getLatestSelection` · `checkDocumentDirty` · `saveDocument` · `openFile` · `closeTab` · `captureScreenshot` |
@@ -422,6 +423,17 @@ claude-ide-bridge --workspace /path/to/project \
422
423
  "prompt": "Review the saved file: {{file}}",
423
424
  "cooldownMs": 10000
424
425
  },
426
+ "onFileChanged": {
427
+ "enabled": true,
428
+ "patterns": ["**/*.ts"],
429
+ "prompt": "A file was edited: {{file}}. Run getDiagnostics to check for new errors.",
430
+ "cooldownMs": 15000
431
+ },
432
+ "onCwdChanged": {
433
+ "enabled": true,
434
+ "prompt": "Working directory changed to {{cwd}}. Call getBridgeStatus and getOpenEditors to orient.",
435
+ "cooldownMs": 10000
436
+ },
425
437
  "onPostCompact": {
426
438
  "enabled": true,
427
439
  "prompt": "Context was compacted. Call getOpenEditors and getDiagnostics to rebuild your understanding of the current state.",
@@ -430,20 +442,29 @@ claude-ide-bridge --workspace /path/to/project \
430
442
  "onInstructionsLoaded": {
431
443
  "enabled": true,
432
444
  "prompt": "Call getToolCapabilities to confirm the bridge is connected and note which tools are available for this session."
445
+ },
446
+ "onTestRun": {
447
+ "enabled": true,
448
+ "onFailureOnly": true,
449
+ "prompt": "Tests failed ({{failed}}/{{total}}). Fix the failures:\n{{failures}}",
450
+ "cooldownMs": 15000
433
451
  }
434
452
  }
435
453
  ```
436
454
 
437
- When automation is active, VS Code save events and diagnostic errors automatically enqueue Claude tasks. Output streams to the "Claude IDE Bridge" output channel in real time.
455
+ When automation is active, VS Code save/change events, diagnostic errors, and Claude Code hook events automatically enqueue Claude tasks. Output streams to the "Claude IDE Bridge" output channel in real time.
438
456
 
439
457
  **Policy triggers:**
440
458
 
441
459
  | Trigger | When it fires | Key fields |
442
460
  |---------|--------------|------------|
443
461
  | `onDiagnosticsError` | VS Code reports new errors/warnings for a file | `enabled`, `minSeverity` (`error`/`warning`), `prompt` (supports `{{file}}` and `{{diagnostics}}`), `cooldownMs` |
444
- | `onFileSave` | A file matching `patterns` is saved | `enabled`, `patterns` (minimatch globs), `prompt` (supports `{{file}}`), `cooldownMs` |
462
+ | `onFileSave` | A file matching `patterns` is explicitly saved (Ctrl+S) | `enabled`, `patterns` (minimatch globs), `prompt` (supports `{{file}}`), `cooldownMs` |
463
+ | `onFileChanged` | Any buffer edit on a matching file (unsaved changes, external writes) — CC 2.1.83+ | `enabled`, `patterns` (minimatch globs), `prompt` (supports `{{file}}`), `cooldownMs` |
464
+ | `onCwdChanged` | Claude Code's working directory changes — CC 2.1.83+; call via `notifyCwdChanged` tool from a CC `CwdChanged` hook | `enabled`, `prompt` (supports `{{cwd}}`), `cooldownMs` |
445
465
  | `onPostCompact` | Claude compacts its context (Claude Code 2.1.76+) | `enabled`, `prompt`, `cooldownMs` |
446
466
  | `onInstructionsLoaded` | Claude loads CLAUDE.md at session start (Claude Code 2.1.76+) | `enabled`, `prompt` |
467
+ | `onTestRun` | `runTests` completes | `enabled`, `onFailureOnly` (bool, default `true`), `prompt` (supports `{{runner}}`, `{{failed}}`, `{{passed}}`, `{{total}}`, `{{failures}}`), `cooldownMs` |
447
468
 
448
469
  > **Cloud sessions**: If `CLAUDE_CODE_REMOTE=true` (Claude Code on the web), automation tasks will still enqueue but the bridge itself runs locally — those tasks will not execute. Guard policy prompts or the `onInstructionsLoaded` hook with an environment check if needed.
449
470
 
@@ -638,7 +659,7 @@ bash scripts/gen-claude-desktop-config.sh --write
638
659
 
639
660
  Then restart Claude Desktop once to load the new config. After that, the bridge's **stdio shim** handles everything automatically — it discovers the running bridge via lock files, buffers requests until connected, and reconnects transparently when the bridge restarts. No port or token needs to be hard-coded, and no further Desktop restarts are needed when the bridge restarts.
640
661
 
641
- > **Tool availability:** Without the VS Code extension connected, ~38 tools (debugger, LSP intelligence, editor state, decorations, refactoring) are unavailable. Claude Desktop works best alongside the running extension. You can verify connectivity by asking *"What tools do you have available?"* — the response will list what's active.
662
+ > **Tool availability:** Without the VS Code extension connected, ~48 tools (debugger, LSP intelligence, editor state, decorations, refactoring) are unavailable. Claude Desktop works best alongside the running extension. You can verify connectivity by asking *"What tools do you have available?"* — the response will list what's active.
642
663
 
643
664
  > **Debugging the shim:** If the connection seems stuck, the shim logs to stderr. In Claude Desktop, check **Settings → Developer → MCP Logs** to see shim output. Common cause: bridge not running — start it with `claude-ide-bridge --watch` first.
644
665
 
@@ -746,7 +767,7 @@ Team Lead (Claude Code)
746
767
  └── Teammate C ──► Bridge Session 3 ──► IDE
747
768
  ```
748
769
 
749
- All teammates share the same IDE and workspace. Each gets full access to all 95+ bridge tools.
770
+ All teammates share the same IDE and workspace. Each gets full access to all 130+ bridge tools.
750
771
 
751
772
  ### Setup
752
773
 
@@ -897,7 +918,7 @@ claude-ide-bridge \
897
918
 
898
919
  > The bridge token is entered once during authorization. After that, claude.ai holds a short-lived OAuth access token that it refreshes automatically — you don't need to update the connector URL when the bridge restarts.
899
920
 
900
- > **Tool availability:** All 95+ tools are available in full mode. VS Code extension-dependent tools (LSP, debugger, editor state) require the extension to be connected on the remote machine. Without the extension, ~57 CLI-backed tools still work (file ops, git, terminal, search, HTTP client). In slim mode (default), only the 38 IDE-exclusive tools are exposed.
921
+ > **Tool availability:** All 130+ tools are available in full mode. VS Code extension-dependent tools (LSP, debugger, editor state) require the extension to be connected on the remote machine. Without the extension, ~57 CLI-backed tools still work (file ops, git, terminal, search, HTTP client). In slim mode (default), only the 48 IDE-exclusive tools are exposed.
901
922
 
902
923
  ### Alternatives
903
924
 
@@ -993,7 +1014,7 @@ claude-ide-bridge gen-claude-md [--write] [--workspace <path>]
993
1014
  --automation-policy <path> Path to JSON automation policy file
994
1015
  --plugin <path> Load a plugin directory (repeatable)
995
1016
  --plugin-watch Watch plugin directories and hot-reload on change
996
- --full Register all ~95 tools (default: slim mode with 38 IDE-exclusive tools)
1017
+ --full Register all ~130 tools (default: slim mode with 48 IDE-exclusive tools)
997
1018
  --verbose Enable debug logging
998
1019
  --version, -v Print version and exit
999
1020
  --analytics <on|off> Enable or disable anonymous usage analytics
@@ -1012,8 +1033,8 @@ claude-ide-bridge/
1012
1033
  config.ts CLI args & config
1013
1034
  claudeDriver.ts IClaudeDriver interface + SubprocessDriver
1014
1035
  claudeOrchestrator.ts Task queue (MAX_CONCURRENT=10, MAX_QUEUE=20)
1015
- automation.ts AutomationHooks — onDiagnosticsError / onFileSave / onPostCompact / onInstructionsLoaded policies
1016
- tools/ 95+ MCP tool implementations
1036
+ automation.ts AutomationHooks — onDiagnosticsError / onFileSave / onFileChanged / onTestRun / onPostCompact / onInstructionsLoaded policies
1037
+ tools/ 130+ MCP tool implementations
1017
1038
  vscode-extension/
1018
1039
  src/extension.ts VS Code extension
1019
1040
  src/connection.ts WebSocket connection management
@@ -1116,7 +1137,7 @@ npm test # Run 394 extension tests
1116
1137
 
1117
1138
  ### Claude says a tool doesn't exist or tool count seems low
1118
1139
 
1119
- When the VS Code extension is disconnected, 38 tools that require extension access return an error with reconnect instructions (they remain visible but non-functional). These include LSP, debugger, editor state, and refactoring tools. In slim mode (default), all tools need the extension; in full mode, ~57 CLI-backed tools (git, terminal, file ops, HTTP, GitHub) still work. Check the "Claude IDE Bridge" output channel in VS Code — if you see a disconnection event, use `Claude IDE Bridge: Reconnect` from the command palette, or reload the window.
1140
+ When the VS Code extension is disconnected, 48 tools that require extension access return an error with reconnect instructions (they remain visible but non-functional). These include LSP, debugger, editor state, and refactoring tools. In slim mode (default), all tools need the extension; in full mode, ~57 CLI-backed tools (git, terminal, file ops, HTTP, GitHub) still work. Check the "Claude IDE Bridge" output channel in VS Code — if you see a disconnection event, use `Claude IDE Bridge: Reconnect` from the command palette, or reload the window.
1120
1141
 
1121
1142
  ### Bridge and extension version mismatch
1122
1143
 
@@ -15,6 +15,14 @@ export interface OnFileSavePolicy {
15
15
  prompt: string;
16
16
  cooldownMs: number;
17
17
  }
18
+ export interface OnFileChangedPolicy {
19
+ enabled: boolean;
20
+ /** Minimatch glob patterns, e.g. ["**\/*.ts", "!node_modules/**"] */
21
+ patterns: string[];
22
+ /** Placeholders: {{file}} */
23
+ prompt: string;
24
+ cooldownMs: number;
25
+ }
18
26
  export interface OnPostCompactPolicy {
19
27
  enabled: boolean;
20
28
  /**
@@ -35,13 +43,137 @@ export interface OnInstructionsLoadedPolicy {
35
43
  */
36
44
  prompt: string;
37
45
  }
46
+ export interface OnCwdChangedPolicy {
47
+ enabled: boolean;
48
+ /**
49
+ * Prompt to enqueue when Claude Code's working directory changes (Claude Code 2.1.83+).
50
+ * Useful for re-initialising workspace context when CC switches projects.
51
+ * Placeholder: {{cwd}}
52
+ */
53
+ prompt: string;
54
+ /** Minimum ms between triggers. Enforced minimum: 5000. */
55
+ cooldownMs: number;
56
+ }
57
+ export interface OnTestRunPolicy {
58
+ enabled: boolean;
59
+ /**
60
+ * Only trigger when there are test failures or errors.
61
+ * Set to false to trigger after every test run regardless of outcome.
62
+ * Default: true.
63
+ */
64
+ onFailureOnly: boolean;
65
+ /**
66
+ * Prompt to enqueue after a test run.
67
+ * Placeholders: {{runner}}, {{failed}}, {{passed}}, {{total}}, {{failures}}
68
+ */
69
+ prompt: string;
70
+ /** Minimum ms between triggers. Enforced minimum: 5000. */
71
+ cooldownMs: number;
72
+ }
73
+ /** Minimal test run result passed to handleTestRun — avoids importing TestResult from tool files. */
74
+ export interface TestRunResult {
75
+ runners: string[];
76
+ summary: {
77
+ total: number;
78
+ passed: number;
79
+ failed: number;
80
+ skipped: number;
81
+ errored: number;
82
+ };
83
+ failures: Array<{
84
+ name: string;
85
+ file: string;
86
+ message: string;
87
+ }>;
88
+ }
89
+ export interface OnGitCommitPolicy {
90
+ enabled: boolean;
91
+ /**
92
+ * Prompt to enqueue after a successful git commit.
93
+ * Placeholders: {{hash}}, {{branch}}, {{message}}, {{files}}, {{count}}
94
+ */
95
+ prompt: string;
96
+ /** Minimum ms between triggers. Enforced minimum: 5000. */
97
+ cooldownMs: number;
98
+ }
99
+ /** Minimal commit result passed to handleGitCommit — avoids importing from gitWrite. */
100
+ export interface GitCommitResult {
101
+ hash: string;
102
+ branch: string;
103
+ message: string;
104
+ files: string[];
105
+ count: number;
106
+ }
107
+ export interface OnGitPushPolicy {
108
+ enabled: boolean;
109
+ /**
110
+ * Prompt to enqueue after a successful git push.
111
+ * Placeholders: {{remote}}, {{branch}}, {{hash}}
112
+ */
113
+ prompt: string;
114
+ /** Minimum ms between triggers. Enforced minimum: 5000. */
115
+ cooldownMs: number;
116
+ }
117
+ /** Minimal push result passed to handleGitPush — avoids importing from gitWrite. */
118
+ export interface GitPushResult {
119
+ remote: string;
120
+ branch: string;
121
+ hash: string;
122
+ }
123
+ export interface OnBranchCheckoutPolicy {
124
+ enabled: boolean;
125
+ /**
126
+ * Prompt to enqueue after a successful git checkout (branch switch or creation).
127
+ * Placeholders: {{branch}}, {{previousBranch}}, {{created}}
128
+ */
129
+ prompt: string;
130
+ /** Minimum ms between triggers. Enforced minimum: 5000. */
131
+ cooldownMs: number;
132
+ }
133
+ /** Minimal checkout result passed to handleBranchCheckout — avoids importing from gitWrite. */
134
+ export interface BranchCheckoutResult {
135
+ branch: string;
136
+ previousBranch: string | null;
137
+ created: boolean;
138
+ }
139
+ export interface OnPullRequestPolicy {
140
+ enabled: boolean;
141
+ /**
142
+ * Prompt to enqueue after a GitHub PR is successfully created.
143
+ * Placeholders: {{url}}, {{number}}, {{title}}, {{branch}}
144
+ */
145
+ prompt: string;
146
+ /** Minimum ms between triggers. Enforced minimum: 5000. */
147
+ cooldownMs: number;
148
+ }
149
+ /** Minimal PR result passed to handlePullRequest — avoids importing from github/pr. */
150
+ export interface PullRequestResult {
151
+ url: string;
152
+ number: number | null;
153
+ title: string;
154
+ branch: string;
155
+ }
38
156
  export interface AutomationPolicy {
39
157
  onDiagnosticsError?: OnDiagnosticsErrorPolicy;
40
158
  onFileSave?: OnFileSavePolicy;
159
+ /** Fired by Claude Code 2.1.83+ FileChanged hook — reacts to any file edit, not just explicit saves. */
160
+ onFileChanged?: OnFileChangedPolicy;
161
+ /** Fired by Claude Code 2.1.83+ CwdChanged hook — fires when CC's working directory changes. */
162
+ onCwdChanged?: OnCwdChangedPolicy;
41
163
  /** Fired by Claude Code 2.1.76+ PostCompact hook — re-injects IDE context after compaction. */
42
164
  onPostCompact?: OnPostCompactPolicy;
43
165
  /** Fired by Claude Code 2.1.76+ InstructionsLoaded hook — injects bridge status at session start. */
44
166
  onInstructionsLoaded?: OnInstructionsLoadedPolicy;
167
+ /** Fired after every runTests call (or only on failures, depending on onFailureOnly). */
168
+ onTestRun?: OnTestRunPolicy;
169
+ /** Fired after every successful gitCommit call. */
170
+ onGitCommit?: OnGitCommitPolicy;
171
+ /** Fired after every successful gitPush call. */
172
+ onGitPush?: OnGitPushPolicy;
173
+ /** Fired after every successful gitCheckout call (branch switch or creation). */
174
+ onBranchCheckout?: OnBranchCheckoutPolicy;
175
+ /** Fired after every successful githubCreatePR call. */
176
+ onPullRequest?: OnPullRequestPolicy;
45
177
  }
46
178
  export interface Diagnostic {
47
179
  message: string;
@@ -64,10 +196,27 @@ export declare class AutomationHooks {
64
196
  private activeDiagnosticsTasks;
65
197
  /** Active task IDs per file for the file-saved handler. */
66
198
  private activeSaveTasks;
199
+ /** Active task IDs per file for the file-changed handler. */
200
+ private activeFileChangedTasks;
201
+ /** Active task ID for the test-run handler (workspace-global). */
202
+ private activeTestRunTaskId;
203
+ /** Active task ID for the git-commit handler (workspace-global). */
204
+ private activeGitCommitTaskId;
205
+ /** Active task ID for the git-push handler (workspace-global). */
206
+ private activeGitPushTaskId;
207
+ /** Active task ID for the branch-checkout handler (workspace-global). */
208
+ private activeBranchCheckoutTaskId;
209
+ /** Active task ID for the pull-request handler (workspace-global). */
210
+ private activePullRequestTaskId;
67
211
  constructor(policy: AutomationPolicy, orchestrator: ClaudeOrchestrator, log: (msg: string) => void);
68
212
  handleDiagnosticsChanged(file: string, diagnostics: Diagnostic[]): void;
69
213
  /** Prune lastTrigger entries older than LAST_TRIGGER_MAX_AGE_MS to prevent unbounded growth. */
70
214
  private _pruneLastTrigger;
215
+ /**
216
+ * Called when Claude Code fires a CwdChanged hook (Claude Code 2.1.83+).
217
+ * Fires when CC's working directory changes — useful for re-snapshotting workspace context.
218
+ */
219
+ handleCwdChanged(newCwd: string): void;
71
220
  /**
72
221
  * Called when Claude Code fires a PostCompact hook (Claude Code 2.1.76+).
73
222
  * Re-enqueues the configured prompt so Claude can re-snapshot IDE state after losing context.
@@ -79,6 +228,36 @@ export declare class AutomationHooks {
79
228
  */
80
229
  handleInstructionsLoaded(): void;
81
230
  handleFileSaved(_id: string, type: string, file: string): void;
231
+ /**
232
+ * Called when the VS Code extension reports a file-changed event (type === "change").
233
+ * Distinct from handleFileSaved — reacts to any editor buffer change, not just explicit saves.
234
+ * Useful for triggering tasks on unsaved edits (e.g. lint-as-you-type workflows).
235
+ */
236
+ handleFileChanged(_id: string, type: string, file: string): void;
237
+ /**
238
+ * Called after every runTests tool invocation completes.
239
+ * Triggers an automation task when tests fail (or on every run if onFailureOnly is false).
240
+ */
241
+ handleTestRun(result: TestRunResult): void;
242
+ /**
243
+ * Called after a successful gitCommit tool call.
244
+ * Fires the onGitCommit automation hook if configured.
245
+ */
246
+ handleGitCommit(result: GitCommitResult): void;
247
+ /**
248
+ * Called after a successful gitPush tool call.
249
+ * Fires the onGitPush automation hook if configured.
250
+ */
251
+ handleGitPush(result: GitPushResult): void;
252
+ /**
253
+ * Called after a successful gitCheckout tool call.
254
+ * Fires the onBranchCheckout automation hook if configured.
255
+ */
256
+ handleBranchCheckout(result: BranchCheckoutResult): void;
257
+ /**
258
+ * Fires the onPullRequest automation hook if configured.
259
+ */
260
+ handlePullRequest(result: PullRequestResult): void;
82
261
  /** Summary of automation policy for getBridgeStatus. */
83
262
  getStatus(): {
84
263
  onPostCompact: {
@@ -92,5 +271,34 @@ export declare class AutomationHooks {
92
271
  enabled: boolean;
93
272
  patternCount: number;
94
273
  } | null;
274
+ onFileChanged: {
275
+ enabled: boolean;
276
+ patternCount: number;
277
+ } | null;
278
+ onCwdChanged: {
279
+ enabled: boolean;
280
+ cooldownMs: number;
281
+ } | null;
282
+ onTestRun: {
283
+ enabled: boolean;
284
+ onFailureOnly: boolean;
285
+ cooldownMs: number;
286
+ } | null;
287
+ onGitCommit: {
288
+ enabled: boolean;
289
+ cooldownMs: number;
290
+ } | null;
291
+ onGitPush: {
292
+ enabled: boolean;
293
+ cooldownMs: number;
294
+ } | null;
295
+ onBranchCheckout: {
296
+ enabled: boolean;
297
+ cooldownMs: number;
298
+ } | null;
299
+ onPullRequest: {
300
+ enabled: boolean;
301
+ cooldownMs: number;
302
+ } | null;
95
303
  };
96
304
  }