@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
@@ -1,4 +1,4 @@
1
- // bkit workstreams parse|comment — design Step 10: read the organised design's
1
+ // bkit workstreams parse|comment — design Step 11: read the organised design's
2
2
  // `## Suggested Workstreams` and build the advisory comment for the feature's
3
3
  // own issue.
4
4
  //
@@ -84,7 +84,7 @@ export function parseWorkstreams(md: string): Workstream[] {
84
84
  /** `[]` or `[WS-1, WS-2]`. */
85
85
  export const requiresList = (w: Workstream) => `[${w.requires.join(", ")}]`;
86
86
 
87
- /** The Step 10 comment: one line per workstream, then the design doc link. */
87
+ /** The Step 11 comment: one line per workstream, then the design doc link. */
88
88
  export function commentBody(
89
89
  ws: Workstream[],
90
90
  opts: { ownerRepo: string; month: string; fid: string },
@@ -92,7 +92,7 @@ export function commentBody(
92
92
  const doc = `docs/plans/${opts.month}/${opts.fid}-design.md`;
93
93
  return [
94
94
  "###### bkit:generated",
95
- "### Step 10 — Suggested Workstreams",
95
+ "### Step 11 — Suggested Workstreams",
96
96
  "Advisory only. NEVER auto-trigger.",
97
97
  ...ws.map((w) => `- ${w.id}: ${w.name}. Requires: ${requiresList(w)}`),
98
98
  `[${doc}](https://github.com/${opts.ownerRepo}/blob/dev/${doc})`,
@@ -135,7 +135,7 @@ export const workstreamsCommand: CommandSpec = {
135
135
  },
136
136
  comment: {
137
137
  summary:
138
- "The Step 10 comment body for the feature's own issue (posted via MCP by the workflow).",
138
+ "The Step 11 comment body for the feature's own issue (posted via MCP by the workflow).",
139
139
  flags: [
140
140
  ARTIFACT_FLAG,
141
141
  { name: "fid", type: "string", required: true, help: "feature id" },
@@ -45,36 +45,26 @@ const BASELINE_TOKEN_PLACEHOLDERS: ReadonlyArray<readonly [string, string]> = [
45
45
  ],
46
46
  ];
47
47
 
48
- // Earlier-compaction override — a bkit constant, not a secret. Appended to the
49
- // block when not already resolved from a source file. Claude-harness-only knob —
50
- // Cursor has no equivalent, so it is NOT in the Cursor policy's constants.
51
- const AUTOCOMPACT_KEY = "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE";
52
- const AUTOCOMPACT_VALUE = "70";
53
-
54
48
  // Per-cloud env-var policy. The `.envrc`-following resolver core is identical for
55
49
  // both clouds (same dotenv sources, same unset/hijack/empty drops) — only the
56
- // baseline placeholder set and the appended constants differ. Claude pairs with the
57
- // GitHub tracker and wants the autocompact override; Cursor pairs with Linear (and
58
- // so also needs `BKIT_LINEAR_API_KEY`) and has no autocompact knob. Keeping one resolver
59
- // with a small policy object is what guarantees the two generated docs describe the
60
- // SAME cloud environment — just different mechanics (pasted setup vs. Dockerfile).
50
+ // baseline placeholder set differs. Claude pairs with the GitHub tracker; Cursor pairs
51
+ // with Linear (and so also needs `BKIT_LINEAR_API_KEY`). Keeping one resolver with a
52
+ // small policy object is what guarantees the two generated docs describe the SAME
53
+ // cloud environment — just different mechanics (pasted setup vs. Dockerfile).
61
54
  export interface CloudEnvPolicy {
62
55
  /** Baseline env-var NAMES this cloud always needs; emitted as `NAME=<placeholder>`
63
56
  * when absent from the resolved `.envrc` set. */
64
57
  baseline: ReadonlyArray<readonly [string, string]>;
65
- /** Constant KEY/value pairs appended when not already resolved from a source. */
66
- constants: ReadonlyArray<readonly [string, string]>;
67
58
  }
68
59
 
69
- // Claude Code on the web: GitHub tracker, autocompact override.
60
+ // Claude Code on the web: GitHub tracker.
70
61
  export const CLAUDE_CLOUD_POLICY: CloudEnvPolicy = {
71
62
  baseline: BASELINE_TOKEN_PLACEHOLDERS,
72
- constants: [[AUTOCOMPACT_KEY, AUTOCOMPACT_VALUE]],
73
63
  };
74
64
 
75
65
  // Cursor Background Agents: `BKIT_LINEAR_API_KEY` prepended for the Linear tracker
76
66
  // (bkit-preflight.sh calls the Linear GraphQL API and hard-fails without it); GitHub
77
- // tracker uses the same GH baseline as Claude, minus the autocompact knob.
67
+ // tracker uses the same GH baseline as Claude.
78
68
  const CURSOR_LINEAR_PLACEHOLDER: readonly [string, string] = [
79
69
  "BKIT_LINEAR_API_KEY",
80
70
  "<Linear personal API key — https://linear.app/settings/api>",
@@ -85,7 +75,6 @@ export function cursorCloudPolicy(tracker: IssueTracker): CloudEnvPolicy {
85
75
  tracker === "linear"
86
76
  ? [CURSOR_LINEAR_PLACEHOLDER, ...BASELINE_TOKEN_PLACEHOLDERS]
87
77
  : BASELINE_TOKEN_PLACEHOLDERS,
88
- constants: [],
89
78
  };
90
79
  }
91
80
 
@@ -234,7 +223,7 @@ export function resolveCloudEnvVars(
234
223
 
235
224
  /**
236
225
  * Render the `.env`-format paste block: resolved KEY=value lines, then placeholder
237
- * lines for any absent baseline token, then the autocompact override if unset.
226
+ * lines for any absent baseline token.
238
227
  */
239
228
  export function renderCloudEnvBlock(
240
229
  res: CloudEnvResolution,
@@ -245,9 +234,6 @@ export function renderCloudEnvBlock(
245
234
  for (const [name, placeholder] of policy.baseline) {
246
235
  if (res.placeholders.includes(name)) lines.push(`${name}=${placeholder}`);
247
236
  }
248
- for (const [key, value] of policy.constants) {
249
- if (!res.included.some(([k]) => k === key)) lines.push(`${key}=${value}`);
250
- }
251
237
  return lines.join("\n");
252
238
  }
253
239
 
@@ -0,0 +1,21 @@
1
+ // install/hosts.ts — which host modules a consumer has installed.
2
+
3
+ import * as fs from "node:fs";
4
+ import * as path from "node:path";
5
+ import type { ModuleFlag } from "../cli.js";
6
+
7
+ /**
8
+ * Detect which host modules a consumer has installed, by the presence of each host's
9
+ * source-rendered agents directory. `bkit upgrade` re-renders only these hosts — never
10
+ * force-creating an opencode/cursor tree — and setup tips key host-specific advice on them.
11
+ */
12
+ export function detectInstalledHostModules(cwd: string): Set<ModuleFlag> {
13
+ const mods = new Set<ModuleFlag>();
14
+ if (fs.existsSync(path.join(cwd, ".claude", "agents"))) mods.add("claude");
15
+ if (fs.existsSync(path.join(cwd, ".cursor", "agents"))) mods.add("cursor");
16
+ if (fs.existsSync(path.join(cwd, ".opencode", "agents"))) mods.add("opencode");
17
+ if (fs.existsSync(path.join(cwd, ".codex", "agents"))) mods.add("codex");
18
+ if (fs.existsSync(path.join(cwd, ".agents", "plugins", "bkit", "plugin.json")))
19
+ mods.add("antigravity");
20
+ return mods;
21
+ }
@@ -139,6 +139,42 @@ export function detectMarkerStyle(content: string): MarkerStyle | null {
139
139
  return null;
140
140
  }
141
141
 
142
+ // Verbatim long lines a text must share with a block, beside its title, to count as a copy.
143
+ const COPY_MIN_SHARED_LINES = 10;
144
+ // Shortest trimmed line counted as shared; shorter lines (rules, `>`, table dividers) recur by chance.
145
+ const COPY_MIN_LINE_LENGTH = 40;
146
+
147
+ // Lines outside fenced code blocks; a shell comment in a fence (`# Vercel errors`) is no heading.
148
+ function proseLines(text: string): string[] {
149
+ const out: string[] = [];
150
+ let inFence = false;
151
+ for (const line of text.split("\n")) {
152
+ if (line.trimStart().startsWith("```")) {
153
+ inFence = !inFence;
154
+ continue;
155
+ }
156
+ if (!inFence) out.push(line);
157
+ }
158
+ return out;
159
+ }
160
+
161
+ // The block's `# ` title when `text` holds an older unmarked copy of the same markdown block:
162
+ // the title line plus COPY_MIN_SHARED_LINES long lines verbatim, all outside fenced code.
163
+ // Null otherwise, including for a block with no title.
164
+ export function findUnmarkedCopy(text: string, block: string): string | null {
165
+ const blockLines = proseLines(block);
166
+ const title = blockLines.find((l) => /^# \S/.test(l));
167
+ if (title === undefined) return null;
168
+ const textLines = proseLines(text);
169
+ if (!textLines.includes(title)) return null;
170
+ const long = new Set(
171
+ blockLines.map((l) => l.trim()).filter((l) => l.length >= COPY_MIN_LINE_LENGTH),
172
+ );
173
+ let shared = 0;
174
+ for (const l of new Set(textLines.map((t) => t.trim()))) if (long.has(l)) shared++;
175
+ return shared >= COPY_MIN_SHARED_LINES ? title : null;
176
+ }
177
+
142
178
  // Remove the bkit-managed block (including marker lines) from a string,
143
179
  // preserving all consumer-owned content outside the block.
144
180
  //
@@ -12,7 +12,7 @@ import type { ModuleFlag } from "../cli.js";
12
12
  * (`--auto=`, `--opencode=`). A bare/full `uninstall` DOES remove them (zero footprint).
13
13
  * Dependency-updater files are not modules — bkit never writes or removes them.
14
14
  */
15
- export const OPTIN_MODULES = new Set<ModuleFlag>(["cloud", "opencode", "codex"]);
15
+ export const OPTIN_MODULES = new Set<ModuleFlag>(["cloud", "opencode", "codex", "antigravity"]);
16
16
 
17
17
  // ---------------------------------------------------------------------------
18
18
  // Types
@@ -44,7 +44,8 @@ export interface ManifestEntry {
44
44
  generated?: boolean;
45
45
  }
46
46
 
47
- export type ModuleName = "core" | "claude" | "cursor" | "opencode" | "codex" | "cloud";
47
+ export type ModuleName =
48
+ "core" | "claude" | "cursor" | "opencode" | "codex" | "antigravity" | "cloud";
48
49
 
49
50
  // ---------------------------------------------------------------------------
50
51
  // Issue tracker
@@ -132,9 +133,8 @@ const CORE_MANIFEST: ManifestEntry[] = [
132
133
  { path: ".bkit/comparison.md", format: "byte-equal-text", module: "core" },
133
134
  { path: ".bkit/install.md", format: "byte-equal-text", module: "core" },
134
135
  { path: ".bkit/jsonl.md", format: "byte-equal-text", module: "core" },
135
- // The PolyForm notice that travels with every file bkit writes (the managed-version
136
- // marker names the licence and its URL; this file carries both full texts and the
137
- // Required Notice). Sourced from `.bkit/core/.bkit/LICENSE.md`.
136
+ // The MIT notice that travels with the files bkit writes: the full text and copyright
137
+ // notice. Sourced from `.bkit/core/.bkit/LICENSE.md`.
138
138
  { path: ".bkit/LICENSE.md", format: "byte-equal-text", module: "core" },
139
139
  { path: ".bkit/providers.md", format: "byte-equal-text", module: "core" },
140
140
  { path: ".bkit/prompts.md", format: "markered-text", module: "core" },
@@ -161,6 +161,13 @@ const CLAUDE_MANIFEST: ManifestEntry[] = [
161
161
  format: "markered-text",
162
162
  module: "claude",
163
163
  },
164
+ // ReadGuard advisory repeat-read hook — same ownership split as GateGuard. Wired in
165
+ // .claude/settings.json → PreToolUse (matcher `Read|Bash`) and PreCompact.
166
+ {
167
+ path: ".claude/hooks/bkit-readguard.cjs",
168
+ format: "markered-text",
169
+ module: "claude",
170
+ },
164
171
  // bkit-guardrails.cjs — Tier-2 markered-text, twin of the Cursor/Codex hooks.
165
172
  // PreToolUse matcher `Bash`. ADVISORY ONLY: covers URL hosts and shell-as-edit-channel;
166
173
  // never denies or asks.
@@ -265,6 +272,14 @@ export const BKIT_BUILD_GATES: readonly string[] = [
265
272
  "bkit:gate:static-unit",
266
273
  ];
267
274
 
275
+ /**
276
+ * Runs ONE test file — `pnpm bkit:test:file <repo-relative path>` — and writes a JUnit
277
+ * report to `$BKIT_TEST_REPORT`. `/bkit-build` records each task's red and audits its
278
+ * green through it. Never seeded: no default works on every stack; install advises
279
+ * when it is missing (detectGateAdvisories).
280
+ */
281
+ export const BKIT_TEST_FILE_SCRIPT = "bkit:test:file";
282
+
268
283
  /**
269
284
  * The deeper gates, shallowest first, with what declaring each one costs.
270
285
  *
@@ -316,6 +331,14 @@ const CURSOR_MANIFEST: ManifestEntry[] = [
316
331
  format: "markered-text",
317
332
  module: "cursor",
318
333
  },
334
+ // ReadGuard for Cursor — same managed block as the Claude twin. Wired in
335
+ // .cursor/hooks.json → preToolUse (matcher "Read|Shell") and preCompact, without
336
+ // failClosed.
337
+ {
338
+ path: ".cursor/hooks/bkit-readguard.cjs",
339
+ format: "markered-text",
340
+ module: "cursor",
341
+ },
319
342
  // Curl/wget host allowlist read at runtime by bkit-guardrails.cjs. No template backs it —
320
343
  // `writeNetworkAllowlistArtifact` (install/cloud-env.ts) computes the domain set from the
321
344
  // consumer's own config, so it is `generated` and its hash is in `canonicalHashes`.
@@ -353,6 +376,12 @@ export const OPENCODE_MANIFEST: ManifestEntry[] = [
353
376
  format: "markered-text",
354
377
  module: "opencode",
355
378
  },
379
+ // bkit-readguard.js — same split as bkit-gateguard.js.
380
+ {
381
+ path: ".opencode/plugin/bkit-readguard.js",
382
+ format: "markered-text",
383
+ module: "opencode",
384
+ },
356
385
  // Agent and command mirrors are managed dynamically (not listed individually here —
357
386
  // the exact set depends on the bkit-prefix prompt/workflow files at install time).
358
387
  // Uninstall uses the BKIT_PREFIX filter for .opencode/agents/ and .opencode/commands/.
@@ -373,6 +402,13 @@ export const CODEX_MANIFEST: ManifestEntry[] = [
373
402
  format: "markered-text",
374
403
  module: "codex",
375
404
  },
405
+ // bkit-readguard.cjs — Tier-2 markered-text, twin of the Claude hook. Registered on
406
+ // PreToolUse matcher `Bash` (Codex has no read tool) and PreCompact.
407
+ {
408
+ path: ".codex/hooks/bkit-readguard.cjs",
409
+ format: "markered-text",
410
+ module: "codex",
411
+ },
376
412
  // bkit-guardrails.cjs — Tier-2 markered-text, twin of the Cursor hook (same decision
377
413
  // engine). Registered on matcher `Bash`, Codex's shell tool name. Codex parses but
378
414
  // does not implement `permissionDecision: "ask"`, so the deny tier blocks for real
@@ -387,6 +423,47 @@ export const CODEX_MANIFEST: ManifestEntry[] = [
387
423
  // managed dynamically — the set follows the bkit-prefix prompt/workflow files at install.
388
424
  ];
389
425
 
426
+ // --antigravity: Google Antigravity IDE host. Installs as a workspace PLUGIN at
427
+ // `.agents/plugins/bkit/` (Antigravity's own packaging surface), so `.agents/` root stays
428
+ // the dedicated Codex install. Root `GEMINI.md` is the redirect mirror of `CLAUDE.md`
429
+ // (Antigravity loads `GEMINI.md` as a workspace rule file).
430
+ export const ANTIGRAVITY_MANIFEST: ManifestEntry[] = [
431
+ // plugin.json — the required plugin manifest. Tier-2 json (deep-contained): bkit owns
432
+ // the schema/name/description keys (the schema is `additionalProperties: false`).
433
+ { path: ".agents/plugins/bkit/plugin.json", format: "json", module: "antigravity" },
434
+ // hooks.json — Tier-2 json (deep-contained): bkit owns the PreToolUse GateGuard and
435
+ // guardrails entries, consumers may add their own event groups alongside them.
436
+ { path: ".agents/plugins/bkit/hooks.json", format: "json", module: "antigravity" },
437
+ // bkit-gateguard.cjs — Tier-2 markered-text, twin of the Claude/Codex hook (same
438
+ // stdin/stdout contract); differs in the tool names (`write_to_file` /
439
+ // `replace_file_content`) and the payload path field.
440
+ {
441
+ path: ".agents/plugins/bkit/hooks/bkit-gateguard.cjs",
442
+ format: "markered-text",
443
+ module: "antigravity",
444
+ },
445
+ // bkit-readguard.cjs — Tier-2 markered-text, twin of the Claude hook. Registered on
446
+ // matcher `view_file|run_command`.
447
+ {
448
+ path: ".agents/plugins/bkit/hooks/bkit-readguard.cjs",
449
+ format: "markered-text",
450
+ module: "antigravity",
451
+ },
452
+ // bkit-guardrails.cjs — Tier-2 markered-text, twin of the Cursor/Codex hook. Registered
453
+ // on matcher `view_file|run_command`, Antigravity's file-read and shell tool names.
454
+ {
455
+ path: ".agents/plugins/bkit/hooks/bkit-guardrails.cjs",
456
+ format: "markered-text",
457
+ module: "antigravity",
458
+ },
459
+ // Root GEMINI.md — Antigravity workspace-rule redirect to .agents/rules.md, owned by the
460
+ // antigravity module: `uninstall --antigravity` removes it; other installs leave it.
461
+ { path: "GEMINI.md", format: "markered-text", module: "antigravity" },
462
+ // Subagent prompts (.agents/plugins/bkit/agents/bkit-*.md) and workflow skills
463
+ // (.agents/plugins/bkit/skills/bkit-*/) are managed dynamically — the set follows the
464
+ // bkit-prefix prompt/workflow files at install.
465
+ ];
466
+
390
467
  // Cloud agent integration is opt-in — NOT in a default install, so a default install
391
468
  // ships ZERO cloud footprint. Every variant writes no files: the cloud workflow
392
469
  // (bkit-cloud.yml), bkit-cloud-bootstrap.sh and the Cursor Background Agent files
@@ -418,6 +495,7 @@ const MODULE_MANIFESTS: Record<ModuleName, ManifestEntry[]> = {
418
495
  cursor: CURSOR_MANIFEST,
419
496
  opencode: OPENCODE_MANIFEST,
420
497
  codex: CODEX_MANIFEST,
498
+ antigravity: ANTIGRAVITY_MANIFEST,
421
499
  cloud: CLOUD_MANIFEST,
422
500
  };
423
501
 
@@ -0,0 +1,266 @@
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
+
5
+ import * as fs from "node:fs";
6
+ import * as path from "node:path";
7
+ import { writeTier2, writeTier2JsonContained, ensureDir } from "../write.js";
8
+ import { stampManagedVersion } from "../version-file.js";
9
+ import {
10
+ ANTIGRAVITY_AGENTS_DIR,
11
+ applyAntigravityPrompt,
12
+ applyAntigravitySkill,
13
+ } from "../../render/hosts.js";
14
+ import {
15
+ getCoreRoot,
16
+ getSharedRoot,
17
+ getWorkflowsRoot,
18
+ getPromptsRoot,
19
+ } from "../../shared/package-roots.js";
20
+ import { type IssueTracker, DEFAULT_ISSUE_TRACKER } from "../manifest.js";
21
+ import { substituteWorkflow } from "../../render/trackers.js";
22
+ import type { ModuleContext } from "./index.js";
23
+ import {
24
+ BKIT_PREFIX,
25
+ installFile,
26
+ listMdFiles,
27
+ readInstallingVersion,
28
+ trackMirrorWrite,
29
+ } from "./core.js";
30
+
31
+ // ---------------------------------------------------------------------------
32
+ // runAntigravityModule — Google Antigravity IDE host (opt-in via --antigravity)
33
+ //
34
+ // Nullary flag, like --codex: Antigravity runs on one pinned gateway (`google`).
35
+ //
36
+ // The host installs as a workspace PLUGIN (`.agents/plugins/bkit/`) — Antigravity's own
37
+ // packaging surface (antigravity.google/docs/plugins). The plugin activates per project:
38
+ // .agents/plugins/bkit/plugin.json — plugin manifest (required)
39
+ // .agents/plugins/bkit/skills/bkit-<wf>/SKILL.md — workflow entry points (skills)
40
+ // .agents/plugins/bkit/agents/<name>.md — subagent prompt definitions
41
+ // .agents/plugins/bkit/hooks.json + hooks/ — GateGuard registration (PreToolUse)
42
+ //
43
+ // `.agents/` ROOT stays the dedicated Codex install: Codex workflow skills live at
44
+ // `.agents/skills/bkit-<wf>/SKILL.md` and this module never writes there.
45
+ //
46
+ // There is no native subagent tool on Antigravity: the orchestrator loads a prompt with
47
+ // `view_file` and executes its step contract in-session, which is why the workflow skills
48
+ // respell `**Subagent:** @name` to the plugin's `agents/<name>.md` path.
49
+ //
50
+ // `.agents/plugins/` may hold consumer plugins, so every sweep here is scoped to the
51
+ // `bkit` plugin directory (and, within it, to `bkit-` prefixed entries).
52
+ // ---------------------------------------------------------------------------
53
+
54
+ /** The bkit Antigravity workspace plugin root. */
55
+ export const ANTIGRAVITY_PLUGIN_DIR = ".agents/plugins/bkit";
56
+
57
+ /** Workflow skills, one directory per workflow, each holding SKILL.md. */
58
+ export const ANTIGRAVITY_SKILLS_DIR = ".agents/plugins/bkit/skills";
59
+
60
+ /** Subagent prompt definitions. Sourced from the renderer's shared constant. */
61
+ export { ANTIGRAVITY_AGENTS_DIR };
62
+
63
+ /** Hook scripts referenced by the plugin's hooks.json. */
64
+ export const ANTIGRAVITY_HOOKS_DIR = ".agents/plugins/bkit/hooks";
65
+
66
+ /**
67
+ * Convert a workflow orchestrator into an Antigravity SKILL.md. Tracker-conditional
68
+ * blocks are resolved first, exactly as for the other hosts' command mirrors.
69
+ */
70
+ export function applyAntigravityWorkflowSkill(
71
+ content: string,
72
+ skillName: string,
73
+ issueTracker: IssueTracker,
74
+ ): string {
75
+ return applyAntigravitySkill(substituteWorkflow(content, issueTracker).output, skillName);
76
+ }
77
+
78
+ /**
79
+ * Render the plugin's subagent prompts and workflow skills. Extracted so `bkit upgrade`
80
+ * re-renders them identically — bkit-owned output, force-overwritten.
81
+ */
82
+ export function renderAntigravityAgentsSkills(ctx: ModuleContext): string[] {
83
+ const { dryRun, effortMap, logPrefix } = ctx;
84
+ const tag = dryRun ? "[dry-run] " : "";
85
+ const issueTracker = ctx.issueTracker ?? DEFAULT_ISSUE_TRACKER;
86
+ const version = ctx.version ?? readInstallingVersion();
87
+ const written: string[] = [];
88
+ const modelLookup = ctx.antigravityModelLookup;
89
+ if (!modelLookup) {
90
+ throw new Error("renderAntigravityAgentsSkills: ctx.antigravityModelLookup is required");
91
+ }
92
+
93
+ // --- Prompts: markdown+frontmatter -> .agents/plugins/bkit/agents/<name>.md ---
94
+ {
95
+ const src = getPromptsRoot();
96
+ const dest = ANTIGRAVITY_AGENTS_DIR;
97
+ if (!dryRun) ensureDir(dest);
98
+ const files = listMdFiles(src, BKIT_PREFIX);
99
+ const sourceSet = new Set(files);
100
+
101
+ for (const f of files) {
102
+ const transform = (c: string) =>
103
+ stampManagedVersion(
104
+ applyAntigravityPrompt(
105
+ substituteWorkflow(c, issueTracker).output,
106
+ modelLookup,
107
+ effortMap,
108
+ ),
109
+ version,
110
+ );
111
+ if (installFile(path.join(src, f), path.join(dest, f), transform, dryRun)) {
112
+ const rel = path.join(dest, f);
113
+ console.log(`${logPrefix} ${tag}write: ${rel}`);
114
+ trackMirrorWrite(ctx, rel, written);
115
+ }
116
+ }
117
+
118
+ // Orphan sweep is bkit-prefix scoped — the plugin's agents/ is bkit-owned.
119
+ if (fs.existsSync(dest)) {
120
+ for (const f of fs.readdirSync(dest)) {
121
+ if (!f.startsWith(BKIT_PREFIX)) continue;
122
+ if (sourceSet.has(f)) continue;
123
+ const rel = path.join(dest, f);
124
+ if (!dryRun) fs.rmSync(rel, { force: true });
125
+ console.log(`${logPrefix} ${tag}delete orphan: ${rel}`);
126
+ trackMirrorWrite(ctx, rel, written);
127
+ }
128
+ }
129
+ }
130
+
131
+ // --- Workflow skills: one directory per workflow, each holding SKILL.md ---
132
+ {
133
+ const src = getWorkflowsRoot();
134
+ const files = listMdFiles(src, BKIT_PREFIX);
135
+ const sourceStems = new Set(files.map((f) => f.replace(/\.md$/, "")));
136
+ if (!dryRun && files.length > 0) ensureDir(ANTIGRAVITY_SKILLS_DIR);
137
+
138
+ for (const f of files) {
139
+ const stem = f.replace(/\.md$/, "");
140
+ const dest = path.join(ANTIGRAVITY_SKILLS_DIR, stem, "SKILL.md");
141
+ if (!dryRun) ensureDir(path.dirname(dest));
142
+ const transform = (c: string) =>
143
+ stampManagedVersion(applyAntigravityWorkflowSkill(c, stem, issueTracker), version);
144
+ if (installFile(path.join(src, f), dest, transform, dryRun)) {
145
+ console.log(`${logPrefix} ${tag}write: ${dest}`);
146
+ trackMirrorWrite(ctx, dest, written);
147
+ }
148
+ }
149
+
150
+ // Prefix-scoped sweep inside the bkit plugin's skills/.
151
+ if (fs.existsSync(ANTIGRAVITY_SKILLS_DIR)) {
152
+ for (const d of fs.readdirSync(ANTIGRAVITY_SKILLS_DIR)) {
153
+ if (!d.startsWith(BKIT_PREFIX)) continue;
154
+ if (sourceStems.has(d)) continue;
155
+ const rel = path.join(ANTIGRAVITY_SKILLS_DIR, d);
156
+ if (!dryRun) fs.rmSync(rel, { recursive: true, force: true });
157
+ console.log(`${logPrefix} ${tag}delete orphan: ${rel}`);
158
+ trackMirrorWrite(ctx, rel, written);
159
+ }
160
+ }
161
+ }
162
+
163
+ return written;
164
+ }
165
+
166
+ export function runAntigravityModule(ctx: ModuleContext): void {
167
+ const { dryRun, advisories, ws, logPrefix } = ctx;
168
+ const tag = dryRun ? "[dry-run] " : "";
169
+
170
+ renderAntigravityAgentsSkills(ctx);
171
+
172
+ const pluginShared = path.join(getSharedRoot(), ".agents", "plugins", "bkit");
173
+ const pluginHooksSrc = path.join(getCoreRoot(), ".agents", "plugins", "bkit", "hooks");
174
+
175
+ // --- plugin.json — Tier-2 json (deep-contained), the required plugin manifest ---
176
+ {
177
+ const jsonSrc = path.join(pluginShared, "plugin.json");
178
+ const jsonDst = path.join(ANTIGRAVITY_PLUGIN_DIR, "plugin.json");
179
+ if (fs.existsSync(jsonSrc)) {
180
+ if (!dryRun) ensureDir(path.dirname(jsonDst));
181
+ const prevLen = ws.writes.length;
182
+ writeTier2JsonContained(jsonSrc, jsonDst, dryRun, ws);
183
+ if (ws.writes.length > prevLen) console.log(`${logPrefix} ${tag}antigravity: ${jsonDst}`);
184
+ }
185
+ }
186
+
187
+ // Root GEMINI.md — Antigravity workspace-rule redirect to .agents/rules.md. A ROOT file
188
+ // (not under .agents/), so the plugin walk does not cover it. Tier-2 markered-text
189
+ // (writeTier2 html-comment), exact twin of the claude module's CLAUDE.md.
190
+ {
191
+ const src = path.join(getSharedRoot(), "GEMINI.md");
192
+ const dst = "GEMINI.md";
193
+ if (fs.existsSync(src)) {
194
+ const prevLen = ws.writes.length;
195
+ writeTier2(src, dst, ctx.tokens, "html-comment", dryRun, ws);
196
+ if (ws.writes.length > prevLen) console.log(`${logPrefix} ${tag}antigravity: ${dst}`);
197
+ }
198
+ }
199
+
200
+ // --- plugin hooks.json — Tier-2 deep-contained (consumers may add their own groups) ---
201
+ {
202
+ const jsonSrc = path.join(pluginShared, "hooks.json");
203
+ const jsonDst = path.join(ANTIGRAVITY_PLUGIN_DIR, "hooks.json");
204
+ if (fs.existsSync(jsonSrc)) {
205
+ if (!dryRun) ensureDir(path.dirname(jsonDst));
206
+ const prevLen = ws.writes.length;
207
+ writeTier2JsonContained(jsonSrc, jsonDst, dryRun, ws);
208
+ if (ws.writes.length > prevLen) console.log(`${logPrefix} ${tag}antigravity: ${jsonDst}`);
209
+ }
210
+ }
211
+
212
+ // --- bkit-gateguard.cjs / bkit-readguard.cjs — Tier-2 markered-text, twins of the Claude/Codex hooks ---
213
+ for (const hook of ["bkit-gateguard.cjs", "bkit-readguard.cjs"]) {
214
+ const hookSrc = path.join(pluginHooksSrc, hook);
215
+ const hookDst = path.join(ANTIGRAVITY_HOOKS_DIR, hook);
216
+ if (fs.existsSync(hookSrc)) {
217
+ if (!dryRun) ensureDir(path.dirname(hookDst));
218
+ const prevLen = ws.writes.length;
219
+ writeTier2(hookSrc, hookDst, ctx.tokens, "slash-comment", dryRun, ws);
220
+ if (ws.writes.length > prevLen) console.log(`${logPrefix} ${tag}antigravity: ${hookDst}`);
221
+ }
222
+ }
223
+
224
+ // --- bkit-guardrails.cjs — Tier-2 markered-text, twin of the Cursor/Codex hook ---
225
+ // Registered on matcher `view_file|run_command` in hooks.json above. Same decision engine
226
+ // as the other hosts (shell tiers; read tiers shared with Cursor); the deny tier blocks
227
+ // for real.
228
+ {
229
+ const railSrc = path.join(pluginHooksSrc, "bkit-guardrails.cjs");
230
+ const railDst = path.join(ANTIGRAVITY_HOOKS_DIR, "bkit-guardrails.cjs");
231
+ if (fs.existsSync(railSrc)) {
232
+ if (!dryRun) ensureDir(path.dirname(railDst));
233
+ const prevLen = ws.writes.length;
234
+ writeTier2(railSrc, railDst, ctx.tokens, "slash-comment", dryRun, ws);
235
+ if (ws.writes.length > prevLen) console.log(`${logPrefix} ${tag}antigravity: ${railDst}`);
236
+ }
237
+ }
238
+
239
+ advisories.push({
240
+ id: "antigravity-setup",
241
+ severity: "advisory",
242
+ detect:
243
+ "antigravity host installed as a workspace plugin (.agents/plugins/bkit/: plugin.json + skills/bkit-* + agents/ + hooks.json).",
244
+ action:
245
+ "Three things that differ from the other hosts:\n" +
246
+ "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" +
247
+ "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" +
248
+ "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.",
249
+ });
250
+
251
+ // Both hosts installed: Antigravity's skill selector lists TWO sets of bkit-* skills.
252
+ // Codex does not merge same-named skills; Antigravity lists both. Warn which to pick.
253
+ const codexPresent =
254
+ ctx.installedModules?.has("codex") ??
255
+ fs.existsSync(path.join(process.cwd(), ".codex", "agents"));
256
+ if (codexPresent) {
257
+ advisories.push({
258
+ id: "antigravity-codex-skill-overlap",
259
+ severity: "advisory",
260
+ detect:
261
+ "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`).",
262
+ action:
263
+ "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.",
264
+ });
265
+ }
266
+ }
@@ -140,13 +140,13 @@ export function runClaudeModule(ctx: ModuleContext): void {
140
140
  }
141
141
  }
142
142
 
143
- // markered-text (slash-comment) — GateGuard advisory PreToolUse hook. bkit owns
143
+ // markered-text (slash-comment) — GateGuard and ReadGuard advisory hooks. bkit owns
144
144
  // only the advisory engine between the markers; consumers own the stdin/stdout
145
- // driver from first install onward (env vars BKIT_GATEGUARD / BKIT_ALLOW_CONFIG_EDIT
146
- // still tune behaviour, same as before).
147
- {
148
- const src = path.join(claudeHooks, "bkit-gateguard.cjs");
149
- const dst = ".claude/hooks/bkit-gateguard.cjs";
145
+ // driver from first install onward (env vars BKIT_GATEGUARD / BKIT_ALLOW_CONFIG_EDIT /
146
+ // BKIT_READGUARD still tune behaviour).
147
+ for (const hook of ["bkit-gateguard.cjs", "bkit-readguard.cjs"]) {
148
+ const src = path.join(claudeHooks, hook);
149
+ const dst = `.claude/hooks/${hook}`;
150
150
  if (fs.existsSync(src)) {
151
151
  const prevLen = ws.writes.length;
152
152
  writeTier2(src, dst, tokens, "slash-comment", dryRun, ws);
@@ -102,8 +102,8 @@ export function runCloudModule(ctx: ModuleContext): void {
102
102
  "IN CLAUDE APP (claude.ai/code → environment selector → + Add environment):\n" +
103
103
  " - Name: the repo name (e.g. `acme-web`) — one environment per repo, since secrets are per-repo.\n" +
104
104
  " - 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" +
105
- " - Environment variables: `BKIT_GH_TOKEN` (fine-grained for one owner, classic across owners — GitHub MCP), `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=70`.\n" +
106
- " - 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" +
105
+ " - Environment variables: `BKIT_GH_TOKEN` (fine-grained for one owner, classic across owners — GitHub MCP).\n" +
106
+ " - 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" +
107
107
  " - 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.",
108
108
  });
109
109
  } else if (variant === "opencode") {
@@ -123,6 +123,9 @@ export function renderCodexAgentsSkills(ctx: ModuleContext): string[] {
123
123
  }
124
124
 
125
125
  // --- Workflow skills: one directory per workflow, each holding SKILL.md ---
126
+ // `.agents/skills/` is Codex's. The Antigravity host installs its own workflow skills
127
+ // into a workspace plugin (`.agents/plugins/bkit/skills/`) instead, so this directory
128
+ // has a single writer and the two hosts never fight over one file.
126
129
  {
127
130
  const src = getWorkflowsRoot();
128
131
  const files = listMdFiles(src, BKIT_PREFIX);
@@ -179,10 +182,10 @@ export function runCodexModule(ctx: ModuleContext): void {
179
182
  }
180
183
  }
181
184
 
182
- // --- bkit-gateguard.cjs — Tier-2 markered-text, twin of the Claude hook ---
183
- {
184
- const hookSrc = path.join(codexHooks, "bkit-gateguard.cjs");
185
- const hookDst = ".codex/hooks/bkit-gateguard.cjs";
185
+ // --- bkit-gateguard.cjs / bkit-readguard.cjs — Tier-2 markered-text, twins of the Claude hooks ---
186
+ for (const hook of ["bkit-gateguard.cjs", "bkit-readguard.cjs"]) {
187
+ const hookSrc = path.join(codexHooks, hook);
188
+ const hookDst = `.codex/hooks/${hook}`;
186
189
  if (fs.existsSync(hookSrc)) {
187
190
  if (!dryRun) ensureDir(path.dirname(hookDst));
188
191
  const prevLen = ws.writes.length;
@@ -212,7 +215,7 @@ export function runCodexModule(ctx: ModuleContext): void {
212
215
  detect: "codex host installed (.codex/agents + .agents/skills/bkit-*).",
213
216
  action:
214
217
  "Three things that differ from the other hosts:\n" +
215
- "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" +
218
+ "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" +
216
219
  "2. Workflows are SKILLS here, not slash commands: invoke `$bkit-design`, not `/bkit-design`.\n" +
217
220
  "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.",
218
221
  });