@ironbee-ai/cli 0.8.2 → 0.9.0
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.
- package/CHANGELOG.md +12 -0
- package/README.md +48 -17
- package/dist/clients/claude/commands/ironbee-verify.md +19 -106
- package/dist/clients/claude/hooks/clear-verdict.d.ts.map +1 -1
- package/dist/clients/claude/hooks/clear-verdict.js +25 -4
- package/dist/clients/claude/hooks/clear-verdict.js.map +1 -1
- package/dist/clients/claude/hooks/require-verdict.d.ts +3 -3
- package/dist/clients/claude/hooks/require-verdict.d.ts.map +1 -1
- package/dist/clients/claude/hooks/require-verdict.js +26 -8
- package/dist/clients/claude/hooks/require-verdict.js.map +1 -1
- package/dist/clients/claude/hooks/require-verification.d.ts +6 -5
- package/dist/clients/claude/hooks/require-verification.d.ts.map +1 -1
- package/dist/clients/claude/hooks/require-verification.js +20 -17
- package/dist/clients/claude/hooks/require-verification.js.map +1 -1
- package/dist/clients/claude/hooks/track-action-monitor.d.ts.map +1 -1
- package/dist/clients/claude/hooks/track-action-monitor.js +4 -1
- package/dist/clients/claude/hooks/track-action-monitor.js.map +1 -1
- package/dist/clients/claude/hooks/track-action.d.ts +11 -8
- package/dist/clients/claude/hooks/track-action.d.ts.map +1 -1
- package/dist/clients/claude/hooks/track-action.js +14 -9
- package/dist/clients/claude/hooks/track-action.js.map +1 -1
- package/dist/clients/claude/index.d.ts.map +1 -1
- package/dist/clients/claude/index.js +79 -18
- package/dist/clients/claude/index.js.map +1 -1
- package/dist/clients/claude/platforms/command-verify.backend.md +74 -0
- package/dist/clients/claude/platforms/command-verify.browser.md +108 -0
- package/dist/clients/claude/platforms/command-verify.node.md +67 -0
- package/dist/clients/claude/platforms/rule.backend.md +23 -0
- package/dist/clients/claude/platforms/rule.browser.md +17 -0
- package/dist/clients/claude/{fragments → platforms}/rule.node.md +3 -3
- package/dist/clients/claude/platforms/skill.backend.md +65 -0
- package/dist/clients/claude/platforms/skill.browser.md +31 -0
- package/dist/clients/claude/{fragments → platforms}/skill.node.md +2 -2
- package/dist/clients/claude/rules/ironbee-verification.md +14 -13
- package/dist/clients/claude/skills/ironbee-verification.md +19 -49
- package/dist/clients/cursor/commands/ironbee-verify/SKILL.md +21 -108
- package/dist/clients/cursor/hooks/clear-verdict.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/clear-verdict.js +31 -5
- package/dist/clients/cursor/hooks/clear-verdict.js.map +1 -1
- package/dist/clients/cursor/hooks/require-verdict.d.ts +1 -1
- package/dist/clients/cursor/hooks/require-verdict.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/require-verdict.js +27 -6
- package/dist/clients/cursor/hooks/require-verdict.js.map +1 -1
- package/dist/clients/cursor/hooks/require-verification.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/require-verification.js +9 -5
- package/dist/clients/cursor/hooks/require-verification.js.map +1 -1
- package/dist/clients/cursor/hooks/track-action-monitor.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/track-action-monitor.js +4 -1
- package/dist/clients/cursor/hooks/track-action-monitor.js.map +1 -1
- package/dist/clients/cursor/hooks/track-action.d.ts +14 -12
- package/dist/clients/cursor/hooks/track-action.d.ts.map +1 -1
- package/dist/clients/cursor/hooks/track-action.js +25 -16
- package/dist/clients/cursor/hooks/track-action.js.map +1 -1
- package/dist/clients/cursor/index.d.ts.map +1 -1
- package/dist/clients/cursor/index.js +45 -11
- package/dist/clients/cursor/index.js.map +1 -1
- package/dist/clients/cursor/platforms/command-verify.backend.md +74 -0
- package/dist/clients/cursor/platforms/command-verify.browser.md +108 -0
- package/dist/clients/cursor/platforms/command-verify.node.md +67 -0
- package/dist/clients/cursor/platforms/rule.backend.md +23 -0
- package/dist/clients/cursor/platforms/rule.browser.md +17 -0
- package/dist/clients/cursor/{fragments → platforms}/rule.node.md +3 -3
- package/dist/clients/cursor/platforms/skill.backend.md +65 -0
- package/dist/clients/cursor/platforms/skill.browser.md +31 -0
- package/dist/clients/cursor/{fragments → platforms}/skill.node.md +2 -2
- package/dist/clients/cursor/rules/ironbee-verification.mdc +14 -13
- package/dist/clients/cursor/skills/ironbee-verification.md +19 -49
- package/dist/commands/backend.d.ts +17 -0
- package/dist/commands/backend.d.ts.map +1 -0
- package/dist/commands/backend.js +58 -0
- package/dist/commands/backend.js.map +1 -0
- package/dist/commands/browser.d.ts +19 -0
- package/dist/commands/browser.d.ts.map +1 -0
- package/dist/commands/browser.js +60 -0
- package/dist/commands/browser.js.map +1 -0
- package/dist/commands/config.d.ts +45 -10
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +80 -28
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/cycle-toggle.d.ts +89 -0
- package/dist/commands/cycle-toggle.d.ts.map +1 -0
- package/dist/commands/cycle-toggle.js +264 -0
- package/dist/commands/cycle-toggle.js.map +1 -0
- package/dist/commands/disable-verification.d.ts.map +1 -1
- package/dist/commands/disable-verification.js +5 -2
- package/dist/commands/disable-verification.js.map +1 -1
- package/dist/commands/enable-verification.d.ts.map +1 -1
- package/dist/commands/enable-verification.js +5 -2
- package/dist/commands/enable-verification.js.map +1 -1
- package/dist/commands/node.d.ts +16 -0
- package/dist/commands/node.d.ts.map +1 -0
- package/dist/commands/node.js +57 -0
- package/dist/commands/node.js.map +1 -0
- package/dist/commands/verification-toggle.d.ts +18 -1
- package/dist/commands/verification-toggle.d.ts.map +1 -1
- package/dist/commands/verification-toggle.js +96 -21
- package/dist/commands/verification-toggle.js.map +1 -1
- package/dist/hooks/core/actions.d.ts +20 -2
- package/dist/hooks/core/actions.d.ts.map +1 -1
- package/dist/hooks/core/actions.js.map +1 -1
- package/dist/hooks/core/file-diff.d.ts +17 -0
- package/dist/hooks/core/file-diff.d.ts.map +1 -1
- package/dist/hooks/core/file-diff.js +72 -0
- package/dist/hooks/core/file-diff.js.map +1 -1
- package/dist/hooks/core/tool-use-stash.d.ts +7 -1
- package/dist/hooks/core/tool-use-stash.d.ts.map +1 -1
- package/dist/hooks/core/tool-use-stash.js.map +1 -1
- package/dist/hooks/core/verify-gate.d.ts.map +1 -1
- package/dist/hooks/core/verify-gate.js +44 -14
- package/dist/hooks/core/verify-gate.js.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +218 -36
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +359 -95
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/gitignore.d.ts +26 -11
- package/dist/lib/gitignore.d.ts.map +1 -1
- package/dist/lib/gitignore.js +71 -24
- package/dist/lib/gitignore.js.map +1 -1
- package/dist/lib/platform-section.d.ts +126 -0
- package/dist/lib/platform-section.d.ts.map +1 -0
- package/dist/lib/platform-section.js +279 -0
- package/dist/lib/platform-section.js.map +1 -0
- package/package.json +1 -1
- package/dist/clients/claude/fragments/command-verify.node.md +0 -33
- package/dist/clients/cursor/fragments/command-verify.node.md +0 -33
- package/dist/commands/backend-toggle.d.ts +0 -45
- package/dist/commands/backend-toggle.d.ts.map +0 -1
- package/dist/commands/backend-toggle.js +0 -192
- package/dist/commands/backend-toggle.js.map +0 -1
- package/dist/commands/disable-backend.d.ts +0 -14
- package/dist/commands/disable-backend.d.ts.map +0 -1
- package/dist/commands/disable-backend.js +0 -34
- package/dist/commands/disable-backend.js.map +0 -1
- package/dist/commands/enable-backend.d.ts +0 -15
- package/dist/commands/enable-backend.d.ts.map +0 -1
- package/dist/commands/enable-backend.js +0 -35
- package/dist/commands/enable-backend.js.map +0 -1
- package/dist/lib/runtime-section.d.ts +0 -118
- package/dist/lib/runtime-section.d.ts.map +0 -1
- package/dist/lib/runtime-section.js +0 -256
- package/dist/lib/runtime-section.js.map +0 -1
|
@@ -1,126 +1,44 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ironbee-verify
|
|
3
|
-
description: "Trigger verification of code changes
|
|
3
|
+
description: "Trigger verification of code changes — runs every active cycle wired up for this project (see the platform sections at the bottom of the file)."
|
|
4
4
|
disable-model-invocation: true
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# IronBee Verify
|
|
8
8
|
|
|
9
|
-
Verify the current code changes through real tools
|
|
9
|
+
Verify the current code changes through real tools. The gate runs every cycle that has been wired up for this project, and all active cycles must be satisfied within a single verification cycle for `status: pass`. Each cycle has its own tools, flow, and verdict fields — **see the platform sections near the bottom of this file** for which cycles apply and what to call.
|
|
10
10
|
|
|
11
|
-
##
|
|
12
|
-
- `/ironbee-verify` — **default** — focus on what changed, visual + functional checks on affected areas (browser-cycle modes; any enabled backend-runtime cycle runs alongside automatically — see runtime section below)
|
|
13
|
-
- `/ironbee-verify full` — **full scope** — entire application, all checklists, edge cases, responsive, accessibility deep dive
|
|
14
|
-
- `/ironbee-verify visual` — **visual only** — contrast, layout, spacing, fonts, images, theming
|
|
15
|
-
- `/ironbee-verify functional` — **functional only** — clicks, forms, navigation, data flow, error handling
|
|
11
|
+
## Universal steps
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
3. **For EVERY page you visit**, repeat this cycle:
|
|
28
|
-
a. **Navigate** using `MCP:bdt_navigation_go-to`
|
|
29
|
-
b. **Take a FULL PAGE screenshot** using `MCP:bdt_content_take-screenshot` with `fullPage: true`
|
|
30
|
-
c. **Take an ARIA snapshot** using `MCP:bdt_a11y_take-aria-snapshot`
|
|
31
|
-
d. **STOP and visually analyze the screenshot** — switch your focus entirely to finding visual problems. Look at this screenshot as if your ONLY job is to find visual defects:
|
|
32
|
-
**WARNING: ARIA reports DOM content, not what the user actually sees.** Do NOT assume the page looks correct just because ARIA shows the right content. Only the screenshot tells you what the user actually sees.
|
|
33
|
-
- Text readability — is it readable against its background? Look for text that blends in or poor contrast
|
|
34
|
-
- Layout — overlapping elements, unexpected gaps, overflow, content cut off
|
|
35
|
-
- Spacing — consistent padding/margin? Too cramped or too far apart?
|
|
36
|
-
- Colors — intentional and consistent? Any jarring mismatches?
|
|
37
|
-
- Typography — right sizes? Clipped or truncated text?
|
|
38
|
-
- Images/icons — loaded? Right size and aspect ratio?
|
|
39
|
-
- States — empty, loading, disabled, error states rendered properly?
|
|
40
|
-
Report your visual findings before continuing.
|
|
41
|
-
e. **Read the ARIA snapshot** — verify headings, labels, landmarks, and structure
|
|
42
|
-
f. If anything looks wrong → note it as an issue
|
|
43
|
-
4. **Functionally test** — run the checklist for your mode (see below). After each significant interaction, take another screenshot and repeat the visual analysis.
|
|
44
|
-
5. **Check console** for errors using `MCP:bdt_o11y_get-console-messages`
|
|
45
|
-
6. **Stop** the dev server when verification is complete
|
|
46
|
-
7. **If recording was started, stop it now** — `MCP:bdt_content_stop-recording`. submit-verdict rejects with `"recording is still active"` when this step is skipped. (Recording is a server-side opt-in via `recording.enable` — when on, the gate forces `MCP:bdt_content_start-recording` BEFORE the steps above and demands the matching stop here.)
|
|
47
|
-
8. **Submit your verdict** via terminal:
|
|
48
|
-
- Pass: `echo '{"session_id":"...","status":"pass","pages_tested":[...],"checks":[...],"console_errors":0,"network_failures":0}' | ironbee hook submit-verdict`
|
|
49
|
-
- Fail: `echo '{"session_id":"...","status":"fail","pages_tested":[...],"checks":[...],"console_errors":N,"network_failures":N,"issues":["describe what failed"]}' | ironbee hook submit-verdict`
|
|
50
|
-
9. **If failed** → collect ALL issues first (finish testing all affected pages), submit one fail verdict with all issues, then fix everything, rebuild, and re-verify. Do not fix one issue at a time — batch fixes to avoid repeated build/restart cycles.
|
|
51
|
-
10. If pass after a previous fail, include `"fixes"` in the verdict describing what was fixed
|
|
13
|
+
1. **Start verification**: Run `echo '{"session_id":"<your-session-id>"}' | ironbee hook verification-start` via terminal.
|
|
14
|
+
2. **Build and start** the application if not already running.
|
|
15
|
+
3. **For every active cycle, run its flow** as described in the platform sections near the bottom of this file. All active cycles must be exercised within this same verification cycle.
|
|
16
|
+
4. **Stop** the dev server when verification is complete.
|
|
17
|
+
5. **Honor any cycle-specific teardown** noted in the platform sections BEFORE submitting your verdict.
|
|
18
|
+
6. **Submit your verdict** via terminal. Include fields for every active cycle:
|
|
19
|
+
- Pass: `echo '{"session_id":"...","status":"pass", ...cycle-specific fields...}' | ironbee hook submit-verdict`
|
|
20
|
+
- Fail: `echo '{"session_id":"...","status":"fail", ...cycle-specific fields..., "issues":["describe what failed"]}' | ironbee hook submit-verdict`
|
|
21
|
+
7. **If failed** → collect ALL issues first (finish testing every active cycle), submit one fail verdict with all issues, then fix everything, rebuild, and re-verify. Do not fix one issue at a time — batch fixes to avoid repeated build/restart cycles.
|
|
22
|
+
8. If pass after a previous fail, include `"fixes"` in the verdict describing what was fixed.
|
|
52
23
|
|
|
53
24
|
---
|
|
54
25
|
|
|
55
|
-
|
|
26
|
+
<!--IRONBEE:PLATFORM:browser-->
|
|
27
|
+
<!--/IRONBEE:PLATFORM:browser-->
|
|
56
28
|
|
|
57
|
-
|
|
29
|
+
<!--IRONBEE:PLATFORM:node-->
|
|
30
|
+
<!--/IRONBEE:PLATFORM:node-->
|
|
58
31
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
2. **Ignore `.ironbee/`, `.claude/`, `.cursor/`** — tool config, not application code
|
|
62
|
-
3. **Read the full diff** (`git diff` and/or `git diff HEAD~1`) — understand every change: what was added, removed, modified. Note specific values (colors, sizes, conditions, logic, API endpoints, component props).
|
|
63
|
-
4. Before opening the browser, you should be able to answer: what exactly changed, what should look or behave differently, and what could go wrong?
|
|
64
|
-
|
|
65
|
-
### 2. Verify in the browser
|
|
66
|
-
- **Cross-reference the diff against what you see.** For each change in the diff, verify it is correctly reflected in the browser. If the diff changes a color → check that color. If it changes a calculation → verify the result. If it adds a component → confirm it renders.
|
|
67
|
-
- **Test the flow end-to-end** — navigate, click, fill forms, submit, verify the outcome
|
|
68
|
-
- **Check one edge case** — empty input, invalid data, or double-click
|
|
69
|
-
- **Console** — any new errors or warnings?
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## Full Mode (`/ironbee-verify full`)
|
|
74
|
-
|
|
75
|
-
Comprehensive verification of the **entire application**. Do NOT run `git diff` or scope to recent changes. Test every page, every flow, every visual detail. Any issue is a failure, regardless of when it was introduced.
|
|
76
|
-
|
|
77
|
-
### Visual Checklist
|
|
78
|
-
In addition to the per-page visual analysis in step 3d:
|
|
79
|
-
- **Responsiveness** — does the layout adapt if viewport changes? No horizontal scrolling on standard widths
|
|
80
|
-
- **Borders & separators** — visible and consistent? Not too faint or missing
|
|
81
|
-
- **Scroll behavior** — does the page scroll smoothly? No content hidden behind sticky headers/footers?
|
|
82
|
-
|
|
83
|
-
### Functional Checklist
|
|
84
|
-
- **Navigation** — do links and buttons navigate to the correct pages?
|
|
85
|
-
- **Forms** — fill inputs with real data, select options, submit. Do validation messages appear correctly?
|
|
86
|
-
- **Buttons & interactions** — do click handlers fire? Do toggles, dropdowns, and modals work?
|
|
87
|
-
- **Data flow** — does submitted data appear where expected?
|
|
88
|
-
- **Error handling** — what happens with invalid input? Does the UI handle errors gracefully?
|
|
89
|
-
- **Authentication** — if applicable, do protected routes redirect correctly?
|
|
90
|
-
- **API calls** — do network requests succeed? Check for failed requests in console/network
|
|
91
|
-
- **State persistence** — does state survive page refresh where expected?
|
|
92
|
-
- **Edge cases** — empty inputs, very long text, special characters, rapid clicks
|
|
93
|
-
|
|
94
|
-
### Accessibility (deep dive)
|
|
95
|
-
- Are headings hierarchical? Do form inputs have labels? Are landmarks present?
|
|
96
|
-
- Check for missing alt text on images
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
## Visual Mode (`/ironbee-verify visual`)
|
|
101
|
-
|
|
102
|
-
Focus exclusively on visual quality. Run the per-page visual analysis from step 3d on every page, plus:
|
|
103
|
-
- **Responsiveness** — viewport changes, no horizontal scrolling
|
|
104
|
-
- **Borders & separators** — visible and consistent?
|
|
105
|
-
- **Scroll behavior** — smooth scrolling, no hidden content
|
|
106
|
-
|
|
107
|
-
Take screenshots of **multiple states** if applicable (hover, active, disabled, empty, populated).
|
|
108
|
-
|
|
109
|
-
---
|
|
110
|
-
|
|
111
|
-
## Functional Mode (`/ironbee-verify functional`)
|
|
112
|
-
|
|
113
|
-
Focus exclusively on behavior. Use the same functional checklist as Full Mode above.
|
|
114
|
-
|
|
115
|
-
Test the **complete user flow**, not just the single step you changed.
|
|
32
|
+
<!--IRONBEE:PLATFORM:backend-->
|
|
33
|
+
<!--/IRONBEE:PLATFORM:backend-->
|
|
116
34
|
|
|
117
35
|
---
|
|
118
36
|
|
|
119
37
|
## When to FAIL
|
|
120
38
|
|
|
121
|
-
If you observe ANY problem — wrong data, unexpected errors,
|
|
39
|
+
If you observe ANY problem on any active cycle — wrong data, unexpected errors, broken interactions, missing evidence, anything that doesn't match the spec — you MUST submit a **fail** verdict.
|
|
122
40
|
|
|
123
|
-
**Do NOT rationalize away problems.** If something looks wrong or behaves unexpectedly, it IS wrong.
|
|
41
|
+
**Do NOT rationalize away problems.** If something looks wrong or behaves unexpectedly, it IS wrong.
|
|
124
42
|
|
|
125
43
|
**After a fail verdict, you MUST fix the issues and re-verify.** Do not just report and stop.
|
|
126
44
|
|
|
@@ -134,8 +52,3 @@ Your `checks` array must list **specific observations**, not generic statements:
|
|
|
134
52
|
- ALWAYS submit a verdict after every verification attempt — both pass AND fail
|
|
135
53
|
- Do NOT edit code before submitting a fail verdict
|
|
136
54
|
- **Noticing a bug and submitting pass is the #1 violation** — if you see it, fail it
|
|
137
|
-
|
|
138
|
-
---
|
|
139
|
-
|
|
140
|
-
<!--IRONBEE:RUNTIME:node-->
|
|
141
|
-
<!--/IRONBEE:RUNTIME:node-->
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-verdict.d.ts","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/clear-verdict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"clear-verdict.d.ts","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/clear-verdict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA6FH,wBAAsB,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiE3D"}
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*/
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.run = run;
|
|
22
|
+
const fs_1 = require("fs");
|
|
22
23
|
const clear_verdict_1 = require("../../../hooks/core/clear-verdict");
|
|
23
24
|
const actions_1 = require("../../../hooks/core/actions");
|
|
24
25
|
const session_state_1 = require("../../../hooks/core/session-state");
|
|
@@ -33,30 +34,49 @@ function deriveChangeFacts(input, sessionId) {
|
|
|
33
34
|
if (!ti) {
|
|
34
35
|
return null;
|
|
35
36
|
}
|
|
37
|
+
const stash = input.tool_use_id
|
|
38
|
+
? (0, tool_use_stash_1.consumeToolUseData)(sessionId, input.tool_use_id)
|
|
39
|
+
: null;
|
|
36
40
|
if (tool === "StrReplace") {
|
|
37
41
|
const oldStr = ti.old_string ?? "";
|
|
38
42
|
const newStr = ti.new_string ?? "";
|
|
39
43
|
const counts = (0, file_diff_1.diffLineCounts)(oldStr, newStr);
|
|
40
|
-
return { tool_name: "StrReplace", operation: "update", lines_added: counts.added, lines_removed: counts.removed };
|
|
44
|
+
return { tool_name: "StrReplace", operation: "update", lines_added: counts.added, lines_removed: counts.removed, stash };
|
|
41
45
|
}
|
|
42
46
|
if (tool === "Write") {
|
|
43
47
|
const contents = ti.contents ?? "";
|
|
44
|
-
const stash = input.tool_use_id
|
|
45
|
-
? (0, tool_use_stash_1.consumeToolUseData)(sessionId, input.tool_use_id)
|
|
46
|
-
: null;
|
|
47
48
|
const fileExisted = stash?.file_existed ?? false;
|
|
48
49
|
return {
|
|
49
50
|
tool_name: "Write",
|
|
50
51
|
operation: fileExisted ? "update" : "create",
|
|
51
52
|
lines_added: (0, file_diff_1.countLines)(contents),
|
|
52
53
|
lines_removed: fileExisted ? null : 0,
|
|
54
|
+
stash,
|
|
53
55
|
};
|
|
54
56
|
}
|
|
55
57
|
if (tool === "Delete") {
|
|
56
|
-
return { tool_name: "Delete", operation: "delete", lines_added: 0, lines_removed: null };
|
|
58
|
+
return { tool_name: "Delete", operation: "delete", lines_added: 0, lines_removed: null, stash };
|
|
57
59
|
}
|
|
58
60
|
return null;
|
|
59
61
|
}
|
|
62
|
+
function buildChangeset(filePath, operation, stash, maxBytes) {
|
|
63
|
+
const priorContent = stash?.prior_content ?? "";
|
|
64
|
+
let postContent;
|
|
65
|
+
if (operation === "delete") {
|
|
66
|
+
postContent = "";
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
try {
|
|
70
|
+
postContent = (0, fs_1.existsSync)(filePath) ? (0, fs_1.readFileSync)(filePath, "utf-8") : "";
|
|
71
|
+
}
|
|
72
|
+
catch (e) {
|
|
73
|
+
logger_1.logger.debug(`failed to read post-edit content of ${filePath} for changeset: ${e}`);
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const diff = (0, file_diff_1.createUnifiedDiff)(priorContent, postContent, maxBytes);
|
|
78
|
+
return diff ?? undefined;
|
|
79
|
+
}
|
|
60
80
|
async function run(projectDir) {
|
|
61
81
|
let input;
|
|
62
82
|
try {
|
|
@@ -101,6 +121,12 @@ async function run(projectDir) {
|
|
|
101
121
|
activity_id: (0, session_state_1.getActiveActivityId)(sessionDir),
|
|
102
122
|
fix_id: (0, session_state_1.getActiveFixId)(sessionDir),
|
|
103
123
|
};
|
|
124
|
+
if ((0, config_1.getCaptureFileChangeset)(config)) {
|
|
125
|
+
const changeset = buildChangeset(writtenFile, facts.operation, facts.stash, (0, config_1.getMaxChangesetBytes)(config));
|
|
126
|
+
if (changeset !== undefined) {
|
|
127
|
+
entry.changeset = changeset;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
104
130
|
await (0, actions_1.appendAction)(actionsFile, entry);
|
|
105
131
|
(0, clear_verdict_1.runClearVerdict)({
|
|
106
132
|
verdictFile: `${sessionDir}/verdict.json`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clear-verdict.js","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/clear-verdict.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;
|
|
1
|
+
{"version":3,"file":"clear-verdict.js","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/clear-verdict.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AA6FH,kBAiEC;AA5JD,2BAA8C;AAC9C,qEAAoE;AACpE,yDAA8G;AAC9G,qEAAwF;AACxF,uEAAwF;AACxF,6DAA8G;AAC9G,gDAM6B;AAC7B,gDAAyD;AACzD,8CAA+C;AAwB/C,SAAS,iBAAiB,CAAC,KAA6B,EAAE,SAAiB;IACvE,MAAM,IAAI,GAAuB,KAAK,CAAC,SAAS,CAAC;IACjD,MAAM,EAAE,GAAyC,KAAK,CAAC,UAAU,CAAC;IAClE,IAAI,CAAC,EAAE,EAAE,CAAC;QACN,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,KAAK,GAA0B,KAAK,CAAC,WAAW;QAClD,CAAC,CAAC,IAAA,mCAAkB,EAAiB,SAAS,EAAE,KAAK,CAAC,WAAW,CAAC;QAClE,CAAC,CAAC,IAAI,CAAC;IAEX,IAAI,IAAI,KAAK,YAAY,EAAE,CAAC;QACxB,MAAM,MAAM,GAAW,EAAE,CAAC,UAAU,IAAI,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAW,EAAE,CAAC,UAAU,IAAI,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAmB,IAAA,0BAAc,EAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,CAA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AAC;IACD,MAAM,IAAA,sBAAY,EAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAEvC,IAAA,+BAAe,EAAC;QACZ,WAAW,EAAE,GAAG,UAAU,eAAe;QACzC,UAAU;KACb,CAAC,CAAC;IAEH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Cursor — require-verdict hook adapter
|
|
3
3
|
*
|
|
4
4
|
* preToolUse hook for Write|StrReplace|Delete — blocks file edits
|
|
5
|
-
* if the agent used any devtools tools (browser-devtools
|
|
5
|
+
* if the agent used any devtools tools (browser-devtools / node-devtools / backend-devtools) but hasn't submitted a verdict
|
|
6
6
|
* yet. Forces the agent to submit a fail verdict before fixing code.
|
|
7
7
|
*
|
|
8
8
|
* Side effect: when `tool_name === "Write"`, stashes whether the target
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-verdict.d.ts","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/require-verdict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"require-verdict.d.ts","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/require-verdict.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0BH,wBAAsB,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA+D3D"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Cursor — require-verdict hook adapter
|
|
4
4
|
*
|
|
5
5
|
* preToolUse hook for Write|StrReplace|Delete — blocks file edits
|
|
6
|
-
* if the agent used any devtools tools (browser-devtools
|
|
6
|
+
* if the agent used any devtools tools (browser-devtools / node-devtools / backend-devtools) but hasn't submitted a verdict
|
|
7
7
|
* yet. Forces the agent to submit a fail verdict before fixing code.
|
|
8
8
|
*
|
|
9
9
|
* Side effect: when `tool_name === "Write"`, stashes whether the target
|
|
@@ -20,6 +20,7 @@ const fs_1 = require("fs");
|
|
|
20
20
|
const actions_1 = require("../../../hooks/core/actions");
|
|
21
21
|
const activity_1 = require("../../../hooks/core/activity");
|
|
22
22
|
const tool_use_stash_1 = require("../../../hooks/core/tool-use-stash");
|
|
23
|
+
const config_1 = require("../../../lib/config");
|
|
23
24
|
const logger_1 = require("../../../lib/logger");
|
|
24
25
|
const stdin_1 = require("../../../lib/stdin");
|
|
25
26
|
async function run(projectDir) {
|
|
@@ -41,9 +42,9 @@ async function run(projectDir) {
|
|
|
41
42
|
if ((0, actions_1.hasToolCallsSinceLastVerdict)(actionsFile)) {
|
|
42
43
|
const output = {
|
|
43
44
|
permission: "deny",
|
|
44
|
-
agent_message: `BLOCKED: You used verification tools (browser-devtools
|
|
45
|
+
agent_message: `BLOCKED: You used verification tools (browser-devtools / node-devtools / backend-devtools) but did not submit a verdict. You MUST submit a verdict (pass or fail) before editing code.
|
|
45
46
|
|
|
46
|
-
Submit your verdict first (include cycle-appropriate fields — browser fields for bdt_*, backend_node_*
|
|
47
|
+
Submit your verdict first (include cycle-appropriate fields — browser fields for bdt_*, backend_node_* for ndt_*, backend_endpoints_called/backend_response_statuses for bedt_*):
|
|
47
48
|
echo '{"session_id":"${sessionId}","status":"fail","checks":[...],"issues":["describe what failed"], ...}' | ironbee hook submit-verdict
|
|
48
49
|
|
|
49
50
|
Then you can edit code to fix the issues.`,
|
|
@@ -52,9 +53,29 @@ Then you can edit code to fix the issues.`,
|
|
|
52
53
|
process.exit(2);
|
|
53
54
|
return;
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
(0,
|
|
56
|
+
const filePath = input.tool_input?.path;
|
|
57
|
+
if (filePath && input.tool_use_id) {
|
|
58
|
+
const config = (0, config_1.loadConfig)(projectDir);
|
|
59
|
+
const captureChangeset = (0, config_1.getCaptureFileChangeset)(config);
|
|
60
|
+
const fileExisted = (0, fs_1.existsSync)(filePath);
|
|
61
|
+
// Always stash for Write so PostToolUse can label create vs update.
|
|
62
|
+
// For StrReplace / Delete we only stash when changeset capture is on
|
|
63
|
+
// (StrReplace is always "update" and Delete is always "delete" — no
|
|
64
|
+
// operation-derivation need otherwise).
|
|
65
|
+
const isWrite = input.tool_name === "Write";
|
|
66
|
+
const isOtherEdit = input.tool_name === "StrReplace" || input.tool_name === "Delete";
|
|
67
|
+
if (isWrite || (isOtherEdit && captureChangeset)) {
|
|
68
|
+
const state = { file_existed: fileExisted };
|
|
69
|
+
if (captureChangeset && fileExisted) {
|
|
70
|
+
try {
|
|
71
|
+
state.prior_content = (0, fs_1.readFileSync)(filePath, "utf-8");
|
|
72
|
+
}
|
|
73
|
+
catch (e) {
|
|
74
|
+
logger_1.logger.debug(`failed to pre-read ${filePath} for changeset capture: ${e}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
(0, tool_use_stash_1.stashToolUseData)(sessionId, input.tool_use_id, state);
|
|
78
|
+
}
|
|
58
79
|
}
|
|
59
80
|
await (0, activity_1.startActivity)({ sessionDir, actionsFile, source: "pre_tool_use" });
|
|
60
81
|
const output = { permission: "allow" };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-verdict.js","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/require-verdict.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;
|
|
1
|
+
{"version":3,"file":"require-verdict.js","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/require-verdict.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AA0BH,kBA+DC;AAvFD,2BAA8C;AAC9C,yDAA2E;AAC3E,2DAA6D;AAC7D,uEAAsF;AACtF,gDAAyF;AACzF,gDAAyD;AACzD,8CAA+C;AAkBxC,KAAK,UAAU,GAAG,CAAC,UAAkB;IACxC,IAAI,KAA4B,CAAC;IACjC,IAAI,CAAC;QACD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAS,GAAE,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AoE;QACpE,qEAAqE;QACrE,oEAAoE;QACpE,wCAAwC;QACxC,MAAM,OAAO,GAAY,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC;QACrD,MAAM,WAAW,GAAY,KAAK,CAAC,SAAS,KAAK,YAAY,IAAI,KAAK,CAAC,SAAS,KAAK,QAAQ,CAAC;QAC9F,IAAI,OAAO,IAAI,CAAC,WAAW,IAAI,gBAAgB,CAAC,EAAE,CAAC;YAC/C,MAAM,KAAK,GAAmB,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;YAC5D,IAAI,gBAAgB,IAAI,WAAW,EAAE,CAAC;gBAClC,IAAI,CAAC;oBACD,KAAK,CAAC,aAAa,GAAG,IAAA,iBAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAC1D,CAAC;gBAAC,OAAO,CAAU,EAAE,CAAC;oBAClB,eAAM,CAAC,KAAK,CAAC,sBAAsB,QAAQ,2BAA2B,CAAC,EAAE,CAAC,CAAC;gBAC/E,CAAC;YACL,CAAC;YACD,IAAA,iCAAgB,EAAC,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC1D,CAAC;IACL,CAAC;IAED,MAAM,IAAA,wBAAa,EAAC,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;IAEzE,MAAM,MAAM,GAA2B,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;IAC/D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-verification.d.ts","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/require-verification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"require-verification.d.ts","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/require-verification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAsCH,wBAAsB,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA8H3D"}
|
|
@@ -22,10 +22,14 @@ const config_1 = require("../../../lib/config");
|
|
|
22
22
|
const logger_1 = require("../../../lib/logger");
|
|
23
23
|
const stdin_1 = require("../../../lib/stdin");
|
|
24
24
|
/** Prefix → MCP server lookup. Cursor's `MCP:<bare-tool>` wire has no server
|
|
25
|
-
* segment, so we identify by tool prefix (matcher
|
|
25
|
+
* segment, so we identify by tool prefix (matcher routes
|
|
26
|
+
* `MCP:(bdt|ndt|bedt)_.*`). All three prefixes are mutually distinct
|
|
27
|
+
* (`bdt` / `ndt` / `bedt` differ in the second character), so iteration
|
|
28
|
+
* order doesn't matter for correctness. */
|
|
26
29
|
const SERVER_BY_PREFIX = {
|
|
27
30
|
"MCP:bdt_": "browser-devtools",
|
|
28
31
|
"MCP:ndt_": "node-devtools",
|
|
32
|
+
"MCP:bedt_": "backend-devtools",
|
|
29
33
|
};
|
|
30
34
|
const FALLBACK_MCP_SERVER_NAME = "browser-devtools";
|
|
31
35
|
async function run(projectDir) {
|
|
@@ -48,12 +52,12 @@ async function run(projectDir) {
|
|
|
48
52
|
if (!verificationId) {
|
|
49
53
|
const output = {
|
|
50
54
|
permission: "deny",
|
|
51
|
-
agent_message: `BLOCKED: You must start a verification cycle before using devtools tools (browser-devtools
|
|
55
|
+
agent_message: `BLOCKED: You must start a verification cycle before using devtools tools (browser-devtools / node-devtools / backend-devtools).
|
|
52
56
|
|
|
53
57
|
Start verification first:
|
|
54
58
|
echo '{"session_id":"${sessionId}"}' | ironbee hook verification-start
|
|
55
59
|
|
|
56
|
-
Then use the verification tools for the active cycle(s) — MCP:bdt_* for browser, MCP:ndt_* for node.`,
|
|
60
|
+
Then use the verification tools for the active cycle(s) — MCP:bdt_* for browser, MCP:ndt_* for node, MCP:bedt_* for backend.`,
|
|
57
61
|
};
|
|
58
62
|
process.stdout.write(JSON.stringify(output));
|
|
59
63
|
process.exit(2);
|
|
@@ -118,8 +122,8 @@ Then use the verification tools for the active cycle(s) — MCP:bdt_* for browse
|
|
|
118
122
|
}
|
|
119
123
|
// Cursor's preToolUse stdin doesn't expose the MCP server and its
|
|
120
124
|
// tool_name format (`MCP:<bare-tool>`) has no server segment. The
|
|
121
|
-
// matcher restricts this hook to `MCP:(bdt|ndt)_.*` — we identify
|
|
122
|
-
// server by prefix lookup. Future runtimes extend SERVER_BY_PREFIX.
|
|
125
|
+
// matcher restricts this hook to `MCP:(bdt|ndt|bedt)_.*` — we identify
|
|
126
|
+
// the server by prefix lookup. Future runtimes extend SERVER_BY_PREFIX.
|
|
123
127
|
metadata.mcpServer = (() => {
|
|
124
128
|
for (const prefix of Object.keys(SERVER_BY_PREFIX)) {
|
|
125
129
|
if (toolName.startsWith(prefix)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-verification.js","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/require-verification.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;
|
|
1
|
+
{"version":3,"file":"require-verification.js","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/require-verification.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAsCH,kBA8HC;AAlKD,mCAAoC;AACpC,qEAAyK;AACzK,yDAAiE;AACjE,2DAA6D;AAC7D,gDAAiD;AACjD,gDAAyD;AACzD,8CAA+C;AAE/C;;;;4CAI4C;AAC5C,MAAM,gBAAgB,GAA2B;IAC7C,UAAU,EAAE,kBAAkB;IAC9B,UAAU,EAAE,eAAe;IAC3B,WAAW,EAAE,kBAAkB;CAClC,CAAC;AAEF,MAAM,wBAAwB,GAAW,kBAAkB,CAAC;AAiBrD,KAAK,UAAU,GAAG,CAAC,UAAkB;IACxC,IAAI,KAA4B,CAAC;IACjC,I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AAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track-action-monitor.d.ts","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/track-action-monitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;
|
|
1
|
+
{"version":3,"file":"track-action-monitor.d.ts","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/track-action-monitor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AA4BH,wBAAsB,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0E3D"}
|
|
@@ -37,6 +37,7 @@ const queue_1 = require("../../../queue");
|
|
|
37
37
|
const util_1 = require("../util");
|
|
38
38
|
const TOOL_NAME_PREFIX = "bdt_";
|
|
39
39
|
const NODE_TOOL_NAME_PREFIX = "ndt_";
|
|
40
|
+
const BACKEND_TOOL_NAME_PREFIX = "bedt_";
|
|
40
41
|
async function run(projectDir) {
|
|
41
42
|
let input;
|
|
42
43
|
try {
|
|
@@ -62,7 +63,9 @@ async function run(projectDir) {
|
|
|
62
63
|
const activityId = (0, session_state_1.getActiveActivityId)(sessionDir);
|
|
63
64
|
const classified = (0, util_1.classifyTool)(rawToolName, input.tool_input);
|
|
64
65
|
const isOurDevToolsTool = classified.tool_type === "mcp"
|
|
65
|
-
&& (classified.tool_name.startsWith(TOOL_NAME_PREFIX)
|
|
66
|
+
&& (classified.tool_name.startsWith(TOOL_NAME_PREFIX)
|
|
67
|
+
|| classified.tool_name.startsWith(NODE_TOOL_NAME_PREFIX)
|
|
68
|
+
|| classified.tool_name.startsWith(BACKEND_TOOL_NAME_PREFIX));
|
|
66
69
|
if (isOurDevToolsTool) {
|
|
67
70
|
logger_1.logger.debug(`track-action-monitor: skipped devtools tool ${rawToolName}`);
|
|
68
71
|
(0, output_1.writeAndExit)(JSON.stringify({}), 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track-action-monitor.js","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/track-action-monitor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;
|
|
1
|
+
{"version":3,"file":"track-action-monitor.js","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/track-action-monitor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;;AA4BH,kBA0EC;AApGD,yDAAyE;AACzE,2DAA6D;AAC7D,qEAAwE;AACxE,gDAAwD;AACxD,gDAAyD;AACzD,gDAAmD;AACnD,8CAA+C;AAC/C,0CAA2E;AAC3E,kCAA+E;AAE/E,MAAM,gBAAgB,GAAW,MAAM,CAAC;AACxC,MAAM,qBAAqB,GAAW,MAAM,CAAC;AAC7C,MAAM,wBAAwB,GAAW,OAAO,CAAC;AAc1C,KAAK,UAAU,GAAG,CAAC,UAAkB;IACxC,IAAI,KAA6B,CAAC;IAClC,IAAI,CAAC;QACD,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAS,GAAE,CAA2B,CAAC;IAC9D,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QAClB,eAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC;QAC5C,IAAA,qBAAY,EAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACpC,OAAO;IACX,CAAC;IAED,MAAM,SAAS,GAAW,KAAK,CAAC,eAAe,IAAI,SAAS,CAAC;IAC7D,MAAM,UAAU,GAAW,GAAG,UAAU,sBAAsB,SAAS,EAAE,CAAC;IAC1E,MAAM,WAAW,GAAW,GAAG,UAAU,gBAAgB,CAAC;IAC1D,IAAA,m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AI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,CAAC,CAAC;IACb,CAAC;IACD,IAAI,CAAC;QACD,MAAM,CAAC,GAAW,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC5E,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC/D,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,CAAC,CAAC;IACb,CAAC;AACL,CAAC"}
|
|
@@ -8,15 +8,17 @@
|
|
|
8
8
|
* `duration`) that we fold into the event.
|
|
9
9
|
*
|
|
10
10
|
* Responsibilities:
|
|
11
|
-
* 1. **
|
|
12
|
-
* taxonomy so tool_type/tool_name/mcp_server
|
|
13
|
-
* append the tool_call entry to
|
|
14
|
-
* of truth)
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
11
|
+
* 1. **devtools MCP tools** (`MCP:bdt_*` / `MCP:ndt_*` / `MCP:bedt_*`):
|
|
12
|
+
* classify via the shared taxonomy so tool_type/tool_name/mcp_server
|
|
13
|
+
* match Claude's schema, append the tool_call entry to
|
|
14
|
+
* `actions.jsonl` (verify-gate source of truth); for browser tools,
|
|
15
|
+
* also update recording state and extract nested `callTool()` from
|
|
16
|
+
* bdt_execute. Queue submit is SKIPPED: all three modes ship the
|
|
17
|
+
* same `browser-devtools-mcp` package and self-deliver `tool_call`
|
|
18
|
+
* events to the collector. tool_input is kept AS-IS for these so
|
|
19
|
+
* verify-gate and the local nested parser see the raw shape.
|
|
18
20
|
* 2. **All other tools** (Shell / Read / Write / Grep / Delete / Task /
|
|
19
|
-
* non-
|
|
21
|
+
* non-devtools MCP): submit a send_event job. `tool_input` is replaced
|
|
20
22
|
* with a per-tool safe projection (see `extractCursorToolInput`) —
|
|
21
23
|
* only labels (`file_path`, `pattern`, `working_directory`,
|
|
22
24
|
* `subagent_type`, …) survive, never raw content. `tool_output` stays
|
|
@@ -25,10 +27,10 @@
|
|
|
25
27
|
* byte counts.
|
|
26
28
|
*
|
|
27
29
|
* MCP server note: Cursor's wire format (`MCP:<tool>`) does not carry the
|
|
28
|
-
* server name, so the classifier returns `mcp_server: null`. For
|
|
29
|
-
*
|
|
30
|
-
* + tool prefix are enough to identify the server. For
|
|
31
|
-
* leave it null (unknown).
|
|
30
|
+
* server name, so the classifier returns `mcp_server: null`. For
|
|
31
|
+
* `bdt_*` / `ndt_*` / `bedt_*` we override locally via prefix lookup —
|
|
32
|
+
* matcher routing + tool prefix are enough to identify the server. For
|
|
33
|
+
* other MCP tools we leave it null (unknown).
|
|
32
34
|
*
|
|
33
35
|
* On failure: the event's `error` field is populated (with `failure_type:`
|
|
34
36
|
* prefix + interrupt marker when applicable) and the response is omitted.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track-action.d.ts","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/track-action.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"track-action.d.ts","sourceRoot":"","sources":["../../../../src/clients/cursor/hooks/track-action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAwIH,wBAAsB,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0J3D"}
|
|
@@ -9,15 +9,17 @@
|
|
|
9
9
|
* `duration`) that we fold into the event.
|
|
10
10
|
*
|
|
11
11
|
* Responsibilities:
|
|
12
|
-
* 1. **
|
|
13
|
-
* taxonomy so tool_type/tool_name/mcp_server
|
|
14
|
-
* append the tool_call entry to
|
|
15
|
-
* of truth)
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
12
|
+
* 1. **devtools MCP tools** (`MCP:bdt_*` / `MCP:ndt_*` / `MCP:bedt_*`):
|
|
13
|
+
* classify via the shared taxonomy so tool_type/tool_name/mcp_server
|
|
14
|
+
* match Claude's schema, append the tool_call entry to
|
|
15
|
+
* `actions.jsonl` (verify-gate source of truth); for browser tools,
|
|
16
|
+
* also update recording state and extract nested `callTool()` from
|
|
17
|
+
* bdt_execute. Queue submit is SKIPPED: all three modes ship the
|
|
18
|
+
* same `browser-devtools-mcp` package and self-deliver `tool_call`
|
|
19
|
+
* events to the collector. tool_input is kept AS-IS for these so
|
|
20
|
+
* verify-gate and the local nested parser see the raw shape.
|
|
19
21
|
* 2. **All other tools** (Shell / Read / Write / Grep / Delete / Task /
|
|
20
|
-
* non-
|
|
22
|
+
* non-devtools MCP): submit a send_event job. `tool_input` is replaced
|
|
21
23
|
* with a per-tool safe projection (see `extractCursorToolInput`) —
|
|
22
24
|
* only labels (`file_path`, `pattern`, `working_directory`,
|
|
23
25
|
* `subagent_type`, …) survive, never raw content. `tool_output` stays
|
|
@@ -26,10 +28,10 @@
|
|
|
26
28
|
* byte counts.
|
|
27
29
|
*
|
|
28
30
|
* MCP server note: Cursor's wire format (`MCP:<tool>`) does not carry the
|
|
29
|
-
* server name, so the classifier returns `mcp_server: null`. For
|
|
30
|
-
*
|
|
31
|
-
* + tool prefix are enough to identify the server. For
|
|
32
|
-
* leave it null (unknown).
|
|
31
|
+
* server name, so the classifier returns `mcp_server: null`. For
|
|
32
|
+
* `bdt_*` / `ndt_*` / `bedt_*` we override locally via prefix lookup —
|
|
33
|
+
* matcher routing + tool prefix are enough to identify the server. For
|
|
34
|
+
* other MCP tools we leave it null (unknown).
|
|
33
35
|
*
|
|
34
36
|
* On failure: the event's `error` field is populated (with `failure_type:`
|
|
35
37
|
* prefix + interrupt marker when applicable) and the response is omitted.
|
|
@@ -49,19 +51,25 @@ const CALL_TOOL_NAME_PATTERN = /callTool\(\s*['"]([^'"]+)['"]/g;
|
|
|
49
51
|
const MCP_PREFIX = "mcp__browser-devtools__";
|
|
50
52
|
const TOOL_NAME_PREFIX = "bdt_";
|
|
51
53
|
const NODE_TOOL_NAME_PREFIX = "ndt_";
|
|
54
|
+
const BACKEND_TOOL_NAME_PREFIX = "bedt_";
|
|
52
55
|
const BROWSER_DEVTOOLS_SERVER = "browser-devtools";
|
|
53
56
|
const NODE_DEVTOOLS_SERVER = "node-devtools";
|
|
57
|
+
const BACKEND_DEVTOOLS_SERVER = "backend-devtools";
|
|
54
58
|
/** Bare (post-classification) names used for recording-state detection and nested extract gating. */
|
|
55
59
|
const EXECUTE_TOOL_BARE = `${TOOL_NAME_PREFIX}execute`;
|
|
56
60
|
const RECORDING_START_BARE = `${TOOL_NAME_PREFIX}content_start-recording`;
|
|
57
61
|
const RECORDING_STOP_BARE = `${TOOL_NAME_PREFIX}content_stop-recording`;
|
|
58
62
|
/**
|
|
59
63
|
* Cursor wire format `MCP:<bare-tool>` doesn't carry the server segment, so
|
|
60
|
-
* we identify the server by tool prefix.
|
|
61
|
-
* package (`browser-devtools-mcp`) — they self-ship
|
|
62
|
-
* the collector, so the queue submit is skipped for
|
|
64
|
+
* we identify the server by tool prefix. All three devtools servers ship
|
|
65
|
+
* the same npm package (`browser-devtools-mcp`) — they self-ship
|
|
66
|
+
* `tool_call` events to the collector, so the queue submit is skipped for
|
|
67
|
+
* all of them.
|
|
63
68
|
*/
|
|
64
69
|
function resolveServerByPrefix(bareToolName) {
|
|
70
|
+
if (bareToolName.startsWith(BACKEND_TOOL_NAME_PREFIX)) {
|
|
71
|
+
return BACKEND_DEVTOOLS_SERVER;
|
|
72
|
+
}
|
|
65
73
|
if (bareToolName.startsWith(TOOL_NAME_PREFIX)) {
|
|
66
74
|
return BROWSER_DEVTOOLS_SERVER;
|
|
67
75
|
}
|
|
@@ -170,7 +178,8 @@ async function run(projectDir) {
|
|
|
170
178
|
const classified = (0, util_1.classifyTool)(rawToolName, input.tool_input);
|
|
171
179
|
const isBrowserTool = classified.tool_type === "mcp" && classified.tool_name.startsWith(TOOL_NAME_PREFIX);
|
|
172
180
|
const isNodeTool = classified.tool_type === "mcp" && classified.tool_name.startsWith(NODE_TOOL_NAME_PREFIX);
|
|
173
|
-
const
|
|
181
|
+
const isBackendTool = classified.tool_type === "mcp" && classified.tool_name.startsWith(BACKEND_TOOL_NAME_PREFIX);
|
|
182
|
+
const isOurDevToolsTool = isBrowserTool || isNodeTool || isBackendTool;
|
|
174
183
|
const resolvedMcpServer = classified.tool_type === "mcp"
|
|
175
184
|
? (resolveServerByPrefix(classified.tool_name) ?? classified.mcp_server)
|
|
176
185
|
: classified.mcp_server;
|