@cbartens/bkit 6.1.0 → 6.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 (317) hide show
  1. package/.bkit/README.md +14 -12
  2. package/.bkit/core/.agents/docs.md +1 -11
  3. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-gateguard.cjs +30 -9
  4. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +25 -27
  5. package/.bkit/core/.agents/rules.md +22 -9
  6. package/.bkit/core/.bkit/README.md +13 -11
  7. package/.bkit/core/.bkit/authoring.md +58 -13
  8. package/.bkit/core/.bkit/cli.md +43 -33
  9. package/.bkit/core/.bkit/cloud.md +93 -30
  10. package/.bkit/core/.bkit/install.md +55 -16
  11. package/.bkit/core/.bkit/jsonl.md +24 -7
  12. package/.bkit/core/.bkit/pipeline.md +8 -8
  13. package/.bkit/core/.bkit/prompts.md +160 -43
  14. package/.bkit/core/.bkit/providers.md +99 -36
  15. package/.bkit/core/.bkit/templates.md +167 -37
  16. package/.bkit/core/.bkit/trackers.md +39 -6
  17. package/.bkit/core/.bkit/workflows.md +344 -136
  18. package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +50 -27
  19. package/.bkit/core/.claude/hooks/bkit-preflight.sh +11 -11
  20. package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +13 -8
  21. package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +14 -25
  22. package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +20 -9
  23. package/.bkit/core/.cursor/hooks/bkit-preflight.sh +8 -8
  24. package/.bkit/core/.opencode/plugin/bkit-gateguard.js +14 -4
  25. package/.bkit/core/.opencode/plugin/bkit-guardrails.js +114 -0
  26. package/.bkit/core/docs/templates/bkit-audit-accessibility.md +1 -1
  27. package/.bkit/core/docs/templates/bkit-audit-adoption.md +30 -6
  28. package/.bkit/core/docs/templates/bkit-audit-agents.md +1 -1
  29. package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +1 -1
  30. package/.bkit/core/docs/templates/bkit-audit-analytics.md +1 -1
  31. package/.bkit/core/docs/templates/bkit-audit-annotations.md +1 -1
  32. package/.bkit/core/docs/templates/bkit-audit-app-performance.md +1 -1
  33. package/.bkit/core/docs/templates/bkit-audit-app-store.md +1 -1
  34. package/.bkit/core/docs/templates/bkit-audit-architecture.md +1 -1
  35. package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +2 -2
  36. package/.bkit/core/docs/templates/bkit-audit-config.md +3 -2
  37. package/.bkit/core/docs/templates/bkit-audit-cost.md +1 -1
  38. package/.bkit/core/docs/templates/bkit-audit-coverage.md +1 -1
  39. package/.bkit/core/docs/templates/bkit-audit-database.md +3 -3
  40. package/.bkit/core/docs/templates/bkit-audit-dead-code.md +1 -1
  41. package/.bkit/core/docs/templates/bkit-audit-deferrals.md +1 -1
  42. package/.bkit/core/docs/templates/bkit-audit-dependencies.md +3 -3
  43. package/.bkit/core/docs/templates/bkit-audit-documentation.md +32 -2
  44. package/.bkit/core/docs/templates/bkit-audit-duplication.md +1 -1
  45. package/.bkit/core/docs/templates/bkit-audit-failures.md +1 -1
  46. package/.bkit/core/docs/templates/bkit-audit-flakes.md +2 -2
  47. package/.bkit/core/docs/templates/bkit-audit-gates.md +5 -3
  48. package/.bkit/core/docs/templates/bkit-audit-issues.md +1 -1
  49. package/.bkit/core/docs/templates/bkit-audit-llm.md +2 -2
  50. package/.bkit/core/docs/templates/bkit-audit-logs.md +1 -1
  51. package/.bkit/core/docs/templates/bkit-audit-models.md +2 -2
  52. package/.bkit/core/docs/templates/bkit-audit-privacy.md +1 -1
  53. package/.bkit/core/docs/templates/bkit-audit-prompts.md +1 -1
  54. package/.bkit/core/docs/templates/bkit-audit-red-team.md +2 -2
  55. package/.bkit/core/docs/templates/bkit-audit-reliability.md +3 -2
  56. package/.bkit/core/docs/templates/bkit-audit-repo.md +1 -1
  57. package/.bkit/core/docs/templates/bkit-audit-security.md +1 -1
  58. package/.bkit/core/docs/templates/bkit-audit-slop.md +1 -1
  59. package/.bkit/core/docs/templates/bkit-audit-testing.md +3 -2
  60. package/.bkit/core/docs/templates/bkit-audit-usability.md +1 -1
  61. package/.bkit/core/docs/templates/bkit-plan.md +38 -8
  62. package/.bkit/core/engine/checks/after/auth.ts +118 -47
  63. package/.bkit/core/engine/checks/after/github.ts +161 -37
  64. package/.bkit/core/engine/checks/after/index.ts +18 -3
  65. package/.bkit/core/engine/checks/after/tools.ts +245 -1
  66. package/.bkit/core/engine/checks/before/files.ts +59 -1
  67. package/.bkit/core/engine/checks/before/index.ts +8 -0
  68. package/.bkit/core/engine/checks/status-holes.ts +20 -26
  69. package/.bkit/core/engine/checks/tips/catalogue.ts +107 -10
  70. package/.bkit/core/engine/checks/tips/detect.ts +36 -3
  71. package/.bkit/core/engine/checks/tips/index.ts +1 -1
  72. package/.bkit/core/engine/cli.ts +13 -13
  73. package/.bkit/core/engine/commands/ci/ci.ts +124 -19
  74. package/.bkit/core/engine/commands/ci/push-gate.ts +101 -43
  75. package/.bkit/core/engine/commands/install/doctor.ts +5 -5
  76. package/.bkit/core/engine/commands/install/install.ts +28 -25
  77. package/.bkit/core/engine/commands/install/uninstall.ts +42 -30
  78. package/.bkit/core/engine/commands/install/upgrade.ts +14 -2
  79. package/.bkit/core/engine/commands/land.ts +2 -3
  80. package/.bkit/core/engine/commands/lib.ts +394 -39
  81. package/.bkit/core/engine/commands/registry.ts +1 -1
  82. package/.bkit/core/engine/commands/workflow/branches.ts +351 -78
  83. package/.bkit/core/engine/commands/workflow/challenge.ts +63 -14
  84. package/.bkit/core/engine/commands/workflow/context.ts +71 -10
  85. package/.bkit/core/engine/commands/workflow/counters.ts +298 -23
  86. package/.bkit/core/engine/commands/workflow/decisions.ts +260 -125
  87. package/.bkit/core/engine/commands/workflow/disk.ts +2 -1
  88. package/.bkit/core/engine/commands/workflow/feature-base.ts +66 -0
  89. package/.bkit/core/engine/commands/workflow/issues.ts +312 -17
  90. package/.bkit/core/engine/commands/workflow/junit.ts +204 -0
  91. package/.bkit/core/engine/commands/workflow/ledgers.ts +904 -99
  92. package/.bkit/core/engine/commands/workflow/locks.ts +186 -29
  93. package/.bkit/core/engine/commands/workflow/loops.ts +87 -0
  94. package/.bkit/core/engine/commands/workflow/open-decision.ts +251 -0
  95. package/.bkit/core/engine/commands/workflow/plan-blocks.ts +8 -0
  96. package/.bkit/core/engine/commands/workflow/plans.ts +1 -1
  97. package/.bkit/core/engine/commands/workflow/prs.ts +311 -16
  98. package/.bkit/core/engine/commands/workflow/repo.ts +1 -1
  99. package/.bkit/core/engine/commands/workflow/run-facts.ts +6 -0
  100. package/.bkit/core/engine/commands/workflow/runs.ts +877 -174
  101. package/.bkit/core/engine/commands/workflow/runtime.ts +12 -4
  102. package/.bkit/core/engine/commands/workflow/status.ts +324 -11
  103. package/.bkit/core/engine/commands/workflow/step-table.ts +41 -15
  104. package/.bkit/core/engine/commands/workflow/steps.ts +604 -29
  105. package/.bkit/core/engine/commands/workflow/summary-findings.ts +1 -1
  106. package/.bkit/core/engine/commands/workflow/summary.ts +314 -8
  107. package/.bkit/core/engine/commands/workflow/tasks.ts +400 -27
  108. package/.bkit/core/engine/commands/workflow/tests-base.ts +319 -0
  109. package/.bkit/core/engine/commands/workflow/tests-changed.ts +138 -74
  110. package/.bkit/core/engine/commands/workflow/tests-jump.ts +93 -0
  111. package/.bkit/core/engine/commands/workflow/tests.ts +815 -182
  112. package/.bkit/core/engine/commands/workflow/tracker.ts +1134 -137
  113. package/.bkit/core/engine/commands/workflow/workflows.ts +100 -72
  114. package/.bkit/core/engine/commands/workflow/worktrees.ts +421 -57
  115. package/.bkit/core/engine/install/cloud-env.ts +38 -10
  116. package/.bkit/core/engine/install/managed-block.ts +105 -0
  117. package/.bkit/core/engine/install/manifest.ts +7 -1
  118. package/.bkit/core/engine/install/modules/claude.ts +6 -2
  119. package/.bkit/core/engine/install/modules/cloud.ts +84 -95
  120. package/.bkit/core/engine/install/modules/codex.ts +10 -2
  121. package/.bkit/core/engine/install/modules/core.ts +202 -26
  122. package/.bkit/core/engine/install/modules/opencode.ts +18 -23
  123. package/.bkit/core/engine/install/network-allowlist.ts +8 -3
  124. package/.bkit/core/engine/install/project-docs.ts +650 -0
  125. package/.bkit/core/engine/install/template-copies.ts +58 -5
  126. package/.bkit/core/engine/install/write.ts +128 -7
  127. package/.bkit/core/engine/ledgers/journal.ts +18 -10
  128. package/.bkit/core/engine/ledgers/migrate.ts +20 -8
  129. package/.bkit/core/engine/ledgers/status.ts +604 -8
  130. package/.bkit/core/engine/ledgers/telemetry.ts +115 -13
  131. package/.bkit/core/engine/render/trackers.ts +46 -11
  132. package/.bkit/core/engine/shared/package-manager.ts +7 -3
  133. package/.bkit/core/engine/shared/settings.ts +12 -1
  134. package/.bkit/core/engine/shared/text.ts +14 -0
  135. package/.bkit/core/engine/tools/instructions-sources.ts +1 -0
  136. package/.bkit/core/engine/tools/instructions.ts +116 -20
  137. package/.bkit/core/hooks/antigravity-hook.js +20 -4
  138. package/.bkit/core/hooks/gateguard-edit-payload.js +8 -5
  139. package/.bkit/core/hooks/gateguard-engine.js +249 -23
  140. package/.bkit/core/hooks/guardrails-deny.js +167 -0
  141. package/.bkit/core/hooks/guardrails-read.js +3 -3
  142. package/.bkit/core/hooks/guardrails-shell.js +1122 -167
  143. package/.bkit/core/hooks/guardrails-tiers.js +247 -176
  144. package/.bkit/core/hooks/preflight-tracker.sh +219 -0
  145. package/.bkit/core/prompts/bkit-audit-generate.md +23 -6
  146. package/.bkit/core/prompts/bkit-build-challenge-1.md +5 -4
  147. package/.bkit/core/prompts/bkit-build-challenge-2.md +6 -5
  148. package/.bkit/core/prompts/bkit-build-install-skills.md +2 -2
  149. package/.bkit/core/prompts/bkit-build-plan-convert.md +21 -7
  150. package/.bkit/core/prompts/bkit-build-plan-current.md +5 -4
  151. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +22 -17
  152. package/.bkit/core/prompts/bkit-build-plan-tasks.md +16 -12
  153. package/.bkit/core/prompts/bkit-build-plan-tests.md +14 -10
  154. package/.bkit/core/prompts/bkit-build-plan-verify.md +21 -8
  155. package/.bkit/core/prompts/bkit-debug-abort-handover.md +10 -5
  156. package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +22 -6
  157. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +19 -3
  158. package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +22 -6
  159. package/.bkit/core/prompts/bkit-debug-failure-soak.md +10 -7
  160. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +3 -3
  161. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +4 -4
  162. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +3 -3
  163. package/.bkit/core/prompts/bkit-design-generate.md +6 -4
  164. package/.bkit/core/prompts/bkit-design-organise.md +4 -3
  165. package/.bkit/core/prompts/bkit-design-review-1.md +5 -4
  166. package/.bkit/core/prompts/bkit-design-review-2.md +6 -5
  167. package/.bkit/core/prompts/bkit-design-spike.md +4 -3
  168. package/.bkit/core/prompts/bkit-design-update.md +6 -4
  169. package/.bkit/core/prompts/bkit-plan-generate.md +35 -14
  170. package/.bkit/core/prompts/bkit-plan-review-1.md +9 -7
  171. package/.bkit/core/prompts/bkit-plan-review-2.md +9 -7
  172. package/.bkit/core/prompts/bkit-plan-scope-check.md +8 -6
  173. package/.bkit/core/prompts/bkit-plan-update.md +22 -8
  174. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +11 -8
  175. package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +9 -5
  176. package/.bkit/core/prompts/bkit-ship-update-docs.md +26 -4
  177. package/.bkit/core/prompts/bkit-utility-compress-markdown.md +3 -3
  178. package/.bkit/core/prompts/bkit-utility-update-decisions.md +10 -7
  179. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +8 -5
  180. package/.bkit/core/prompts/bkit-utility-update-documentation.md +31 -7
  181. package/.bkit/core/prompts/bkit-utility-update-failures.md +8 -5
  182. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +10 -7
  183. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +4 -4
  184. package/.bkit/core/prompts/bkit-utility-update-tracker.md +4 -4
  185. package/.bkit/core/workflows/bkit-auto.md +23 -11
  186. package/.bkit/core/workflows/bkit-build.md +331 -100
  187. package/.bkit/core/workflows/bkit-debug.md +135 -64
  188. package/.bkit/core/workflows/bkit-design.md +58 -32
  189. package/.bkit/core/workflows/bkit-plan.md +73 -45
  190. package/.bkit/core/workflows/bkit-ship.md +233 -167
  191. package/.bkit/shared/.agents/plugins/bkit/hooks.json +1 -1
  192. package/.bkit/shared/.bkit/.env.example +5 -0
  193. package/.bkit/shared/.claude/bkit-cloud.md +7 -7
  194. package/.bkit/shared/.claude/settings.json +5 -1
  195. package/.bkit/shared/.cursor/bkit-cloud.md +1 -1
  196. package/.bkit/shared/.cursor/hooks.json +1 -1
  197. package/.bkit/shared/.opencode/opencode.json +11 -2
  198. package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +27 -0
  199. package/.bkit/templates/.cursor/Dockerfile +7 -7
  200. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +1 -1
  201. package/.bkit/templates/.github/dependabot.yml +5 -0
  202. package/.bkit/templates/.github/renovate.json5 +5 -3
  203. package/.bkit/templates/.github/workflows/bkit-ci.yml +11 -11
  204. package/.bkit/templates/.github/workflows/bkit-cloud.yml +525 -161
  205. package/.bkit/templates/.github/workflows/bkit-renovate.yml +2 -2
  206. package/.bkit/templates/.husky/pre-push +123 -6
  207. package/.bkit/templates/context/bkit-serena.md +1 -1
  208. package/.bkit/templates/context/bkit-vercel.md +103 -59
  209. package/.bkit/templates/docs/architecture.md +98 -0
  210. package/.bkit/templates/docs/capabilities.md +33 -37
  211. package/.bkit/templates/docs/components.md +142 -0
  212. package/.bkit/templates/docs/data-schema.md +87 -0
  213. package/.bkit/{shared → templates}/docs/deployments.md +128 -142
  214. package/.bkit/templates/docs/design.md +117 -0
  215. package/.bkit/templates/docs/noise.md +54 -0
  216. package/.bkit/templates/docs/observability.md +99 -0
  217. package/.bkit/templates/docs/security.md +137 -0
  218. package/.bkit/templates/docs/setup.md +93 -0
  219. package/.bkit/templates/docs/technology.md +70 -0
  220. package/.bkit/{shared → templates}/docs/testing.md +200 -87
  221. package/.bkit/templates/scripts/ci/bkit-check-accepted-divergences.mjs +1 -6
  222. package/.bkit/templates/scripts/ci/bkit-machine-lock.sh +511 -103
  223. package/.bkit/templates/scripts/ci/bkit-test-awake.mjs +314 -28
  224. package/.bkit/templates/scripts/ci/bkit-test-awake.test.mjs +500 -1
  225. package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +1 -1
  226. package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +91 -62
  227. package/.bkit/templates/scripts/graphify/bkit-graphify.sh +59 -11
  228. package/.bkit/templates/slop-scan.config.json +2 -0
  229. package/CHANGELOG.md +79 -0
  230. package/DETAILS.md +661 -0
  231. package/README.md +73 -604
  232. package/dist/checks/after/auth.js +114 -46
  233. package/dist/checks/after/github.js +138 -35
  234. package/dist/checks/after/index.js +16 -4
  235. package/dist/checks/after/tools.js +224 -1
  236. package/dist/checks/before/files.js +59 -1
  237. package/dist/checks/before/index.js +7 -1
  238. package/dist/checks/status-holes.js +20 -21
  239. package/dist/checks/tips/catalogue.js +99 -10
  240. package/dist/checks/tips/detect.js +35 -3
  241. package/dist/checks/tips/index.js +1 -1
  242. package/dist/cli.js +13 -13
  243. package/dist/commands/ci/ci.js +113 -20
  244. package/dist/commands/ci/push-gate.js +79 -44
  245. package/dist/commands/install/doctor.js +5 -5
  246. package/dist/commands/install/install.js +23 -22
  247. package/dist/commands/install/uninstall.js +36 -30
  248. package/dist/commands/install/upgrade.js +10 -2
  249. package/dist/commands/land.js +2 -3
  250. package/dist/commands/lib.js +323 -25
  251. package/dist/commands/workflow/branches.js +312 -72
  252. package/dist/commands/workflow/challenge.js +66 -13
  253. package/dist/commands/workflow/context.js +46 -10
  254. package/dist/commands/workflow/counters.js +231 -23
  255. package/dist/commands/workflow/decisions.js +221 -106
  256. package/dist/commands/workflow/disk.js +2 -1
  257. package/dist/commands/workflow/feature-base.js +60 -0
  258. package/dist/commands/workflow/issues.js +243 -15
  259. package/dist/commands/workflow/junit.js +137 -0
  260. package/dist/commands/workflow/ledgers.js +726 -112
  261. package/dist/commands/workflow/locks.js +150 -29
  262. package/dist/commands/workflow/loops.js +67 -0
  263. package/dist/commands/workflow/open-decision.js +199 -0
  264. package/dist/commands/workflow/plan-blocks.js +6 -0
  265. package/dist/commands/workflow/plans.js +1 -1
  266. package/dist/commands/workflow/prs.js +272 -16
  267. package/dist/commands/workflow/repo.js +1 -1
  268. package/dist/commands/workflow/run-facts.js +6 -0
  269. package/dist/commands/workflow/runs.js +747 -155
  270. package/dist/commands/workflow/runtime.js +8 -4
  271. package/dist/commands/workflow/status.js +259 -13
  272. package/dist/commands/workflow/step-table.js +41 -15
  273. package/dist/commands/workflow/steps.js +530 -26
  274. package/dist/commands/workflow/summary-findings.js +1 -1
  275. package/dist/commands/workflow/summary.js +289 -8
  276. package/dist/commands/workflow/tasks.js +294 -27
  277. package/dist/commands/workflow/tests-base.js +266 -0
  278. package/dist/commands/workflow/tests-changed.js +130 -56
  279. package/dist/commands/workflow/tests-jump.js +77 -0
  280. package/dist/commands/workflow/tests.js +608 -131
  281. package/dist/commands/workflow/tracker.js +920 -112
  282. package/dist/commands/workflow/workflows.js +80 -59
  283. package/dist/commands/workflow/worktrees.js +387 -58
  284. package/dist/install/cloud-env.js +32 -10
  285. package/dist/install/managed-block.js +101 -0
  286. package/dist/install/manifest.js +7 -1
  287. package/dist/install/modules/claude.js +6 -2
  288. package/dist/install/modules/cloud.js +73 -86
  289. package/dist/install/modules/codex.js +9 -2
  290. package/dist/install/modules/core.js +190 -27
  291. package/dist/install/modules/opencode.js +18 -23
  292. package/dist/install/network-allowlist.js +8 -3
  293. package/dist/install/project-docs.js +551 -0
  294. package/dist/install/template-copies.js +55 -5
  295. package/dist/install/write.js +117 -5
  296. package/dist/ledgers/journal.js +10 -8
  297. package/dist/ledgers/migrate.js +20 -9
  298. package/dist/ledgers/status.js +461 -8
  299. package/dist/ledgers/telemetry.js +71 -13
  300. package/dist/render/trackers.js +21 -12
  301. package/dist/shared/package-manager.js +7 -2
  302. package/dist/shared/settings.js +8 -0
  303. package/dist/shared/text.js +13 -0
  304. package/dist/tools/instructions-sources.js +1 -0
  305. package/dist/tools/instructions.js +97 -24
  306. package/package.json +23 -15
  307. package/.bkit/core/hooks/preflight-linear.sh +0 -73
  308. package/.bkit/shared/docs/architecture.md +0 -16
  309. package/.bkit/shared/docs/data-schema.md +0 -16
  310. package/.bkit/shared/docs/design.md +0 -38
  311. package/.bkit/shared/docs/noise.md +0 -20
  312. package/.bkit/shared/docs/observability.md +0 -22
  313. package/.bkit/shared/docs/security.md +0 -62
  314. package/.bkit/shared/docs/setup.md +0 -52
  315. package/.bkit/shared/docs/technology.md +0 -15
  316. /package/.bkit/templates/{.lintstagedrc.json → lintstagedrc.example.json} +0 -0
  317. /package/.bkit/templates/{.prettierignore → prettierignore.example} +0 -0
@@ -6,13 +6,14 @@ import * as path from "node:path";
6
6
  import { writeTier1, writeTier2, ensurePackageJsonScripts } from "../write.js";
7
7
  import { readBkitVersion, writeBkitVersion, hashFile, mergeCanonicalHashes, sha256, } from "../version-file.js";
8
8
  import { extractManagedBlock, findLineAnchoredMarkers, selectMarkers, stripManagedBlock, } from "../managed-block.js";
9
- import { listFilesRecursive, syncTemplateCopies } from "../template-copies.js";
9
+ import { listFilesRecursive, warnMissingLintStagedConfig, syncTemplateCopies, } from "../template-copies.js";
10
10
  import { PAYLOAD_LINK_RELPATHS, syncPayloadLinks } from "../payload-links.js";
11
11
  import { writeNetworkAllowlist } from "../network-allowlist.js";
12
12
  import { migrateContextCiWorkflow } from "../context-ci-workflow.js";
13
13
  import { migrateTemplateNotes } from "../template-notes.js";
14
14
  import { isAdvisorySuppressed } from "../../checks/after/suppression.js";
15
15
  import { parseJson, readJsonFile } from "../../shared/json.js";
16
+ import { compareSemver } from "../../shared/bkit-latest.js";
16
17
  import { readInstallingVersion } from "../../shared/package-json.js";
17
18
  import { detectDepUpdater } from "../../shared/dep-updater.js";
18
19
  import { ASK_POINTS, CONFIG_DEFAULTS, ciWorkflowPath, limitKey } from "../../shared/settings.js";
@@ -145,8 +146,8 @@ export function listCoreTemplateFiles(root = getCoreRoot()) {
145
146
  }
146
147
  /**
147
148
  * The shared payload files core writes, sourced from `root` (defaults to the
148
- * resolved shared root): the `docs/*.md` managed blocks and the two shared-root
149
- * files the core manifest owns.
149
+ * resolved shared root): the two shared-root files the core manifest owns. The ten project
150
+ * documents are copy-and-own starters under `templates/docs/`, never written here.
150
151
  */
151
152
  export function listSharedTemplateFiles(root = getSharedRoot()) {
152
153
  const out = [];
@@ -155,14 +156,6 @@ export function listSharedTemplateFiles(root = getSharedRoot()) {
155
156
  if (fs.existsSync(src))
156
157
  out.push({ src, dst, scope: "block", marker: "html-comment" });
157
158
  }
158
- for (const name of listMdFiles(path.join(root, "docs"))) {
159
- out.push({
160
- src: path.join(root, "docs", name),
161
- dst: path.join("docs", name),
162
- scope: "block",
163
- marker: "html-comment",
164
- });
165
- }
166
159
  return out;
167
160
  }
168
161
  function runCoreTemplates(dryRun, tokens, ws, logPrefix) {
@@ -259,6 +252,7 @@ export function runBkitDocs(dryRun, tokens, ws, logPrefix) {
259
252
  migrateTemplateNotes(dryRun, ws, logPrefix);
260
253
  migrateContextCiWorkflow(dryRun, ws, logPrefix);
261
254
  migrateSlopTypeSuppression(dryRun, ws, logPrefix);
255
+ migrateMachineLockCopy(dryRun, ws, logPrefix);
262
256
  const renames = migrateBrandedTemplateFiles(dryRun, ws, logPrefix);
263
257
  migrateBrandedFileTokens(dryRun, ws, logPrefix, renames);
264
258
  migrateBrandedCheckNames(dryRun, ws, logPrefix, tokens.DEFAULT_BRANCH);
@@ -477,6 +471,9 @@ export function seedCorePackageJsonScripts(ctx) {
477
471
  if (pruneMinPushPaths(dryRun, ws, logPrefix) && !written.includes("package.json")) {
478
472
  written.push("package.json");
479
473
  }
474
+ if (lowerVerifyMaxAttempts(dryRun, ws, logPrefix) && !written.includes("package.json")) {
475
+ written.push("package.json");
476
+ }
480
477
  if (seedBkitDefaults(dryRun, ws, logPrefix) && !written.includes("package.json")) {
481
478
  written.push("package.json");
482
479
  }
@@ -512,7 +509,7 @@ export const SEEDED_BKIT_DEFAULTS = {
512
509
  cloud: { agent: "" },
513
510
  providers: { opencode: { default: "", installed: [] } },
514
511
  testing: {
515
- // What bkit writes (ship's bookkeeping allow-list, the plans tree) is always a min push;
512
+ // What bkit writes (ship's bookkeeping allow-list, the plans tree, docs/audits/**) is always a min push;
516
513
  // the seed adds nothing, because a project doc can be a test's input.
517
514
  minPushPaths: [...CONFIG_DEFAULTS.minPushPaths],
518
515
  ciWorkflow: CONFIG_DEFAULTS.ciWorkflow,
@@ -692,6 +689,89 @@ function migrateSlopTypeSuppression(dryRun, ws, logPrefix) {
692
689
  ws.writes.push({ path: file, action: "update", unhashed: true });
693
690
  console.log(`${logPrefix} ${tag}core: ${file} — slop plugin updated`);
694
691
  }
692
+ // sha256 of every released scripts/ci/bkit-machine-lock.sh text older than the current template (6.1.0, 6.1.1).
693
+ const SHIPPED_MACHINE_LOCK_HASHES = [
694
+ "63ee5873795fd06b60e1f13c238c9e3c44d9f6dc76a50fe271793de6ad284e87",
695
+ ];
696
+ // Migration (6.1.0-6.2.x installs, docs/migrations.md): replace an unedited adopted machine-lock
697
+ // copy with the current template; warn about an edited copy that lacks the queue, never writes
698
+ // the status file or has no hold limit. A copy that starts bkit-test-awake.mjs gets that file
699
+ // beside it (see `migrateHoldSupervisor`).
700
+ function migrateMachineLockCopy(dryRun, ws, logPrefix) {
701
+ const file = path.join("scripts", "ci", "bkit-machine-lock.sh");
702
+ const stat = fs.lstatSync(file, { throwIfNoEntry: false });
703
+ if (!stat)
704
+ return;
705
+ const tag = dryRun ? "[dry-run] " : "";
706
+ const templatePath = ".bkit/templates/scripts/ci/bkit-machine-lock.sh";
707
+ const outOfOrder = "waiting runs take the lock out of arrival order";
708
+ const manual = (reason, until = outOfOrder) => {
709
+ console.warn(`${logPrefix} ${tag}core: ${file} left unchanged (${reason}); merge ${templatePath} by hand, until then ${until}`);
710
+ };
711
+ if (linkedPath(file) || !stat.isFile()) {
712
+ manual("the path is not a regular file or sits under a symlink");
713
+ return;
714
+ }
715
+ const current = fs.readFileSync(file);
716
+ const template = fs.readFileSync(path.join(getTemplatesRoot(), "scripts", "ci", "bkit-machine-lock.sh"));
717
+ const text = current.toString("utf8");
718
+ if (current.equals(template)) {
719
+ migrateHoldSupervisor(dryRun, ws, logPrefix);
720
+ return;
721
+ }
722
+ if (SHIPPED_MACHINE_LOCK_HASHES.includes(sha256(current))) {
723
+ if (!dryRun)
724
+ fs.writeFileSync(file, template);
725
+ ws.writes.push({ path: file, action: "update", unhashed: true });
726
+ console.log(`${logPrefix} ${tag}core: ${file} — machine lock updated to the current template`);
727
+ migrateHoldSupervisor(dryRun, ws, logPrefix);
728
+ return;
729
+ }
730
+ if (text.includes("bkit-test-awake.mjs"))
731
+ migrateHoldSupervisor(dryRun, ws, logPrefix);
732
+ if (!text.includes(".queue"))
733
+ manual("the copy differs from the shipped version");
734
+ if (!text.includes("LOCAL_STACK_LOCK_STATUS_FILE"))
735
+ manual("the copy never writes LOCAL_STACK_LOCK_STATUS_FILE", "a lock wait that gives up reads as a gate failure (exit 1) instead of exit 81");
736
+ if (!text.includes("LOCAL_STACK_LOCK_HOLD_S"))
737
+ manual("the copy has no LOCAL_STACK_LOCK_HOLD_S hold limit", "a hung run holds the tests lock until someone stops it by hand");
738
+ }
739
+ // sha256 of every scripts/ci/bkit-test-awake.mjs template text in history older than the current one.
740
+ const SHIPPED_AWAKE_HASHES = [
741
+ "d218439bd4d65b57732a96aaea7bb678f9ebf95a6247f5e6b899d6ef26a59cb5",
742
+ "a686bf75700f2ff54de2cedd3b7afc943774da40a68c243b9911bc435742f434",
743
+ "0842c2e2789a1c77935655130de5b8cf253bfe0655407834f23a6abaaf1b0bb1",
744
+ "0dce1b50638cd609183a871ed8d0d9e3d20c545073f0a32f18526d6f38b5b748",
745
+ ];
746
+ // The machine-lock script runs a command holding its own tests lock under
747
+ // scripts/ci/bkit-test-awake.mjs --hold-s: write the template there when the file is missing,
748
+ // replace an unedited shipped copy, and warn about an edited copy without --hold-s, since the
749
+ // lock script refuses every such run with exit 73.
750
+ function migrateHoldSupervisor(dryRun, ws, logPrefix) {
751
+ const file = path.join("scripts", "ci", "bkit-test-awake.mjs");
752
+ const tag = dryRun ? "[dry-run] " : "";
753
+ const template = path.join(getTemplatesRoot(), "scripts", "ci", "bkit-test-awake.mjs");
754
+ if (!fs.lstatSync(file, { throwIfNoEntry: false })) {
755
+ if (!dryRun)
756
+ fs.copyFileSync(template, file);
757
+ ws.writes.push({ path: file, action: "write", unhashed: true });
758
+ console.log(`${logPrefix} ${tag}core: ${file} — added beside the machine lock, which runs its hold limit`);
759
+ return;
760
+ }
761
+ const stat = fs.statSync(file, { throwIfNoEntry: false });
762
+ if (stat?.isFile() &&
763
+ !linkedPath(file) &&
764
+ SHIPPED_AWAKE_HASHES.includes(sha256(fs.readFileSync(file)))) {
765
+ if (!dryRun)
766
+ fs.copyFileSync(template, file);
767
+ ws.writes.push({ path: file, action: "update", unhashed: true });
768
+ console.log(`${logPrefix} ${tag}core: ${file} — test sleep prevention updated to the current template`);
769
+ return;
770
+ }
771
+ if (stat?.isFile() && fs.readFileSync(file, "utf8").includes("--hold-s"))
772
+ return;
773
+ console.warn(`${logPrefix} ${tag}core: ${file} left unchanged (it has no --hold-s hold limit); merge .bkit/templates/scripts/ci/bkit-test-awake.mjs by hand, until then every run that holds the tests lock is refused with exit 73`);
774
+ }
695
775
  // Every `.github/workflows/*.yml` / `*.yaml` regular file outside `skip`.
696
776
  function otherWorkflows(skip) {
697
777
  const dir = path.join(".github", "workflows");
@@ -735,22 +815,66 @@ export function renameScriptTokens(text, renames) {
735
815
  return text.replace(re, (_m, flags, gap, old) => `pnpm${flags}${gap}${renames[old]}`);
736
816
  }
737
817
  /**
738
- * Each old script name still in `text`, with its 1-based line. A name without `:` (`graph`) is
739
- * a plain word, so it counts only after `pnpm` / `npm` / `yarn` / `bun` on the same line and
740
- * before any `#`.
818
+ * Old script invocations in shell commands or YAML run steps, with their 1-based lines.
819
+ * Quoted arguments and escaped hashes stay intact; shell comments end the command.
741
820
  */
742
821
  export function findOldScriptNames(text, renames) {
743
822
  const found = [];
744
- const lines = text.split("\n");
745
- for (const name of Object.keys(renames)) {
746
- const re = name.includes(":")
747
- ? new RegExp(`(?<![\\w:./-])${escapeRegExp(name)}(?![\\w:-])`)
748
- : new RegExp(`\\b(?:pnpm|npm|yarn|bun)\\b[^#\\n]*\\s${escapeRegExp(name)}(?![\\w:./-])`);
749
- lines.forEach((l, i) => {
750
- if (re.test(l))
751
- found.push({ line: i + 1, name });
752
- });
753
- }
823
+ text.split("\n").forEach((line, index) => {
824
+ const runStep = /^\s*(?:-\s*)?run:\s*/;
825
+ const command = runStep.test(line)
826
+ ? line
827
+ .replace(runStep, "")
828
+ .trim()
829
+ .replace(/^(['"])(.*)\1(?:\s+#.*)?$/, "$2")
830
+ : line;
831
+ const words = command.match(/(?:[^\s"'\\;&|()]+|\\.|"(?:\\.|[^"\\])*"|'[^']*')+|[;&|()]/g) ?? [];
832
+ const comment = words.findIndex((word) => word.startsWith("#"));
833
+ const tokens = comment < 0 ? words : words.slice(0, comment);
834
+ const names = new Set();
835
+ let commandStart = true;
836
+ for (let i = 0; i < tokens.length; i++) {
837
+ const token = tokens[i];
838
+ if (/^[;&|()]$/.test(token)) {
839
+ commandStart = true;
840
+ continue;
841
+ }
842
+ if (!commandStart)
843
+ continue;
844
+ if (/^(?:[A-Za-z_][A-Za-z_0-9]*=|env$|exec$|command$|corepack$|if$|then$|elif$|else$|do$|!$|--$)/.test(token))
845
+ continue;
846
+ commandStart = false;
847
+ if (/^(?:sh|bash|zsh)$/.test(token) && /^-[a-z]*c[a-z]*$/.test(tokens[i + 1] ?? "")) {
848
+ const body = tokens[i + 2]?.match(/^(['"])(.*)\1$/)?.[2];
849
+ if (body)
850
+ for (const { name } of findOldScriptNames(body, renames))
851
+ names.add(name);
852
+ }
853
+ if (!/^(pnpm|npm|yarn|bun)$/.test(token))
854
+ continue;
855
+ let script = i + 1;
856
+ let ran = false;
857
+ while (script < tokens.length) {
858
+ const arg = tokens[script];
859
+ if ((arg === "run" || (token === "npm" && arg === "run-script")) && !ran) {
860
+ ran = true;
861
+ script++;
862
+ }
863
+ else if (arg.startsWith("-")) {
864
+ const takesValue = /^(--filter|-F|--dir|-C|--prefix|--cwd|--workspace|--reporter)$/.test(arg) ||
865
+ (token === "npm" && arg === "-w");
866
+ script += takesValue ? 2 : 1;
867
+ }
868
+ else
869
+ break;
870
+ }
871
+ const name = tokens[script]?.replace(/^(['"])(.*)\1$/, "$2");
872
+ if (name && Object.hasOwn(renames, name))
873
+ names.add(name);
874
+ }
875
+ for (const name of names)
876
+ found.push({ line: index + 1, name });
877
+ });
754
878
  return found;
755
879
  }
756
880
  // Renames the old script keys in place (values kept), rewrites old `pnpm` tokens in every
@@ -1288,7 +1412,7 @@ export const BKIT_LAYOUT_MOVES = [
1288
1412
  ];
1289
1413
  // Migration (up to 6.0.x installs, `docs/migrations.md`): `bkit.testing.minPushPaths` was the
1290
1414
  // whole min-push list, so installs seeded and repos restated what bkit itself writes. The
1291
- // engine now always allows that floor (ship's bookkeeping allow-list, `docs/plans/**`) and
1415
+ // engine now always allows that floor (ship's bookkeeping allow-list, `docs/plans/**`, `docs/audits/**`) and
1292
1416
  // `bkit.testing.ciSkipPaths`; the setting only adds. Entries the floor already covers are
1293
1417
  // dropped from the list. Returns true when package.json changed.
1294
1418
  export const MIN_PUSH_FLOOR_ENTRIES = [
@@ -1323,6 +1447,44 @@ export function pruneMinPushPaths(dryRun, ws, logPrefix) {
1323
1447
  console.log(`${logPrefix} ${dryRun ? "[dry-run] " : ""}core: dropped [${dropped.join(", ")}] from bkit.testing.minPushPaths in package.json — bkit always allows what it writes, and ciSkipPaths counts`);
1324
1448
  return true;
1325
1449
  }
1450
+ const LAST_RELEASE_WITHOUT_VERIFY_CAP = "6.1.1";
1451
+ // Migration (up to 6.1.x installs, `docs/migrations.md`): `bkit.workflows.build.verify.maxAttempts`
1452
+ // is one non-resetting allowance per run, and every build limit is 2. A value above 2 is
1453
+ // lowered to 2 once, on the upgrade from an install that predates this release (no recorded
1454
+ // version, an unreadable one, or an older one); 2 or less is left alone, and a value set after
1455
+ // that upgrade is the consumer's. Returns true when package.json changed.
1456
+ export function lowerVerifyMaxAttempts(dryRun, ws, logPrefix) {
1457
+ const pkgPath = "package.json";
1458
+ if (!fs.existsSync(pkgPath))
1459
+ return false;
1460
+ const recorded = readBkitVersion(path.join(".bkit", "version"))?.pinnedVersion ?? "";
1461
+ // Skip a re-run of the same version, and any install recorded after the last release without
1462
+ // this migration, so a value set after the upgrade to this release is never lowered again.
1463
+ const order = compareSemver(recorded, readInstallingVersion());
1464
+ if (order === 0 || order === 1)
1465
+ return false;
1466
+ if (compareSemver(recorded, LAST_RELEASE_WITHOUT_VERIFY_CAP) === 1)
1467
+ return false;
1468
+ const raw = fs.readFileSync(pkgPath, "utf-8");
1469
+ const parsed = parseJson(raw);
1470
+ if (!parsed.ok)
1471
+ return false;
1472
+ const pkg = parsed.value;
1473
+ if (!plainObject(pkg.bkit) || !plainObject(pkg.bkit.workflows))
1474
+ return false;
1475
+ const build = pkg.bkit.workflows.build;
1476
+ if (!plainObject(build) || !plainObject(build.verify))
1477
+ return false;
1478
+ const old = build.verify.maxAttempts;
1479
+ if (typeof old !== "number" || old <= 2)
1480
+ return false;
1481
+ build.verify.maxAttempts = 2;
1482
+ ws.writes.push({ path: pkgPath, action: "update" });
1483
+ if (!dryRun)
1484
+ writePackageJsonLike(raw, pkg);
1485
+ console.log(`${logPrefix} ${dryRun ? "[dry-run] " : ""}core: lowered bkit.workflows.build.verify.maxAttempts from ${old} to 2 in package.json — the holistic allowance is one per run`);
1486
+ return true;
1487
+ }
1326
1488
  // Fill `into` with each `from` key it lacks, descending into blocks both sides hold.
1327
1489
  function mergeMissing(into, from) {
1328
1490
  for (const [k, v] of Object.entries(from)) {
@@ -1564,7 +1726,7 @@ export function detectGateAdvisories(cwd) {
1564
1726
  id: "test-file-script-missing",
1565
1727
  severity: "advisory",
1566
1728
  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.`,
1567
- 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.`,
1729
+ 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\njest reads a bare path as a regex, so a folder such as \`(tabs)\` matches no file: pass \`--runTestsByPath\`. Call 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.`,
1568
1730
  });
1569
1731
  }
1570
1732
  // A red recorded before the linter sees the test: a lint rewrite after it reads as an
@@ -1658,6 +1820,7 @@ export function runCoreModule(ctx) {
1658
1820
  console.log(`${logPrefix} ${tag}template ${verb}: ${path.join(TEMPLATE_COPIES_DIR, p)}`);
1659
1821
  }
1660
1822
  }
1823
+ warnMissingLintStagedConfig(cwd, logPrefix);
1661
1824
  // 3b3. Payload view links — `.bkit/core` + `.bkit/shared` symlinks into the
1662
1825
  // installed package (browse-only, gitignored; no-op in dogfood). A real
1663
1826
  // directory or file at either path is never clobbered (advisory); a platform
@@ -116,8 +116,9 @@ export function opencodeProviderEnvVar(providerKey) {
116
116
  * secret `env:` var. `bkit install --opencode=<provider>` rewrites neither; this advisory names
117
117
  * the hand-edit.
118
118
  *
119
- * bkit-cloud.yml runs `opencode run` against the committed `.opencode/` config and fans one
120
- * `OPENCODE_PROVIDER_KEY` secret out to every provider env var, so it is not checked.
119
+ * bkit-cloud.yml runs `opencode run` against the committed `.opencode/` config and passes
120
+ * the provider's `BKIT_` secret (`BKIT_OPENCODE_API_KEY`, `BKIT_OPENROUTER_API_KEY` or
121
+ * `BKIT_OLLAMA_API_KEY`) under its own env var name, so it is not checked.
121
122
  *
122
123
  * No-op when opencode.yml is absent. No equivalent check for claude.yml (provider-fixed to
123
124
  * Claude). Severity "advisory": never gates `bkit check`; surfaces on both check and postinstall.
@@ -174,7 +175,7 @@ export function detectOpencodeYmlProviderDrift(cwd) {
174
175
  " model: " +
175
176
  expectedPrefix +
176
177
  "/<model> # a model your provider serves (see .opencode/opencode.json)\n\n" +
177
- "Keep opencode.yml in sync with .opencode/opencode.json on every provider switch. (bkit-cloud.yml needs no such edit: it reads .opencode/ and fans OPENCODE_PROVIDER_KEY out to every provider env var.)",
178
+ "Keep opencode.yml in sync with .opencode/opencode.json on every provider switch. (bkit-cloud.yml needs no such edit: it reads .opencode/ and passes the provider's BKIT_ secret under its own name.)",
178
179
  };
179
180
  }
180
181
  // Sentinel values used in the opencode.json template for tracker-filtered mcp injection.
@@ -188,10 +189,8 @@ const OPENCODE_PROVIDER_BASE_URL_SENTINEL = "@@OPENCODE_PROVIDER_BASE_URL@@";
188
189
  * and fills in provider-specific fields.
189
190
  *
190
191
  * Also injects derived **allow** rules for {@link resolveNetworkAllowlist} so
191
- * context-fetch / provider hosts do not prompt on either fetch surface: `curl *{domain}*` /
192
- * `wget *{domain}*` after the template's `curl *` / `wget *` ask (OpenCode bash is
193
- * last-match-wins), and `*{domain}*` into the `permission.webfetch` URL map (after its
194
- * `"*": "ask"`). Adds `<server>_*` allows for the consumer's `mcp-servers` block.
192
+ * context-fetch / provider hosts do not prompt on the fetch tool: `*{domain}*` into the
193
+ * `permission.webfetch` URL map (after its `"*": "ask"`); shell fetches keep asking. Adds `<server>_*` allows for the consumer's `mcp-servers` block.
195
194
  */
196
195
  export function renderOpencodeJson(templatePath, tracker, provider, cwd = process.cwd()) {
197
196
  const raw = fs.readFileSync(templatePath, "utf-8");
@@ -280,12 +279,10 @@ export function renderOpencodeJson(templatePath, tracker, provider, cwd = proces
280
279
  * last-match-wins), and one `<server>_*` allow per declared MCP server — opencode names
281
280
  * MCP tools `<server>_<tool>` and matches permission keys as globs against the tool name.
282
281
  *
283
- * The allowlist is applied to BOTH fetch surfaces, so an allowlisted host does not prompt
284
- * whichever path the agent takes:
285
- * - fetch tool — `permission.webfetch` is a URL-keyed map (`{ "*": "ask" }` from the
286
- * template); opencode matches the resource against the URL, so `*{base}*` allows it;
287
- * - shell fetch — `permission.bash` gains `curl *{base}*` / `wget *{base}*` after the
288
- * template's `curl *` / `wget *` ask.
282
+ * Only the fetch tool gets derived allows: `permission.webfetch` is a URL-keyed map
283
+ * (`{ "*": "ask" }` from the template); opencode matches the resource against the URL, so
284
+ * `*{base}*` allows it (accepted risk, decision 551). Shell `curl` / `wget` keep the
285
+ * template's ask, because a glob over the command string also matches a host in a query.
289
286
  */
290
287
  function injectOpencodeDerivedAllows(parsed, cwd) {
291
288
  const permission = parsed.permission;
@@ -295,13 +292,6 @@ function injectOpencodeDerivedAllows(parsed, cwd) {
295
292
  permission[`${server}_*`] = "allow";
296
293
  }
297
294
  const bases = networkAllowlistBases(resolveNetworkAllowlist(cwd));
298
- if (typeof permission.bash === "object" && permission.bash !== null) {
299
- const bash = permission.bash;
300
- for (const base of bases) {
301
- bash[`curl *${base}*`] = "allow";
302
- bash[`wget *${base}*`] = "allow";
303
- }
304
- }
305
295
  // Fetch tool — opencode matches the webfetch resource against the requested URL.
306
296
  if (typeof permission.webfetch === "object" && permission.webfetch !== null) {
307
297
  const webfetch = permission.webfetch;
@@ -450,9 +440,14 @@ export function runOpencodeModule(ctx) {
450
440
  }
451
441
  }
452
442
  }
453
- // --- bkit-gateguard.js / bkit-readguard.js / bkit-rules.js — Tier-2 markered-text
454
- // (slash-comment); see install/manifest.ts ---
455
- for (const plugin of ["bkit-gateguard.js", "bkit-readguard.js", "bkit-rules.js"]) {
443
+ // --- bkit-gateguard.js / bkit-readguard.js / bkit-rules.js / bkit-guardrails.js — Tier-2
444
+ // markered-text (slash-comment); see install/manifest.ts ---
445
+ for (const plugin of [
446
+ "bkit-gateguard.js",
447
+ "bkit-readguard.js",
448
+ "bkit-rules.js",
449
+ "bkit-guardrails.js",
450
+ ]) {
456
451
  const opencodeCore = path.join(getCoreRoot(), ".opencode", "plugin");
457
452
  const pluginSrc = path.join(opencodeCore, plugin);
458
453
  const pluginDst = `.opencode/plugin/${plugin}`;
@@ -5,15 +5,20 @@
5
5
  // it exists for every host that reads it and `bkit check` reports it missing or stale.
6
6
  import * as fs from "node:fs";
7
7
  import * as path from "node:path";
8
- import { resolveNetworkAllowlist } from "./cloud-env.js";
8
+ import { egressFingerprint, resolveNetworkAllowlist } from "./cloud-env.js";
9
9
  import { readBkitVersion } from "./version-file.js";
10
10
  /** Consumer-relative path of the install-written curl/wget allowlist. */
11
11
  export const NETWORK_ALLOWLIST_RELPATH = path.join(".bkit", "allowlist.json");
12
12
  /** Where the cursor module wrote the allowlist up to 5.2.4 (migrated away). */
13
13
  export const RETIRED_NETWORK_ALLOWLIST_RELPATH = path.join(".cursor", "allowlist.json");
14
- /** The allowlist file body: `{ domains }`, apex + `*.` wildcard per base, sorted. */
14
+ /**
15
+ * The allowlist file body: `{ domains, fingerprint }` — `domains` is apex + `*.` wildcard
16
+ * per base, sorted; `fingerprint` is the 8-hex stamp of that list, which the cloud
17
+ * bootstrap compares with `BKIT_CLOUD_ALLOWLIST_FINGERPRINT`.
18
+ */
15
19
  export function renderNetworkAllowlist(cwd) {
16
- return JSON.stringify({ domains: resolveNetworkAllowlist(cwd) }, null, 2) + "\n";
20
+ const domains = resolveNetworkAllowlist(cwd);
21
+ return JSON.stringify({ domains, fingerprint: egressFingerprint(domains) }, null, 2) + "\n";
17
22
  }
18
23
  /**
19
24
  * Write `.bkit/allowlist.json` whole (hand edits do not survive — `allowed-domains` in