@cbartens/bkit 5.2.3 → 5.3.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 (254) hide show
  1. package/.bkit/README.md +29 -12
  2. package/.bkit/core/.agents/context.md +1 -1
  3. package/.bkit/core/.agents/docs.md +1 -1
  4. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +1 -1
  5. package/.bkit/core/.agents/rules.md +11 -0
  6. package/.bkit/core/.bkit/README.md +28 -11
  7. package/.bkit/core/.bkit/cloud.md +9 -8
  8. package/.bkit/core/.bkit/comparison.md +68 -345
  9. package/.bkit/core/.bkit/install.md +15 -9
  10. package/.bkit/core/.bkit/lite.md +73 -0
  11. package/.bkit/core/.bkit/pipeline.md +345 -0
  12. package/.bkit/core/.bkit/prompts.md +88 -73
  13. package/.bkit/core/.bkit/providers.md +41 -22
  14. package/.bkit/core/.bkit/templates.md +125 -18
  15. package/.bkit/core/.bkit/trackers.md +47 -1
  16. package/.bkit/core/.bkit/workflows.md +51 -45
  17. package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +1 -1
  18. package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +7 -4
  19. package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +8 -5
  20. package/.bkit/core/docs/templates/bkit-audit-accessibility.md +9 -1
  21. package/.bkit/core/docs/templates/bkit-audit-adoption.md +10 -2
  22. package/.bkit/core/docs/templates/bkit-audit-agents.md +9 -1
  23. package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +9 -1
  24. package/.bkit/core/docs/templates/bkit-audit-analytics.md +9 -1
  25. package/.bkit/core/docs/templates/bkit-audit-annotations.md +10 -2
  26. package/.bkit/core/docs/templates/bkit-audit-app-performance.md +9 -1
  27. package/.bkit/core/docs/templates/bkit-audit-app-store.md +9 -1
  28. package/.bkit/core/docs/templates/bkit-audit-architecture.md +9 -1
  29. package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +9 -1
  30. package/.bkit/core/docs/templates/bkit-audit-config.md +9 -1
  31. package/.bkit/core/docs/templates/bkit-audit-cost.md +10 -2
  32. package/.bkit/core/docs/templates/bkit-audit-coverage.md +9 -1
  33. package/.bkit/core/docs/templates/bkit-audit-database.md +9 -1
  34. package/.bkit/core/docs/templates/bkit-audit-dead-code.md +9 -1
  35. package/.bkit/core/docs/templates/bkit-audit-deferrals.md +9 -1
  36. package/.bkit/core/docs/templates/bkit-audit-dependencies.md +22 -10
  37. package/.bkit/core/docs/templates/bkit-audit-documentation.md +9 -1
  38. package/.bkit/core/docs/templates/bkit-audit-duplication.md +9 -1
  39. package/.bkit/core/docs/templates/bkit-audit-failures.md +9 -1
  40. package/.bkit/core/docs/templates/bkit-audit-flakes.md +10 -2
  41. package/.bkit/core/docs/templates/bkit-audit-gates.md +9 -1
  42. package/.bkit/core/docs/templates/bkit-audit-issues.md +9 -1
  43. package/.bkit/core/docs/templates/bkit-audit-llm.md +29 -15
  44. package/.bkit/core/docs/templates/bkit-audit-logs.md +10 -2
  45. package/.bkit/core/docs/templates/bkit-audit-models.md +9 -1
  46. package/.bkit/core/docs/templates/bkit-audit-privacy.md +9 -1
  47. package/.bkit/core/docs/templates/bkit-audit-prompts.md +11 -3
  48. package/.bkit/core/docs/templates/bkit-audit-red-team.md +19 -9
  49. package/.bkit/core/docs/templates/bkit-audit-reliability.md +9 -1
  50. package/.bkit/core/docs/templates/bkit-audit-repo.md +10 -2
  51. package/.bkit/core/docs/templates/bkit-audit-security.md +13 -5
  52. package/.bkit/core/docs/templates/bkit-audit-slop.md +9 -1
  53. package/.bkit/core/docs/templates/bkit-audit-testing.md +14 -5
  54. package/.bkit/core/docs/templates/bkit-audit-usability.md +9 -1
  55. package/.bkit/core/docs/templates/bkit-plan.md +8 -6
  56. package/.bkit/core/engine/checks/after/auth.ts +9 -9
  57. package/.bkit/core/engine/checks/after/ci-yml.ts +14 -12
  58. package/.bkit/core/engine/checks/after/github.ts +29 -120
  59. package/.bkit/core/engine/checks/after/index.ts +2 -2
  60. package/.bkit/core/engine/checks/after/managed.ts +8 -28
  61. package/.bkit/core/engine/checks/after/tools.ts +3 -15
  62. package/.bkit/core/engine/checks/before/context-fetch.ts +1 -21
  63. package/.bkit/core/engine/checks/before/index.ts +7 -43
  64. package/.bkit/core/engine/checks/before/mcp.ts +17 -8
  65. package/.bkit/core/engine/checks/before/repo.ts +9 -12
  66. package/.bkit/core/engine/checks/status-holes.ts +4 -5
  67. package/.bkit/core/engine/checks/tips/catalogue.ts +70 -24
  68. package/.bkit/core/engine/checks/tips/detect.ts +45 -2
  69. package/.bkit/core/engine/checks/tips/index.ts +37 -8
  70. package/.bkit/core/engine/cli.ts +39 -16
  71. package/.bkit/core/engine/commands/analysis.ts +36 -26
  72. package/.bkit/core/engine/commands/comply.ts +17 -16
  73. package/.bkit/core/engine/commands/harvest.ts +12 -12
  74. package/.bkit/core/engine/commands/install/doctor.ts +57 -28
  75. package/.bkit/core/engine/commands/install/install.ts +62 -126
  76. package/.bkit/core/engine/commands/install/uninstall.ts +191 -33
  77. package/.bkit/core/engine/commands/install/upgrade.ts +58 -53
  78. package/.bkit/core/engine/commands/lib.ts +35 -10
  79. package/.bkit/core/engine/commands/tips.ts +8 -5
  80. package/.bkit/core/engine/commands/workflow/branches.ts +65 -11
  81. package/.bkit/core/engine/commands/workflow/counters.ts +21 -12
  82. package/.bkit/core/engine/commands/workflow/fids.ts +46 -0
  83. package/.bkit/core/engine/commands/workflow/ledgers.ts +3 -1
  84. package/.bkit/core/engine/commands/workflow/prs.ts +4 -2
  85. package/.bkit/core/engine/commands/workflow/repo.ts +18 -4
  86. package/.bkit/core/engine/commands/workflow/roadmap.ts +4 -3
  87. package/.bkit/core/engine/commands/workflow/runs.ts +8 -7
  88. package/.bkit/core/engine/commands/workflow/steps.ts +1 -0
  89. package/.bkit/core/engine/commands/workflow/tests.ts +17 -5
  90. package/.bkit/core/engine/commands/workflow/workflows.ts +19 -17
  91. package/.bkit/core/engine/commands/workflow/workstreams.ts +2 -1
  92. package/.bkit/core/engine/commands/workflow/worktrees.ts +13 -5
  93. package/.bkit/core/engine/install/cloud-env.ts +10 -31
  94. package/.bkit/core/engine/install/manifest.ts +14 -7
  95. package/.bkit/core/engine/install/modules/antigravity.ts +15 -26
  96. package/.bkit/core/engine/install/modules/claude.ts +20 -28
  97. package/.bkit/core/engine/install/modules/cloud.ts +5 -2
  98. package/.bkit/core/engine/install/modules/codex.ts +15 -29
  99. package/.bkit/core/engine/install/modules/core.ts +91 -70
  100. package/.bkit/core/engine/install/modules/cursor.ts +6 -20
  101. package/.bkit/core/engine/install/modules/index.ts +7 -1
  102. package/.bkit/core/engine/install/modules/opencode.ts +48 -70
  103. package/.bkit/core/engine/install/network-allowlist.ts +73 -0
  104. package/.bkit/core/engine/install/placeholders.ts +3 -18
  105. package/.bkit/core/engine/install/write.ts +59 -12
  106. package/.bkit/core/engine/ledgers/telemetry.ts +6 -4
  107. package/.bkit/core/engine/render/hosts.ts +47 -67
  108. package/.bkit/core/engine/render/models.ts +29 -11
  109. package/.bkit/core/engine/shared/bkit-latest.ts +164 -0
  110. package/.bkit/core/engine/shared/branches.ts +13 -0
  111. package/.bkit/core/engine/shared/egress.ts +3 -3
  112. package/.bkit/core/engine/shared/json.ts +18 -1
  113. package/.bkit/core/engine/shared/package-json.ts +63 -0
  114. package/.bkit/core/engine/shared/package-roots.ts +0 -10
  115. package/.bkit/core/engine/shared/protected-paths.ts +5 -130
  116. package/.bkit/core/engine/shared/settings.ts +36 -0
  117. package/.bkit/core/engine/shared/timeouts.ts +6 -0
  118. package/.bkit/core/hooks/antigravity-hook.js +1 -0
  119. package/.bkit/core/hooks/guardrails-shell.js +186 -40
  120. package/.bkit/core/hooks/guardrails-tiers.js +5 -78
  121. package/.bkit/core/prompts/bkit-audit-generate.md +65 -10
  122. package/.bkit/core/prompts/bkit-build-challenge-1.md +1 -1
  123. package/.bkit/core/prompts/bkit-build-challenge-2.md +1 -1
  124. package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +1 -1
  125. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +1 -1
  126. package/.bkit/core/prompts/bkit-build-challenge-tests.md +1 -1
  127. package/.bkit/core/prompts/bkit-build-install-skills.md +1 -1
  128. package/.bkit/core/prompts/bkit-build-plan-current.md +1 -1
  129. package/.bkit/core/prompts/bkit-build-plan-execute.md +4 -4
  130. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +1 -1
  131. package/.bkit/core/prompts/bkit-build-plan-verify.md +2 -2
  132. package/.bkit/core/prompts/bkit-debug-abort-handover.md +1 -1
  133. package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +1 -1
  134. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +1 -1
  135. package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +78 -0
  136. package/.bkit/core/prompts/bkit-debug-failure-soak.md +1 -1
  137. package/.bkit/core/prompts/bkit-debug-summary.md +3 -3
  138. package/.bkit/core/prompts/bkit-design-spike.md +1 -1
  139. package/.bkit/core/prompts/bkit-design-summary.md +2 -2
  140. package/.bkit/core/prompts/bkit-design-update.md +1 -1
  141. package/.bkit/core/prompts/bkit-plan-complexity-check.md +1 -1
  142. package/.bkit/core/prompts/bkit-plan-generate.md +1 -1
  143. package/.bkit/core/prompts/bkit-plan-scope-check-1.md +1 -1
  144. package/.bkit/core/prompts/bkit-plan-scope-check-2.md +1 -1
  145. package/.bkit/core/prompts/bkit-plan-summary.md +1 -1
  146. package/.bkit/core/prompts/bkit-plan-update.md +1 -1
  147. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +1 -1
  148. package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +1 -1
  149. package/.bkit/core/prompts/bkit-ship-update-docs.md +1 -1
  150. package/.bkit/core/prompts/bkit-utility-update-decisions.md +9 -2
  151. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +9 -2
  152. package/.bkit/core/prompts/bkit-utility-update-documentation.md +2 -1
  153. package/.bkit/core/prompts/bkit-utility-update-failures.md +9 -2
  154. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +9 -2
  155. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +11 -4
  156. package/.bkit/core/workflows/bkit-build.md +4 -4
  157. package/.bkit/core/workflows/bkit-debug.md +70 -34
  158. package/.bkit/core/workflows/bkit-design.md +3 -3
  159. package/.bkit/core/workflows/bkit-plan.md +12 -5
  160. package/.bkit/core/workflows/bkit-ship.md +6 -6
  161. package/.bkit/shared/.claude/bkit-cloud.md +46 -13
  162. package/.bkit/shared/.claude/settings.json +18 -0
  163. package/.bkit/shared/.cursor/mcp.json +2 -1
  164. package/.bkit/shared/.opencode/opencode.json +19 -1
  165. package/.bkit/shared/docs/deployments.md +20 -4
  166. package/.bkit/shared/docs/security.md +8 -6
  167. package/.bkit/shared/docs/testing.md +9 -5
  168. package/.bkit/templates/.cursor/Dockerfile +30 -16
  169. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-bug.yml +78 -0
  170. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +91 -0
  171. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +56 -0
  172. package/.bkit/templates/.github/renovate.json5 +91 -12
  173. package/.bkit/templates/.github/workflows/bkit-ci.yml +66 -53
  174. package/.bkit/templates/.github/workflows/bkit-cloud.yml +3 -1
  175. package/.bkit/templates/.github/workflows/bkit-renovate.yml +8 -1
  176. package/.bkit/templates/.github/workflows/bkit-trivy.yml +67 -0
  177. package/.bkit/templates/.husky/pre-push +15 -3
  178. package/.bkit/templates/.oxlintrc.json +21 -0
  179. package/.bkit/templates/docs/capabilities.md +1 -1
  180. package/.bkit/templates/scripts/ci/check-capstone.mjs +176 -0
  181. package/.bkit/templates/scripts/ci/check-capstone.test.mjs +311 -0
  182. package/.bkit/templates/scripts/cleanup/bkit-tmp-prune.mjs +115 -0
  183. package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +2 -2
  184. package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +43 -20
  185. package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +33 -11
  186. package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +3 -2
  187. package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +5 -5
  188. package/.bkit/templates/scripts/graphify/bkit-graphify.sh +79 -19
  189. package/CHANGELOG.md +67 -3
  190. package/README.md +258 -129
  191. package/dist/checks/after/auth.js +10 -11
  192. package/dist/checks/after/ci-yml.js +11 -14
  193. package/dist/checks/after/github.js +32 -125
  194. package/dist/checks/after/index.js +3 -2
  195. package/dist/checks/after/managed.js +8 -24
  196. package/dist/checks/after/tools.js +3 -16
  197. package/dist/checks/before/context-fetch.js +1 -21
  198. package/dist/checks/before/index.js +6 -42
  199. package/dist/checks/before/mcp.js +14 -9
  200. package/dist/checks/before/repo.js +8 -11
  201. package/dist/checks/status-holes.js +5 -6
  202. package/dist/checks/tips/catalogue.js +60 -18
  203. package/dist/checks/tips/detect.js +41 -2
  204. package/dist/checks/tips/index.js +25 -5
  205. package/dist/cli.js +34 -14
  206. package/dist/commands/analysis.js +21 -5
  207. package/dist/commands/comply.js +20 -18
  208. package/dist/commands/harvest.js +12 -13
  209. package/dist/commands/install/doctor.js +55 -23
  210. package/dist/commands/install/install.js +62 -118
  211. package/dist/commands/install/uninstall.js +165 -31
  212. package/dist/commands/install/upgrade.js +55 -49
  213. package/dist/commands/lib.js +32 -10
  214. package/dist/commands/tips.js +6 -3
  215. package/dist/commands/workflow/branches.js +57 -13
  216. package/dist/commands/workflow/counters.js +17 -7
  217. package/dist/commands/workflow/fids.js +39 -0
  218. package/dist/commands/workflow/ledgers.js +3 -1
  219. package/dist/commands/workflow/prs.js +3 -3
  220. package/dist/commands/workflow/repo.js +16 -4
  221. package/dist/commands/workflow/roadmap.js +4 -4
  222. package/dist/commands/workflow/runs.js +5 -5
  223. package/dist/commands/workflow/steps.js +1 -0
  224. package/dist/commands/workflow/tests.js +16 -3
  225. package/dist/commands/workflow/workflows.js +19 -18
  226. package/dist/commands/workflow/workstreams.js +2 -1
  227. package/dist/commands/workflow/worktrees.js +4 -5
  228. package/dist/install/cloud-env.js +10 -23
  229. package/dist/install/manifest.js +14 -7
  230. package/dist/install/modules/antigravity.js +15 -26
  231. package/dist/install/modules/claude.js +17 -21
  232. package/dist/install/modules/cloud.js +6 -2
  233. package/dist/install/modules/codex.js +15 -29
  234. package/dist/install/modules/core.js +82 -63
  235. package/dist/install/modules/cursor.js +6 -9
  236. package/dist/install/modules/index.js +6 -1
  237. package/dist/install/modules/opencode.js +41 -72
  238. package/dist/install/network-allowlist.js +62 -0
  239. package/dist/install/placeholders.js +3 -16
  240. package/dist/install/write.js +55 -15
  241. package/dist/ledgers/telemetry.js +5 -4
  242. package/dist/render/hosts.js +30 -55
  243. package/dist/render/models.js +20 -9
  244. package/dist/shared/bkit-latest.js +150 -0
  245. package/dist/shared/branches.js +11 -0
  246. package/dist/shared/egress.js +0 -2
  247. package/dist/shared/json.js +14 -0
  248. package/dist/shared/package-json.js +61 -0
  249. package/dist/shared/package-roots.js +0 -8
  250. package/dist/shared/protected-paths.js +5 -122
  251. package/dist/shared/settings.js +18 -1
  252. package/dist/shared/timeouts.js +6 -0
  253. package/package.json +21 -17
  254. package/.bkit/core/.agents/shortcuts.md +0 -73
@@ -2,6 +2,7 @@ import * as fs from "node:fs";
2
2
  import * as path from "node:path";
3
3
  import { updateManagedBlock, extractFullManagedBlock, extractManagedBlock, findLineAnchoredMarkers, findUnmarkedCopy, selectMarkers, } from "./managed-block.js";
4
4
  import { readTemplate } from "../render/parts.js";
5
+ import { parseJson } from "../shared/json.js";
5
6
  import { applyTokens } from "./placeholders.js";
6
7
  import { sha256 } from "./version-file.js";
7
8
  export function deepContains(template, consumer, pathPrefix = "") {
@@ -135,6 +136,51 @@ export function deepMergeJson(base, override) {
135
136
  return result;
136
137
  }
137
138
  // ---------------------------------------------------------------------------
139
+ // MCP tracker entry — bkit owns the template's parts of the entry, not the whole entry (#613)
140
+ //
141
+ // - every key the template sets is reset to the template's value
142
+ // - `headers["X-MCP-Toolsets"]` keeps the consumer's list and appends any template toolset
143
+ // it lacks, so a consumer can enable extra toolsets and a toolset bkit adds still lands
144
+ // - every other consumer key, header and toolset is kept
145
+ // ---------------------------------------------------------------------------
146
+ export const MCP_TOOLSETS_HEADER = "X-MCP-Toolsets";
147
+ /** Split an `X-MCP-Toolsets` value into toolset names (trimmed, empties dropped). */
148
+ export function parseToolsets(value) {
149
+ return value
150
+ .split(",")
151
+ .map((s) => s.trim())
152
+ .filter((s) => s !== "");
153
+ }
154
+ /** True for a JSON object (not null, not an array). */
155
+ export function isJsonObject(v) {
156
+ return v !== null && typeof v === "object" && !Array.isArray(v);
157
+ }
158
+ /** Merge bkit's tracker entry `owned` into the consumer's `existing` entry (rules above). */
159
+ export function mergeTrackerEntry(existing, owned) {
160
+ if (!isJsonObject(existing) || !isJsonObject(owned))
161
+ return owned;
162
+ const merged = deepMergeJson(existing, owned);
163
+ const ownedHeaders = owned.headers;
164
+ const existingHeaders = existing.headers;
165
+ if (isJsonObject(ownedHeaders) && isJsonObject(existingHeaders)) {
166
+ const ownedSets = ownedHeaders[MCP_TOOLSETS_HEADER];
167
+ const existingSets = existingHeaders[MCP_TOOLSETS_HEADER];
168
+ if (typeof ownedSets === "string" && typeof existingSets === "string") {
169
+ const have = parseToolsets(existingSets);
170
+ const missing = parseToolsets(ownedSets).filter((t) => !have.includes(t));
171
+ merged.headers[MCP_TOOLSETS_HEADER] =
172
+ missing.length === 0 ? existingSets : [...have, ...missing].join(",");
173
+ }
174
+ }
175
+ return merged;
176
+ }
177
+ /** True when `existing` already holds everything `mergeTrackerEntry` would write. */
178
+ export function trackerEntryInSync(existing, owned) {
179
+ if (existing === undefined)
180
+ return false;
181
+ return deepContains(mergeTrackerEntry(existing, owned), existing).ok;
182
+ }
183
+ // ---------------------------------------------------------------------------
138
184
  // writeTier2JsonContained — deep-containment JSON helper (BAR-167 Phase 1)
139
185
  //
140
186
  // Contract:
@@ -147,13 +193,11 @@ export function deepMergeJson(base, override) {
147
193
  // ---------------------------------------------------------------------------
148
194
  export function writeTier2JsonContained(srcPath, dstPath, dryRun, ws) {
149
195
  const srcRaw = fs.readFileSync(srcPath, "utf-8");
150
- let template;
151
- try {
152
- template = JSON.parse(srcRaw);
153
- }
154
- catch {
196
+ const templateRead = parseJson(srcRaw);
197
+ if (!templateRead.ok) {
155
198
  throw new Error(`writeTier2JsonContained: template at ${srcPath} is not valid JSON`);
156
199
  }
200
+ const template = templateRead.value;
157
201
  if (!fs.existsSync(dstPath)) {
158
202
  // First install — write template as-is
159
203
  ensureDir(path.dirname(dstPath));
@@ -167,14 +211,12 @@ export function writeTier2JsonContained(srcPath, dstPath, dryRun, ws) {
167
211
  }
168
212
  // dest exists — read and check containment
169
213
  const dstRaw = fs.readFileSync(dstPath, "utf-8");
170
- let existing;
171
- try {
172
- existing = JSON.parse(dstRaw);
173
- }
174
- catch {
214
+ const existingRead = parseJson(dstRaw);
215
+ if (!existingRead.ok) {
175
216
  // Malformed destination — refuse to overwrite; require manual fix (matches malformed-package-json blocker discipline)
176
217
  throw new Error(`[bkit] ${dstPath} is malformed JSON — fix manually before running bkit install`);
177
218
  }
219
+ const existing = existingRead.value;
178
220
  // Check if existing already contains the template
179
221
  const containsResult = deepContains(template, existing);
180
222
  if (containsResult.ok) {
@@ -364,13 +406,11 @@ export function ensurePackageJsonScripts(scripts, dryRun, ws) {
364
406
  return { added: [], preserved: [], missingPkg: true, malformed: false };
365
407
  }
366
408
  const raw = fs.readFileSync(pkgPath, "utf-8");
367
- let pkg;
368
- try {
369
- pkg = JSON.parse(raw);
370
- }
371
- catch {
409
+ const parsed = parseJson(raw);
410
+ if (!parsed.ok) {
372
411
  return { added: [], preserved: [], missingPkg: false, malformed: true };
373
412
  }
413
+ const pkg = parsed.value;
374
414
  let pkgScripts = pkg.scripts ?? undefined;
375
415
  const added = [];
376
416
  const preserved = [];
@@ -18,6 +18,7 @@
18
18
  // so an unexpected version surfaces for triage.
19
19
  import { spawnSync } from "node:child_process";
20
20
  import * as fs from "node:fs";
21
+ import { parseJson } from "../shared/json.js";
21
22
  // ---------------------------------------------------------------------------
22
23
  // Constants
23
24
  // ---------------------------------------------------------------------------
@@ -397,11 +398,11 @@ export function parse(raw) {
397
398
  const trimmed = line.trim();
398
399
  if (trimmed === "")
399
400
  continue;
400
- try {
401
- const obj = JSON.parse(trimmed);
402
- result.events.push(obj);
401
+ const obj = parseJson(trimmed);
402
+ if (obj.ok) {
403
+ result.events.push(obj.value);
403
404
  }
404
- catch {
405
+ else {
405
406
  result.malformedLineCount++;
406
407
  }
407
408
  }
@@ -103,22 +103,10 @@ export function antigravityToolsBlock(toolsBlock) {
103
103
  * lookup missing for name.
104
104
  */
105
105
  export function applyOpencodeAgent(content, opencodeModelLookup, effortMap, provider) {
106
- const fmMatch = content.match(/^(---\r?\n)([\s\S]*?)(\r?\n---\r?\n?)/);
107
- if (!fmMatch)
106
+ const subagent = requireSubagentModel(content, opencodeModelLookup, "opencode");
107
+ if (!subagent)
108
108
  return content;
109
- const fmBlock = fmMatch[2];
110
- const afterFm = content.slice(fmMatch[0].length);
111
- const parsed = parseFrontmatter(fmBlock);
112
- const name = parsed.get("name") ?? "";
113
- if (!name) {
114
- console.error(`${LOG_PREFIX} Subagent frontmatter missing 'name' field`);
115
- process.exit(1);
116
- }
117
- const opencodeModel = opencodeModelLookup.get(name);
118
- if (!opencodeModel) {
119
- console.error(`${LOG_PREFIX} Missing opencode model lookup for ${name}`);
120
- process.exit(1);
121
- }
109
+ const { fmBlock, afterFm, parsed, name, model: opencodeModel } = subagent;
122
110
  const description = parsed.get("description") ?? "";
123
111
  const effort = parsed.get("effort");
124
112
  const toolsBlock = extractFrontmatterField(fmBlock, "tools");
@@ -201,22 +189,11 @@ function tomlString(key, value) {
201
189
  * host (documented in providers.md).
202
190
  */
203
191
  export function applyCodexAgent(content, codexModelLookup, effortMap) {
204
- const fmMatch = content.match(/^(---\r?\n)([\s\S]*?)(\r?\n---\r?\n?)/);
205
- if (!fmMatch)
192
+ const subagent = requireSubagentModel(content, codexModelLookup, "codex");
193
+ if (!subagent)
206
194
  return content;
207
- const fmBlock = fmMatch[2];
208
- const body = content.slice(fmMatch[0].length).trim();
209
- const parsed = parseFrontmatter(fmBlock);
210
- const name = parsed.get("name") ?? "";
211
- if (!name) {
212
- console.error(`${LOG_PREFIX} Subagent frontmatter missing 'name' field`);
213
- process.exit(1);
214
- }
215
- const model = codexModelLookup.get(name);
216
- if (!model) {
217
- console.error(`${LOG_PREFIX} Missing codex model lookup for ${name}`);
218
- process.exit(1);
219
- }
195
+ const { afterFm, parsed, name, model } = subagent;
196
+ const body = afterFm.trim();
220
197
  const effort = parsed.get("effort");
221
198
  let out = "";
222
199
  out += tomlString("name", name);
@@ -347,27 +324,37 @@ function extractFrontmatterField(fmBlock, field) {
347
324
  const m = fmBlock.match(re);
348
325
  return m ? m[1] : null;
349
326
  }
350
- // T3: Cursor subagent frontmatter rewrite.
351
- // Emits: name, description, model, tools (passthrough — Cursor 2.4+ accepts identical tool names per BAR-113),
352
- // effort (from prompts.md Cursor column). Drops: permissionMode, maxTurns, readonly, is_background.
353
- // Hard-fails with non-zero exit if model lookup missing for name.
354
- export function applyT3(content, modelLookup, effortMap) {
327
+ // Shared opening of the subagent renderers: split off the frontmatter, require `name`, look
328
+ // the model up. Returns null when `content` has no frontmatter (the renderer passes it
329
+ // through); exits 1 when `name` or the model is missing. `host` qualifies the model-lookup
330
+ // message ("" for the unqualified Cursor message).
331
+ function requireSubagentModel(content, lookup, host) {
355
332
  const fmMatch = content.match(/^(---\r?\n)([\s\S]*?)(\r?\n---\r?\n?)/);
356
333
  if (!fmMatch)
357
- return content;
334
+ return null;
358
335
  const fmBlock = fmMatch[2];
359
- const afterFm = content.slice(fmMatch[0].length);
360
336
  const parsed = parseFrontmatter(fmBlock);
361
337
  const name = parsed.get("name") ?? "";
362
338
  if (!name) {
363
339
  console.error(`${LOG_PREFIX} Subagent frontmatter missing 'name' field`);
364
340
  process.exit(1);
365
341
  }
366
- const cursorModel = modelLookup.get(name);
367
- if (!cursorModel) {
368
- console.error(`${LOG_PREFIX} Missing model lookup for ${name}`);
342
+ const model = lookup.get(name);
343
+ if (!model) {
344
+ console.error(`${LOG_PREFIX} Missing ${host ? `${host} ` : ""}model lookup for ${name}`);
369
345
  process.exit(1);
370
346
  }
347
+ return { fmBlock, afterFm: content.slice(fmMatch[0].length), parsed, name, model };
348
+ }
349
+ // T3: Cursor subagent frontmatter rewrite.
350
+ // Emits: name, description, model, tools (passthrough — Cursor 2.4+ accepts identical tool names per BAR-113),
351
+ // effort (from prompts.md Cursor column). Drops: permissionMode, maxTurns, readonly, is_background.
352
+ // Hard-fails with non-zero exit if model lookup missing for name.
353
+ export function applyT3(content, modelLookup, effortMap) {
354
+ const subagent = requireSubagentModel(content, modelLookup, "");
355
+ if (!subagent)
356
+ return content;
357
+ const { fmBlock, afterFm, parsed, name, model: cursorModel } = subagent;
371
358
  const description = parsed.get("description") ?? "";
372
359
  const effort = parsed.get("effort");
373
360
  const toolsBlock = extractFrontmatterField(fmBlock, "tools");
@@ -427,22 +414,10 @@ export function applyAntigravityToolRewrites(content, agentsDir = ANTIGRAVITY_AG
427
414
  * readonly) are dropped. Hard-fails with non-zero exit if the model lookup is missing.
428
415
  */
429
416
  export function applyAntigravityPrompt(content, modelLookup, effortMap) {
430
- const fmMatch = content.match(/^(---\r?\n)([\s\S]*?)(\r?\n---\r?\n?)/);
431
- if (!fmMatch)
417
+ const subagent = requireSubagentModel(content, modelLookup, "antigravity");
418
+ if (!subagent)
432
419
  return content;
433
- const fmBlock = fmMatch[2];
434
- const afterFm = content.slice(fmMatch[0].length);
435
- const parsed = parseFrontmatter(fmBlock);
436
- const name = parsed.get("name") ?? "";
437
- if (!name) {
438
- console.error(`${LOG_PREFIX} Subagent frontmatter missing 'name' field`);
439
- process.exit(1);
440
- }
441
- const model = modelLookup.get(name);
442
- if (!model) {
443
- console.error(`${LOG_PREFIX} Missing antigravity model lookup for ${name}`);
444
- process.exit(1);
445
- }
420
+ const { fmBlock, afterFm, parsed, name, model } = subagent;
446
421
  const description = parsed.get("description") ?? "";
447
422
  const effort = parsed.get("effort");
448
423
  const toolsBlock = extractFrontmatterField(fmBlock, "tools");
@@ -3,7 +3,7 @@
3
3
  import * as fs from "node:fs";
4
4
  import { findLineAnchoredMarkers, selectMarkers } from "../install/managed-block.js";
5
5
  import { LOG_PREFIX } from "../shared/log-prefix.js";
6
- import { OPENCODE_PROVIDER_DEFAULTS } from "../shared/egress.js";
6
+ import { OPENCODE_PROVIDERS, OPENCODE_PROVIDER_DEFAULTS, } from "../shared/egress.js";
7
7
  /**
8
8
  * Parse .bkit/prompts.md § Models table → Map<name, columnValue>.
9
9
  * columnHeader is the column header label to extract (e.g. "Cursor model", "opencode model").
@@ -83,6 +83,9 @@ export function parseModelLookup(subagentsMdPath) {
83
83
  *
84
84
  * Cells hold the BARE, gateway-scoped model id. Any prefix a program's config format needs
85
85
  * is added at render time by formatModelPin — never stored in the table.
86
+ *
87
+ * Every allowlisted opencode provider MUST have an entry; the `satisfies Record<OpencodeProvider | …>`
88
+ * check fails tsc when one is missing.
86
89
  */
87
90
  const GATEWAY_COLUMN = {
88
91
  anthropic: "Anthropic",
@@ -94,6 +97,9 @@ const GATEWAY_COLUMN = {
94
97
  openai: "OpenAI",
95
98
  google: "Google",
96
99
  };
100
+ function isGatewayKey(value) {
101
+ return Object.hasOwn(GATEWAY_COLUMN, value);
102
+ }
97
103
  /**
98
104
  * Spell a model pin the way a program's config file expects it.
99
105
  *
@@ -110,17 +116,16 @@ export function formatModelPin(program, gateway, bareModel) {
110
116
  return bareModel;
111
117
  }
112
118
  /**
113
- * Build the per-agent opencode model lookup for the selected provider.
114
- * Source of truth = prompts.md § Models, which carries one curated column per
115
- * provider ("OpenRouter", "Ollama"). Header-addressed. Every allowlisted provider
116
- * ships a column; an absent one throws.
119
+ * Build the per-agent model lookup for one gateway: an opencode provider, or the Codex
120
+ * "openai" column. Source of truth = prompts.md § Models, which carries one curated column per
121
+ * gateway ("OpenRouter", "Ollama", "OpenAI"). Header-addressed. Every key of GATEWAY_COLUMN
122
+ * ships a column; any other key throws.
117
123
  */
118
124
  export function buildOpencodeModelLookup(subagentsMdPath, provider) {
119
- const header = GATEWAY_COLUMN[provider];
120
- if (!header) {
125
+ if (!isGatewayKey(provider)) {
121
126
  throw new Error(`buildOpencodeModelLookup: no prompts.md § Models column for provider ${JSON.stringify(provider)}`);
122
127
  }
123
- return parseModelLookupForColumn(subagentsMdPath, header);
128
+ return parseModelLookupForColumn(subagentsMdPath, GATEWAY_COLUMN[provider]);
124
129
  }
125
130
  /**
126
131
  * Build the per-agent Antigravity model lookup for Google models.
@@ -293,5 +298,11 @@ export function lookupEffort(effortMap, program, sourceEffort) {
293
298
  * keys pass through unchanged.
294
299
  */
295
300
  export function opencodeProviderId(providerKey) {
296
- return OPENCODE_PROVIDER_DEFAULTS[providerKey]?.providerId ?? providerKey;
301
+ if (!isOpencodeProvider(providerKey))
302
+ return providerKey;
303
+ return OPENCODE_PROVIDER_DEFAULTS[providerKey].providerId ?? providerKey;
304
+ }
305
+ /** Narrow a raw string to the opencode provider allowlist. */
306
+ export function isOpencodeProvider(value) {
307
+ return OPENCODE_PROVIDERS.some((provider) => provider === value);
297
308
  }
@@ -0,0 +1,150 @@
1
+ // bkit-latest — is the bkit this repo rendered its workflows and audit templates
2
+ // from behind the newest published release?
3
+ //
4
+ // `bkit repo info` (every phase workflow's Step 1) and the anchor stamp on every
5
+ // audit report, design and plan report it, so a run on outdated workflow /
6
+ // template text says so. Advisory only: no registry answer means `latest`
7
+ // is null and nothing is printed, never an error. The registry answer is kept in
8
+ // the git common dir (shared by every worktree, never committed) so parallel runs
9
+ // ask npm at most once a day.
10
+ import { spawnSync } from "node:child_process";
11
+ import * as fs from "node:fs";
12
+ import * as path from "node:path";
13
+ import { readBkitVersion } from "../install/version-file.js";
14
+ import { parseJson } from "./json.js";
15
+ import { PACKAGE_RUNNER } from "./package-manager.js";
16
+ import { TIMEOUTS } from "./timeouts.js";
17
+ export const BKIT_PACKAGE = "@cbartens/bkit";
18
+ /** Cache file name inside the git common dir. */
19
+ export const BKIT_LATEST_CACHE = "bkit-latest-version.json";
20
+ /** Set to anything but `0` / empty to skip the registry lookup (air-gapped machines, CI). */
21
+ export const NO_UPDATE_CHECK_ENV = "BKIT_NO_UPDATE_CHECK";
22
+ const SEMVER_RE = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;
23
+ /** Order of two prerelease identifier lists per semver §11: numeric < alphanumeric, shorter < longer. */
24
+ function comparePrerelease(a, b) {
25
+ for (let i = 0; i < Math.max(a.length, b.length); i++) {
26
+ const x = a[i];
27
+ const y = b[i];
28
+ if (x === undefined)
29
+ return -1;
30
+ if (y === undefined)
31
+ return 1;
32
+ const xn = /^\d+$/.test(x);
33
+ const yn = /^\d+$/.test(y);
34
+ if (xn && yn) {
35
+ if (Number(x) !== Number(y))
36
+ return Number(x) < Number(y) ? -1 : 1;
37
+ }
38
+ else if (xn !== yn) {
39
+ return xn ? -1 : 1;
40
+ }
41
+ else if (x !== y) {
42
+ return x < y ? -1 : 1;
43
+ }
44
+ }
45
+ return 0;
46
+ }
47
+ /**
48
+ * -1 / 0 / 1 for `a` older / equal / newer than `b`, compared as numbers (so 5.10.0
49
+ * is newer than 5.9.0) and with a prerelease older than its release. null when
50
+ * either is not a semver.
51
+ */
52
+ export function compareSemver(a, b) {
53
+ const ma = SEMVER_RE.exec(a.trim());
54
+ const mb = SEMVER_RE.exec(b.trim());
55
+ if (!ma || !mb)
56
+ return null;
57
+ for (let i = 1; i <= 3; i++) {
58
+ const x = Number(ma[i]);
59
+ const y = Number(mb[i]);
60
+ if (x !== y)
61
+ return x < y ? -1 : 1;
62
+ }
63
+ const pa = ma[4];
64
+ const pb = mb[4];
65
+ if (pa === undefined && pb === undefined)
66
+ return 0;
67
+ if (pa === undefined)
68
+ return 1;
69
+ if (pb === undefined)
70
+ return -1;
71
+ const c = comparePrerelease(pa.split("."), pb.split("."));
72
+ return c === 0 ? 0 : c < 0 ? -1 : 1;
73
+ }
74
+ /** The newest published bkit per the registry, or null on any failure (offline, timeout, no pnpm). */
75
+ export function lookupLatestPublished(cwd, timeoutS = TIMEOUTS.BKIT_LATEST_LOOKUP_TIMEOUT_S) {
76
+ const res = spawnSync(PACKAGE_RUNNER, ["view", BKIT_PACKAGE, "version"], {
77
+ cwd,
78
+ encoding: "utf-8",
79
+ ...(timeoutS === null ? {} : { timeout: timeoutS * 1000 }),
80
+ });
81
+ if (res.error || res.status !== 0)
82
+ return null;
83
+ const version = (res.stdout ?? "").trim().replace(/^v/, "");
84
+ return SEMVER_RE.test(version) ? version : null;
85
+ }
86
+ /** The cached registry answer when still fresh: a version, or null for a remembered failure. */
87
+ function readCache(file, now) {
88
+ if (!fs.existsSync(file))
89
+ return undefined;
90
+ const parsed = parseJson(fs.readFileSync(file, "utf-8"));
91
+ if (!parsed.ok || typeof parsed.value !== "object" || parsed.value === null)
92
+ return undefined;
93
+ const { latest, checkedAt } = parsed.value;
94
+ if (typeof checkedAt !== "number")
95
+ return undefined;
96
+ const value = typeof latest === "string" && SEMVER_RE.test(latest) ? latest : null;
97
+ const ttl = value === null ? TIMEOUTS.BKIT_LATEST_RETRY_S : TIMEOUTS.BKIT_LATEST_CACHE_S;
98
+ return now - checkedAt < ttl * 1000 && now >= checkedAt ? { latest: value } : undefined;
99
+ }
100
+ /** Remember the registry answer; a cache that cannot be written only costs a lookup next run. */
101
+ function writeCache(file, latest, now) {
102
+ const tmp = `${file}.${process.pid}.tmp`;
103
+ try {
104
+ fs.writeFileSync(tmp, `${JSON.stringify({ latest, checkedAt: now })}\n`);
105
+ fs.renameSync(tmp, file);
106
+ }
107
+ catch {
108
+ // Read-only git dir: the next run asks the registry again, nothing else changes.
109
+ fs.rmSync(tmp, { force: true });
110
+ }
111
+ }
112
+ /**
113
+ * Whether this repo's bkit is behind the newest release. `gitCommonDir` holds the
114
+ * once-a-day cache; null (not a git repo) skips the cache, not the check.
115
+ */
116
+ export function bkitVersionStatus(root, gitCommonDir, deps = {}) {
117
+ const version = readBkitVersion(path.join(root, ".bkit", "version"))?.pinnedVersion || null;
118
+ const unknown = { version, latest: null, outdated: null, advisory: null };
119
+ if (version === null)
120
+ return unknown;
121
+ const optOut = process.env[NO_UPDATE_CHECK_ENV];
122
+ if (optOut !== undefined && optOut !== "" && optOut !== "0")
123
+ return unknown;
124
+ const now = (deps.now ?? Date.now)();
125
+ const cacheFile = gitCommonDir === null ? null : path.join(gitCommonDir, BKIT_LATEST_CACHE);
126
+ let latest;
127
+ const cached = cacheFile === null ? undefined : readCache(cacheFile, now);
128
+ if (cached !== undefined) {
129
+ latest = cached.latest;
130
+ }
131
+ else {
132
+ latest = (deps.lookup ?? lookupLatestPublished)(root);
133
+ if (cacheFile !== null)
134
+ writeCache(cacheFile, latest, now);
135
+ }
136
+ if (latest === null)
137
+ return unknown;
138
+ const order = compareSemver(version, latest);
139
+ if (order === null)
140
+ return { version, latest, outdated: null, advisory: null };
141
+ const outdated = order < 0;
142
+ return {
143
+ version,
144
+ latest,
145
+ outdated,
146
+ advisory: outdated
147
+ ? `running bkit ${version}; ${latest} is out. Upgrade: ${PACKAGE_RUNNER} bkit upgrade --latest`
148
+ : null,
149
+ };
150
+ }
@@ -0,0 +1,11 @@
1
+ // shared/branches.ts — which branches are shared, so nobody works on them directly.
2
+ //
3
+ // `dev` is the integration branch; `dev` and `main` are the shared branches. The workflow
4
+ // commands (`commands/lib.ts` re-exports these) and the managed-version check both read
5
+ // this one rule.
6
+ /** The integration branch feature work lands on. */
7
+ export const DEV = "dev";
8
+ /** True for `dev` and `main`: no feature work happens on them, no force-push touches them. */
9
+ export function isSharedBranch(branch) {
10
+ return branch === DEV || branch === "main";
11
+ }
@@ -3,8 +3,6 @@
3
3
  /**
4
4
  * Providers bkit supports for the opencode host. `--opencode=<provider>` accepts
5
5
  * ONLY these — anything else is rejected (no generic/arbitrary-endpoint fallback).
6
- * Keep in sync with OPENCODE_PROVIDER_DEFAULTS (below) and
7
- * GATEWAY_COLUMN (render/models.ts § Models lookup).
8
6
  */
9
7
  export const OPENCODE_PROVIDERS = [
10
8
  // OpenAI-compatible npm driver — endpoint + key per provider.
@@ -4,6 +4,8 @@
4
4
  // .bkit/version) must fail open into a result the caller reports in its own terms,
5
5
  // never abort install, upgrade or `bkit check`. One shape, one catch — so the
6
6
  // defensive-slop gate reads a single documented fallback instead of one per caller.
7
+ // `audits/repo/json-parse-owner.test.ts` fails on a `JSON.parse` inside a `try` anywhere else.
8
+ import * as fs from "node:fs";
7
9
  /** `JSON.parse(raw)` as a result: `{ ok: true, value }`, or `{ ok: false }` when not JSON. */
8
10
  export function parseJson(raw) {
9
11
  try {
@@ -14,3 +16,15 @@ export function parseJson(raw) {
14
16
  return { ok: false };
15
17
  }
16
18
  }
19
+ /** `parseJson` over the file at `file`; `{ ok: false }` also when the file cannot be read. */
20
+ export function readJsonFile(file) {
21
+ let raw;
22
+ try {
23
+ raw = fs.readFileSync(file, "utf-8");
24
+ }
25
+ catch {
26
+ // Missing, unreadable or a directory: the result says so, like malformed JSON.
27
+ return { ok: false };
28
+ }
29
+ return parseJson(raw);
30
+ }
@@ -3,9 +3,12 @@
3
3
  // Commands that look up a script or a `bkit` setting need to tell "no file" and
4
4
  // "file is not JSON" apart from "key absent", so a broken manifest is named in the
5
5
  // message instead of reading as an empty one.
6
+ //
7
+ // `readInstallingVersion` reads the same file for the bkit package doing the install.
6
8
  import * as fs from "node:fs";
7
9
  import * as path from "node:path";
8
10
  import { parseJson } from "./json.js";
11
+ import { getPkgRoot } from "./package-roots.js";
9
12
  /** `dir/package.json` as an object, or why it could not be read as one. */
10
13
  export function readPackageJson(dir) {
11
14
  const file = path.join(dir, "package.json");
@@ -20,3 +23,61 @@ export function readPackageJson(dir) {
20
23
  }
21
24
  return { ok: true, pkg: parsed.value };
22
25
  }
26
+ /** Every dependency name across the four `package.json` dependency fields; `[]` when unreadable. */
27
+ export function readDependencyNames(cwd) {
28
+ const read = readPackageJson(cwd);
29
+ if (!read.ok)
30
+ return [];
31
+ const names = [];
32
+ for (const field of [
33
+ "dependencies",
34
+ "devDependencies",
35
+ "optionalDependencies",
36
+ "peerDependencies",
37
+ ]) {
38
+ const deps = read.pkg[field];
39
+ if (deps && typeof deps === "object") {
40
+ names.push(...Object.keys(deps));
41
+ }
42
+ }
43
+ return names;
44
+ }
45
+ /**
46
+ * The spec `package.json` declares for dependency `name` (`"^5.2.0"`, `"file:../x.tgz"`, …),
47
+ * from `dependencies`, `devDependencies` or `optionalDependencies`; `null` when undeclared or
48
+ * the file is unreadable.
49
+ */
50
+ export function readDependencySpec(cwd, name) {
51
+ const read = readPackageJson(cwd);
52
+ if (!read.ok)
53
+ return null;
54
+ for (const field of ["dependencies", "devDependencies", "optionalDependencies"]) {
55
+ const deps = read.pkg[field];
56
+ if (deps && typeof deps === "object") {
57
+ const spec = deps[name];
58
+ if (typeof spec === "string")
59
+ return spec;
60
+ }
61
+ }
62
+ return null;
63
+ }
64
+ /**
65
+ * The version of the bkit package doing the install, read from that package's own
66
+ * `package.json` (`root` defaults to the package root; never the consumer's file).
67
+ * Throws when the file is missing, is not a JSON object, or has no non-empty string
68
+ * `version`: the value is stamped into every managed file and the `.bkit/version` pin,
69
+ * so a damaged package stops the command instead of writing a guessed version.
70
+ */
71
+ export function readInstallingVersion(root = getPkgRoot()) {
72
+ const file = path.join(root, "package.json");
73
+ const read = readPackageJson(root);
74
+ if (!read.ok) {
75
+ const state = read.reason === "missing" ? "is missing" : "is not a JSON object";
76
+ throw new Error(`bkit's own package.json ${state} (${file}); reinstall @cbartens/bkit.`);
77
+ }
78
+ const version = read.pkg["version"];
79
+ if (typeof version !== "string" || version === "") {
80
+ throw new Error(`bkit's own package.json has no string "version" (${file}); reinstall @cbartens/bkit.`);
81
+ }
82
+ return version;
83
+ }
@@ -132,11 +132,3 @@ export function getHooksRoot() {
132
132
  export function getBkitDocsRoot() {
133
133
  return path.join(getCoreRoot(), ".bkit");
134
134
  }
135
- // ---------------------------------------------------------------------------
136
- // isDogfood — true when bkit is running inside its own repo (in-repo install).
137
- // In this case the source tree IS the consumer's .agents/ directory, so any
138
- // payload copy would overwrite the source with itself.
139
- // ---------------------------------------------------------------------------
140
- export function isDogfood() {
141
- return getPkgRoot() === process.cwd();
142
- }