@cbartens/bkit 5.5.1 → 6.1.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 (425) hide show
  1. package/.bkit/README.md +167 -154
  2. package/.bkit/core/.agents/context.md +95 -29
  3. package/.bkit/core/.agents/docs.md +18 -15
  4. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-gateguard.cjs +1 -0
  5. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +6 -5
  6. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-readguard.cjs +1 -0
  7. package/.bkit/core/.agents/plugins/bkit/hooks/bkit-rules.cjs +65 -0
  8. package/.bkit/core/.agents/rules.md +112 -102
  9. package/.bkit/core/.agents/skills.md +63 -15
  10. package/.bkit/core/.bkit/README.md +167 -154
  11. package/.bkit/core/.bkit/authoring.md +747 -0
  12. package/.bkit/core/.bkit/cli.md +407 -0
  13. package/.bkit/core/.bkit/cloud.md +283 -195
  14. package/.bkit/core/.bkit/comparison.md +45 -43
  15. package/.bkit/core/.bkit/install.md +166 -95
  16. package/.bkit/core/.bkit/jsonl.md +339 -196
  17. package/.bkit/core/.bkit/pipeline.md +142 -145
  18. package/.bkit/core/.bkit/prompts.md +295 -264
  19. package/.bkit/core/.bkit/providers.md +460 -277
  20. package/.bkit/core/.bkit/router.md +69 -0
  21. package/.bkit/core/.bkit/templates.md +530 -256
  22. package/.bkit/core/.bkit/trackers.md +116 -65
  23. package/.bkit/core/.bkit/workflows.md +742 -618
  24. package/.bkit/core/.claude/hooks/bkit-gateguard.cjs +2 -2
  25. package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +3 -3
  26. package/.bkit/core/.claude/hooks/bkit-preflight.sh +45 -14
  27. package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +3 -3
  28. package/.bkit/core/.codex/hooks/bkit-rules.cjs +57 -0
  29. package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +7 -7
  30. package/.bkit/core/.cursor/hooks/bkit-preflight.sh +47 -12
  31. package/.bkit/core/.opencode/plugin/bkit-rules.js +89 -0
  32. package/.bkit/core/AGENTS.md +6 -80
  33. package/.bkit/core/docs/templates/bkit-audit-accessibility.md +128 -130
  34. package/.bkit/core/docs/templates/bkit-audit-adoption.md +104 -94
  35. package/.bkit/core/docs/templates/bkit-audit-agents.md +96 -98
  36. package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +100 -103
  37. package/.bkit/core/docs/templates/bkit-audit-analytics.md +141 -107
  38. package/.bkit/core/docs/templates/bkit-audit-annotations.md +99 -97
  39. package/.bkit/core/docs/templates/bkit-audit-app-performance.md +122 -121
  40. package/.bkit/core/docs/templates/bkit-audit-app-store.md +158 -101
  41. package/.bkit/core/docs/templates/bkit-audit-architecture.md +114 -96
  42. package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +76 -97
  43. package/.bkit/core/docs/templates/bkit-audit-config.md +123 -101
  44. package/.bkit/core/docs/templates/bkit-audit-cost.md +86 -99
  45. package/.bkit/core/docs/templates/bkit-audit-coverage.md +76 -93
  46. package/.bkit/core/docs/templates/bkit-audit-database.md +102 -95
  47. package/.bkit/core/docs/templates/bkit-audit-dead-code.md +165 -108
  48. package/.bkit/core/docs/templates/bkit-audit-deferrals.md +115 -109
  49. package/.bkit/core/docs/templates/bkit-audit-dependencies.md +265 -113
  50. package/.bkit/core/docs/templates/bkit-audit-documentation.md +119 -118
  51. package/.bkit/core/docs/templates/bkit-audit-duplication.md +140 -111
  52. package/.bkit/core/docs/templates/bkit-audit-failures.md +111 -106
  53. package/.bkit/core/docs/templates/bkit-audit-flakes.md +100 -99
  54. package/.bkit/core/docs/templates/bkit-audit-gates.md +107 -103
  55. package/.bkit/core/docs/templates/bkit-audit-issues.md +105 -105
  56. package/.bkit/core/docs/templates/bkit-audit-llm.md +134 -85
  57. package/.bkit/core/docs/templates/bkit-audit-logs.md +124 -125
  58. package/.bkit/core/docs/templates/bkit-audit-models.md +99 -78
  59. package/.bkit/core/docs/templates/bkit-audit-privacy.md +56 -76
  60. package/.bkit/core/docs/templates/bkit-audit-prompts.md +63 -78
  61. package/.bkit/core/docs/templates/bkit-audit-red-team.md +125 -93
  62. package/.bkit/core/docs/templates/bkit-audit-reliability.md +97 -96
  63. package/.bkit/core/docs/templates/bkit-audit-repo.md +170 -98
  64. package/.bkit/core/docs/templates/bkit-audit-security.md +207 -121
  65. package/.bkit/core/docs/templates/bkit-audit-slop.md +78 -95
  66. package/.bkit/core/docs/templates/bkit-audit-testing.md +163 -139
  67. package/.bkit/core/docs/templates/bkit-audit-usability.md +114 -96
  68. package/.bkit/core/docs/templates/bkit-plan.md +158 -281
  69. package/.bkit/core/engine/checks/after/auth.ts +40 -37
  70. package/.bkit/core/engine/checks/after/ci-yml.ts +104 -31
  71. package/.bkit/core/engine/checks/after/github.ts +95 -17
  72. package/.bkit/core/engine/checks/after/index.ts +21 -8
  73. package/.bkit/core/engine/checks/after/suppression.ts +8 -5
  74. package/.bkit/core/engine/checks/after/tools.ts +125 -123
  75. package/.bkit/core/engine/checks/before/context-fetch.ts +227 -33
  76. package/.bkit/core/engine/checks/before/env.ts +3 -3
  77. package/.bkit/core/engine/checks/before/files.ts +5 -4
  78. package/.bkit/core/engine/checks/before/index.ts +25 -1
  79. package/.bkit/core/engine/checks/before/repo.ts +208 -2
  80. package/.bkit/core/engine/checks/status-holes.ts +916 -123
  81. package/.bkit/core/engine/checks/tips/catalogue.ts +82 -20
  82. package/.bkit/core/engine/checks/tips/detect.ts +66 -0
  83. package/.bkit/core/engine/checks/tips/index.ts +52 -11
  84. package/.bkit/core/engine/cli.ts +251 -130
  85. package/.bkit/core/engine/commands/analysis.ts +282 -199
  86. package/.bkit/core/engine/commands/ci/ci.ts +363 -29
  87. package/.bkit/core/engine/commands/ci/pins.ts +172 -0
  88. package/.bkit/core/engine/commands/ci/push-gate.ts +223 -0
  89. package/.bkit/core/engine/commands/comply.ts +77 -103
  90. package/.bkit/core/engine/commands/install/doctor.ts +2 -2
  91. package/.bkit/core/engine/commands/install/install.ts +57 -18
  92. package/.bkit/core/engine/commands/install/uninstall.ts +86 -55
  93. package/.bkit/core/engine/commands/install/upgrade.ts +32 -15
  94. package/.bkit/core/engine/commands/land.ts +139 -18
  95. package/.bkit/core/engine/commands/lib.ts +381 -22
  96. package/.bkit/core/engine/commands/registry.ts +10 -2
  97. package/.bkit/core/engine/commands/setup/setup.ts +8 -7
  98. package/.bkit/core/engine/commands/stats.ts +260 -0
  99. package/.bkit/core/engine/commands/tips.ts +10 -5
  100. package/.bkit/core/engine/commands/workflow/branches.ts +2215 -176
  101. package/.bkit/core/engine/commands/workflow/challenge.ts +748 -0
  102. package/.bkit/core/engine/commands/workflow/completeness.ts +109 -0
  103. package/.bkit/core/engine/commands/workflow/context.ts +1249 -47
  104. package/.bkit/core/engine/commands/workflow/counters.ts +483 -95
  105. package/.bkit/core/engine/commands/workflow/decisions.ts +585 -0
  106. package/.bkit/core/engine/commands/workflow/disk.ts +238 -56
  107. package/.bkit/core/engine/commands/workflow/fids.ts +811 -33
  108. package/.bkit/core/engine/commands/workflow/issues.ts +413 -64
  109. package/.bkit/core/engine/commands/workflow/ledgers.ts +1333 -36
  110. package/.bkit/core/engine/commands/workflow/locks.ts +28 -2
  111. package/.bkit/core/engine/commands/workflow/plan-blocks.ts +691 -0
  112. package/.bkit/core/engine/commands/workflow/plan-versions.ts +21 -0
  113. package/.bkit/core/engine/commands/workflow/plans.ts +257 -0
  114. package/.bkit/core/engine/commands/workflow/prs.ts +178 -33
  115. package/.bkit/core/engine/commands/workflow/repo.ts +66 -8
  116. package/.bkit/core/engine/commands/workflow/roadmap.ts +72 -22
  117. package/.bkit/core/engine/commands/workflow/run-facts.ts +492 -0
  118. package/.bkit/core/engine/commands/workflow/runs.ts +827 -79
  119. package/.bkit/core/engine/commands/workflow/runtime.ts +25 -1
  120. package/.bkit/core/engine/commands/workflow/skills.ts +1 -0
  121. package/.bkit/core/engine/commands/workflow/status.ts +329 -33
  122. package/.bkit/core/engine/commands/workflow/step-table.ts +381 -0
  123. package/.bkit/core/engine/commands/workflow/steps.ts +841 -105
  124. package/.bkit/core/engine/commands/workflow/summary-findings.ts +177 -0
  125. package/.bkit/core/engine/commands/workflow/summary.ts +544 -0
  126. package/.bkit/core/engine/commands/workflow/tasks.ts +409 -0
  127. package/.bkit/core/engine/commands/workflow/test-blocks.ts +254 -0
  128. package/.bkit/core/engine/commands/workflow/tests-changed.ts +201 -0
  129. package/.bkit/core/engine/commands/workflow/tests.ts +2124 -330
  130. package/.bkit/core/engine/commands/workflow/tracker.ts +1195 -0
  131. package/.bkit/core/engine/commands/workflow/workflows.ts +1197 -235
  132. package/.bkit/core/engine/commands/workflow/worktrees.ts +543 -24
  133. package/.bkit/core/engine/install/cloud-env.ts +251 -121
  134. package/.bkit/core/engine/install/context-ci-workflow.ts +102 -0
  135. package/.bkit/core/engine/install/manifest.ts +67 -17
  136. package/.bkit/core/engine/install/modules/antigravity.ts +3 -2
  137. package/.bkit/core/engine/install/modules/cloud.ts +24 -16
  138. package/.bkit/core/engine/install/modules/codex.ts +15 -2
  139. package/.bkit/core/engine/install/modules/core.ts +1196 -45
  140. package/.bkit/core/engine/install/modules/cursor.ts +6 -6
  141. package/.bkit/core/engine/install/modules/opencode.ts +18 -6
  142. package/.bkit/core/engine/install/template-notes.ts +130 -0
  143. package/.bkit/core/engine/install/version-file.ts +9 -4
  144. package/.bkit/core/engine/install/write.ts +5 -0
  145. package/.bkit/core/engine/ledgers/compact.ts +124 -0
  146. package/.bkit/core/engine/ledgers/journal.ts +291 -0
  147. package/.bkit/core/engine/ledgers/migrate.ts +92 -0
  148. package/.bkit/core/engine/ledgers/status.ts +249 -21
  149. package/.bkit/core/engine/ledgers/telemetry.ts +1397 -253
  150. package/.bkit/core/engine/render/hosts.ts +118 -14
  151. package/.bkit/core/engine/render/models.ts +12 -0
  152. package/.bkit/core/engine/shared/bkit-latest.ts +26 -4
  153. package/.bkit/core/engine/shared/branches.ts +4 -1
  154. package/.bkit/core/engine/shared/dep-updater.ts +60 -0
  155. package/.bkit/core/engine/shared/egress.ts +8 -1
  156. package/.bkit/core/engine/shared/json.ts +25 -7
  157. package/.bkit/core/engine/shared/package-manager.ts +9 -0
  158. package/.bkit/core/engine/shared/settings.ts +243 -31
  159. package/.bkit/core/engine/shared/text.ts +361 -0
  160. package/.bkit/core/engine/shared/timeouts.ts +2 -0
  161. package/.bkit/core/engine/tools/cli-doc.ts +111 -0
  162. package/.bkit/core/engine/tools/grammar-density.ts +215 -0
  163. package/.bkit/core/engine/tools/instructions-sources.ts +832 -0
  164. package/.bkit/core/engine/tools/instructions.ts +1802 -0
  165. package/.bkit/core/hooks/antigravity-hook.js +25 -10
  166. package/.bkit/core/hooks/gateguard-engine.js +54 -29
  167. package/.bkit/core/hooks/guardrails-shell.js +4 -5
  168. package/.bkit/core/hooks/guardrails-tiers.js +10 -4
  169. package/.bkit/core/hooks/preflight-linear.sh +9 -9
  170. package/.bkit/core/hooks/preflight-rules.sh +8 -0
  171. package/.bkit/core/hooks/readguard-engine.js +29 -10
  172. package/.bkit/core/hooks/session-rules-advisory.js +61 -0
  173. package/.bkit/core/prompts/bkit-audit-generate.md +202 -94
  174. package/.bkit/core/prompts/bkit-build-challenge-1.md +76 -34
  175. package/.bkit/core/prompts/bkit-build-challenge-2.md +85 -38
  176. package/.bkit/core/prompts/bkit-build-install-skills.md +50 -28
  177. package/.bkit/core/prompts/bkit-build-plan-convert.md +85 -0
  178. package/.bkit/core/prompts/bkit-build-plan-current.md +59 -36
  179. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +101 -36
  180. package/.bkit/core/prompts/bkit-build-plan-tasks.md +149 -0
  181. package/.bkit/core/prompts/bkit-build-plan-tests.md +120 -0
  182. package/.bkit/core/prompts/bkit-build-plan-verify.md +104 -43
  183. package/.bkit/core/prompts/bkit-debug-abort-handover.md +47 -32
  184. package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +109 -57
  185. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +65 -39
  186. package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +53 -31
  187. package/.bkit/core/prompts/bkit-debug-failure-soak.md +65 -34
  188. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +46 -31
  189. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +45 -31
  190. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +43 -30
  191. package/.bkit/core/prompts/bkit-design-generate.md +80 -46
  192. package/.bkit/core/prompts/bkit-design-organise.md +83 -32
  193. package/.bkit/core/prompts/bkit-design-review-1.md +70 -50
  194. package/.bkit/core/prompts/bkit-design-review-2.md +65 -46
  195. package/.bkit/core/prompts/bkit-design-spike.md +64 -40
  196. package/.bkit/core/prompts/bkit-design-update.md +53 -28
  197. package/.bkit/core/prompts/bkit-plan-generate.md +101 -29
  198. package/.bkit/core/prompts/bkit-plan-review-1.md +78 -41
  199. package/.bkit/core/prompts/bkit-plan-review-2.md +78 -35
  200. package/.bkit/core/prompts/bkit-plan-scope-check.md +116 -0
  201. package/.bkit/core/prompts/bkit-plan-update.md +86 -31
  202. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +94 -50
  203. package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +91 -41
  204. package/.bkit/core/prompts/bkit-ship-update-docs.md +45 -24
  205. package/.bkit/core/prompts/bkit-utility-compress-markdown.md +65 -49
  206. package/.bkit/core/prompts/bkit-utility-update-decisions.md +87 -42
  207. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +81 -37
  208. package/.bkit/core/prompts/bkit-utility-update-documentation.md +43 -25
  209. package/.bkit/core/prompts/bkit-utility-update-failures.md +84 -37
  210. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +88 -42
  211. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +92 -39
  212. package/.bkit/core/prompts/bkit-utility-update-tracker.md +159 -60
  213. package/.bkit/core/workflows/bkit-auto.md +89 -58
  214. package/.bkit/core/workflows/bkit-build.md +967 -517
  215. package/.bkit/core/workflows/bkit-debug.md +555 -387
  216. package/.bkit/core/workflows/bkit-design.md +319 -283
  217. package/.bkit/core/workflows/bkit-plan.md +319 -342
  218. package/.bkit/core/workflows/bkit-ship.md +525 -328
  219. package/.bkit/shared/.agents/plugins/bkit/hooks.json +10 -0
  220. package/.bkit/shared/.bkit/.env.example +2 -2
  221. package/.bkit/shared/.claude/bkit-cloud.md +12 -10
  222. package/.bkit/shared/.claude/settings.json +14 -0
  223. package/.bkit/shared/.codex/bkit-cloud.md +98 -0
  224. package/.bkit/shared/.codex/hooks.json +20 -0
  225. package/.bkit/shared/.cursor/bkit-cloud.md +3 -3
  226. package/.bkit/shared/.cursor/mcp.json +1 -1
  227. package/.bkit/shared/.cursor/rules/bkit-rules.mdc +1 -1
  228. package/.bkit/shared/.gitattributes +1 -1
  229. package/.bkit/shared/.mcp.json +1 -1
  230. package/.bkit/shared/.opencode/opencode.json +12 -1
  231. package/.bkit/shared/CLAUDE.md +6 -2
  232. package/.bkit/shared/GEMINI.md +5 -2
  233. package/.bkit/shared/docs/architecture.md +4 -7
  234. package/.bkit/shared/docs/data-schema.md +4 -7
  235. package/.bkit/shared/docs/deployments.md +241 -168
  236. package/.bkit/shared/docs/design.md +11 -12
  237. package/.bkit/shared/docs/noise.md +8 -7
  238. package/.bkit/shared/docs/observability.md +5 -8
  239. package/.bkit/shared/docs/security.md +35 -17
  240. package/.bkit/shared/docs/setup.md +29 -18
  241. package/.bkit/shared/docs/technology.md +3 -6
  242. package/.bkit/shared/docs/testing.md +289 -174
  243. package/.bkit/shared/gitignore +6 -2
  244. package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +15 -16
  245. package/.bkit/templates/.cursor/Dockerfile +12 -8
  246. package/.bkit/templates/.cursor/environment.json +1 -1
  247. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-bug.yml +10 -8
  248. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +45 -12
  249. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +3 -3
  250. package/.bkit/templates/.github/renovate.json5 +34 -6
  251. package/.bkit/templates/.github/workflows/bkit-ci.yml +54 -51
  252. package/.bkit/templates/.github/workflows/bkit-cloud.yml +34 -33
  253. package/.bkit/templates/.github/workflows/bkit-health.yml +97 -0
  254. package/.bkit/templates/.github/workflows/bkit-renovate.yml +5 -4
  255. package/.bkit/templates/.github/workflows/bkit-trivy.yml +5 -4
  256. package/.bkit/templates/.husky/pre-commit +2 -2
  257. package/.bkit/templates/.husky/pre-push +96 -36
  258. package/.bkit/templates/.prettierignore +6 -0
  259. package/.bkit/templates/.vale.ini +27 -27
  260. package/.bkit/templates/context/bkit-cloudrun.md +23 -15
  261. package/.bkit/templates/context/bkit-expo.md +70 -52
  262. package/.bkit/templates/context/bkit-github.md +93 -56
  263. package/.bkit/templates/context/bkit-inngest.md +21 -15
  264. package/.bkit/templates/context/bkit-maestro.md +22 -16
  265. package/.bkit/templates/context/bkit-playwright.md +23 -17
  266. package/.bkit/templates/context/bkit-resend.md +12 -10
  267. package/.bkit/templates/context/bkit-sentry.md +30 -20
  268. package/.bkit/templates/context/bkit-serena.md +8 -7
  269. package/.bkit/templates/context/bkit-stripe.md +14 -13
  270. package/.bkit/templates/context/bkit-supabase.md +16 -13
  271. package/.bkit/templates/context/bkit-tavily.md +14 -11
  272. package/.bkit/templates/context/bkit-vercel.md +27 -18
  273. package/.bkit/templates/docs/capabilities.md +15 -14
  274. package/.bkit/templates/scripts/ci/{check-accepted-divergences.mjs → bkit-check-accepted-divergences.mjs} +6 -3
  275. package/.bkit/templates/scripts/ci/{check-accepted-divergences.test.mjs → bkit-check-accepted-divergences.test.mjs} +3 -3
  276. package/.bkit/templates/scripts/ci/{check-capstone.mjs → bkit-check-capstone.mjs} +2 -2
  277. package/.bkit/templates/scripts/ci/{check-capstone.test.mjs → bkit-check-capstone.test.mjs} +4 -4
  278. package/.bkit/templates/scripts/ci/{check-dependency-audit.mjs → bkit-check-dependency-audit.mjs} +103 -18
  279. package/.bkit/templates/scripts/ci/{check-dependency-audit.test.mjs → bkit-check-dependency-audit.test.mjs} +31 -3
  280. package/.bkit/templates/scripts/ci/bkit-machine-lock.sh +387 -0
  281. package/.bkit/templates/scripts/ci/bkit-test-awake.mjs +75 -0
  282. package/.bkit/templates/scripts/ci/bkit-test-awake.test.mjs +160 -0
  283. package/.bkit/templates/scripts/ci/lanes/{resolve-push-base.mjs → bkit-resolve-push-base.mjs} +3 -3
  284. package/.bkit/templates/scripts/ci/lanes/{resolve-push-base.test.mjs → bkit-resolve-push-base.test.mjs} +4 -4
  285. package/.bkit/templates/scripts/cleanup/bkit-disk-prune.mjs +10 -2
  286. package/.bkit/templates/scripts/graphify/bkit-graph-drift.py +1 -1
  287. package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +3 -3
  288. package/.bkit/templates/scripts/graphify/bkit-graph-embed.py +63 -0
  289. package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +2 -2
  290. package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +69 -18
  291. package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +3 -3
  292. package/.bkit/templates/scripts/graphify/bkit-graph-surface.py +1 -1
  293. package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +1 -1
  294. package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +197 -126
  295. package/.bkit/templates/scripts/graphify/bkit-graphify.sh +64 -41
  296. package/.bkit/templates/scripts/slop/bkit-slop-type-suppression.mjs +23 -7
  297. package/.bkit/templates/slop-scan.config.json +9 -2
  298. package/CHANGELOG.md +231 -0
  299. package/README.md +278 -89
  300. package/dist/checks/after/auth.js +36 -33
  301. package/dist/checks/after/ci-yml.js +91 -30
  302. package/dist/checks/after/github.js +91 -17
  303. package/dist/checks/after/index.js +22 -11
  304. package/dist/checks/after/suppression.js +8 -5
  305. package/dist/checks/after/tools.js +111 -114
  306. package/dist/checks/before/context-fetch.js +218 -33
  307. package/dist/checks/before/env.js +3 -3
  308. package/dist/checks/before/files.js +5 -3
  309. package/dist/checks/before/index.js +20 -3
  310. package/dist/checks/before/repo.js +197 -2
  311. package/dist/checks/status-holes.js +739 -114
  312. package/dist/checks/tips/catalogue.js +70 -19
  313. package/dist/checks/tips/detect.js +62 -0
  314. package/dist/checks/tips/index.js +51 -9
  315. package/dist/cli.js +234 -124
  316. package/dist/commands/analysis.js +174 -141
  317. package/dist/commands/ci/ci.js +302 -25
  318. package/dist/commands/ci/pins.js +142 -0
  319. package/dist/commands/ci/push-gate.js +194 -0
  320. package/dist/commands/comply.js +54 -91
  321. package/dist/commands/install/doctor.js +2 -2
  322. package/dist/commands/install/install.js +50 -19
  323. package/dist/commands/install/uninstall.js +82 -55
  324. package/dist/commands/install/upgrade.js +21 -11
  325. package/dist/commands/land.js +137 -17
  326. package/dist/commands/lib.js +295 -21
  327. package/dist/commands/registry.js +10 -2
  328. package/dist/commands/setup/setup.js +8 -7
  329. package/dist/commands/stats.js +175 -0
  330. package/dist/commands/tips.js +7 -3
  331. package/dist/commands/workflow/branches.js +1873 -152
  332. package/dist/commands/workflow/challenge.js +609 -0
  333. package/dist/commands/workflow/completeness.js +97 -0
  334. package/dist/commands/workflow/context.js +1045 -46
  335. package/dist/commands/workflow/counters.js +385 -86
  336. package/dist/commands/workflow/decisions.js +484 -0
  337. package/dist/commands/workflow/disk.js +214 -56
  338. package/dist/commands/workflow/fids.js +706 -33
  339. package/dist/commands/workflow/issues.js +349 -59
  340. package/dist/commands/workflow/ledgers.js +1123 -37
  341. package/dist/commands/workflow/locks.js +26 -2
  342. package/dist/commands/workflow/plan-blocks.js +501 -0
  343. package/dist/commands/workflow/plan-versions.js +22 -0
  344. package/dist/commands/workflow/plans.js +205 -0
  345. package/dist/commands/workflow/prs.js +154 -35
  346. package/dist/commands/workflow/repo.js +58 -8
  347. package/dist/commands/workflow/roadmap.js +58 -23
  348. package/dist/commands/workflow/run-facts.js +421 -0
  349. package/dist/commands/workflow/runs.js +670 -72
  350. package/dist/commands/workflow/runtime.js +15 -1
  351. package/dist/commands/workflow/skills.js +1 -0
  352. package/dist/commands/workflow/status.js +282 -34
  353. package/dist/commands/workflow/step-table.js +308 -0
  354. package/dist/commands/workflow/steps.js +703 -96
  355. package/dist/commands/workflow/summary-findings.js +117 -0
  356. package/dist/commands/workflow/summary.js +388 -0
  357. package/dist/commands/workflow/tasks.js +378 -0
  358. package/dist/commands/workflow/test-blocks.js +231 -0
  359. package/dist/commands/workflow/tests-changed.js +172 -0
  360. package/dist/commands/workflow/tests.js +1695 -305
  361. package/dist/commands/workflow/tracker.js +983 -0
  362. package/dist/commands/workflow/workflows.js +1014 -222
  363. package/dist/commands/workflow/worktrees.js +432 -26
  364. package/dist/install/cloud-env.js +233 -99
  365. package/dist/install/context-ci-workflow.js +85 -0
  366. package/dist/install/manifest.js +64 -17
  367. package/dist/install/modules/antigravity.js +3 -2
  368. package/dist/install/modules/cloud.js +25 -16
  369. package/dist/install/modules/codex.js +12 -2
  370. package/dist/install/modules/core.js +1090 -48
  371. package/dist/install/modules/cursor.js +6 -6
  372. package/dist/install/modules/opencode.js +13 -7
  373. package/dist/install/template-notes.js +116 -0
  374. package/dist/install/version-file.js +9 -4
  375. package/dist/ledgers/compact.js +87 -0
  376. package/dist/ledgers/journal.js +233 -0
  377. package/dist/ledgers/migrate.js +81 -0
  378. package/dist/ledgers/status.js +176 -13
  379. package/dist/ledgers/telemetry.js +1010 -125
  380. package/dist/render/hosts.js +104 -14
  381. package/dist/render/models.js +12 -0
  382. package/dist/shared/bkit-latest.js +26 -4
  383. package/dist/shared/branches.js +3 -1
  384. package/dist/shared/dep-updater.js +49 -0
  385. package/dist/shared/egress.js +8 -1
  386. package/dist/shared/json.js +20 -7
  387. package/dist/shared/package-manager.js +6 -0
  388. package/dist/shared/settings.js +181 -24
  389. package/dist/shared/text.js +333 -0
  390. package/dist/shared/timeouts.js +2 -0
  391. package/dist/tools/cli-doc.js +97 -0
  392. package/dist/tools/grammar-density.js +183 -0
  393. package/dist/tools/instructions-sources.js +720 -0
  394. package/dist/tools/instructions.js +1623 -0
  395. package/package.json +156 -51
  396. package/.bkit/core/.bkit/lite.md +0 -73
  397. package/.bkit/core/engine/commands/harvest.ts +0 -459
  398. package/.bkit/core/engine/commands/workflow/workstreams.ts +0 -166
  399. package/.bkit/core/engine/tools/wording.ts +0 -748
  400. package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +0 -69
  401. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +0 -71
  402. package/.bkit/core/prompts/bkit-build-challenge-tests.md +0 -74
  403. package/.bkit/core/prompts/bkit-build-plan-execute.md +0 -76
  404. package/.bkit/core/prompts/bkit-build-summary.md +0 -94
  405. package/.bkit/core/prompts/bkit-debug-summary.md +0 -96
  406. package/.bkit/core/prompts/bkit-design-summary.md +0 -107
  407. package/.bkit/core/prompts/bkit-plan-complexity-check.md +0 -67
  408. package/.bkit/core/prompts/bkit-plan-complexity-split.md +0 -88
  409. package/.bkit/core/prompts/bkit-plan-review-3.md +0 -93
  410. package/.bkit/core/prompts/bkit-plan-scope-check-1.md +0 -85
  411. package/.bkit/core/prompts/bkit-plan-scope-check-2.md +0 -85
  412. package/.bkit/core/prompts/bkit-plan-summary.md +0 -107
  413. package/.bkit/core/prompts/bkit-ship-summary.md +0 -78
  414. package/.bkit/templates/scripts/ci/bkit-local-stack-lock.sh +0 -194
  415. package/dist/commands/harvest.js +0 -353
  416. package/dist/commands/workflow/workstreams.js +0 -143
  417. package/dist/tools/wording.js +0 -680
  418. /package/.bkit/templates/.vale/styles/{House → Bkit}/Filler.yml +0 -0
  419. /package/.bkit/templates/.vale/styles/{House → Bkit}/Hedging.yml +0 -0
  420. /package/.bkit/templates/.vale/styles/{House → Bkit}/LLMSlop.yml +0 -0
  421. /package/.bkit/templates/.vale/styles/{House → Bkit}/Verbose.yml +0 -0
  422. /package/.bkit/templates/scripts/ci/{accepted-advisories.json → bkit-accepted-advisories.json} +0 -0
  423. /package/.bkit/templates/scripts/ci/{accepted-divergences.json → bkit-accepted-divergences.json} +0 -0
  424. /package/.bkit/templates/scripts/launchd/{launchd.env.example → bkit-launchd.env.example} +0 -0
  425. /package/.bkit/templates/scripts/launchd/{ai.bkit.launchd.plist → bkit-launchd.plist} +0 -0
@@ -1,8 +1,10 @@
1
- // install/cloud-env.ts — resolve a copy-paste-ready Claude Code on the web env-var block
2
- // by *following the consumer's `.envrc`*.
1
+ // install/cloud-env.ts — resolve a copy-paste-ready cloud env-var block by *following
2
+ // the consumer's `.envrc`*.
3
3
  //
4
- // The generated `.claude/bkit-cloud.md` (see runClaudeModule) inlines REAL SECRET
5
- // VALUES so it is gitignored + chmod 600 and never committed. This module owns the
4
+ // The generated `.claude/bkit-cloud.md`, `.cursor/bkit-cloud.md` and
5
+ // `.codex/bkit-cloud.md` (see the claude / cursor / codex host modules) inline REAL
6
+ // SECRET VALUES so they are gitignored + chmod 600 and never committed. All three carry
7
+ // the same env block whatever the issue tracker. This module owns the
6
8
  // stack-agnostic resolution: it reads whatever dotenv files the repo's `.envrc`
7
9
  // sources, honours the `.envrc` `unset` lines, and drops session-hijack keys.
8
10
  // bkit hardcodes NO stack-specific key lists — the stack knowledge lives in the
@@ -15,49 +17,36 @@ import * as path from "node:path";
15
17
  import { readJsonFile } from "../shared/json.js";
16
18
  import { getSharedRoot } from "../shared/package-roots.js";
17
19
  import { applyTokens } from "./placeholders.js";
18
- import { BKIT_EGRESS_SOURCES } from "../shared/egress.js";
20
+ import { BKIT_EGRESS_SOURCES, MULTI_TENANT_APEXES } from "../shared/egress.js";
19
21
  import { sha256 } from "./version-file.js";
20
22
  // Consumer-relative paths of the generated docs. Shared so the upgrade template walk
21
23
  // (commands/install/install.ts) can exclude them — they are generated OUTPUT files, never
22
24
  // templates to reconcile. One per cloud host (Claude Code on the web / Cursor
23
- // Background Agents); both inline resolved secrets, both gitignored + chmod 600.
25
+ // Background Agents / Codex Cloud); all inline resolved secrets, all gitignored + chmod 600.
24
26
  export const CLAUDE_CLOUD_RELPATH = path.join(".claude", "bkit-cloud.md");
25
27
  export const CURSOR_CLOUD_RELPATH = path.join(".cursor", "bkit-cloud.md");
28
+ export const CODEX_CLOUD_RELPATH = path.join(".codex", "bkit-cloud.md");
26
29
  // Session-hijack keys: exporting these into a cloud env redirects Claude Code's
27
30
  // OWN model calls onto API-key billing instead of the user's subscription
28
- // (`.bkit/cloud.md` § Environment variables). Always dropped from the paste block.
31
+ // (`.bkit/cloud.md` § Tokens by session type). Always dropped from the paste block.
29
32
  export const SESSION_HIJACK_KEYS = [
30
33
  "ANTHROPIC_API_KEY",
31
34
  "BKIT_ANTHROPIC_API_KEY",
32
35
  "ANTHROPIC_AUTH_TOKEN",
33
36
  ];
34
- // bkit baseline env-var NAMES every Claude-on-web environment needs. Emitted as a
35
- // placeholder ONLY when absent from the resolved `.envrc` set — a present value
36
- // (e.g. BKIT_GH_TOKEN already in `.bkit/.env`) keeps its real resolved value.
37
+ // bkit baseline env-var NAMES every cloud environment needs, whatever the tracker:
38
+ // `gh` and the GitHub MCP server read BKIT_GH_TOKEN on every host. Emitted as a
39
+ // placeholder ONLY when absent from the resolved `.envrc` set — a present value keeps
40
+ // its real resolved value. Tracker keys (BKIT_LINEAR_API_KEY, BKIT_JIRA_API_KEY) are
41
+ // never baseline: a consumer on that tracker already sets them in `.envrc`, so they
42
+ // arrive with the resolved set. One baseline for every host keeps the generated docs
43
+ // describing the SAME cloud environment — just different mechanics.
37
44
  const BASELINE_TOKEN_PLACEHOLDERS = [
38
45
  [
39
46
  "BKIT_GH_TOKEN",
40
47
  "<PAT — fine-grained one owner / classic across owners; see .bkit/cloud.md § BKIT_GH_TOKEN token permissions>",
41
48
  ],
42
49
  ];
43
- // Claude Code on the web: GitHub tracker.
44
- export const CLAUDE_CLOUD_POLICY = {
45
- baseline: BASELINE_TOKEN_PLACEHOLDERS,
46
- };
47
- // Cursor Background Agents: `BKIT_LINEAR_API_KEY` prepended for the Linear tracker
48
- // (bkit-preflight.sh calls the Linear GraphQL API and hard-fails without it); GitHub
49
- // tracker uses the same GH baseline as Claude.
50
- const CURSOR_LINEAR_PLACEHOLDER = [
51
- "BKIT_LINEAR_API_KEY",
52
- "<Linear personal API key — https://linear.app/settings/api>",
53
- ];
54
- export function cursorCloudPolicy(tracker) {
55
- return {
56
- baseline: tracker === "linear"
57
- ? [CURSOR_LINEAR_PLACEHOLDER, ...BASELINE_TOKEN_PLACEHOLDERS]
58
- : BASELINE_TOKEN_PLACEHOLDERS,
59
- };
60
- }
61
50
  /** Strip one layer of matching surrounding single/double quotes. */
62
51
  function stripQuotes(v) {
63
52
  const t = v.trim();
@@ -117,7 +106,7 @@ export function parseDotenv(content) {
117
106
  * Applies `.envrc` unsets, then drops session-hijack keys. Returns empty when no
118
107
  * `.envrc` exists — the caller still emits a usable placeholder doc.
119
108
  */
120
- export function resolveCloudEnvVars(cwd, policy = CLAUDE_CLOUD_POLICY) {
109
+ export function resolveCloudEnvVars(cwd) {
121
110
  const res = {
122
111
  included: [],
123
112
  unset: [],
@@ -171,7 +160,7 @@ export function resolveCloudEnvVars(cwd, policy = CLAUDE_CLOUD_POLICY) {
171
160
  }
172
161
  // Baseline names absent from the resolved set → emitted as placeholders.
173
162
  const present = new Set(res.included.map(([k]) => k));
174
- for (const [name] of policy.baseline) {
163
+ for (const [name] of BASELINE_TOKEN_PLACEHOLDERS) {
175
164
  if (!present.has(name))
176
165
  res.placeholders.push(name);
177
166
  }
@@ -181,11 +170,11 @@ export function resolveCloudEnvVars(cwd, policy = CLAUDE_CLOUD_POLICY) {
181
170
  * Render the `.env`-format paste block: resolved KEY=value lines, then placeholder
182
171
  * lines for any absent baseline token.
183
172
  */
184
- export function renderCloudEnvBlock(res, policy = CLAUDE_CLOUD_POLICY) {
173
+ export function renderCloudEnvBlock(res) {
185
174
  const lines = [];
186
175
  for (const [k, v] of res.included)
187
176
  lines.push(`${k}=${v}`);
188
- for (const [name, placeholder] of policy.baseline) {
177
+ for (const [name, placeholder] of BASELINE_TOKEN_PLACEHOLDERS) {
189
178
  if (res.placeholders.includes(name))
190
179
  lines.push(`${name}=${placeholder}`);
191
180
  }
@@ -244,11 +233,19 @@ export function renderCorepackLine(cwd) {
244
233
  * enabled below `<!-- bkit:end -->` in `.agents/context.md`. Stack-agnostic: bkit
245
234
  * hardcodes no CLI names — the install recipe lives in the consumer's context.md,
246
235
  * co-located with the fetch block that needs the CLI. `bkit context list-blocks` returns
247
- * the same list as `provision`, which `.claude/hooks/bkit-cloud-bootstrap.sh` runs, so the web
248
- * setup-script snapshot and the per-session hook provision the same CLIs. Returns one
249
- * string per block (bash body).
236
+ * the same list as `provision`, so the web setup-script snapshot and the per-session
237
+ * hook provision the same CLIs. Returns one string per block (bash body).
250
238
  */
251
239
  export function extractContextFetchProvisionRecipes(cwd) {
240
+ return extractContextFetchProvisionBlocks(cwd).map((b) => b.body);
241
+ }
242
+ /**
243
+ * {@link extractContextFetchProvisionRecipes} with each block's name — the word after
244
+ * `context-fetch:provision` in its opening marker, limited to `[A-Za-z0-9._-]` so it is
245
+ * safe inside a quoted shell string; "" when the marker names none.
246
+ * {@link renderCloudContextFetchProvision} reports a failing recipe by this name.
247
+ */
248
+ export function extractContextFetchProvisionBlocks(cwd) {
252
249
  const filePath = path.join(cwd, ".agents", "context.md");
253
250
  if (!fs.existsSync(filePath))
254
251
  return [];
@@ -258,11 +255,14 @@ export function extractContextFetchProvisionRecipes(cwd) {
258
255
  return [];
259
256
  const consumer = content.slice(endIdx);
260
257
  const recipes = [];
258
+ let name = "";
261
259
  let cur = null;
262
260
  let inProv = false;
263
261
  let inFence = false;
264
262
  for (const line of consumer.split("\n")) {
265
- if (/^<!-- context-fetch:provision/.test(line)) {
263
+ const opening = /^<!-- context-fetch:provision\b\s*([A-Za-z0-9][A-Za-z0-9._-]*)?/.exec(line);
264
+ if (opening) {
265
+ name = opening[1] ?? "";
266
266
  inProv = true;
267
267
  inFence = false;
268
268
  cur = [];
@@ -270,7 +270,7 @@ export function extractContextFetchProvisionRecipes(cwd) {
270
270
  }
271
271
  if (/^<!-- context-fetch:(start|end|none)/.test(line)) {
272
272
  if (inProv && cur && cur.length > 0)
273
- recipes.push(cur.join("\n"));
273
+ recipes.push({ name, body: cur.join("\n") });
274
274
  inProv = false;
275
275
  inFence = false;
276
276
  cur = null;
@@ -319,30 +319,70 @@ export function renderCloudCacheBust(cwd, today) {
319
319
  const CLOUD_PNPM_GLOBAL_PATH_SETUP = "# pnpm refuses `add -g` unless its global-bin dir is on PATH (corepack pnpm skips `pnpm setup`).\n" +
320
320
  'export PNPM_HOME="${PNPM_HOME:-$HOME/.local/share/pnpm}"\n' +
321
321
  'export PATH="$PNPM_HOME:$PNPM_HOME/bin:$PATH"';
322
+ /** Where a cloud environment lists the provision recipes that failed in it, from the repo root. */
323
+ export const UNAVAILABLE_RELPATH = ".bkit/.unavailable";
324
+ /**
325
+ * Runs one provision recipe (a function named in `$2`) in its own `set -e` subshell. Its
326
+ * stdout goes to stderr, so a caller's stdout carries only its own report. A failure is
327
+ * named on stderr with the recipe's last error line, added to `$BKIT_UNAVAILABLE`, and
328
+ * appended to `$BKIT_UNAVAILABLE_FILE` as `<name>: <reason>` when that is set. The
329
+ * subshell is never the left side of `||`: bash ignores `set -e` there, so only the
330
+ * recipe's last command would count.
331
+ */
332
+ const CLOUD_PROVISION_RUNNER = "bkit_provision() {\n" +
333
+ " bkit_err=$(mktemp)\n" +
334
+ ' ( set -e; "$2" ) >&2 2>"$bkit_err"\n' +
335
+ " bkit_rc=$?\n" +
336
+ ' cat "$bkit_err" >&2\n' +
337
+ ' if [ "$bkit_rc" -ne 0 ]; then\n' +
338
+ " bkit_why=$(grep -v '^[[:space:]]*$' \"$bkit_err\" | tail -n 1 | cut -c 1-300)\n" +
339
+ ' [ -n "$bkit_why" ] || bkit_why="exit $bkit_rc"\n' +
340
+ " echo \"[cloud-setup] provision '$1' failed (non-blocking): $bkit_why\" >&2\n" +
341
+ ' BKIT_UNAVAILABLE="${BKIT_UNAVAILABLE:+$BKIT_UNAVAILABLE, }$1"\n' +
342
+ ' [ -z "$BKIT_UNAVAILABLE_FILE" ] || printf \'%s: %s\\n\' "$1" "$bkit_why" >> "$BKIT_UNAVAILABLE_FILE"\n' +
343
+ " fi\n" +
344
+ ' rm -f "$bkit_err"\n' +
345
+ "}";
322
346
  /**
323
347
  * Render the `@@CLOUD_CONTEXT_FETCH_PROVISION@@` setup-script region: the consumer's
324
348
  * `context-fetch:provision` recipes, or "" when none are enabled. Placed AFTER the
325
- * corepack line in the template so `pnpm add -g …` recipes have pnpm available.
349
+ * corepack line in the template so `pnpm add -g …` recipes have pnpm available. `bkit
350
+ * context provision` runs the same region, so every cloud platform runs the recipes one way.
326
351
  *
327
- * Recipes run in a best-effort `( set +e … ) || …` subshell: the setup script is
328
- * `set -euo pipefail`, so without this a single failing recipe (e.g. a heavy `curl |
329
- * bash` CLI installer that trips over a missing base-image dep) aborts the whole
330
- * snapshot build and discards every CLI provisioned before it. `set +e` also lets a
331
- * later recipe run after an earlier one fails. Mirrors the non-blocking per-session
332
- * hook (`… | bash || log`), keeping the two cloud provision paths behaviourally equal.
352
+ * The setup script is `set -euo pipefail`, so a bare failing recipe (e.g. a heavy
353
+ * `curl | bash` CLI installer that trips over a missing base-image dep) would abort the
354
+ * whole snapshot build and discard every CLI provisioned before it. So errexit is off
355
+ * around the region and back on after it, and each recipe runs on its own through
356
+ * {@link CLOUD_PROVISION_RUNNER}: a failing command stops only its own recipe.
357
+ *
358
+ * With `$REPO_ROOT` set, the region rewrites {@link UNAVAILABLE_RELPATH} under it
359
+ * (removed when nothing failed) for the cloud agent to read. The Claude setup script runs
360
+ * before the clone, with no `$REPO_ROOT`; there the session hook writes the file. The
361
+ * region leaves `$BKIT_UNAVAILABLE` set for the script's closing line.
333
362
  */
334
363
  export function renderCloudContextFetchProvision(cwd) {
335
- const recipes = extractContextFetchProvisionRecipes(cwd);
364
+ const recipes = extractContextFetchProvisionBlocks(cwd)
365
+ .map(({ name, body }, i) => ({ label: name === "" ? `#${i + 1}` : name, body }))
366
+ .filter(({ body }) => body.trim() !== "");
336
367
  if (recipes.length === 0)
337
368
  return "";
338
- return ("# context-fetch CLIs (from .agents/context.md provision blocks) — self-guarded, best-effort.\n" +
369
+ const runs = recipes.map(({ label, body }, i) => `bkit_provision_${i + 1}() {\n${body}\n}\nbkit_provision '${label}' bkit_provision_${i + 1}`);
370
+ return ("# context-fetch provision recipes (from .agents/context.md) — each runs on its own. A\n" +
371
+ "# failing one is named with its last error line and never stops this script.\n" +
339
372
  CLOUD_PNPM_GLOBAL_PATH_SETUP +
373
+ "\nset +e\n" +
374
+ 'BKIT_UNAVAILABLE=""\n' +
375
+ `BKIT_UNAVAILABLE_FILE="\${REPO_ROOT:+$REPO_ROOT/${UNAVAILABLE_RELPATH}}"\n` +
376
+ '[ -z "$BKIT_UNAVAILABLE_FILE" ] || { mkdir -p "${BKIT_UNAVAILABLE_FILE%/*}"; : > "$BKIT_UNAVAILABLE_FILE"; }\n' +
377
+ CLOUD_PROVISION_RUNNER +
340
378
  "\n" +
341
- "(\n" +
342
- " set +e\n" +
343
- recipes.join("\n") +
344
- "\n" +
345
- ') || echo "[cloud-setup] a context-fetch provision recipe failed (non-blocking); its CLI will be absent" >&2');
379
+ runs.join("\n") +
380
+ '\nif [ -n "$BKIT_UNAVAILABLE" ]; then\n' +
381
+ ' echo "[cloud-setup] UNAVAILABLE in this environment: $BKIT_UNAVAILABLE. Their setup failed: treat them as absent and do not retry the install." >&2\n' +
382
+ "else\n" +
383
+ ' [ -z "$BKIT_UNAVAILABLE_FILE" ] || rm -f "$BKIT_UNAVAILABLE_FILE"\n' +
384
+ "fi\n" +
385
+ "set -e");
346
386
  }
347
387
  /**
348
388
  * Entries of every `<!-- {tag}:start --> … <!-- {tag}:end -->` list block BELOW
@@ -537,6 +577,21 @@ export function egressFingerprint() {
537
577
  ].sort();
538
578
  return sha256(derived.join("\n")).slice(0, 8);
539
579
  }
580
+ /**
581
+ * The "where these came from" clause of a network list's count note. A declared entry
582
+ * bkit already ships adds nothing to the list, so it counts once, as shipped, and the
583
+ * clause names how many declared entries that was. `declared` and `shipped` are in the
584
+ * list's own unit: apex bases for the Claude list, exact hosts for Cursor and Codex.
585
+ */
586
+ function networkSourceCounts(declared, shipped) {
587
+ const shippedSet = new Set(shipped);
588
+ const declaredSet = new Set(declared);
589
+ const added = [...declaredSet].filter((d) => !shippedSet.has(d)).length;
590
+ const overlap = declaredSet.size - added;
591
+ return (`${shippedSet.size} from bkit's shipped egress registry and ${added} more from ` +
592
+ "`allowed-domains` in `.agents/context.md`" +
593
+ (overlap > 0 ? ` (${overlap} of its ${declaredSet.size} entries already shipped)` : ""));
594
+ }
540
595
  /**
541
596
  * Render the `@@CLOUD_NETWORK_ALLOWLIST@@` region — the whole `## Network access`
542
597
  * body. Always emits a **Custom** paste block: the list is the derived shipped bases
@@ -547,7 +602,6 @@ export function egressFingerprint() {
547
602
  export function renderCloudNetworkAllowlist(cwd) {
548
603
  const declared = extractAllowedDomains(cwd);
549
604
  const domains = resolveNetworkAllowlist(cwd);
550
- const derivedCount = BKIT_SHIPPED_NETWORK_DOMAINS.length;
551
605
  const declaredNote = declared.length === 0
552
606
  ? "\n\n_No `allowed-domains` block is declared in `.agents/context.md`. The list above is\n" +
553
607
  "bkit's own shipped hosts. If you run cloud `/bkit-debug` or e2e against a deployment,\n" +
@@ -560,9 +614,9 @@ export function renderCloudNetworkAllowlist(cwd) {
560
614
  "```text\n" +
561
615
  domains.join("\n") +
562
616
  "\n```\n\n" +
563
- `_${domains.length} entries — ${derivedCount} derived from bkit's shipped egress registry ` +
564
- `and ${declared.length} declared in \`allowed-domains\` in \`.agents/context.md\`, ` +
565
- "each as apex + `*.` wildcard. Derived set fingerprint `" +
617
+ `_${domains.length} entries (${domains.length / 2} domains, each as apex + \`*.\` wildcard): ` +
618
+ networkSourceCounts(networkAllowlistBases(declared), BKIT_SHIPPED_NETWORK_DOMAINS) +
619
+ ". Derived set fingerprint `" +
566
620
  egressFingerprint() +
567
621
  "`._" +
568
622
  declaredNote +
@@ -665,6 +719,23 @@ export function renderCloudUserSettings(cwd) {
665
719
  `jq --argjson e '${env}' '.autoMode.environment //= $e' \\\n` +
666
720
  ' "$CLAUDE_SETTINGS" > "$CLAUDE_SETTINGS.tmp" && mv "$CLAUDE_SETTINGS.tmp" "$CLAUDE_SETTINGS"');
667
721
  }
722
+ /** `# bkit-toolchain:start|end` marker lines in the Claude template's setup script. */
723
+ const TOOLCHAIN_MARKER_LINE = /^# bkit-toolchain:(?:start|end)\n/gm;
724
+ /**
725
+ * The pinned toolchain installs (Node, vale, gh, jq + the PATH lead) from the Claude
726
+ * template's setup script — the region between the `# bkit-toolchain:start` / `:end`
727
+ * markers, markers stripped. The pins live once, in `.bkit/shared/.claude/bkit-cloud.md`
728
+ * (where Renovate's regex manager bumps them); every other pasted install script inlines
729
+ * this slice so the cloud toolchains never diverge. Throws when the markers are absent:
730
+ * a Codex doc without its toolchain is a broken paste, not an empty one.
731
+ */
732
+ export function extractCloudToolchainScript() {
733
+ const src = fs.readFileSync(path.join(getSharedRoot(), ".claude", "bkit-cloud.md"), "utf-8");
734
+ const m = /^# bkit-toolchain:start\n([\s\S]*?)^# bkit-toolchain:end$/m.exec(src);
735
+ if (!m)
736
+ throw new Error(".claude/bkit-cloud.md template lacks the bkit-toolchain markers");
737
+ return m[1].trim();
738
+ }
668
739
  /**
669
740
  * Generate `.claude/bkit-cloud.md` — a copy-paste-ready Claude Code on the web setup doc
670
741
  * with the env-var block resolved to REAL VALUES from the consumer's `.envrc`.
@@ -689,6 +760,7 @@ export function writeClaudeCloudDoc(cwd, tokens) {
689
760
  // Function-form replacers: resolved secret values may contain `$`, which a string
690
761
  // replacement would interpret ($&, $1, …).
691
762
  const content = applyTokens(fs.readFileSync(src, "utf-8"), tokens)
763
+ .replace(TOOLCHAIN_MARKER_LINE, "")
692
764
  .replace(/@@CLOUD_CACHE_BUST@@/g, () => renderCloudCacheBust(cwd, today))
693
765
  .replace(/@@CLOUD_NETWORK_ALLOWLIST@@/g, () => renderCloudNetworkAllowlist(cwd))
694
766
  .replace(/@@CLOUD_WORKSPACE_TRUST@@/g, () => renderCloudWorkspaceTrust(cwd))
@@ -705,58 +777,71 @@ export function writeClaudeCloudDoc(cwd, tokens) {
705
777
  }
706
778
  /**
707
779
  * Render the `@@CURSOR_CONTEXT_FETCH@@` region of `.cursor/bkit-cloud.md`: the consumer's
708
- * `context-fetch:provision` recipes formatted for the Cursor mechanic, or "" when none
709
- * are enabled. On Claude these CLIs are baked into the pasted setup script (see
710
- * renderCloudContextFetchProvision); Cursor has no setup script, so — to keep the two
711
- * cloud environments aligned — the same recipes are surfaced as a copy-paste block for
712
- * the per-snapshot `install` command in `.cursor/environment.json`. The recipes are
713
- * already idempotent (`command -v X || pnpm add -g X`), so they are safe to re-run on
714
- * every snapshot build. Reuses the SAME extractor as the Claude path so the two clouds
715
- * never diverge on which CLIs they provision.
780
+ * `context-fetch:provision` recipes by name, or "" when none are enabled. On Claude and
781
+ * Codex they are inlined into the pasted script ({@link renderCloudContextFetchProvision});
782
+ * Cursor has no pasted script, so the `install` command in `.cursor/environment.json` runs
783
+ * `bkit context provision`, which runs that same region. The section names the recipes and
784
+ * the line a copy of `environment.json` without it needs.
716
785
  */
717
786
  export function renderCursorContextFetchProvision(cwd) {
718
- const recipes = extractContextFetchProvisionRecipes(cwd);
787
+ const blocks = extractContextFetchProvisionBlocks(cwd);
719
788
  // Empty → "" and the template's sentinel line collapses to a single blank between
720
789
  // sections; non-empty → a self-contained section with its own leading/trailing blank.
721
- if (recipes.length === 0)
790
+ if (blocks.length === 0)
722
791
  return "";
792
+ const names = blocks.map(({ name }, i) => `\`${name === "" ? `#${i + 1}` : name}\``);
723
793
  return ("\n## Context-fetch CLIs (parity with the Claude setup script)\n\n" +
724
- "Your `.agents/context.md` declares these context-fetch CLIs. The Claude setup script\n" +
725
- "bakes them into its snapshot; for the SAME tools on Cursor, chain them into the\n" +
726
- "`install` command in `.cursor/environment.json` (idempotent — safe every rebuild):\n\n" +
794
+ `Your \`.agents/context.md\` declares these provision recipes: ${names.join(", ")}. The\n` +
795
+ "`install` command in `.cursor/environment.json` runs them each snapshot build, after\n" +
796
+ "`pnpm install`, by ending with:\n\n" +
727
797
  "```bash\n" +
728
- recipes.join("\n") +
729
- "\n```\n");
798
+ "&& pnpm exec bkit context provision\n" +
799
+ "```\n\n" +
800
+ "A recipe that fails is named in the install log and listed in `.bkit/.unavailable`\n" +
801
+ "for the agent; the install still succeeds.\n");
730
802
  }
731
803
  /**
732
- * Render the `@@CURSOR_NETWORK@@` region — Cursor Cloud Agents DO have an egress
733
- * allowlist (dashboard → Security: "Allow all" / "Default + allowlist" / "Allowlist
734
- * only"), unlike the earlier assumption. Reuses the SAME declared `allowed-domains`
735
- * as the Claude side, but — critically — does NOT apply Claude's apex+`*.`
736
- * expansion: Cursor's own docs warn that a broad wildcard (`*.s3….amazonaws.com`)
737
- * opens egress far wider than intended, so the declared apex entries are emitted
738
- * verbatim with a note to add only the specific subdomains you need.
804
+ * The Cursor and Codex allowlist: the fenced paste block and the notes under it. bkit's
805
+ * shipped HOSTS are listed exactly; each declared `allowed-domains` entry bkit does not
806
+ * already ship is listed as the domain and its `*.` wildcard, like the Claude side, since
807
+ * the CLIs and APIs a consumer declares call subdomains (`api.vercel.com` under
808
+ * `vercel.com`). A declared {@link MULTI_TENANT_APEXES} entry is widened the same way,
809
+ * with a note that its wildcard reaches every tenant on the platform, the exfiltration
810
+ * path Cursor's docs warn about.
739
811
  */
740
- export function renderCursorNetworkAllowlist(cwd) {
812
+ function renderWidenedNetworkList(cwd) {
741
813
  const declared = extractAllowedDomains(cwd);
742
- // Exact hosts, never apex + `*.`: Cursor's own docs warn a broad wildcard opens
743
- // egress far wider than intended, so the shipped set contributes its HOSTS here
744
- // while the Claude side takes the wildcard-expanded bases.
745
- const entries = [...new Set([...BKIT_SHIPPED_NETWORK_HOSTS, ...declared])].sort();
746
- return ("If your org runs Cloud Agents in **Allowlist only** / **Default + allowlist** mode\n" +
747
- "(dashboard → **Security**), add these hosts so cloud `/bkit-debug` + e2e can reach\n" +
748
- "bkit's own tooling and your app and log backends:\n\n" +
749
- "```text\n" +
814
+ const names = [...new Set([...BKIT_SHIPPED_NETWORK_HOSTS, ...declared])].sort();
815
+ const shipped = new Set(BKIT_SHIPPED_NETWORK_HOSTS);
816
+ const widened = (n) => declared.includes(n) && !shipped.has(n);
817
+ const entries = names.flatMap((n) => (widened(n) ? [n, `*.${n}`] : [n]));
818
+ const shared = [...new Set(declared)].filter((d) => MULTI_TENANT_APEXES.includes(d));
819
+ const sharedNote = shared.length === 0
820
+ ? ""
821
+ : `\n\n${shared.map((d) => `\`${d}\``).join(", ")}: shared by many tenants, so the ` +
822
+ "`*.` wildcard reaches every tenant on it. To narrow it, declare the exact hosts you " +
823
+ `call there instead (e.g. \`<name>.${shared[0]}\`).`;
824
+ return ("```text\n" +
750
825
  entries.join("\n") +
751
826
  "\n```\n\n" +
752
- `_${entries.length} host(s) — ${BKIT_SHIPPED_NETWORK_HOSTS.length} derived from bkit's shipped ` +
753
- `egress registry and ${declared.length} declared in \`allowed-domains\` in ` +
754
- "`.agents/context.md`. Derived set fingerprint `" +
827
+ `_${entries.length} entries (${names.length} hosts and domains, each declared domain ` +
828
+ "also as a `*.` wildcard): " +
829
+ networkSourceCounts(declared, BKIT_SHIPPED_NETWORK_HOSTS) +
830
+ ". Derived set fingerprint `" +
755
831
  egressFingerprint() +
756
- "`._ Add only the\n" +
757
- "specific subdomains you need (e.g. `api.example.com`) — Cursor warns that a broad `*.`\n" +
758
- "wildcard opens egress far wider than intended. (The Claude side auto-expands to apex + `*.`;\n" +
759
- "Cursor's allowlist is deliberately narrower.)");
832
+ "`._" +
833
+ sharedNote);
834
+ }
835
+ /**
836
+ * Render the `@@CURSOR_NETWORK@@` region — Cursor Cloud Agents' egress allowlist
837
+ * (dashboard → Security: "Allow all" / "Default + allowlist" / "Allowlist only"), which
838
+ * takes `*.` patterns (Cursor's own default list is written that way).
839
+ */
840
+ export function renderCursorNetworkAllowlist(cwd) {
841
+ return ("If your org runs Cloud Agents in **Allowlist only** / **Default + allowlist** mode\n" +
842
+ "(dashboard → **Security**), add these hosts so cloud `/bkit-debug` + e2e can reach\n" +
843
+ "bkit's own tooling and your app and log backends:\n\n" +
844
+ renderWidenedNetworkList(cwd));
760
845
  }
761
846
  /**
762
847
  * Generate `.cursor/bkit-cloud.md` — the Cursor Cloud Agents analogue of
@@ -765,8 +850,8 @@ export function renderCursorNetworkAllowlist(cwd) {
765
850
  * selector; on Cursor the toolchain lives in `.cursor/Dockerfile` + the per-snapshot
766
851
  * `.cursor/environment.json` `install` (both committed, nothing to paste), so this doc
767
852
  * is narrower: it resolves the **dashboard environment variables** to real values from
768
- * the consumer's `.envrc` (Cursor policy — Linear tracker adds `BKIT_LINEAR_API_KEY`, no
769
- * autocompact knob) and surfaces any context-fetch CLIs for parity.
853
+ * the consumer's `.envrc` (the same tracker-independent set as the Claude doc) and
854
+ * surfaces any context-fetch CLIs for parity.
770
855
  *
771
856
  * Like `.claude/bkit-cloud.md` it is gitignored + chmod 600 and UNTRACKED (never pushed to
772
857
  * any WriteSet / manifest / canonicalHashes) — its values are machine-local and
@@ -776,16 +861,15 @@ export function renderCursorNetworkAllowlist(cwd) {
776
861
  * host being installed. Returns true when a file was written (false when the template
777
862
  * is absent). Never logs the resolved values.
778
863
  */
779
- export function writeCursorCloudDoc(cwd, tokens, tracker) {
864
+ export function writeCursorCloudDoc(cwd, tokens) {
780
865
  const src = path.join(getSharedRoot(), ".cursor", "bkit-cloud.md");
781
866
  if (!fs.existsSync(src))
782
867
  return false;
783
- const policy = cursorCloudPolicy(tracker);
784
- const res = resolveCloudEnvVars(cwd, policy);
868
+ const res = resolveCloudEnvVars(cwd);
785
869
  // Function-form replacers: resolved secret values may contain `$`, which a string
786
870
  // replacement would interpret ($&, $1, …).
787
871
  const content = applyTokens(fs.readFileSync(src, "utf-8"), tokens)
788
- .replace(/@@CLOUD_ENV_VARS@@/g, () => renderCloudEnvBlock(res, policy))
872
+ .replace(/@@CLOUD_ENV_VARS@@/g, () => renderCloudEnvBlock(res))
789
873
  .replace(/@@CLOUD_ENV_NOTES@@/g, () => renderCloudEnvNotes(res))
790
874
  .replace(/@@CURSOR_NETWORK@@/g, () => renderCursorNetworkAllowlist(cwd))
791
875
  .replace(/@@CURSOR_CONTEXT_FETCH@@/g, () => renderCursorContextFetchProvision(cwd));
@@ -795,3 +879,53 @@ export function writeCursorCloudDoc(cwd, tokens, tracker) {
795
879
  fs.chmodSync(dst, 0o600);
796
880
  return true;
797
881
  }
882
+ /**
883
+ * Render the `@@CODEX_NETWORK@@` region — Codex Cloud's **Internet access** settings
884
+ * for the environment: the same list as the Cursor doc. Codex's docs describe
885
+ * **Additional allowed domains** as exact hosts (a root domain also allows `www.`) and
886
+ * say nothing of `*.`, so the note marks the wildcard entries untested and names the
887
+ * setting that gets past a host they miss.
888
+ */
889
+ export function renderCodexNetworkAllowlist(cwd) {
890
+ return ("Under **Internet access**, keep **Enable package manager domains** on and paste these\n" +
891
+ "into **Additional allowed domains** (one per line) so cloud `/bkit-debug` + e2e can\n" +
892
+ "reach bkit's own tooling and your app and log backends:\n\n" +
893
+ renderWidenedNetworkList(cwd) +
894
+ "\n\nThe `*.` entries are untested on Codex: its docs list exact hosts only. If a task\n" +
895
+ "still cannot reach a subdomain, switch to **Enable all public internet access** (opens\n" +
896
+ "all egress) or add that exact host.");
897
+ }
898
+ /**
899
+ * Generate `.codex/bkit-cloud.md` — the Codex Cloud analogue of `.claude/bkit-cloud.md`:
900
+ * the SAME bkit cloud environment, built by Codex's mechanics. Codex runs a pasted
901
+ * **Install script** (like Claude's setup script) plus the environment's variables, so
902
+ * this doc carries the Claude template's pinned toolchain slice
903
+ * ({@link extractCloudToolchainScript}), the consumer's corepack pnpm and context-fetch
904
+ * provision recipes, the per-snapshot `pnpm install`, the exact-host network list, and
905
+ * the resolved env block.
906
+ *
907
+ * Gitignored + chmod 600 and UNTRACKED like its siblings. Shared by install
908
+ * (runCodexModule) and upgrade. Callers MUST guard on `!dryRun` and on the codex host
909
+ * being installed. Returns true when a file was written (false when the template is
910
+ * absent). Never logs the resolved values.
911
+ */
912
+ export function writeCodexCloudDoc(cwd, tokens) {
913
+ const src = path.join(getSharedRoot(), ".codex", "bkit-cloud.md");
914
+ if (!fs.existsSync(src))
915
+ return false;
916
+ const res = resolveCloudEnvVars(cwd);
917
+ // Function-form replacers: resolved secret values may contain `$`, which a string
918
+ // replacement would interpret ($&, $1, …).
919
+ const content = applyTokens(fs.readFileSync(src, "utf-8"), tokens)
920
+ .replace(/@@CODEX_TOOLCHAIN@@/g, () => extractCloudToolchainScript())
921
+ .replace(/@@CODEX_NETWORK@@/g, () => renderCodexNetworkAllowlist(cwd))
922
+ .replace(/@@CLOUD_COREPACK@@/g, () => renderCorepackLine(cwd))
923
+ .replace(/@@CLOUD_CONTEXT_FETCH_PROVISION@@/g, () => renderCloudContextFetchProvision(cwd))
924
+ .replace(/@@CLOUD_ENV_VARS@@/g, () => renderCloudEnvBlock(res))
925
+ .replace(/@@CLOUD_ENV_NOTES@@/g, () => renderCloudEnvNotes(res));
926
+ const dst = path.join(cwd, CODEX_CLOUD_RELPATH);
927
+ fs.mkdirSync(path.dirname(dst), { recursive: true });
928
+ fs.writeFileSync(dst, content, "utf-8");
929
+ fs.chmodSync(dst, 0o600);
930
+ return true;
931
+ }
@@ -0,0 +1,85 @@
1
+ // install/context-ci-workflow.ts — the CI-run lookup in the consumer's `context=ci` and
2
+ // `context=e2e` blocks in `.agents/context.md`.
3
+ //
4
+ // A lookup without `--workflow` takes the newest run of any workflow on the branch. Other
5
+ // workflows (a security scan, a cloud agent) often finish after CI and pass, so the block reads
6
+ // their run and reports nothing failing. The consumer owns the copies below
7
+ // `<!-- bkit:end -->`, so upgrade rewrites a lookup only when it is byte-identical to the line
8
+ // an older bkit template carried. Register: docs/migrations.md.
9
+ import * as fs from "node:fs";
10
+ import * as path from "node:path";
11
+ import { readBkitConfig } from "../shared/settings.js";
12
+ import { findLineAnchoredMarkers, selectMarkers } from "./managed-block.js";
13
+ const CONTEXT_FILE = path.join(".agents", "context.md");
14
+ const LOOKUP_TAIL = '=$(gh run list --branch "$(git branch --show-current)" --limit 1 \\';
15
+ /** The shipped lookup's first line: `RUN_JSON` in `bkit-github.md`, `RUN_ID` in the e2e blocks. */
16
+ const SHIPPED_LOOKUP = new RegExp(`^(RUN_JSON|RUN_ID)${LOOKUP_TAIL.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`);
17
+ /** Any lookup of the current branch's runs, shipped or edited. */
18
+ const ANY_LOOKUP = /gh run list --branch "\$\(git branch --show-current\)"/;
19
+ const NAMES_WORKFLOW = /(?:^|\s)(?:--workflow|-w)(?:\s|=)/;
20
+ const PLAIN_FILE_NAME = /^[\w.-]+$/;
21
+ /**
22
+ * Rewrites each shipped CI-run lookup below the first line-anchored `<!-- bkit:end -->` so it
23
+ * reads only `workflow`'s runs: a `CI_WORKFLOW="${CI_WORKFLOW:-<workflow>}"` line goes above
24
+ * it, and the lookup gains `--workflow "$CI_WORKFLOW"`. A lookup that names a workflow on
25
+ * either line is already scoped and stays. An edited lookup, or any lookup when `workflow` is
26
+ * not a plain file name, stays and is listed in `unscoped`. A line ending in CR keeps it.
27
+ */
28
+ export function scopeCiRunLookups(content, workflow) {
29
+ const endAt = findLineAnchoredMarkers(content, selectMarkers("html-comment")[1])[0];
30
+ if (endAt === undefined)
31
+ return { content, rewritten: 0, unscoped: [] };
32
+ const lines = content.slice(endAt).split("\n");
33
+ const plainName = PLAIN_FILE_NAME.test(workflow);
34
+ const out = [];
35
+ const unscoped = [];
36
+ let rewritten = 0;
37
+ lines.forEach((line, i) => {
38
+ const bare = line.replace(/\r$/, "");
39
+ const next = lines[i + 1] ?? "";
40
+ if (!ANY_LOOKUP.test(bare) || NAMES_WORKFLOW.test(bare) || NAMES_WORKFLOW.test(next)) {
41
+ out.push(line);
42
+ return;
43
+ }
44
+ if (!plainName || !SHIPPED_LOOKUP.test(bare)) {
45
+ unscoped.push(bare);
46
+ out.push(line);
47
+ return;
48
+ }
49
+ const cr = line.endsWith("\r") ? "\r" : "";
50
+ out.push(`CI_WORKFLOW="\${CI_WORKFLOW:-${workflow}}"${cr}`);
51
+ out.push(line.replace(" --limit 1 ", ' --workflow "$CI_WORKFLOW" --limit 1 '));
52
+ rewritten++;
53
+ });
54
+ if (rewritten === 0)
55
+ return { content, rewritten, unscoped };
56
+ return { content: content.slice(0, endAt) + out.join("\n"), rewritten, unscoped };
57
+ }
58
+ /** Absolute paths already named in this process. */
59
+ const warned = new Set();
60
+ /**
61
+ * Migration (installs up to 6.0.x, `docs/migrations.md`): scopes each shipped CI-run lookup in
62
+ * `.agents/context.md` to the workflow file `bkit.testing.ciWorkflow` names. Recorded in ws as
63
+ * an update; the canonical hash covers the managed block only. A lookup it leaves unscoped is
64
+ * named once per process, so the consumer can add `--workflow` by hand.
65
+ */
66
+ export function migrateContextCiWorkflow(dryRun, ws, logPrefix) {
67
+ if (!fs.lstatSync(CONTEXT_FILE, { throwIfNoEntry: false })?.isFile())
68
+ return;
69
+ const workflow = readBkitConfig(process.cwd()).ciWorkflow;
70
+ const result = scopeCiRunLookups(fs.readFileSync(CONTEXT_FILE, "utf-8"), workflow);
71
+ // Upgrade runs this pass again as its closing dry-run check, so each file is named once.
72
+ const abs = path.resolve(CONTEXT_FILE);
73
+ if (result.unscoped.length > 0 && !warned.has(abs)) {
74
+ warned.add(abs);
75
+ console.warn(`${logPrefix} ${CONTEXT_FILE}: ${result.unscoped.length} CI run lookup(s) read the newest run of every workflow on the branch, so a later passing workflow hides a failed ${workflow} run. Add \`--workflow "${workflow}"\` to each \`gh run list --branch\` line by hand (the shipped form in .bkit/templates/context/bkit-github.md shows how).`);
76
+ }
77
+ if (result.rewritten === 0)
78
+ return;
79
+ if (!dryRun)
80
+ fs.writeFileSync(CONTEXT_FILE, result.content, "utf-8");
81
+ if (!ws.writes.some((w) => path.normalize(w.path) === CONTEXT_FILE)) {
82
+ ws.writes.push({ path: CONTEXT_FILE, action: "update" });
83
+ }
84
+ console.log(`${logPrefix} ${dryRun ? "[dry-run] " : ""}core: ${CONTEXT_FILE} — CI run lookups now read only ${workflow} runs (${result.rewritten})`);
85
+ }