@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
@@ -19,7 +19,11 @@ import {
19
19
  stripManagedBlock,
20
20
  } from "../managed-block.js";
21
21
  import type { TokenMap } from "../placeholders.js";
22
- import { listFilesRecursive, syncTemplateCopies } from "../template-copies.js";
22
+ import {
23
+ listFilesRecursive,
24
+ warnMissingLintStagedConfig,
25
+ syncTemplateCopies,
26
+ } from "../template-copies.js";
23
27
  import { PAYLOAD_LINK_RELPATHS, syncPayloadLinks } from "../payload-links.js";
24
28
  import { writeNetworkAllowlist } from "../network-allowlist.js";
25
29
  import { migrateContextCiWorkflow } from "../context-ci-workflow.js";
@@ -27,6 +31,7 @@ import { migrateTemplateNotes } from "../template-notes.js";
27
31
  import type { PreflightFinding } from "../../checks/before/index.js";
28
32
  import { isAdvisorySuppressed } from "../../checks/after/suppression.js";
29
33
  import { parseJson, readJsonFile } from "../../shared/json.js";
34
+ import { compareSemver } from "../../shared/bkit-latest.js";
30
35
  import { readInstallingVersion } from "../../shared/package-json.js";
31
36
  import { detectDepUpdater, type DepUpdater } from "../../shared/dep-updater.js";
32
37
  import { ASK_POINTS, CONFIG_DEFAULTS, ciWorkflowPath, limitKey } from "../../shared/settings.js";
@@ -214,8 +219,8 @@ export function listCoreTemplateFiles(root: string = getCoreRoot()): CoreTemplat
214
219
 
215
220
  /**
216
221
  * The shared payload files core writes, sourced from `root` (defaults to the
217
- * resolved shared root): the `docs/*.md` managed blocks and the two shared-root
218
- * files the core manifest owns.
222
+ * resolved shared root): the two shared-root files the core manifest owns. The ten project
223
+ * documents are copy-and-own starters under `templates/docs/`, never written here.
219
224
  */
220
225
  export function listSharedTemplateFiles(root: string = getSharedRoot()): CoreTemplateFile[] {
221
226
  const out: CoreTemplateFile[] = [];
@@ -223,14 +228,6 @@ export function listSharedTemplateFiles(root: string = getSharedRoot()): CoreTem
223
228
  const src = path.join(root, rel);
224
229
  if (fs.existsSync(src)) out.push({ src, dst, scope: "block", marker: "html-comment" });
225
230
  }
226
- for (const name of listMdFiles(path.join(root, "docs"))) {
227
- out.push({
228
- src: path.join(root, "docs", name),
229
- dst: path.join("docs", name),
230
- scope: "block",
231
- marker: "html-comment",
232
- });
233
- }
234
231
  return out;
235
232
  }
236
233
 
@@ -338,6 +335,7 @@ export function runBkitDocs(
338
335
  migrateTemplateNotes(dryRun, ws, logPrefix);
339
336
  migrateContextCiWorkflow(dryRun, ws, logPrefix);
340
337
  migrateSlopTypeSuppression(dryRun, ws, logPrefix);
338
+ migrateMachineLockCopy(dryRun, ws, logPrefix);
341
339
  const renames = migrateBrandedTemplateFiles(dryRun, ws, logPrefix);
342
340
  migrateBrandedFileTokens(dryRun, ws, logPrefix, renames);
343
341
  migrateBrandedCheckNames(dryRun, ws, logPrefix, tokens.DEFAULT_BRANCH);
@@ -574,6 +572,9 @@ export function seedCorePackageJsonScripts(
574
572
  if (pruneMinPushPaths(dryRun, ws, logPrefix) && !written.includes("package.json")) {
575
573
  written.push("package.json");
576
574
  }
575
+ if (lowerVerifyMaxAttempts(dryRun, ws, logPrefix) && !written.includes("package.json")) {
576
+ written.push("package.json");
577
+ }
577
578
  if (seedBkitDefaults(dryRun, ws, logPrefix) && !written.includes("package.json")) {
578
579
  written.push("package.json");
579
580
  }
@@ -610,7 +611,7 @@ export const SEEDED_BKIT_DEFAULTS: Readonly<Record<string, unknown>> = {
610
611
  cloud: { agent: "" },
611
612
  providers: { opencode: { default: "", installed: [] } },
612
613
  testing: {
613
- // What bkit writes (ship's bookkeeping allow-list, the plans tree) is always a min push;
614
+ // What bkit writes (ship's bookkeeping allow-list, the plans tree, docs/audits/**) is always a min push;
614
615
  // the seed adds nothing, because a project doc can be a test's input.
615
616
  minPushPaths: [...CONFIG_DEFAULTS.minPushPaths],
616
617
  ciWorkflow: CONFIG_DEFAULTS.ciWorkflow,
@@ -812,6 +813,104 @@ function migrateSlopTypeSuppression(dryRun: boolean, ws: WriteSet, logPrefix: st
812
813
  console.log(`${logPrefix} ${tag}core: ${file} — slop plugin updated`);
813
814
  }
814
815
 
816
+ // sha256 of every released scripts/ci/bkit-machine-lock.sh text older than the current template (6.1.0, 6.1.1).
817
+ const SHIPPED_MACHINE_LOCK_HASHES: readonly string[] = [
818
+ "63ee5873795fd06b60e1f13c238c9e3c44d9f6dc76a50fe271793de6ad284e87",
819
+ ];
820
+
821
+ // Migration (6.1.0-6.2.x installs, docs/migrations.md): replace an unedited adopted machine-lock
822
+ // copy with the current template; warn about an edited copy that lacks the queue, never writes
823
+ // the status file or has no hold limit. A copy that starts bkit-test-awake.mjs gets that file
824
+ // beside it (see `migrateHoldSupervisor`).
825
+ function migrateMachineLockCopy(dryRun: boolean, ws: WriteSet, logPrefix: string): void {
826
+ const file = path.join("scripts", "ci", "bkit-machine-lock.sh");
827
+ const stat = fs.lstatSync(file, { throwIfNoEntry: false });
828
+ if (!stat) return;
829
+ const tag = dryRun ? "[dry-run] " : "";
830
+ const templatePath = ".bkit/templates/scripts/ci/bkit-machine-lock.sh";
831
+ const outOfOrder = "waiting runs take the lock out of arrival order";
832
+ const manual = (reason: string, until = outOfOrder): void => {
833
+ console.warn(
834
+ `${logPrefix} ${tag}core: ${file} left unchanged (${reason}); merge ${templatePath} by hand, until then ${until}`,
835
+ );
836
+ };
837
+ if (linkedPath(file) || !stat.isFile()) {
838
+ manual("the path is not a regular file or sits under a symlink");
839
+ return;
840
+ }
841
+ const current = fs.readFileSync(file);
842
+ const template = fs.readFileSync(
843
+ path.join(getTemplatesRoot(), "scripts", "ci", "bkit-machine-lock.sh"),
844
+ );
845
+ const text = current.toString("utf8");
846
+ if (current.equals(template)) {
847
+ migrateHoldSupervisor(dryRun, ws, logPrefix);
848
+ return;
849
+ }
850
+ if (SHIPPED_MACHINE_LOCK_HASHES.includes(sha256(current))) {
851
+ if (!dryRun) fs.writeFileSync(file, template);
852
+ ws.writes.push({ path: file, action: "update", unhashed: true });
853
+ console.log(`${logPrefix} ${tag}core: ${file} — machine lock updated to the current template`);
854
+ migrateHoldSupervisor(dryRun, ws, logPrefix);
855
+ return;
856
+ }
857
+ if (text.includes("bkit-test-awake.mjs")) migrateHoldSupervisor(dryRun, ws, logPrefix);
858
+ if (!text.includes(".queue")) manual("the copy differs from the shipped version");
859
+ if (!text.includes("LOCAL_STACK_LOCK_STATUS_FILE"))
860
+ manual(
861
+ "the copy never writes LOCAL_STACK_LOCK_STATUS_FILE",
862
+ "a lock wait that gives up reads as a gate failure (exit 1) instead of exit 81",
863
+ );
864
+ if (!text.includes("LOCAL_STACK_LOCK_HOLD_S"))
865
+ manual(
866
+ "the copy has no LOCAL_STACK_LOCK_HOLD_S hold limit",
867
+ "a hung run holds the tests lock until someone stops it by hand",
868
+ );
869
+ }
870
+
871
+ // sha256 of every scripts/ci/bkit-test-awake.mjs template text in history older than the current one.
872
+ const SHIPPED_AWAKE_HASHES: readonly string[] = [
873
+ "d218439bd4d65b57732a96aaea7bb678f9ebf95a6247f5e6b899d6ef26a59cb5",
874
+ "a686bf75700f2ff54de2cedd3b7afc943774da40a68c243b9911bc435742f434",
875
+ "0842c2e2789a1c77935655130de5b8cf253bfe0655407834f23a6abaaf1b0bb1",
876
+ "0dce1b50638cd609183a871ed8d0d9e3d20c545073f0a32f18526d6f38b5b748",
877
+ ];
878
+
879
+ // The machine-lock script runs a command holding its own tests lock under
880
+ // scripts/ci/bkit-test-awake.mjs --hold-s: write the template there when the file is missing,
881
+ // replace an unedited shipped copy, and warn about an edited copy without --hold-s, since the
882
+ // lock script refuses every such run with exit 73.
883
+ function migrateHoldSupervisor(dryRun: boolean, ws: WriteSet, logPrefix: string): void {
884
+ const file = path.join("scripts", "ci", "bkit-test-awake.mjs");
885
+ const tag = dryRun ? "[dry-run] " : "";
886
+ const template = path.join(getTemplatesRoot(), "scripts", "ci", "bkit-test-awake.mjs");
887
+ if (!fs.lstatSync(file, { throwIfNoEntry: false })) {
888
+ if (!dryRun) fs.copyFileSync(template, file);
889
+ ws.writes.push({ path: file, action: "write", unhashed: true });
890
+ console.log(
891
+ `${logPrefix} ${tag}core: ${file} — added beside the machine lock, which runs its hold limit`,
892
+ );
893
+ return;
894
+ }
895
+ const stat = fs.statSync(file, { throwIfNoEntry: false });
896
+ if (
897
+ stat?.isFile() &&
898
+ !linkedPath(file) &&
899
+ SHIPPED_AWAKE_HASHES.includes(sha256(fs.readFileSync(file)))
900
+ ) {
901
+ if (!dryRun) fs.copyFileSync(template, file);
902
+ ws.writes.push({ path: file, action: "update", unhashed: true });
903
+ console.log(
904
+ `${logPrefix} ${tag}core: ${file} — test sleep prevention updated to the current template`,
905
+ );
906
+ return;
907
+ }
908
+ if (stat?.isFile() && fs.readFileSync(file, "utf8").includes("--hold-s")) return;
909
+ console.warn(
910
+ `${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`,
911
+ );
912
+ }
913
+
815
914
  // Every `.github/workflows/*.yml` / `*.yaml` regular file outside `skip`.
816
915
  function otherWorkflows(skip: readonly string[]): string[] {
817
916
  const dir = path.join(".github", "workflows");
@@ -865,24 +964,66 @@ export function renameScriptTokens(
865
964
  }
866
965
 
867
966
  /**
868
- * Each old script name still in `text`, with its 1-based line. A name without `:` (`graph`) is
869
- * a plain word, so it counts only after `pnpm` / `npm` / `yarn` / `bun` on the same line and
870
- * before any `#`.
967
+ * Old script invocations in shell commands or YAML run steps, with their 1-based lines.
968
+ * Quoted arguments and escaped hashes stay intact; shell comments end the command.
871
969
  */
872
970
  export function findOldScriptNames(
873
971
  text: string,
874
972
  renames: Readonly<Record<string, string>>,
875
973
  ): { line: number; name: string }[] {
876
974
  const found: { line: number; name: string }[] = [];
877
- const lines = text.split("\n");
878
- for (const name of Object.keys(renames)) {
879
- const re = name.includes(":")
880
- ? new RegExp(`(?<![\\w:./-])${escapeRegExp(name)}(?![\\w:-])`)
881
- : new RegExp(`\\b(?:pnpm|npm|yarn|bun)\\b[^#\\n]*\\s${escapeRegExp(name)}(?![\\w:./-])`);
882
- lines.forEach((l, i) => {
883
- if (re.test(l)) found.push({ line: i + 1, name });
884
- });
885
- }
975
+ text.split("\n").forEach((line, index) => {
976
+ const runStep = /^\s*(?:-\s*)?run:\s*/;
977
+ const command = runStep.test(line)
978
+ ? line
979
+ .replace(runStep, "")
980
+ .trim()
981
+ .replace(/^(['"])(.*)\1(?:\s+#.*)?$/, "$2")
982
+ : line;
983
+ const words =
984
+ command.match(/(?:[^\s"'\\;&|()]+|\\.|"(?:\\.|[^"\\])*"|'[^']*')+|[;&|()]/g) ?? [];
985
+ const comment = words.findIndex((word) => word.startsWith("#"));
986
+ const tokens = comment < 0 ? words : words.slice(0, comment);
987
+ const names = new Set<string>();
988
+ let commandStart = true;
989
+ for (let i = 0; i < tokens.length; i++) {
990
+ const token = tokens[i]!;
991
+ if (/^[;&|()]$/.test(token)) {
992
+ commandStart = true;
993
+ continue;
994
+ }
995
+ if (!commandStart) continue;
996
+ if (
997
+ /^(?:[A-Za-z_][A-Za-z_0-9]*=|env$|exec$|command$|corepack$|if$|then$|elif$|else$|do$|!$|--$)/.test(
998
+ token,
999
+ )
1000
+ )
1001
+ continue;
1002
+ commandStart = false;
1003
+ if (/^(?:sh|bash|zsh)$/.test(token) && /^-[a-z]*c[a-z]*$/.test(tokens[i + 1] ?? "")) {
1004
+ const body = tokens[i + 2]?.match(/^(['"])(.*)\1$/)?.[2];
1005
+ if (body) for (const { name } of findOldScriptNames(body, renames)) names.add(name);
1006
+ }
1007
+ if (!/^(pnpm|npm|yarn|bun)$/.test(token)) continue;
1008
+ let script = i + 1;
1009
+ let ran = false;
1010
+ while (script < tokens.length) {
1011
+ const arg = tokens[script]!;
1012
+ if ((arg === "run" || (token === "npm" && arg === "run-script")) && !ran) {
1013
+ ran = true;
1014
+ script++;
1015
+ } else if (arg.startsWith("-")) {
1016
+ const takesValue =
1017
+ /^(--filter|-F|--dir|-C|--prefix|--cwd|--workspace|--reporter)$/.test(arg) ||
1018
+ (token === "npm" && arg === "-w");
1019
+ script += takesValue ? 2 : 1;
1020
+ } else break;
1021
+ }
1022
+ const name = tokens[script]?.replace(/^(['"])(.*)\1$/, "$2");
1023
+ if (name && Object.hasOwn(renames, name)) names.add(name);
1024
+ }
1025
+ for (const name of names) found.push({ line: index + 1, name });
1026
+ });
886
1027
  return found;
887
1028
  }
888
1029
 
@@ -1479,7 +1620,7 @@ export const BKIT_LAYOUT_MOVES: readonly (readonly [string, string])[] = [
1479
1620
 
1480
1621
  // Migration (up to 6.0.x installs, `docs/migrations.md`): `bkit.testing.minPushPaths` was the
1481
1622
  // whole min-push list, so installs seeded and repos restated what bkit itself writes. The
1482
- // engine now always allows that floor (ship's bookkeeping allow-list, `docs/plans/**`) and
1623
+ // engine now always allows that floor (ship's bookkeeping allow-list, `docs/plans/**`, `docs/audits/**`) and
1483
1624
  // `bkit.testing.ciSkipPaths`; the setting only adds. Entries the floor already covers are
1484
1625
  // dropped from the list. Returns true when package.json changed.
1485
1626
  export const MIN_PUSH_FLOOR_ENTRIES: readonly string[] = [
@@ -1512,6 +1653,40 @@ export function pruneMinPushPaths(dryRun: boolean, ws: WriteSet, logPrefix: stri
1512
1653
  return true;
1513
1654
  }
1514
1655
 
1656
+ const LAST_RELEASE_WITHOUT_VERIFY_CAP = "6.1.1";
1657
+
1658
+ // Migration (up to 6.1.x installs, `docs/migrations.md`): `bkit.workflows.build.verify.maxAttempts`
1659
+ // is one non-resetting allowance per run, and every build limit is 2. A value above 2 is
1660
+ // lowered to 2 once, on the upgrade from an install that predates this release (no recorded
1661
+ // version, an unreadable one, or an older one); 2 or less is left alone, and a value set after
1662
+ // that upgrade is the consumer's. Returns true when package.json changed.
1663
+ export function lowerVerifyMaxAttempts(dryRun: boolean, ws: WriteSet, logPrefix: string): boolean {
1664
+ const pkgPath = "package.json";
1665
+ if (!fs.existsSync(pkgPath)) return false;
1666
+ const recorded = readBkitVersion(path.join(".bkit", "version"))?.pinnedVersion ?? "";
1667
+ // Skip a re-run of the same version, and any install recorded after the last release without
1668
+ // this migration, so a value set after the upgrade to this release is never lowered again.
1669
+ const order = compareSemver(recorded, readInstallingVersion());
1670
+ if (order === 0 || order === 1) return false;
1671
+ if (compareSemver(recorded, LAST_RELEASE_WITHOUT_VERIFY_CAP) === 1) return false;
1672
+ const raw = fs.readFileSync(pkgPath, "utf-8");
1673
+ const parsed = parseJson(raw);
1674
+ if (!parsed.ok) return false;
1675
+ const pkg = parsed.value as Record<string, unknown>;
1676
+ if (!plainObject(pkg.bkit) || !plainObject(pkg.bkit.workflows)) return false;
1677
+ const build = pkg.bkit.workflows.build;
1678
+ if (!plainObject(build) || !plainObject(build.verify)) return false;
1679
+ const old = build.verify.maxAttempts;
1680
+ if (typeof old !== "number" || old <= 2) return false;
1681
+ build.verify.maxAttempts = 2;
1682
+ ws.writes.push({ path: pkgPath, action: "update" });
1683
+ if (!dryRun) writePackageJsonLike(raw, pkg);
1684
+ console.log(
1685
+ `${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`,
1686
+ );
1687
+ return true;
1688
+ }
1689
+
1515
1690
  // Fill `into` with each `from` key it lacks, descending into blocks both sides hold.
1516
1691
  function mergeMissing(into: Record<string, unknown>, from: Record<string, unknown>): void {
1517
1692
  for (const [k, v] of Object.entries(from)) {
@@ -1746,7 +1921,7 @@ export function detectGateAdvisories(cwd: string): PreflightFinding[] {
1746
1921
  id: "test-file-script-missing",
1747
1922
  severity: "advisory",
1748
1923
  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.`,
1749
- 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.`,
1924
+ 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.`,
1750
1925
  });
1751
1926
  }
1752
1927
 
@@ -1851,6 +2026,7 @@ export function runCoreModule(ctx: ModuleContext): void {
1851
2026
  console.log(`${logPrefix} ${tag}template ${verb}: ${path.join(TEMPLATE_COPIES_DIR, p)}`);
1852
2027
  }
1853
2028
  }
2029
+ warnMissingLintStagedConfig(cwd, logPrefix);
1854
2030
 
1855
2031
  // 3b3. Payload view links — `.bkit/core` + `.bkit/shared` symlinks into the
1856
2032
  // installed package (browse-only, gitignored; no-op in dogfood). A real
@@ -159,8 +159,9 @@ export function opencodeProviderEnvVar(providerKey: string): string {
159
159
  * secret `env:` var. `bkit install --opencode=<provider>` rewrites neither; this advisory names
160
160
  * the hand-edit.
161
161
  *
162
- * bkit-cloud.yml runs `opencode run` against the committed `.opencode/` config and fans one
163
- * `OPENCODE_PROVIDER_KEY` secret out to every provider env var, so it is not checked.
162
+ * bkit-cloud.yml runs `opencode run` against the committed `.opencode/` config and passes
163
+ * the provider's `BKIT_` secret (`BKIT_OPENCODE_API_KEY`, `BKIT_OPENROUTER_API_KEY` or
164
+ * `BKIT_OLLAMA_API_KEY`) under its own env var name, so it is not checked.
164
165
  *
165
166
  * No-op when opencode.yml is absent. No equivalent check for claude.yml (provider-fixed to
166
167
  * Claude). Severity "advisory": never gates `bkit check`; surfaces on both check and postinstall.
@@ -222,7 +223,7 @@ export function detectOpencodeYmlProviderDrift(cwd: string): PreflightFinding |
222
223
  " model: " +
223
224
  expectedPrefix +
224
225
  "/<model> # a model your provider serves (see .opencode/opencode.json)\n\n" +
225
- "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.)",
226
+ "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.)",
226
227
  };
227
228
  }
228
229
 
@@ -241,10 +242,8 @@ const OPENCODE_PROVIDER_BASE_URL_SENTINEL = "@@OPENCODE_PROVIDER_BASE_URL@@";
241
242
  * and fills in provider-specific fields.
242
243
  *
243
244
  * Also injects derived **allow** rules for {@link resolveNetworkAllowlist} so
244
- * context-fetch / provider hosts do not prompt on either fetch surface: `curl *{domain}*` /
245
- * `wget *{domain}*` after the template's `curl *` / `wget *` ask (OpenCode bash is
246
- * last-match-wins), and `*{domain}*` into the `permission.webfetch` URL map (after its
247
- * `"*": "ask"`). Adds `<server>_*` allows for the consumer's `mcp-servers` block.
245
+ * context-fetch / provider hosts do not prompt on the fetch tool: `*{domain}*` into the
246
+ * `permission.webfetch` URL map (after its `"*": "ask"`); shell fetches keep asking. Adds `<server>_*` allows for the consumer's `mcp-servers` block.
248
247
  */
249
248
  export function renderOpencodeJson(
250
249
  templatePath: string,
@@ -337,12 +336,10 @@ export function renderOpencodeJson(
337
336
  * last-match-wins), and one `<server>_*` allow per declared MCP server — opencode names
338
337
  * MCP tools `<server>_<tool>` and matches permission keys as globs against the tool name.
339
338
  *
340
- * The allowlist is applied to BOTH fetch surfaces, so an allowlisted host does not prompt
341
- * whichever path the agent takes:
342
- * - fetch tool — `permission.webfetch` is a URL-keyed map (`{ "*": "ask" }` from the
343
- * template); opencode matches the resource against the URL, so `*{base}*` allows it;
344
- * - shell fetch — `permission.bash` gains `curl *{base}*` / `wget *{base}*` after the
345
- * template's `curl *` / `wget *` ask.
339
+ * Only the fetch tool gets derived allows: `permission.webfetch` is a URL-keyed map
340
+ * (`{ "*": "ask" }` from the template); opencode matches the resource against the URL, so
341
+ * `*{base}*` allows it (accepted risk, decision 551). Shell `curl` / `wget` keep the
342
+ * template's ask, because a glob over the command string also matches a host in a query.
346
343
  */
347
344
  function injectOpencodeDerivedAllows(parsed: Record<string, unknown>, cwd: string): void {
348
345
  const permission = parsed.permission as Record<string, unknown> | undefined;
@@ -351,13 +348,6 @@ function injectOpencodeDerivedAllows(parsed: Record<string, unknown>, cwd: strin
351
348
  permission[`${server}_*`] = "allow";
352
349
  }
353
350
  const bases = networkAllowlistBases(resolveNetworkAllowlist(cwd));
354
- if (typeof permission.bash === "object" && permission.bash !== null) {
355
- const bash = permission.bash as Record<string, string>;
356
- for (const base of bases) {
357
- bash[`curl *${base}*`] = "allow";
358
- bash[`wget *${base}*`] = "allow";
359
- }
360
- }
361
351
  // Fetch tool — opencode matches the webfetch resource against the requested URL.
362
352
  if (typeof permission.webfetch === "object" && permission.webfetch !== null) {
363
353
  const webfetch = permission.webfetch as Record<string, string>;
@@ -527,9 +517,14 @@ export function runOpencodeModule(ctx: ModuleContext): void {
527
517
  }
528
518
  }
529
519
 
530
- // --- bkit-gateguard.js / bkit-readguard.js / bkit-rules.js — Tier-2 markered-text
531
- // (slash-comment); see install/manifest.ts ---
532
- for (const plugin of ["bkit-gateguard.js", "bkit-readguard.js", "bkit-rules.js"]) {
520
+ // --- bkit-gateguard.js / bkit-readguard.js / bkit-rules.js / bkit-guardrails.js — Tier-2
521
+ // markered-text (slash-comment); see install/manifest.ts ---
522
+ for (const plugin of [
523
+ "bkit-gateguard.js",
524
+ "bkit-readguard.js",
525
+ "bkit-rules.js",
526
+ "bkit-guardrails.js",
527
+ ]) {
533
528
  const opencodeCore = path.join(getCoreRoot(), ".opencode", "plugin");
534
529
  const pluginSrc = path.join(opencodeCore, plugin);
535
530
  const pluginDst = `.opencode/plugin/${plugin}`;
@@ -6,7 +6,7 @@
6
6
 
7
7
  import * as fs from "node:fs";
8
8
  import * as path from "node:path";
9
- import { resolveNetworkAllowlist } from "./cloud-env.js";
9
+ import { egressFingerprint, resolveNetworkAllowlist } from "./cloud-env.js";
10
10
  import { readBkitVersion } from "./version-file.js";
11
11
  import type { WriteSet } from "./write.js";
12
12
 
@@ -16,9 +16,14 @@ export const NETWORK_ALLOWLIST_RELPATH = path.join(".bkit", "allowlist.json");
16
16
  /** Where the cursor module wrote the allowlist up to 5.2.4 (migrated away). */
17
17
  export const RETIRED_NETWORK_ALLOWLIST_RELPATH = path.join(".cursor", "allowlist.json");
18
18
 
19
- /** The allowlist file body: `{ domains }`, apex + `*.` wildcard per base, sorted. */
19
+ /**
20
+ * The allowlist file body: `{ domains, fingerprint }` — `domains` is apex + `*.` wildcard
21
+ * per base, sorted; `fingerprint` is the 8-hex stamp of that list, which the cloud
22
+ * bootstrap compares with `BKIT_CLOUD_ALLOWLIST_FINGERPRINT`.
23
+ */
20
24
  export function renderNetworkAllowlist(cwd: string): string {
21
- return JSON.stringify({ domains: resolveNetworkAllowlist(cwd) }, null, 2) + "\n";
25
+ const domains = resolveNetworkAllowlist(cwd);
26
+ return JSON.stringify({ domains, fingerprint: egressFingerprint(domains) }, null, 2) + "\n";
22
27
  }
23
28
 
24
29
  /**