@cbartens/bkit 5.0.3 → 5.2.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 (212) hide show
  1. package/.bkit/README.md +14 -10
  2. package/.bkit/core/.agents/docs.md +1 -0
  3. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-gateguard.cjs +93 -0
  4. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +137 -0
  5. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-readguard.cjs +72 -0
  6. package/.bkit/core/.agents/rules.md +10 -6
  7. package/.bkit/core/.agents/shortcuts.md +73 -0
  8. package/.bkit/core/.agents/skills.md +5 -3
  9. package/.bkit/core/.bkit/LICENSE.md +18 -140
  10. package/.bkit/core/.bkit/README.md +13 -9
  11. package/.bkit/core/.bkit/cloud.md +12 -15
  12. package/.bkit/core/.bkit/comparison.md +68 -16
  13. package/.bkit/core/.bkit/install.md +36 -11
  14. package/.bkit/core/.bkit/jsonl.md +0 -1
  15. package/.bkit/core/.bkit/prompts.md +83 -81
  16. package/.bkit/core/.bkit/providers.md +110 -28
  17. package/.bkit/core/.bkit/templates.md +42 -13
  18. package/.bkit/core/.bkit/workflows.md +64 -42
  19. package/.bkit/core/.claude/hooks/bkit-gateguard.cjs +4 -3
  20. package/.bkit/core/.claude/hooks/bkit-readguard.cjs +60 -0
  21. package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +8 -6
  22. package/.bkit/core/.codex/hooks/bkit-readguard.cjs +58 -0
  23. package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +12 -19
  24. package/.bkit/core/.cursor/hooks/bkit-readguard.cjs +59 -0
  25. package/.bkit/core/.opencode/plugin/bkit-gateguard.js +73 -22
  26. package/.bkit/core/.opencode/plugin/bkit-readguard.js +126 -0
  27. package/.bkit/core/AGENTS.md +11 -0
  28. package/.bkit/core/docs/templates/bkit-audit-adoption.md +2 -2
  29. package/.bkit/core/docs/templates/bkit-plan.md +6 -3
  30. package/.bkit/core/engine/checks/after/auth.ts +32 -0
  31. package/.bkit/core/engine/checks/after/github.ts +4 -4
  32. package/.bkit/core/engine/checks/after/index.ts +36 -50
  33. package/.bkit/core/engine/checks/after/managed.ts +44 -1
  34. package/.bkit/core/engine/checks/before/index.ts +5 -4
  35. package/.bkit/core/engine/checks/before/mcp.ts +60 -54
  36. package/.bkit/core/engine/checks/status-holes.ts +1 -1
  37. package/.bkit/core/engine/checks/tips/catalogue.ts +356 -0
  38. package/.bkit/core/engine/checks/tips/detect.ts +144 -0
  39. package/.bkit/core/engine/checks/tips/index.ts +174 -0
  40. package/.bkit/core/engine/cli.ts +82 -18
  41. package/.bkit/core/engine/commands/install/check.ts +2 -0
  42. package/.bkit/core/engine/commands/install/doctor.ts +14 -1
  43. package/.bkit/core/engine/commands/install/install.ts +59 -9
  44. package/.bkit/core/engine/commands/install/uninstall.ts +59 -34
  45. package/.bkit/core/engine/commands/install/upgrade.ts +30 -28
  46. package/.bkit/core/engine/commands/launch.ts +33 -11
  47. package/.bkit/core/engine/commands/tips.ts +16 -0
  48. package/.bkit/core/engine/commands/workflow/prs.ts +20 -2
  49. package/.bkit/core/engine/commands/workflow/runs.ts +82 -18
  50. package/.bkit/core/engine/commands/workflow/runtime.ts +12 -0
  51. package/.bkit/core/engine/commands/workflow/steps.ts +1 -0
  52. package/.bkit/core/engine/commands/workflow/tests.ts +647 -4
  53. package/.bkit/core/engine/commands/workflow/workstreams.ts +4 -4
  54. package/.bkit/core/engine/install/cloud-env.ts +7 -21
  55. package/.bkit/core/engine/install/hosts.ts +21 -0
  56. package/.bkit/core/engine/install/managed-block.ts +36 -0
  57. package/.bkit/core/engine/install/manifest.ts +83 -5
  58. package/.bkit/core/engine/install/modules/antigravity.ts +266 -0
  59. package/.bkit/core/engine/install/modules/claude.ts +6 -6
  60. package/.bkit/core/engine/install/modules/cloud.ts +2 -2
  61. package/.bkit/core/engine/install/modules/codex.ts +8 -5
  62. package/.bkit/core/engine/install/modules/core.ts +30 -10
  63. package/.bkit/core/engine/install/modules/cursor.ts +6 -6
  64. package/.bkit/core/engine/install/modules/index.ts +33 -6
  65. package/.bkit/core/engine/install/modules/opencode.ts +4 -4
  66. package/.bkit/core/engine/install/payload-links.ts +6 -10
  67. package/.bkit/core/engine/install/placeholders.ts +1 -1
  68. package/.bkit/core/engine/install/version-file.ts +17 -9
  69. package/.bkit/core/engine/install/write.ts +68 -1
  70. package/.bkit/core/engine/ledgers/telemetry.ts +0 -2
  71. package/.bkit/core/engine/render/hosts.ts +174 -1
  72. package/.bkit/core/engine/render/models.ts +10 -0
  73. package/.bkit/core/engine/shared/package-roots.ts +8 -10
  74. package/.bkit/core/hooks/antigravity-hook.js +67 -0
  75. package/.bkit/core/hooks/gateguard-edit-payload.js +4 -4
  76. package/.bkit/core/hooks/gateguard-engine.js +16 -6
  77. package/.bkit/core/hooks/guardrails-read.js +23 -0
  78. package/.bkit/core/hooks/readguard-engine.js +259 -0
  79. package/.bkit/core/hooks/readguard-payload.js +67 -0
  80. package/.bkit/core/prompts/bkit-audit-generate.md +2 -1
  81. package/.bkit/core/prompts/bkit-build-challenge-1.md +2 -1
  82. package/.bkit/core/prompts/bkit-build-challenge-2.md +2 -1
  83. package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +2 -1
  84. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +2 -1
  85. package/.bkit/core/prompts/bkit-build-challenge-tests.md +2 -1
  86. package/.bkit/core/prompts/bkit-build-install-skills.md +7 -5
  87. package/.bkit/core/prompts/bkit-build-plan-current.md +2 -1
  88. package/.bkit/core/prompts/bkit-build-plan-execute.md +6 -2
  89. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +2 -1
  90. package/.bkit/core/prompts/bkit-build-plan-verify.md +12 -4
  91. package/.bkit/core/prompts/bkit-build-summary.md +2 -1
  92. package/.bkit/core/prompts/bkit-debug-abort-handover.md +2 -1
  93. package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +2 -1
  94. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +2 -1
  95. package/.bkit/core/prompts/bkit-debug-failure-soak.md +2 -1
  96. package/.bkit/core/prompts/bkit-debug-summary.md +2 -1
  97. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +2 -1
  98. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +2 -1
  99. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +2 -1
  100. package/.bkit/core/prompts/bkit-design-generate.md +10 -5
  101. package/.bkit/core/prompts/bkit-design-organise.md +2 -1
  102. package/.bkit/core/prompts/bkit-design-review-1.md +2 -1
  103. package/.bkit/core/prompts/bkit-design-review-2.md +2 -1
  104. package/.bkit/core/prompts/bkit-design-spike.md +2 -1
  105. package/.bkit/core/prompts/bkit-design-summary.md +2 -1
  106. package/.bkit/core/prompts/bkit-design-update.md +2 -1
  107. package/.bkit/core/prompts/bkit-plan-complexity-check.md +2 -1
  108. package/.bkit/core/prompts/bkit-plan-complexity-split.md +4 -3
  109. package/.bkit/core/prompts/bkit-plan-generate.md +2 -1
  110. package/.bkit/core/prompts/bkit-plan-review-1.md +2 -1
  111. package/.bkit/core/prompts/bkit-plan-review-2.md +2 -1
  112. package/.bkit/core/prompts/bkit-plan-review-3.md +2 -1
  113. package/.bkit/core/prompts/bkit-plan-scope-check-1.md +3 -2
  114. package/.bkit/core/prompts/bkit-plan-scope-check-2.md +3 -2
  115. package/.bkit/core/prompts/bkit-plan-summary.md +2 -1
  116. package/.bkit/core/prompts/bkit-plan-update.md +3 -2
  117. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +2 -1
  118. package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +2 -1
  119. package/.bkit/core/prompts/bkit-ship-summary.md +2 -1
  120. package/.bkit/core/prompts/bkit-ship-update-docs.md +2 -1
  121. package/.bkit/core/prompts/bkit-utility-compress-markdown.md +2 -1
  122. package/.bkit/core/prompts/bkit-utility-update-decisions.md +2 -1
  123. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +2 -1
  124. package/.bkit/core/prompts/bkit-utility-update-documentation.md +2 -1
  125. package/.bkit/core/prompts/bkit-utility-update-failures.md +2 -1
  126. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +2 -1
  127. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +4 -3
  128. package/.bkit/core/workflows/bkit-auto.md +1 -1
  129. package/.bkit/core/workflows/bkit-build.md +35 -21
  130. package/.bkit/core/workflows/bkit-debug.md +31 -22
  131. package/.bkit/core/workflows/bkit-design.md +83 -38
  132. package/.bkit/core/workflows/bkit-plan.md +10 -2
  133. package/.bkit/core/workflows/bkit-ship.md +10 -2
  134. package/.bkit/shared/.agents/plugins/bkit/hooks.json +36 -0
  135. package/.bkit/shared/.agents/plugins/bkit/plugin.json +5 -0
  136. package/.bkit/shared/.claude/settings.json +19 -0
  137. package/.bkit/shared/.codex/hooks.json +21 -0
  138. package/.bkit/shared/.cursor/hooks.json +6 -1
  139. package/.bkit/shared/.opencode/opencode.json +1 -1
  140. package/.bkit/shared/GEMINI.md +11 -0
  141. package/.bkit/shared/docs/deployments.md +1 -1
  142. package/.bkit/shared/docs/security.md +3 -3
  143. package/.bkit/shared/docs/testing.md +12 -1
  144. package/.bkit/templates/.github/dependabot.yml +6 -0
  145. package/.bkit/templates/.github/renovate.json5 +3 -3
  146. package/.bkit/templates/.github/workflows/bkit-ci.yml +24 -13
  147. package/.bkit/templates/.github/workflows/bkit-cloud.yml +5 -5
  148. package/.bkit/templates/.prettierignore +4 -1
  149. package/.bkit/templates/context/bkit-expo.md +22 -13
  150. package/.bkit/templates/context/bkit-github.md +20 -6
  151. package/.bkit/templates/context/bkit-inngest.md +10 -4
  152. package/.bkit/templates/context/bkit-maestro.md +5 -5
  153. package/.bkit/templates/context/bkit-playwright.md +3 -3
  154. package/.bkit/templates/context/bkit-sentry.md +6 -5
  155. package/.bkit/templates/context/bkit-stripe.md +31 -8
  156. package/.bkit/templates/scripts/ci/check-accepted-divergences.mjs +65 -19
  157. package/.bkit/templates/scripts/ci/check-accepted-divergences.test.mjs +34 -0
  158. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.mjs +33 -12
  159. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.test.mjs +54 -0
  160. package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +2 -2
  161. package/.bkit/templates/scripts/launchd/bkit-launchd-env.sh +76 -6
  162. package/.bkit/templates/slop-scan.config.json +10 -3
  163. package/CHANGELOG.md +62 -0
  164. package/LICENSE.md +21 -161
  165. package/README.md +66 -35
  166. package/dist/checks/after/auth.js +28 -0
  167. package/dist/checks/after/github.js +4 -4
  168. package/dist/checks/after/index.js +29 -45
  169. package/dist/checks/after/managed.js +41 -1
  170. package/dist/checks/before/index.js +5 -4
  171. package/dist/checks/before/mcp.js +53 -53
  172. package/dist/checks/status-holes.js +1 -1
  173. package/dist/checks/tips/catalogue.js +297 -0
  174. package/dist/checks/tips/detect.js +130 -0
  175. package/dist/checks/tips/index.js +146 -0
  176. package/dist/cli.js +68 -17
  177. package/dist/commands/install/check.js +2 -0
  178. package/dist/commands/install/doctor.js +9 -1
  179. package/dist/commands/install/install.js +49 -8
  180. package/dist/commands/install/uninstall.js +61 -34
  181. package/dist/commands/install/upgrade.js +31 -33
  182. package/dist/commands/launch.js +27 -11
  183. package/dist/commands/tips.js +10 -0
  184. package/dist/commands/workflow/prs.js +13 -1
  185. package/dist/commands/workflow/runs.js +74 -18
  186. package/dist/commands/workflow/runtime.js +8 -0
  187. package/dist/commands/workflow/steps.js +1 -0
  188. package/dist/commands/workflow/tests.js +541 -4
  189. package/dist/commands/workflow/workstreams.js +4 -4
  190. package/dist/install/cloud-env.js +3 -14
  191. package/dist/install/hosts.js +22 -0
  192. package/dist/install/managed-block.js +36 -0
  193. package/dist/install/manifest.js +79 -4
  194. package/dist/install/modules/antigravity.js +225 -0
  195. package/dist/install/modules/claude.js +6 -6
  196. package/dist/install/modules/cloud.js +2 -2
  197. package/dist/install/modules/codex.js +8 -5
  198. package/dist/install/modules/core.js +21 -6
  199. package/dist/install/modules/cursor.js +6 -6
  200. package/dist/install/modules/index.js +17 -6
  201. package/dist/install/modules/opencode.js +4 -4
  202. package/dist/install/payload-links.js +5 -5
  203. package/dist/install/placeholders.js +1 -1
  204. package/dist/install/version-file.js +12 -3
  205. package/dist/install/write.js +61 -2
  206. package/dist/render/hosts.js +149 -1
  207. package/dist/render/models.js +9 -0
  208. package/dist/shared/package-roots.js +8 -11
  209. package/package.json +8 -8
  210. package/.bkit/core/LICENSE.md +0 -149
  211. package/.bkit/shared/LICENSE.md +0 -22
  212. package/.bkit/templates/LICENSE.md +0 -22
@@ -0,0 +1,22 @@
1
+ // install/hosts.ts — which host modules a consumer has installed.
2
+ import * as fs from "node:fs";
3
+ import * as path from "node:path";
4
+ /**
5
+ * Detect which host modules a consumer has installed, by the presence of each host's
6
+ * source-rendered agents directory. `bkit upgrade` re-renders only these hosts — never
7
+ * force-creating an opencode/cursor tree — and setup tips key host-specific advice on them.
8
+ */
9
+ export function detectInstalledHostModules(cwd) {
10
+ const mods = new Set();
11
+ if (fs.existsSync(path.join(cwd, ".claude", "agents")))
12
+ mods.add("claude");
13
+ if (fs.existsSync(path.join(cwd, ".cursor", "agents")))
14
+ mods.add("cursor");
15
+ if (fs.existsSync(path.join(cwd, ".opencode", "agents")))
16
+ mods.add("opencode");
17
+ if (fs.existsSync(path.join(cwd, ".codex", "agents")))
18
+ mods.add("codex");
19
+ if (fs.existsSync(path.join(cwd, ".agents", "plugins", "bkit", "plugin.json")))
20
+ mods.add("antigravity");
21
+ return mods;
22
+ }
@@ -118,6 +118,42 @@ export function detectMarkerStyle(content) {
118
118
  }
119
119
  return null;
120
120
  }
121
+ // Verbatim long lines a text must share with a block, beside its title, to count as a copy.
122
+ const COPY_MIN_SHARED_LINES = 10;
123
+ // Shortest trimmed line counted as shared; shorter lines (rules, `>`, table dividers) recur by chance.
124
+ const COPY_MIN_LINE_LENGTH = 40;
125
+ // Lines outside fenced code blocks; a shell comment in a fence (`# Vercel errors`) is no heading.
126
+ function proseLines(text) {
127
+ const out = [];
128
+ let inFence = false;
129
+ for (const line of text.split("\n")) {
130
+ if (line.trimStart().startsWith("```")) {
131
+ inFence = !inFence;
132
+ continue;
133
+ }
134
+ if (!inFence)
135
+ out.push(line);
136
+ }
137
+ return out;
138
+ }
139
+ // The block's `# ` title when `text` holds an older unmarked copy of the same markdown block:
140
+ // the title line plus COPY_MIN_SHARED_LINES long lines verbatim, all outside fenced code.
141
+ // Null otherwise, including for a block with no title.
142
+ export function findUnmarkedCopy(text, block) {
143
+ const blockLines = proseLines(block);
144
+ const title = blockLines.find((l) => /^# \S/.test(l));
145
+ if (title === undefined)
146
+ return null;
147
+ const textLines = proseLines(text);
148
+ if (!textLines.includes(title))
149
+ return null;
150
+ const long = new Set(blockLines.map((l) => l.trim()).filter((l) => l.length >= COPY_MIN_LINE_LENGTH));
151
+ let shared = 0;
152
+ for (const l of new Set(textLines.map((t) => t.trim())))
153
+ if (long.has(l))
154
+ shared++;
155
+ return shared >= COPY_MIN_SHARED_LINES ? title : null;
156
+ }
121
157
  // Remove the bkit-managed block (including marker lines) from a string,
122
158
  // preserving all consumer-owned content outside the block.
123
159
  //
@@ -9,7 +9,7 @@
9
9
  * (`--auto=`, `--opencode=`). A bare/full `uninstall` DOES remove them (zero footprint).
10
10
  * Dependency-updater files are not modules — bkit never writes or removes them.
11
11
  */
12
- export const OPTIN_MODULES = new Set(["cloud", "opencode", "codex"]);
12
+ export const OPTIN_MODULES = new Set(["cloud", "opencode", "codex", "antigravity"]);
13
13
  // ---------------------------------------------------------------------------
14
14
  // Issue tracker
15
15
  // ---------------------------------------------------------------------------
@@ -85,9 +85,8 @@ const CORE_MANIFEST = [
85
85
  { path: ".bkit/comparison.md", format: "byte-equal-text", module: "core" },
86
86
  { path: ".bkit/install.md", format: "byte-equal-text", module: "core" },
87
87
  { path: ".bkit/jsonl.md", format: "byte-equal-text", module: "core" },
88
- // The PolyForm notice that travels with every file bkit writes (the managed-version
89
- // marker names the licence and its URL; this file carries both full texts and the
90
- // Required Notice). Sourced from `.bkit/core/.bkit/LICENSE.md`.
88
+ // The MIT notice that travels with the files bkit writes: the full text and copyright
89
+ // notice. Sourced from `.bkit/core/.bkit/LICENSE.md`.
91
90
  { path: ".bkit/LICENSE.md", format: "byte-equal-text", module: "core" },
92
91
  { path: ".bkit/providers.md", format: "byte-equal-text", module: "core" },
93
92
  { path: ".bkit/prompts.md", format: "markered-text", module: "core" },
@@ -113,6 +112,13 @@ const CLAUDE_MANIFEST = [
113
112
  format: "markered-text",
114
113
  module: "claude",
115
114
  },
115
+ // ReadGuard advisory repeat-read hook — same ownership split as GateGuard. Wired in
116
+ // .claude/settings.json → PreToolUse (matcher `Read|Bash`) and PreCompact.
117
+ {
118
+ path: ".claude/hooks/bkit-readguard.cjs",
119
+ format: "markered-text",
120
+ module: "claude",
121
+ },
116
122
  // bkit-guardrails.cjs — Tier-2 markered-text, twin of the Cursor/Codex hooks.
117
123
  // PreToolUse matcher `Bash`. ADVISORY ONLY: covers URL hosts and shell-as-edit-channel;
118
124
  // never denies or asks.
@@ -211,6 +217,13 @@ export const BKIT_BUILD_GATES = [
211
217
  "bkit:gate:static-unit-integration",
212
218
  "bkit:gate:static-unit",
213
219
  ];
220
+ /**
221
+ * Runs ONE test file — `pnpm bkit:test:file <repo-relative path>` — and writes a JUnit
222
+ * report to `$BKIT_TEST_REPORT`. `/bkit-build` records each task's red and audits its
223
+ * green through it. Never seeded: no default works on every stack; install advises
224
+ * when it is missing (detectGateAdvisories).
225
+ */
226
+ export const BKIT_TEST_FILE_SCRIPT = "bkit:test:file";
214
227
  /**
215
228
  * The deeper gates, shallowest first, with what declaring each one costs.
216
229
  *
@@ -257,6 +270,14 @@ const CURSOR_MANIFEST = [
257
270
  format: "markered-text",
258
271
  module: "cursor",
259
272
  },
273
+ // ReadGuard for Cursor — same managed block as the Claude twin. Wired in
274
+ // .cursor/hooks.json → preToolUse (matcher "Read|Shell") and preCompact, without
275
+ // failClosed.
276
+ {
277
+ path: ".cursor/hooks/bkit-readguard.cjs",
278
+ format: "markered-text",
279
+ module: "cursor",
280
+ },
260
281
  // Curl/wget host allowlist read at runtime by bkit-guardrails.cjs. No template backs it —
261
282
  // `writeNetworkAllowlistArtifact` (install/cloud-env.ts) computes the domain set from the
262
283
  // consumer's own config, so it is `generated` and its hash is in `canonicalHashes`.
@@ -293,6 +314,12 @@ export const OPENCODE_MANIFEST = [
293
314
  format: "markered-text",
294
315
  module: "opencode",
295
316
  },
317
+ // bkit-readguard.js — same split as bkit-gateguard.js.
318
+ {
319
+ path: ".opencode/plugin/bkit-readguard.js",
320
+ format: "markered-text",
321
+ module: "opencode",
322
+ },
296
323
  // Agent and command mirrors are managed dynamically (not listed individually here —
297
324
  // the exact set depends on the bkit-prefix prompt/workflow files at install time).
298
325
  // Uninstall uses the BKIT_PREFIX filter for .opencode/agents/ and .opencode/commands/.
@@ -312,6 +339,13 @@ export const CODEX_MANIFEST = [
312
339
  format: "markered-text",
313
340
  module: "codex",
314
341
  },
342
+ // bkit-readguard.cjs — Tier-2 markered-text, twin of the Claude hook. Registered on
343
+ // PreToolUse matcher `Bash` (Codex has no read tool) and PreCompact.
344
+ {
345
+ path: ".codex/hooks/bkit-readguard.cjs",
346
+ format: "markered-text",
347
+ module: "codex",
348
+ },
315
349
  // bkit-guardrails.cjs — Tier-2 markered-text, twin of the Cursor hook (same decision
316
350
  // engine). Registered on matcher `Bash`, Codex's shell tool name. Codex parses but
317
351
  // does not implement `permissionDecision: "ask"`, so the deny tier blocks for real
@@ -325,6 +359,46 @@ export const CODEX_MANIFEST = [
325
359
  // Agent mirrors (.codex/agents/*.toml) and workflow skills (.agents/skills/bkit-*/) are
326
360
  // managed dynamically — the set follows the bkit-prefix prompt/workflow files at install.
327
361
  ];
362
+ // --antigravity: Google Antigravity IDE host. Installs as a workspace PLUGIN at
363
+ // `.agents/plugins/bkit/` (Antigravity's own packaging surface), so `.agents/` root stays
364
+ // the dedicated Codex install. Root `GEMINI.md` is the redirect mirror of `CLAUDE.md`
365
+ // (Antigravity loads `GEMINI.md` as a workspace rule file).
366
+ export const ANTIGRAVITY_MANIFEST = [
367
+ // plugin.json — the required plugin manifest. Tier-2 json (deep-contained): bkit owns
368
+ // the schema/name/description keys (the schema is `additionalProperties: false`).
369
+ { path: ".agents/plugins/bkit/plugin.json", format: "json", module: "antigravity" },
370
+ // hooks.json — Tier-2 json (deep-contained): bkit owns the PreToolUse GateGuard and
371
+ // guardrails entries, consumers may add their own event groups alongside them.
372
+ { path: ".agents/plugins/bkit/hooks.json", format: "json", module: "antigravity" },
373
+ // bkit-gateguard.cjs — Tier-2 markered-text, twin of the Claude/Codex hook (same
374
+ // stdin/stdout contract); differs in the tool names (`write_to_file` /
375
+ // `replace_file_content`) and the payload path field.
376
+ {
377
+ path: ".agents/plugins/bkit/hooks/bkit-gateguard.cjs",
378
+ format: "markered-text",
379
+ module: "antigravity",
380
+ },
381
+ // bkit-readguard.cjs — Tier-2 markered-text, twin of the Claude hook. Registered on
382
+ // matcher `view_file|run_command`.
383
+ {
384
+ path: ".agents/plugins/bkit/hooks/bkit-readguard.cjs",
385
+ format: "markered-text",
386
+ module: "antigravity",
387
+ },
388
+ // bkit-guardrails.cjs — Tier-2 markered-text, twin of the Cursor/Codex hook. Registered
389
+ // on matcher `view_file|run_command`, Antigravity's file-read and shell tool names.
390
+ {
391
+ path: ".agents/plugins/bkit/hooks/bkit-guardrails.cjs",
392
+ format: "markered-text",
393
+ module: "antigravity",
394
+ },
395
+ // Root GEMINI.md — Antigravity workspace-rule redirect to .agents/rules.md, owned by the
396
+ // antigravity module: `uninstall --antigravity` removes it; other installs leave it.
397
+ { path: "GEMINI.md", format: "markered-text", module: "antigravity" },
398
+ // Subagent prompts (.agents/plugins/bkit/agents/bkit-*.md) and workflow skills
399
+ // (.agents/plugins/bkit/skills/bkit-*/) are managed dynamically — the set follows the
400
+ // bkit-prefix prompt/workflow files at install.
401
+ ];
328
402
  // Cloud agent integration is opt-in — NOT in a default install, so a default install
329
403
  // ships ZERO cloud footprint. Every variant writes no files: the cloud workflow
330
404
  // (bkit-cloud.yml), bkit-cloud-bootstrap.sh and the Cursor Background Agent files
@@ -351,6 +425,7 @@ const MODULE_MANIFESTS = {
351
425
  cursor: CURSOR_MANIFEST,
352
426
  opencode: OPENCODE_MANIFEST,
353
427
  codex: CODEX_MANIFEST,
428
+ antigravity: ANTIGRAVITY_MANIFEST,
354
429
  cloud: CLOUD_MANIFEST,
355
430
  };
356
431
  // ---------------------------------------------------------------------------
@@ -0,0 +1,225 @@
1
+ // install/modules/antigravity.ts — the Google Antigravity host module. The whole host
2
+ // installs into a workspace PLUGIN at `.agents/plugins/bkit/`, so `.agents/` root stays
3
+ // the dedicated Codex install.
4
+ import * as fs from "node:fs";
5
+ import * as path from "node:path";
6
+ import { writeTier2, writeTier2JsonContained, ensureDir } from "../write.js";
7
+ import { stampManagedVersion } from "../version-file.js";
8
+ import { ANTIGRAVITY_AGENTS_DIR, applyAntigravityPrompt, applyAntigravitySkill, } from "../../render/hosts.js";
9
+ import { getCoreRoot, getSharedRoot, getWorkflowsRoot, getPromptsRoot, } from "../../shared/package-roots.js";
10
+ import { DEFAULT_ISSUE_TRACKER } from "../manifest.js";
11
+ import { substituteWorkflow } from "../../render/trackers.js";
12
+ import { BKIT_PREFIX, installFile, listMdFiles, readInstallingVersion, trackMirrorWrite, } from "./core.js";
13
+ // ---------------------------------------------------------------------------
14
+ // runAntigravityModule — Google Antigravity IDE host (opt-in via --antigravity)
15
+ //
16
+ // Nullary flag, like --codex: Antigravity runs on one pinned gateway (`google`).
17
+ //
18
+ // The host installs as a workspace PLUGIN (`.agents/plugins/bkit/`) — Antigravity's own
19
+ // packaging surface (antigravity.google/docs/plugins). The plugin activates per project:
20
+ // .agents/plugins/bkit/plugin.json — plugin manifest (required)
21
+ // .agents/plugins/bkit/skills/bkit-<wf>/SKILL.md — workflow entry points (skills)
22
+ // .agents/plugins/bkit/agents/<name>.md — subagent prompt definitions
23
+ // .agents/plugins/bkit/hooks.json + hooks/ — GateGuard registration (PreToolUse)
24
+ //
25
+ // `.agents/` ROOT stays the dedicated Codex install: Codex workflow skills live at
26
+ // `.agents/skills/bkit-<wf>/SKILL.md` and this module never writes there.
27
+ //
28
+ // There is no native subagent tool on Antigravity: the orchestrator loads a prompt with
29
+ // `view_file` and executes its step contract in-session, which is why the workflow skills
30
+ // respell `**Subagent:** @name` to the plugin's `agents/<name>.md` path.
31
+ //
32
+ // `.agents/plugins/` may hold consumer plugins, so every sweep here is scoped to the
33
+ // `bkit` plugin directory (and, within it, to `bkit-` prefixed entries).
34
+ // ---------------------------------------------------------------------------
35
+ /** The bkit Antigravity workspace plugin root. */
36
+ export const ANTIGRAVITY_PLUGIN_DIR = ".agents/plugins/bkit";
37
+ /** Workflow skills, one directory per workflow, each holding SKILL.md. */
38
+ export const ANTIGRAVITY_SKILLS_DIR = ".agents/plugins/bkit/skills";
39
+ /** Subagent prompt definitions. Sourced from the renderer's shared constant. */
40
+ export { ANTIGRAVITY_AGENTS_DIR };
41
+ /** Hook scripts referenced by the plugin's hooks.json. */
42
+ export const ANTIGRAVITY_HOOKS_DIR = ".agents/plugins/bkit/hooks";
43
+ /**
44
+ * Convert a workflow orchestrator into an Antigravity SKILL.md. Tracker-conditional
45
+ * blocks are resolved first, exactly as for the other hosts' command mirrors.
46
+ */
47
+ export function applyAntigravityWorkflowSkill(content, skillName, issueTracker) {
48
+ return applyAntigravitySkill(substituteWorkflow(content, issueTracker).output, skillName);
49
+ }
50
+ /**
51
+ * Render the plugin's subagent prompts and workflow skills. Extracted so `bkit upgrade`
52
+ * re-renders them identically — bkit-owned output, force-overwritten.
53
+ */
54
+ export function renderAntigravityAgentsSkills(ctx) {
55
+ const { dryRun, effortMap, logPrefix } = ctx;
56
+ const tag = dryRun ? "[dry-run] " : "";
57
+ const issueTracker = ctx.issueTracker ?? DEFAULT_ISSUE_TRACKER;
58
+ const version = ctx.version ?? readInstallingVersion();
59
+ const written = [];
60
+ const modelLookup = ctx.antigravityModelLookup;
61
+ if (!modelLookup) {
62
+ throw new Error("renderAntigravityAgentsSkills: ctx.antigravityModelLookup is required");
63
+ }
64
+ // --- Prompts: markdown+frontmatter -> .agents/plugins/bkit/agents/<name>.md ---
65
+ {
66
+ const src = getPromptsRoot();
67
+ const dest = ANTIGRAVITY_AGENTS_DIR;
68
+ if (!dryRun)
69
+ ensureDir(dest);
70
+ const files = listMdFiles(src, BKIT_PREFIX);
71
+ const sourceSet = new Set(files);
72
+ for (const f of files) {
73
+ const transform = (c) => stampManagedVersion(applyAntigravityPrompt(substituteWorkflow(c, issueTracker).output, modelLookup, effortMap), version);
74
+ if (installFile(path.join(src, f), path.join(dest, f), transform, dryRun)) {
75
+ const rel = path.join(dest, f);
76
+ console.log(`${logPrefix} ${tag}write: ${rel}`);
77
+ trackMirrorWrite(ctx, rel, written);
78
+ }
79
+ }
80
+ // Orphan sweep is bkit-prefix scoped — the plugin's agents/ is bkit-owned.
81
+ if (fs.existsSync(dest)) {
82
+ for (const f of fs.readdirSync(dest)) {
83
+ if (!f.startsWith(BKIT_PREFIX))
84
+ continue;
85
+ if (sourceSet.has(f))
86
+ continue;
87
+ const rel = path.join(dest, f);
88
+ if (!dryRun)
89
+ fs.rmSync(rel, { force: true });
90
+ console.log(`${logPrefix} ${tag}delete orphan: ${rel}`);
91
+ trackMirrorWrite(ctx, rel, written);
92
+ }
93
+ }
94
+ }
95
+ // --- Workflow skills: one directory per workflow, each holding SKILL.md ---
96
+ {
97
+ const src = getWorkflowsRoot();
98
+ const files = listMdFiles(src, BKIT_PREFIX);
99
+ const sourceStems = new Set(files.map((f) => f.replace(/\.md$/, "")));
100
+ if (!dryRun && files.length > 0)
101
+ ensureDir(ANTIGRAVITY_SKILLS_DIR);
102
+ for (const f of files) {
103
+ const stem = f.replace(/\.md$/, "");
104
+ const dest = path.join(ANTIGRAVITY_SKILLS_DIR, stem, "SKILL.md");
105
+ if (!dryRun)
106
+ ensureDir(path.dirname(dest));
107
+ const transform = (c) => stampManagedVersion(applyAntigravityWorkflowSkill(c, stem, issueTracker), version);
108
+ if (installFile(path.join(src, f), dest, transform, dryRun)) {
109
+ console.log(`${logPrefix} ${tag}write: ${dest}`);
110
+ trackMirrorWrite(ctx, dest, written);
111
+ }
112
+ }
113
+ // Prefix-scoped sweep inside the bkit plugin's skills/.
114
+ if (fs.existsSync(ANTIGRAVITY_SKILLS_DIR)) {
115
+ for (const d of fs.readdirSync(ANTIGRAVITY_SKILLS_DIR)) {
116
+ if (!d.startsWith(BKIT_PREFIX))
117
+ continue;
118
+ if (sourceStems.has(d))
119
+ continue;
120
+ const rel = path.join(ANTIGRAVITY_SKILLS_DIR, d);
121
+ if (!dryRun)
122
+ fs.rmSync(rel, { recursive: true, force: true });
123
+ console.log(`${logPrefix} ${tag}delete orphan: ${rel}`);
124
+ trackMirrorWrite(ctx, rel, written);
125
+ }
126
+ }
127
+ }
128
+ return written;
129
+ }
130
+ export function runAntigravityModule(ctx) {
131
+ const { dryRun, advisories, ws, logPrefix } = ctx;
132
+ const tag = dryRun ? "[dry-run] " : "";
133
+ renderAntigravityAgentsSkills(ctx);
134
+ const pluginShared = path.join(getSharedRoot(), ".agents", "plugins", "bkit");
135
+ const pluginHooksSrc = path.join(getCoreRoot(), ".agents", "plugins", "bkit", "hooks");
136
+ // --- plugin.json — Tier-2 json (deep-contained), the required plugin manifest ---
137
+ {
138
+ const jsonSrc = path.join(pluginShared, "plugin.json");
139
+ const jsonDst = path.join(ANTIGRAVITY_PLUGIN_DIR, "plugin.json");
140
+ if (fs.existsSync(jsonSrc)) {
141
+ if (!dryRun)
142
+ ensureDir(path.dirname(jsonDst));
143
+ const prevLen = ws.writes.length;
144
+ writeTier2JsonContained(jsonSrc, jsonDst, dryRun, ws);
145
+ if (ws.writes.length > prevLen)
146
+ console.log(`${logPrefix} ${tag}antigravity: ${jsonDst}`);
147
+ }
148
+ }
149
+ // Root GEMINI.md — Antigravity workspace-rule redirect to .agents/rules.md. A ROOT file
150
+ // (not under .agents/), so the plugin walk does not cover it. Tier-2 markered-text
151
+ // (writeTier2 html-comment), exact twin of the claude module's CLAUDE.md.
152
+ {
153
+ const src = path.join(getSharedRoot(), "GEMINI.md");
154
+ const dst = "GEMINI.md";
155
+ if (fs.existsSync(src)) {
156
+ const prevLen = ws.writes.length;
157
+ writeTier2(src, dst, ctx.tokens, "html-comment", dryRun, ws);
158
+ if (ws.writes.length > prevLen)
159
+ console.log(`${logPrefix} ${tag}antigravity: ${dst}`);
160
+ }
161
+ }
162
+ // --- plugin hooks.json — Tier-2 deep-contained (consumers may add their own groups) ---
163
+ {
164
+ const jsonSrc = path.join(pluginShared, "hooks.json");
165
+ const jsonDst = path.join(ANTIGRAVITY_PLUGIN_DIR, "hooks.json");
166
+ if (fs.existsSync(jsonSrc)) {
167
+ if (!dryRun)
168
+ ensureDir(path.dirname(jsonDst));
169
+ const prevLen = ws.writes.length;
170
+ writeTier2JsonContained(jsonSrc, jsonDst, dryRun, ws);
171
+ if (ws.writes.length > prevLen)
172
+ console.log(`${logPrefix} ${tag}antigravity: ${jsonDst}`);
173
+ }
174
+ }
175
+ // --- bkit-gateguard.cjs / bkit-readguard.cjs — Tier-2 markered-text, twins of the Claude/Codex hooks ---
176
+ for (const hook of ["bkit-gateguard.cjs", "bkit-readguard.cjs"]) {
177
+ const hookSrc = path.join(pluginHooksSrc, hook);
178
+ const hookDst = path.join(ANTIGRAVITY_HOOKS_DIR, hook);
179
+ if (fs.existsSync(hookSrc)) {
180
+ if (!dryRun)
181
+ ensureDir(path.dirname(hookDst));
182
+ const prevLen = ws.writes.length;
183
+ writeTier2(hookSrc, hookDst, ctx.tokens, "slash-comment", dryRun, ws);
184
+ if (ws.writes.length > prevLen)
185
+ console.log(`${logPrefix} ${tag}antigravity: ${hookDst}`);
186
+ }
187
+ }
188
+ // --- bkit-guardrails.cjs — Tier-2 markered-text, twin of the Cursor/Codex hook ---
189
+ // Registered on matcher `view_file|run_command` in hooks.json above. Same decision engine
190
+ // as the other hosts (shell tiers; read tiers shared with Cursor); the deny tier blocks
191
+ // for real.
192
+ {
193
+ const railSrc = path.join(pluginHooksSrc, "bkit-guardrails.cjs");
194
+ const railDst = path.join(ANTIGRAVITY_HOOKS_DIR, "bkit-guardrails.cjs");
195
+ if (fs.existsSync(railSrc)) {
196
+ if (!dryRun)
197
+ ensureDir(path.dirname(railDst));
198
+ const prevLen = ws.writes.length;
199
+ writeTier2(railSrc, railDst, ctx.tokens, "slash-comment", dryRun, ws);
200
+ if (ws.writes.length > prevLen)
201
+ console.log(`${logPrefix} ${tag}antigravity: ${railDst}`);
202
+ }
203
+ }
204
+ advisories.push({
205
+ id: "antigravity-setup",
206
+ severity: "advisory",
207
+ detect: "antigravity host installed as a workspace plugin (.agents/plugins/bkit/: plugin.json + skills/bkit-* + agents/ + hooks.json).",
208
+ action: "Three things that differ from the other hosts:\n" +
209
+ "1. Workflows are SKILLS here, not slash commands: Antigravity discovers them under `.agents/plugins/bkit/skills/bkit-<wf>/SKILL.md` (the plugin activates per project — no toggle).\n" +
210
+ "2. There is no native subagent tool. The orchestrator loads each subagent prompt from `.agents/plugins/bkit/agents/` with `view_file` and executes it in-session; isolated runs use `run_command` (`agy`).\n" +
211
+ "3. GateGuard, ReadGuard and guardrails are wired from `.agents/plugins/bkit/hooks.json` (PreToolUse on `write_to_file` / `replace_file_content` / `view_file` / `run_command`). See .bkit/providers.md.",
212
+ });
213
+ // Both hosts installed: Antigravity's skill selector lists TWO sets of bkit-* skills.
214
+ // Codex does not merge same-named skills; Antigravity lists both. Warn which to pick.
215
+ const codexPresent = ctx.installedModules?.has("codex") ??
216
+ fs.existsSync(path.join(process.cwd(), ".codex", "agents"));
217
+ if (codexPresent) {
218
+ advisories.push({
219
+ id: "antigravity-codex-skill-overlap",
220
+ severity: "advisory",
221
+ detect: "Codex and Antigravity are both installed — Antigravity's skill selector now lists BOTH the Codex workflow skills (`.agents/skills/bkit-<wf>/SKILL.md`) and the Antigravity plugin skills (`.agents/plugins/bkit/skills/bkit-<wf>/SKILL.md`).",
222
+ action: "In Antigravity, invoke the WORKFLOW skills from the plugin under `.agents/plugins/bkit/skills/bkit-<wf>/SKILL.md` — they carry Antigravity's tool vocabulary (`view_file`, plugin subagent paths). The `.agents/skills/bkit-*` copies are Codex's install and name Claude/Codex tools Antigravity does not have. If you only use one host, the other's skills are harmless but may appear in the picker.",
223
+ });
224
+ }
225
+ }
@@ -98,13 +98,13 @@ export function runClaudeModule(ctx) {
98
98
  }
99
99
  }
100
100
  }
101
- // markered-text (slash-comment) — GateGuard advisory PreToolUse hook. bkit owns
101
+ // markered-text (slash-comment) — GateGuard and ReadGuard advisory hooks. bkit owns
102
102
  // only the advisory engine between the markers; consumers own the stdin/stdout
103
- // driver from first install onward (env vars BKIT_GATEGUARD / BKIT_ALLOW_CONFIG_EDIT
104
- // still tune behaviour, same as before).
105
- {
106
- const src = path.join(claudeHooks, "bkit-gateguard.cjs");
107
- const dst = ".claude/hooks/bkit-gateguard.cjs";
103
+ // driver from first install onward (env vars BKIT_GATEGUARD / BKIT_ALLOW_CONFIG_EDIT /
104
+ // BKIT_READGUARD still tune behaviour).
105
+ for (const hook of ["bkit-gateguard.cjs", "bkit-readguard.cjs"]) {
106
+ const src = path.join(claudeHooks, hook);
107
+ const dst = `.claude/hooks/${hook}`;
108
108
  if (fs.existsSync(src)) {
109
109
  const prevLen = ws.writes.length;
110
110
  writeTier2(src, dst, tokens, "slash-comment", dryRun, ws);
@@ -89,8 +89,8 @@ export function runCloudModule(ctx) {
89
89
  "IN CLAUDE APP (claude.ai/code → environment selector → + Add environment):\n" +
90
90
  " - Name: the repo name (e.g. `acme-web`) — one environment per repo, since secrets are per-repo.\n" +
91
91
  " - Setup script: paste from bkit's `cloud.md` § Setup script (installs vale + gh + corepack-pinned pnpm — exact versions live in cloud.md, not duplicated here).\n" +
92
- " - Environment variables: `BKIT_GH_TOKEN` (fine-grained for one owner, classic across owners — GitHub MCP), `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=70`.\n" +
93
- " - Tracker env vars (GitHub): No tracker PAT needed. Run `gh auth login` once for CLI surface. MCP auth is browser OAuth (automatic on first tool call). Set `BKIT_GH_TOKEN` (fine-grained for one owner, classic across owners — GitHub MCP server).\n" +
92
+ " - Environment variables: `BKIT_GH_TOKEN` (fine-grained for one owner, classic across owners — GitHub MCP).\n" +
93
+ " - Tracker env vars (GitHub): `BKIT_GH_TOKEN` above is the only tracker credential — the GitHub MCP server sends it on every call, and the bootstrap hook signs `gh` in with it.\n" +
94
94
  " - Network access: `Trusted` (default). One environment per repo (secrets differ per repo); the setup script + variable *names* are identical across repos, only the values change. See cloud.md § Sharing across repos → Claude.",
95
95
  });
96
96
  }
@@ -98,6 +98,9 @@ export function renderCodexAgentsSkills(ctx) {
98
98
  }
99
99
  }
100
100
  // --- Workflow skills: one directory per workflow, each holding SKILL.md ---
101
+ // `.agents/skills/` is Codex's. The Antigravity host installs its own workflow skills
102
+ // into a workspace plugin (`.agents/plugins/bkit/skills/`) instead, so this directory
103
+ // has a single writer and the two hosts never fight over one file.
101
104
  {
102
105
  const src = getWorkflowsRoot();
103
106
  const files = listMdFiles(src, BKIT_PREFIX);
@@ -152,10 +155,10 @@ export function runCodexModule(ctx) {
152
155
  console.log(`${logPrefix} ${tag}codex: ${jsonDst}`);
153
156
  }
154
157
  }
155
- // --- bkit-gateguard.cjs — Tier-2 markered-text, twin of the Claude hook ---
156
- {
157
- const hookSrc = path.join(codexHooks, "bkit-gateguard.cjs");
158
- const hookDst = ".codex/hooks/bkit-gateguard.cjs";
158
+ // --- bkit-gateguard.cjs / bkit-readguard.cjs — Tier-2 markered-text, twins of the Claude hooks ---
159
+ for (const hook of ["bkit-gateguard.cjs", "bkit-readguard.cjs"]) {
160
+ const hookSrc = path.join(codexHooks, hook);
161
+ const hookDst = `.codex/hooks/${hook}`;
159
162
  if (fs.existsSync(hookSrc)) {
160
163
  if (!dryRun)
161
164
  ensureDir(path.dirname(hookDst));
@@ -186,7 +189,7 @@ export function runCodexModule(ctx) {
186
189
  severity: "advisory",
187
190
  detect: "codex host installed (.codex/agents + .agents/skills/bkit-*).",
188
191
  action: "Three things that differ from the other hosts:\n" +
189
- "1. TRUST THE LAYER. Codex loads project-local hooks only once the `.codex/` layer is trusted. Until then GateGuard is installed and never fires.\n" +
192
+ "1. TRUST THE LAYER. Codex loads project-local hooks only once the `.codex/` layer is trusted. Until then GateGuard and ReadGuard are installed and never fire.\n" +
190
193
  "2. Workflows are SKILLS here, not slash commands: invoke `$bkit-design`, not `/bkit-design`.\n" +
191
194
  "3. Per-agent `tools:` is NOT enforced. Codex has no tool allowlist, so every agent gets the full built-in tool set. See .bkit/providers.md.",
192
195
  });
@@ -8,7 +8,7 @@ import { readBkitVersion, writeBkitVersion, hashFile, mergeCanonicalHashes, } fr
8
8
  import { listFilesRecursive, syncTemplateCopies } from "../template-copies.js";
9
9
  import { PAYLOAD_LINK_RELPATHS, syncPayloadLinks } from "../payload-links.js";
10
10
  import { getPkgRoot, getCoreRoot, getSharedRoot, getBkitDocsRoot, TEMPLATE_COPIES_DIR, } from "../../shared/package-roots.js";
11
- import { getInstallManifest, BKIT_GATE_SCRIPTS, BKIT_OPTIONAL_GATES } from "../manifest.js";
11
+ import { getInstallManifest, BKIT_GATE_SCRIPTS, BKIT_OPTIONAL_GATES, BKIT_TEST_FILE_SCRIPT, } from "../manifest.js";
12
12
  export function listMdFiles(dir, prefix) {
13
13
  if (!fs.existsSync(dir))
14
14
  return [];
@@ -70,7 +70,13 @@ export function removeOrphans(destDir, sourceFiles, dryRun, prefix) {
70
70
  return removed;
71
71
  }
72
72
  /** The markered-text `.agents/*.md` blocks core owns. */
73
- const CORE_AGENT_FILES = ["context.md", "docs.md", "rules.md", "skills.md"];
73
+ const CORE_AGENT_FILES = [
74
+ "context.md",
75
+ "docs.md",
76
+ "rules.md",
77
+ "shortcuts.md",
78
+ "skills.md",
79
+ ];
74
80
  // The two shared-root files core writes: stored in `shared/`, owned by the core
75
81
  // manifest, written as html-comment managed blocks.
76
82
  const CORE_SHARED_FILES = [
@@ -167,9 +173,8 @@ function runCoreTemplates(dryRun, tokens, ws, logPrefix) {
167
173
  // them, so a consumer edit is replaced. Source of truth is the package's own
168
174
  // `.bkit/core/.bkit/<name>`. (`advisories.md` is a regenerated runtime artifact,
169
175
  // `wording.md` is repo-only tooling and `friction.md` is a consumer-owned seed —
170
- // none belongs here. `LICENSE.md` is the PolyForm notice that travels with every
171
- // file bkit writes: PolyForm's Notices section requires a passed-on copy to carry
172
- // the terms or their URL and the Required Notice line.)
176
+ // none belongs here. `LICENSE.md` is the MIT notice that travels with the files bkit
177
+ // writes: MIT requires the copyright and permission notice in every copy.)
173
178
  export const BKIT_CANONICAL_DOCS = [
174
179
  "cloud.md",
175
180
  "comparison.md",
@@ -344,6 +349,16 @@ export function detectGateAdvisories(cwd) {
344
349
  "\n\nOrder matters — each chains the one above it. Omit a level deliberately to keep it CI-only (E2E in the build loop costs a production build on every remediation attempt). `.bkit/templates.md` lists the tool scripts the gates chain.",
345
350
  });
346
351
  }
352
+ // /bkit-build records each task's red through this script; without it test-first is
353
+ // reported as not enforced. bkit cannot seed it: what runs one file is the stack's.
354
+ if (!(BKIT_TEST_FILE_SCRIPT in declared)) {
355
+ findings.push({
356
+ id: "test-file-script-missing",
357
+ severity: "advisory",
358
+ detect: `package.json does not declare \`${BKIT_TEST_FILE_SCRIPT}\`, so \`/bkit-build\` cannot check that each task's tests fail before its code is written.`,
359
+ action: `Add \`${BKIT_TEST_FILE_SCRIPT}\` to package.json: it runs the ONE test file bkit appends as its argument (repo-relative path) and writes a JUnit report to the path in \`$BKIT_TEST_REPORT\`. Vitest example:\n\n "${BKIT_TEST_FILE_SCRIPT}": "vitest run --reporter=default --reporter=junit --outputFile.junit=\\"$BKIT_TEST_REPORT\\""\n\nCall the runner directly, not through a task runner that caches results or runs dependent packages first. A monorepo routes the path to the package and config that own it.`,
360
+ });
361
+ }
347
362
  return findings;
348
363
  }
349
364
  /** One command that cannot fail: `true`, `:`, `exit 0`, or an `echo`. */
@@ -424,7 +439,7 @@ export function runCoreModule(ctx) {
424
439
  // installed package (browse-only, gitignored; no-op in dogfood). A real
425
440
  // directory or file at either path is never clobbered (advisory); a platform
426
441
  // refusal is an advisory, never a failure.
427
- const linkChanges = syncPayloadLinks(cwd, { dryRun, ws });
442
+ const linkChanges = syncPayloadLinks(cwd, { dryRun });
428
443
  for (const rel of linkChanges.created) {
429
444
  console.log(`${logPrefix} ${tag}payload link: ${rel}`);
430
445
  }
@@ -117,12 +117,12 @@ export function runCursorModule(ctx) {
117
117
  }
118
118
  }
119
119
  }
120
- // markered-text (slash-comment) — GateGuard advisory PreToolUse hook for Cursor.
121
- // Same managed block as the Claude twin; the driver outside it adapts Cursor's
122
- // payload (relative file_path, no subagent marker) and emits Cursor's shape.
123
- {
124
- const src = path.join(cursorHooks, "bkit-gateguard.cjs");
125
- const dst = ".cursor/hooks/bkit-gateguard.cjs";
120
+ // markered-text (slash-comment) — GateGuard and ReadGuard advisory hooks for Cursor.
121
+ // Same managed blocks as the Claude twins; the drivers outside them adapt Cursor's
122
+ // payload (relative file_path, no subagent marker) and emit Cursor's shape.
123
+ for (const hook of ["bkit-gateguard.cjs", "bkit-readguard.cjs"]) {
124
+ const src = path.join(cursorHooks, hook);
125
+ const dst = `.cursor/hooks/${hook}`;
126
126
  if (fs.existsSync(src)) {
127
127
  const prevLen = ws.writes.length;
128
128
  writeTier2(src, dst, tokens, "slash-comment", dryRun, ws);