@ironbee-ai/cli 0.8.3 → 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.
Files changed (112) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +42 -17
  3. package/dist/clients/claude/commands/ironbee-verify.md +19 -106
  4. package/dist/clients/claude/hooks/require-verdict.d.ts +3 -3
  5. package/dist/clients/claude/hooks/require-verdict.js +5 -5
  6. package/dist/clients/claude/hooks/require-verification.d.ts +6 -5
  7. package/dist/clients/claude/hooks/require-verification.d.ts.map +1 -1
  8. package/dist/clients/claude/hooks/require-verification.js +20 -17
  9. package/dist/clients/claude/hooks/require-verification.js.map +1 -1
  10. package/dist/clients/claude/hooks/track-action-monitor.d.ts.map +1 -1
  11. package/dist/clients/claude/hooks/track-action-monitor.js +4 -1
  12. package/dist/clients/claude/hooks/track-action-monitor.js.map +1 -1
  13. package/dist/clients/claude/hooks/track-action.d.ts +11 -8
  14. package/dist/clients/claude/hooks/track-action.d.ts.map +1 -1
  15. package/dist/clients/claude/hooks/track-action.js +14 -9
  16. package/dist/clients/claude/hooks/track-action.js.map +1 -1
  17. package/dist/clients/claude/index.d.ts.map +1 -1
  18. package/dist/clients/claude/index.js +79 -18
  19. package/dist/clients/claude/index.js.map +1 -1
  20. package/dist/clients/claude/platforms/command-verify.backend.md +74 -0
  21. package/dist/clients/claude/platforms/command-verify.browser.md +108 -0
  22. package/dist/clients/claude/platforms/command-verify.node.md +67 -0
  23. package/dist/clients/claude/platforms/rule.backend.md +23 -0
  24. package/dist/clients/claude/platforms/rule.browser.md +17 -0
  25. package/dist/clients/claude/{fragments → platforms}/rule.node.md +3 -3
  26. package/dist/clients/claude/platforms/skill.backend.md +65 -0
  27. package/dist/clients/claude/platforms/skill.browser.md +31 -0
  28. package/dist/clients/claude/{fragments → platforms}/skill.node.md +2 -2
  29. package/dist/clients/claude/rules/ironbee-verification.md +14 -13
  30. package/dist/clients/claude/skills/ironbee-verification.md +19 -49
  31. package/dist/clients/cursor/commands/ironbee-verify/SKILL.md +21 -108
  32. package/dist/clients/cursor/hooks/require-verdict.d.ts +1 -1
  33. package/dist/clients/cursor/hooks/require-verdict.js +3 -3
  34. package/dist/clients/cursor/hooks/require-verification.d.ts.map +1 -1
  35. package/dist/clients/cursor/hooks/require-verification.js +9 -5
  36. package/dist/clients/cursor/hooks/require-verification.js.map +1 -1
  37. package/dist/clients/cursor/hooks/track-action-monitor.d.ts.map +1 -1
  38. package/dist/clients/cursor/hooks/track-action-monitor.js +4 -1
  39. package/dist/clients/cursor/hooks/track-action-monitor.js.map +1 -1
  40. package/dist/clients/cursor/hooks/track-action.d.ts +14 -12
  41. package/dist/clients/cursor/hooks/track-action.d.ts.map +1 -1
  42. package/dist/clients/cursor/hooks/track-action.js +25 -16
  43. package/dist/clients/cursor/hooks/track-action.js.map +1 -1
  44. package/dist/clients/cursor/index.d.ts.map +1 -1
  45. package/dist/clients/cursor/index.js +45 -11
  46. package/dist/clients/cursor/index.js.map +1 -1
  47. package/dist/clients/cursor/platforms/command-verify.backend.md +74 -0
  48. package/dist/clients/cursor/platforms/command-verify.browser.md +108 -0
  49. package/dist/clients/cursor/platforms/command-verify.node.md +67 -0
  50. package/dist/clients/cursor/platforms/rule.backend.md +23 -0
  51. package/dist/clients/cursor/platforms/rule.browser.md +17 -0
  52. package/dist/clients/cursor/{fragments → platforms}/rule.node.md +3 -3
  53. package/dist/clients/cursor/platforms/skill.backend.md +65 -0
  54. package/dist/clients/cursor/platforms/skill.browser.md +31 -0
  55. package/dist/clients/cursor/{fragments → platforms}/skill.node.md +2 -2
  56. package/dist/clients/cursor/rules/ironbee-verification.mdc +14 -13
  57. package/dist/clients/cursor/skills/ironbee-verification.md +19 -49
  58. package/dist/commands/backend.d.ts +17 -0
  59. package/dist/commands/backend.d.ts.map +1 -0
  60. package/dist/commands/backend.js +58 -0
  61. package/dist/commands/backend.js.map +1 -0
  62. package/dist/commands/browser.d.ts +19 -0
  63. package/dist/commands/browser.d.ts.map +1 -0
  64. package/dist/commands/browser.js +60 -0
  65. package/dist/commands/browser.js.map +1 -0
  66. package/dist/commands/config.d.ts +5 -5
  67. package/dist/commands/config.d.ts.map +1 -1
  68. package/dist/commands/config.js +13 -11
  69. package/dist/commands/config.js.map +1 -1
  70. package/dist/commands/cycle-toggle.d.ts +89 -0
  71. package/dist/commands/cycle-toggle.d.ts.map +1 -0
  72. package/dist/commands/cycle-toggle.js +264 -0
  73. package/dist/commands/cycle-toggle.js.map +1 -0
  74. package/dist/commands/node.d.ts +16 -0
  75. package/dist/commands/node.d.ts.map +1 -0
  76. package/dist/commands/node.js +57 -0
  77. package/dist/commands/node.js.map +1 -0
  78. package/dist/hooks/core/actions.d.ts +11 -2
  79. package/dist/hooks/core/actions.d.ts.map +1 -1
  80. package/dist/hooks/core/actions.js.map +1 -1
  81. package/dist/hooks/core/verify-gate.d.ts.map +1 -1
  82. package/dist/hooks/core/verify-gate.js +44 -14
  83. package/dist/hooks/core/verify-gate.js.map +1 -1
  84. package/dist/index.js +9 -6
  85. package/dist/index.js.map +1 -1
  86. package/dist/lib/config.d.ts +142 -41
  87. package/dist/lib/config.d.ts.map +1 -1
  88. package/dist/lib/config.js +251 -82
  89. package/dist/lib/config.js.map +1 -1
  90. package/dist/lib/platform-section.d.ts +126 -0
  91. package/dist/lib/platform-section.d.ts.map +1 -0
  92. package/dist/lib/platform-section.js +279 -0
  93. package/dist/lib/platform-section.js.map +1 -0
  94. package/package.json +1 -1
  95. package/dist/clients/claude/fragments/command-verify.node.md +0 -33
  96. package/dist/clients/cursor/fragments/command-verify.node.md +0 -33
  97. package/dist/commands/backend-toggle.d.ts +0 -56
  98. package/dist/commands/backend-toggle.d.ts.map +0 -1
  99. package/dist/commands/backend-toggle.js +0 -199
  100. package/dist/commands/backend-toggle.js.map +0 -1
  101. package/dist/commands/disable-backend.d.ts +0 -14
  102. package/dist/commands/disable-backend.d.ts.map +0 -1
  103. package/dist/commands/disable-backend.js +0 -38
  104. package/dist/commands/disable-backend.js.map +0 -1
  105. package/dist/commands/enable-backend.d.ts +0 -15
  106. package/dist/commands/enable-backend.d.ts.map +0 -1
  107. package/dist/commands/enable-backend.js +0 -39
  108. package/dist/commands/enable-backend.js.map +0 -1
  109. package/dist/lib/runtime-section.d.ts +0 -118
  110. package/dist/lib/runtime-section.d.ts.map +0 -1
  111. package/dist/lib/runtime-section.js +0 -256
  112. package/dist/lib/runtime-section.js.map +0 -1
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Platform-section toggling for skill / rule / command markdown files.
3
+ *
4
+ * Each agent-facing markdown file (skill, rule, slash command) carries one
5
+ * or more marker blocks per platform. Two marker syntaxes are supported:
6
+ *
7
+ * <!--IRONBEE:PLATFORM:node-->
8
+ * ...content here...
9
+ * <!--/IRONBEE:PLATFORM:node-->
10
+ *
11
+ * (the unkeyed form — handy when a file only needs a single block per
12
+ * platform), and:
13
+ *
14
+ * <!--IRONBEE:PLATFORM:node:tldr-->
15
+ * ...short heads-up content...
16
+ * <!--/IRONBEE:PLATFORM:node:tldr-->
17
+ * ...
18
+ * <!--IRONBEE:PLATFORM:node:full-->
19
+ * ...detailed flow...
20
+ * <!--/IRONBEE:PLATFORM:node:full-->
21
+ *
22
+ * (the keyed form — handy when the same platform needs different content at
23
+ * different positions in the same file: short summary up top, full flow at
24
+ * the bottom, etc.). Keys are alphanumeric + hyphen.
25
+ *
26
+ * Two states per block:
27
+ * - **disabled** — replaced with a short placeholder telling the agent
28
+ * the platform is off and reminding them not to invoke that platform's
29
+ * tools when the project isn't actually using it.
30
+ * - **enabled** — replaced with the full guidance fragment for that
31
+ * platform + key.
32
+ *
33
+ * `ironbee install` writes one or the other based on config state at
34
+ * install time. `ironbee enable-<platform>` / `disable-<platform>` flip
35
+ * already-installed files in place — no re-install needed. The marker block
36
+ * (and its key) is preserved on every flip so the toggle is always
37
+ * reversible.
38
+ *
39
+ * "Platform" is the umbrella term for everything the verify-gate can drive
40
+ * tools against: `browser` (browser-devtools, `bdt_*`), `node` (Node.js
41
+ * runtime debug — V8 inspector, `ndt_*`), `backend` (runtime-agnostic
42
+ * protocol calls, `bedt_*`). Future platforms (mobile / iOS / Android, …)
43
+ * plug in here without code changes to the marker syntax.
44
+ */
45
+ /** Type accepted as the `replacement` argument to `applyPlatformSection`.
46
+ *
47
+ * - `string` → used verbatim for every block (every key) of this platform.
48
+ * - `null` → placeholder used for every block.
49
+ * - `(key: string) => string | null` → resolved per block; returning null
50
+ * uses the placeholder for that block.
51
+ */
52
+ export type PlatformReplacement = string | null | ((key: string) => string | null);
53
+ /**
54
+ * Replace the contents of every platform-section marker block for `platform`
55
+ * in `fileContent`. Returns the new content (or the original content if no
56
+ * markers are found).
57
+ *
58
+ * Each block in the file is independently resolved. The same platform can
59
+ * have multiple blocks distinguished by their key — see file header for
60
+ * the syntax. Blocks that share a key are still treated as a structural
61
+ * bug: only the first is updated and a warning is emitted.
62
+ *
63
+ * The markers themselves are preserved so the operation is reversible.
64
+ */
65
+ export declare function applyPlatformSection(fileContent: string, platform: string, replacement: PlatformReplacement, fileLabel?: string): string;
66
+ /**
67
+ * Build the on-disk fragment filename for `(fragmentBase, platform, key)`:
68
+ * - keyless block (`key === ""`) → `<base>.<platform>.md`
69
+ * - keyed block → `<base>.<platform>.<key>.md`
70
+ */
71
+ export declare function fragmentFilename(fragmentBase: string, platform: string, key: string): string;
72
+ /** Read a fragment file from `${baseDir}/${name}`. Throws when missing. */
73
+ export declare function readFragment(baseDir: string, name: string): string;
74
+ /**
75
+ * Read the file at `targetPath`, apply the platform section toggle, and
76
+ * write back if the content actually changed. No-op when the marker is
77
+ * missing.
78
+ */
79
+ export declare function togglePlatformSectionInFile(targetPath: string, platform: string, replacement: PlatformReplacement): boolean;
80
+ /**
81
+ * One md file in a project that carries platform markers, paired with the
82
+ * fragment base name to use when the platform is enabled. Platform fragments
83
+ * live in the compiled `dist/clients/<client>/platforms/` directory at
84
+ * runtime.
85
+ *
86
+ * The same `fragmentBase` is reused for every key in the file — keyed
87
+ * fragments add `.<key>` before the `.md` extension (see
88
+ * `fragmentFilename`). E.g. fragmentBase `"skill"` + platform `"node"`
89
+ * resolves to `skill.node.md` for the keyless block, `skill.node.tldr.md`
90
+ * for the `tldr` keyed block, etc.
91
+ */
92
+ export interface PlatformTarget {
93
+ /** Project-relative path to the installed md file (e.g. `.claude/skills/...`). */
94
+ projectRelativePath: string;
95
+ /** Fragment file base — see `fragmentFilename` for the full naming rule. */
96
+ fragmentBase: string;
97
+ }
98
+ /** Project files that carry platform markers, per client. */
99
+ export declare const PLATFORM_TARGETS: Record<string, PlatformTarget[]>;
100
+ /**
101
+ * Toggle every platform-section block (across every key) in every installed
102
+ * md file across all known clients in `projectDir`. Files that don't exist
103
+ * are silently skipped (the client may not be installed for this project).
104
+ *
105
+ * When `enabled === true`, fragments for each block's key are loaded from
106
+ * `platformsDirFor(client)`. Missing fragment files for a key fall back to
107
+ * the placeholder rather than crashing — the source md is the source of
108
+ * truth for which keys exist; missing fragments are an authoring gap.
109
+ *
110
+ * Returns the list of project-relative paths that were updated.
111
+ */
112
+ export declare function applyPlatformToProjectFiles(projectDir: string, platform: string, enabled: boolean, platformsDirFor: (client: string) => string, clientFilter?: string[]): string[];
113
+ /**
114
+ * Sync every platform's section in the project's installed md files to
115
+ * match the current config state — ON when the platform's effective patterns
116
+ * are non-empty, OFF otherwise. Browser platform is enabled by default
117
+ * (its `verifyPatterns` defaults to `DEFAULT_BROWSER_VERIFY_PATTERNS` when
118
+ * unset); node and backend platforms default to inert.
119
+ *
120
+ * Called by `ironbee install` right after the source md files are written
121
+ * so that re-installing a project that already enabled / disabled a platform
122
+ * preserves the right state in the freshly-written files (instead of leaving
123
+ * the source's empty marker block visible).
124
+ */
125
+ export declare function syncPlatformSectionsToConfig(projectDir: string, platformsDirFor: (client: string) => string): void;
126
+ //# sourceMappingURL=platform-section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-section.d.ts","sourceRoot":"","sources":["../../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,EAAE,CAiCV;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CACxC,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAC5C,IAAI,CAMN"}
@@ -0,0 +1,279 @@
1
+ "use strict";
2
+ /**
3
+ * Platform-section toggling for skill / rule / command markdown files.
4
+ *
5
+ * Each agent-facing markdown file (skill, rule, slash command) carries one
6
+ * or more marker blocks per platform. Two marker syntaxes are supported:
7
+ *
8
+ * <!--IRONBEE:PLATFORM:node-->
9
+ * ...content here...
10
+ * <!--/IRONBEE:PLATFORM:node-->
11
+ *
12
+ * (the unkeyed form — handy when a file only needs a single block per
13
+ * platform), and:
14
+ *
15
+ * <!--IRONBEE:PLATFORM:node:tldr-->
16
+ * ...short heads-up content...
17
+ * <!--/IRONBEE:PLATFORM:node:tldr-->
18
+ * ...
19
+ * <!--IRONBEE:PLATFORM:node:full-->
20
+ * ...detailed flow...
21
+ * <!--/IRONBEE:PLATFORM:node:full-->
22
+ *
23
+ * (the keyed form — handy when the same platform needs different content at
24
+ * different positions in the same file: short summary up top, full flow at
25
+ * the bottom, etc.). Keys are alphanumeric + hyphen.
26
+ *
27
+ * Two states per block:
28
+ * - **disabled** — replaced with a short placeholder telling the agent
29
+ * the platform is off and reminding them not to invoke that platform's
30
+ * tools when the project isn't actually using it.
31
+ * - **enabled** — replaced with the full guidance fragment for that
32
+ * platform + key.
33
+ *
34
+ * `ironbee install` writes one or the other based on config state at
35
+ * install time. `ironbee enable-<platform>` / `disable-<platform>` flip
36
+ * already-installed files in place — no re-install needed. The marker block
37
+ * (and its key) is preserved on every flip so the toggle is always
38
+ * reversible.
39
+ *
40
+ * "Platform" is the umbrella term for everything the verify-gate can drive
41
+ * tools against: `browser` (browser-devtools, `bdt_*`), `node` (Node.js
42
+ * runtime debug — V8 inspector, `ndt_*`), `backend` (runtime-agnostic
43
+ * protocol calls, `bedt_*`). Future platforms (mobile / iOS / Android, …)
44
+ * plug in here without code changes to the marker syntax.
45
+ */
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.PLATFORM_TARGETS = void 0;
48
+ exports.applyPlatformSection = applyPlatformSection;
49
+ exports.fragmentFilename = fragmentFilename;
50
+ exports.readFragment = readFragment;
51
+ exports.togglePlatformSectionInFile = togglePlatformSectionInFile;
52
+ exports.applyPlatformToProjectFiles = applyPlatformToProjectFiles;
53
+ exports.syncPlatformSectionsToConfig = syncPlatformSectionsToConfig;
54
+ const fs_1 = require("fs");
55
+ const logger_1 = require("./logger");
56
+ const config_1 = require("./config");
57
+ /** Per-platform placeholder content (shown when the platform is disabled). */
58
+ const PLACEHOLDERS = {
59
+ browser: [
60
+ "<!-- Browser cycle verification is OFF for this project.",
61
+ " - To verify frontend / UI changes by driving a real browser (DOM, console,",
62
+ " screenshots, accessibility, network): run `ironbee browser enable` to enable.",
63
+ " This file will be auto-updated with the browser-cycle guidance.",
64
+ " - When OFF, do NOT invoke any `bdt_*` tools voluntarily — there is no",
65
+ " active browser-cycle gate, so calling them only wastes cycles. -->",
66
+ ].join("\n"),
67
+ node: [
68
+ "<!-- Node.js runtime debug verification is OFF for this project.",
69
+ " - If your backend is Node.js and you want non-blocking debugger probes:",
70
+ " run `ironbee node enable` to enable. This file will be auto-updated",
71
+ " with the node-cycle guidance.",
72
+ " - If your backend isn't Node.js (Java / Python / Go / Rust / .NET / Ruby / PHP / Elixir / …):",
73
+ " leave this OFF — `ndt_*` tools only attach to V8/Node processes and will fail elsewhere.",
74
+ " - When OFF, do NOT invoke any `ndt_*` tools voluntarily. -->",
75
+ ].join("\n"),
76
+ backend: [
77
+ "<!-- Backend protocol verification is OFF for this project.",
78
+ " - To verify backend services by driving real protocol calls (HTTP / gRPC /",
79
+ " GraphQL / WebSocket) — runtime- and language-agnostic — run `ironbee",
80
+ " backend enable`. This file will be auto-updated with the backend-cycle",
81
+ " guidance.",
82
+ " - When OFF, do NOT invoke any `bedt_*` tools voluntarily. -->",
83
+ ].join("\n"),
84
+ };
85
+ /** Escape a platform name for use inside a regex. Platform names are short
86
+ * ASCII identifiers but be defensive anyway. */
87
+ function escapeRegex(s) {
88
+ return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
89
+ }
90
+ /** Build the start-marker regex for a platform. The captured group is the
91
+ * optional key (empty when the keyless form is used). */
92
+ function startMarkerRegex(platform) {
93
+ return new RegExp(`<!--IRONBEE:PLATFORM:${escapeRegex(platform)}(?::([\\w-]+))?-->`, "g");
94
+ }
95
+ /** Build the end marker for a platform + key. Key may be empty for keyless. */
96
+ function endMarkerFor(platform, key) {
97
+ return key.length > 0
98
+ ? `<!--/IRONBEE:PLATFORM:${platform}:${key}-->`
99
+ : `<!--/IRONBEE:PLATFORM:${platform}-->`;
100
+ }
101
+ function findMarkerBlocks(content, platform, fileLabel) {
102
+ const re = startMarkerRegex(platform);
103
+ const blocks = [];
104
+ const keysSeen = new Set();
105
+ let m = re.exec(content);
106
+ while (m !== null) {
107
+ const key = m[1] ?? "";
108
+ const startEnd = m.index + m[0].length;
109
+ const endMarker = endMarkerFor(platform, key);
110
+ const endIdx = content.indexOf(endMarker, startEnd);
111
+ if (endIdx === -1) {
112
+ const labelSuffix = fileLabel ? ` in ${fileLabel}` : "";
113
+ const keyDisplay = key.length > 0 ? `${platform}:${key}` : platform;
114
+ logger_1.logger.debug(`platform-section ${keyDisplay}: start marker found without matching end marker${labelSuffix}`);
115
+ m = re.exec(content);
116
+ continue;
117
+ }
118
+ if (keysSeen.has(key)) {
119
+ const labelSuffix = fileLabel ? ` in ${fileLabel}` : "";
120
+ const keyDisplay = key.length > 0 ? `${platform}:${key}` : platform;
121
+ logger_1.logger.warn(`platform-section ${keyDisplay}: multiple marker blocks with the same key${labelSuffix} — only the first will be updated. ` +
122
+ `Either consolidate the blocks or use distinct keys (\`IRONBEE:PLATFORM:${platform}:<key>\`) per position.`);
123
+ m = re.exec(content);
124
+ continue;
125
+ }
126
+ keysSeen.add(key);
127
+ blocks.push({ key, startEnd, endIdx });
128
+ m = re.exec(content);
129
+ }
130
+ return blocks;
131
+ }
132
+ /**
133
+ * Replace the contents of every platform-section marker block for `platform`
134
+ * in `fileContent`. Returns the new content (or the original content if no
135
+ * markers are found).
136
+ *
137
+ * Each block in the file is independently resolved. The same platform can
138
+ * have multiple blocks distinguished by their key — see file header for
139
+ * the syntax. Blocks that share a key are still treated as a structural
140
+ * bug: only the first is updated and a warning is emitted.
141
+ *
142
+ * The markers themselves are preserved so the operation is reversible.
143
+ */
144
+ function applyPlatformSection(fileContent, platform, replacement, fileLabel) {
145
+ const getRepl = typeof replacement === "function"
146
+ ? replacement
147
+ : () => replacement;
148
+ const blocks = findMarkerBlocks(fileContent, platform, fileLabel);
149
+ if (blocks.length === 0) {
150
+ return fileContent;
151
+ }
152
+ const placeholder = PLACEHOLDERS[platform];
153
+ if (placeholder === undefined) {
154
+ throw new Error(`No placeholder registered for platform '${platform}'.`);
155
+ }
156
+ // Apply replacements in REVERSE so earlier indices stay valid as we
157
+ // splice. Keep each marker pair intact; only the inner content moves.
158
+ let result = fileContent;
159
+ for (let i = blocks.length - 1; i >= 0; i--) {
160
+ const b = blocks[i];
161
+ const inner = getRepl(b.key) ?? placeholder;
162
+ const before = result.substring(0, b.startEnd);
163
+ const after = result.substring(b.endIdx);
164
+ result = `${before}\n${inner}\n${after}`;
165
+ }
166
+ return result;
167
+ }
168
+ /**
169
+ * Build the on-disk fragment filename for `(fragmentBase, platform, key)`:
170
+ * - keyless block (`key === ""`) → `<base>.<platform>.md`
171
+ * - keyed block → `<base>.<platform>.<key>.md`
172
+ */
173
+ function fragmentFilename(fragmentBase, platform, key) {
174
+ return key.length > 0
175
+ ? `${fragmentBase}.${platform}.${key}.md`
176
+ : `${fragmentBase}.${platform}.md`;
177
+ }
178
+ /** Read a fragment file from `${baseDir}/${name}`. Throws when missing. */
179
+ function readFragment(baseDir, name) {
180
+ const path = `${baseDir}/${name}`;
181
+ if (!(0, fs_1.existsSync)(path)) {
182
+ throw new Error(`Platform fragment not found: ${path}`);
183
+ }
184
+ return (0, fs_1.readFileSync)(path, "utf-8").trimEnd();
185
+ }
186
+ /**
187
+ * Read the file at `targetPath`, apply the platform section toggle, and
188
+ * write back if the content actually changed. No-op when the marker is
189
+ * missing.
190
+ */
191
+ function togglePlatformSectionInFile(targetPath, platform, replacement) {
192
+ if (!(0, fs_1.existsSync)(targetPath)) {
193
+ return false;
194
+ }
195
+ const original = (0, fs_1.readFileSync)(targetPath, "utf-8");
196
+ const updated = applyPlatformSection(original, platform, replacement, targetPath);
197
+ if (updated === original) {
198
+ return false;
199
+ }
200
+ (0, fs_1.writeFileSync)(targetPath, updated);
201
+ return true;
202
+ }
203
+ /** Project files that carry platform markers, per client. */
204
+ exports.PLATFORM_TARGETS = {
205
+ claude: [
206
+ { projectRelativePath: ".claude/skills/ironbee-verification.md", fragmentBase: "skill" },
207
+ { projectRelativePath: ".claude/rules/ironbee-verification.md", fragmentBase: "rule" },
208
+ { projectRelativePath: ".claude/commands/ironbee-verify.md", fragmentBase: "command-verify" },
209
+ ],
210
+ cursor: [
211
+ { projectRelativePath: ".cursor/skills/ironbee-verification.md", fragmentBase: "skill" },
212
+ { projectRelativePath: ".cursor/rules/ironbee-verification.mdc", fragmentBase: "rule" },
213
+ { projectRelativePath: ".cursor/commands/ironbee-verify/SKILL.md", fragmentBase: "command-verify" },
214
+ ],
215
+ };
216
+ /**
217
+ * Toggle every platform-section block (across every key) in every installed
218
+ * md file across all known clients in `projectDir`. Files that don't exist
219
+ * are silently skipped (the client may not be installed for this project).
220
+ *
221
+ * When `enabled === true`, fragments for each block's key are loaded from
222
+ * `platformsDirFor(client)`. Missing fragment files for a key fall back to
223
+ * the placeholder rather than crashing — the source md is the source of
224
+ * truth for which keys exist; missing fragments are an authoring gap.
225
+ *
226
+ * Returns the list of project-relative paths that were updated.
227
+ */
228
+ function applyPlatformToProjectFiles(projectDir, platform, enabled, platformsDirFor, clientFilter) {
229
+ const updated = [];
230
+ const allClients = Object.keys(exports.PLATFORM_TARGETS);
231
+ const clientsToApply = clientFilter === undefined
232
+ ? allClients
233
+ : allClients.filter((c) => clientFilter.includes(c));
234
+ for (const client of clientsToApply) {
235
+ const targets = exports.PLATFORM_TARGETS[client];
236
+ const platformsDir = platformsDirFor(client);
237
+ for (const t of targets) {
238
+ const target = `${projectDir}/${t.projectRelativePath}`;
239
+ if (!(0, fs_1.existsSync)(target)) {
240
+ continue;
241
+ }
242
+ const resolver = enabled
243
+ ? (key) => {
244
+ const path = `${platformsDir}/${fragmentFilename(t.fragmentBase, platform, key)}`;
245
+ if (!(0, fs_1.existsSync)(path)) {
246
+ const keyDisplay = key.length > 0 ? `${platform}:${key}` : platform;
247
+ logger_1.logger.warn(`platform-section ${keyDisplay}: missing fragment ${path} for ${t.projectRelativePath} — falling back to placeholder.`);
248
+ return null;
249
+ }
250
+ return (0, fs_1.readFileSync)(path, "utf-8").trimEnd();
251
+ }
252
+ : null;
253
+ if (togglePlatformSectionInFile(target, platform, resolver)) {
254
+ updated.push(t.projectRelativePath);
255
+ }
256
+ }
257
+ }
258
+ return updated;
259
+ }
260
+ /**
261
+ * Sync every platform's section in the project's installed md files to
262
+ * match the current config state — ON when the platform's effective patterns
263
+ * are non-empty, OFF otherwise. Browser platform is enabled by default
264
+ * (its `verifyPatterns` defaults to `DEFAULT_BROWSER_VERIFY_PATTERNS` when
265
+ * unset); node and backend platforms default to inert.
266
+ *
267
+ * Called by `ironbee install` right after the source md files are written
268
+ * so that re-installing a project that already enabled / disabled a platform
269
+ * preserves the right state in the freshly-written files (instead of leaving
270
+ * the source's empty marker block visible).
271
+ */
272
+ function syncPlatformSectionsToConfig(projectDir, platformsDirFor) {
273
+ const config = (0, config_1.loadConfig)(projectDir);
274
+ for (const cycle of config_1.ALL_CYCLES) {
275
+ const enabled = (0, config_1.isCycleEnabled)(config, cycle);
276
+ applyPlatformToProjectFiles(projectDir, cycle, enabled, platformsDirFor);
277
+ }
278
+ }
279
+ //# sourceMappingURL=platform-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform-section.js","sourceRoot":"","sources":["../../src/lib/platform-section.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;;;AA0HH,oDA+BC;AAOD,4CAIC;AAGD,oCAMC;AAOD,kEAeC;AA+CD,kEAuCC;AAcD,oEASC;AA9SD,2BAA6D;AAC7D,qCAAkC;AAClC,qCAAkE;AAElE,8EAA8E;AAC9E,MAAM,YAAY,GAA2B;IACzC,OAAO,EAAE;QACL,0DAA0D;QAC1D,iFAAiF;QACjF,sFAAsF;QACtF,wEAAwE;QACxE,4EAA4E;QAC5E,2EAA2E;KAC9E,CAAC,IAAI,CAAC,IAAI,CAAC;IACZ,IAAI,EAAE;QACF,kEAAkE;QAClE,8EAA8E;QAC9E,4EAA4E;QAC5E,sCAAsC;QACtC,oGAAoG;QACpG,iGAAiG;QACjG,mEAAmE;KACtE,CAAC,IAAI,CAAC,IAAI,CAAC;IACZ,OAAO,EAAE;QACL,6DAA6D;QAC7D,iFAAiF;QACjF,6EAA6E;QAC7E,+EAA+E;QAC/E,kBAAkB;QAClB,oEAAoE;KACvE,CAAC,IAAI,CAAC,IAAI,CAAC;CACf,CAAC;AAEF;iDACiD;AACjD,SAAS,WAAW,CAAC,CAAS;IAC1B,OAAO,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC;AAED;0DAC0D;AAC1D,SAAS,gBAAgB,CAAC,QAAgB;IACtC,OAAO,IAAI,MAAM,CAAC,wBAAwB,WAAW,CAAC,QAAQ,CAAC,oBAAoB,EAAE,GAAG,CAAC,CAAC;AAC9F,CAAC;AAED,+EAA+E;AAC/E,SAAS,YAAY,CAAC,QAAgB,EAAE,GAAW;IAC/C,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC;QACjB,CAAC,CAAC,yBAAyB,QAAQ,IAAI,GAAG,KAAK;QA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CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC;YACxC,CAAC;QACL,CAAC;IACL,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,4BAA4B,CACxC,UAAkB,EAClB,eAA2C;IAE3C,MAAM,MAAM,GAAkC,IAAA,mBAAU,EAAC,UAAU,CAAC,CAAC;IACrE,KAAK,MAAM,KAAK,IAAI,mBAAU,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAY,IAAA,uBAAc,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACvD,2BAA2B,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IAC7E,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ironbee-ai/cli",
3
- "version": "0.8.3",
3
+ "version": "0.9.0",
4
4
  "description": "The CLI for IronBee — Verification and Intelligence Layer for Agentic Development",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,33 +0,0 @@
1
- <!-- Node backend verification is ENABLED for this project. -->
2
-
3
- ## Backend Node Mode (when `backend.node.verifyPatterns` matches an edited file)
4
-
5
- > **Precondition: the backend must actually be Node.js.** If you see `pom.xml`, `build.gradle`, `requirements.txt`, `pyproject.toml`, `go.mod`, `Cargo.toml`, etc., this section does NOT apply — `ndt_*` tools won't connect to non-Node processes. Just do browser verification.
6
-
7
- If the project has node backend verification enabled (`ironbee enable-backend node` once at setup, by an operator who confirmed the backend is Node.js) and your edits touch matching paths (e.g. `server/**`, `pages/api/**`), the Stop hook also enforces a Node cycle. The same `verification-start` covers both cycles; the same verdict file carries fields for both.
8
-
9
- ### Steps (additive to the browser flow above)
10
- 1. **Identify the running Node process** — note its PID, container name (`docker compose ps`), or inspector port.
11
- 2. **Connect**: `mcp__node-devtools__ndt_debug_connect` with one of `pid` / `processName` / `containerId` / `containerName` / `inspectorPort` / `wsUrl`. Inspector is auto-activated via SIGUSR1 if needed.
12
- 3. **Pick an evidence path** for each changed code path:
13
- - **Probe path** (proves the code path executed): `mcp__node-devtools__ndt_debug_put-tracepoint` (or `put-logpoint` / `put-exceptionpoint`) at the changed code, exercise the path (e.g. trigger the API call from the browser), then `mcp__node-devtools__ndt_debug_get-probe-snapshots`. At least one probe must come back with `triggered: true`.
14
- - **Log path** (proves no errors): exercise the path, then `mcp__node-devtools__ndt_debug_get-logs` with the error level filter. `backend_node_log_errors` must be empty for `status: pass`.
15
- 4. **Disconnect** (optional): `mcp__node-devtools__ndt_debug_disconnect`.
16
- 5. **Submit verdict** including `backend_node_*` fields. If browser cycle is also active, include browser fields in the SAME verdict — do not submit two verdicts.
17
-
18
- ### Verdict (node-cycle fields)
19
- ```json
20
- {
21
- "session_id": "...",
22
- "status": "pass",
23
- "checks": ["POST /api/orders returned 201", "tracepoint at handler.ts:42 fired once"],
24
- "backend_node_processes_connected": ["pid:12345 (next-server)"],
25
- "backend_node_probes_set": [
26
- { "type": "tracepoint", "location": "src/api/orders.ts:42", "triggered": true }
27
- ],
28
- "backend_node_probe_snapshots_collected": 1,
29
- "backend_node_log_errors": []
30
- }
31
- ```
32
-
33
- For a multi-cycle pass, both browser and node criteria must hold — claiming `pass` without one cycle's evidence will be overridden to fail by the gate.
@@ -1,33 +0,0 @@
1
- <!-- Node backend verification is ENABLED for this project. -->
2
-
3
- ## Backend Node Mode (when `backend.node.verifyPatterns` matches an edited file)
4
-
5
- > **Precondition: the backend must actually be Node.js.** If you see `pom.xml`, `build.gradle`, `requirements.txt`, `pyproject.toml`, `go.mod`, `Cargo.toml`, etc., this section does NOT apply — `MCP:ndt_*` tools won't connect to non-Node processes. Just do browser verification.
6
-
7
- If the project has node backend verification enabled (`ironbee enable-backend node` once at setup, by an operator who confirmed the backend is Node.js) and your edits touch matching paths (e.g. `server/**`, `pages/api/**`), the stop hook also enforces a Node cycle. The same `verification-start` covers both cycles; the same verdict file carries fields for both.
8
-
9
- ### Steps (additive to the browser flow above)
10
- 1. **Identify the running Node process** — note its PID, container name (`docker compose ps`), or inspector port.
11
- 2. **Connect**: `MCP:ndt_debug_connect` with one of `pid` / `processName` / `containerId` / `containerName` / `inspectorPort` / `wsUrl`. Inspector is auto-activated via SIGUSR1 if needed.
12
- 3. **Pick an evidence path** for each changed code path:
13
- - **Probe path** (proves the code path executed): `MCP:ndt_debug_put-tracepoint` (or `put-logpoint` / `put-exceptionpoint`) at the changed code, exercise the path (e.g. trigger the API call from the browser), then `MCP:ndt_debug_get-probe-snapshots`. At least one probe must come back with `triggered: true`.
14
- - **Log path** (proves no errors): exercise the path, then `MCP:ndt_debug_get-logs` with the error level filter. `backend_node_log_errors` must be empty for `status: pass`.
15
- 4. **Disconnect** (optional): `MCP:ndt_debug_disconnect`.
16
- 5. **Submit verdict** including `backend_node_*` fields. If browser cycle is also active, include browser fields in the SAME verdict — do not submit two verdicts.
17
-
18
- ### Verdict (node-cycle fields)
19
- ```json
20
- {
21
- "session_id": "...",
22
- "status": "pass",
23
- "checks": ["POST /api/orders returned 201", "tracepoint at handler.ts:42 fired once"],
24
- "backend_node_processes_connected": ["pid:12345 (next-server)"],
25
- "backend_node_probes_set": [
26
- { "type": "tracepoint", "location": "src/api/orders.ts:42", "triggered": true }
27
- ],
28
- "backend_node_probe_snapshots_collected": 1,
29
- "backend_node_log_errors": []
30
- }
31
- ```
32
-
33
- For a multi-cycle pass, both browser and node criteria must hold — claiming `pass` without one cycle's evidence will be overridden to fail by the gate.
@@ -1,56 +0,0 @@
1
- /**
2
- * Shared helpers for `enable-backend <runtime>` / `disable-backend <runtime>`.
3
- *
4
- * Per design §10 — opt-in activation for backend verification per runtime.
5
- *
6
- * - `applyEnableBackend(runtime, projectDir)` writes opinionated default
7
- * `verifyPatterns` to the project config under `backend.<runtime>`.
8
- * Refuses if patterns are already populated. Other fields
9
- * (`alwaysRequired`, `evidencePaths`, `additionalVerifyPatterns`) are
10
- * not written — they merge in from defaults at config-load time.
11
- *
12
- * - `applyDisableBackend(runtime, projectDir)` resets `verifyPatterns`
13
- * to `[]` for the runtime, leaving customizations of other fields
14
- * intact so a later re-enable restores them. Idempotent.
15
- *
16
- * Both throw when `<runtime>` isn't in the registered runtime set
17
- * (today: just `node`); callers handle the error and exit.
18
- */
19
- import { ConfigTarget } from "../lib/config";
20
- export declare function knownRuntimes(): string[];
21
- export declare function assertKnownRuntime(runtime: string): void;
22
- /**
23
- * Enable a backend runtime: write default `verifyPatterns` + splice the
24
- * runtime fragment into installed skill/rule/command md files.
25
- *
26
- * No-op + warning when patterns are already populated **in the targeted
27
- * layer** (the user must `disable-backend` first to reset, since we don't
28
- * want to clobber their custom additions). Higher-priority layers' patterns
29
- * are not consulted by this check — they ride along through `loadConfig`
30
- * at runtime, but they don't shadow our writes the way they do for boolean
31
- * `verification.enable` flips.
32
- *
33
- * `target` selects which config layer to write:
34
- * - `"project"` (default) — committed `<project>/.ironbee/config.json`.
35
- * - `"global"` — `~/.ironbee/config.json`.
36
- * - `"local"` — gitignored `<project>/.ironbee/config.local.json`.
37
- *
38
- * `clientName`: optional filter for which clients' md files to update.
39
- * Same semantics as `applyVerificationToggle` — `"all"` / `<name>` /
40
- * undefined (default: every registered client; per-file existsSync gate
41
- * skips ones without installed artifacts).
42
- */
43
- export declare function applyEnableBackend(runtime: string, projectDir: string, target: ConfigTarget, clientName?: string): void;
44
- /**
45
- * Disable a backend runtime: reset `verifyPatterns` to `[]` in the
46
- * targeted layer and reset the runtime fragment in installed
47
- * skill/rule/command md files.
48
- *
49
- * Customizations of `alwaysRequired`, `evidencePaths`, and
50
- * `additionalVerifyPatterns` are preserved (we only touch `verifyPatterns`).
51
- * Idempotent — no-op when the targeted layer has no patterns to clear.
52
- *
53
- * `target` / `clientName` semantics match `applyEnableBackend`.
54
- */
55
- export declare function applyDisableBackend(runtime: string, projectDir: string, target: ConfigTarget, clientName?: string): void;
56
- //# sourceMappingURL=backend-toggle.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"backend-toggle.d.ts","sourceRoot":"","sources":["../../src/commands/backend-toggle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAQH,OAAO,EAAmB,YAAY,EAA0C,MAAM,eAAe,CAAC;AAyCtG,wBAAgB,aAAa,IAAI,MAAM,EAAE,CAWxC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAKxD;AAqCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAC9B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,YAAY,EACpB,UAAU,CAAC,EAAE,MAAM,GACpB,IAAI,CAgDN;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,YAAY,EACpB,UAAU,CAAC,EAAE,MAAM,GACpB,IAAI,CAwBN"}