@cbartens/bkit 6.1.1 → 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 (313) 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 +42 -32
  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 +97 -36
  15. package/.bkit/core/.bkit/templates.md +162 -34
  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 +89 -37
  64. package/.bkit/core/engine/checks/after/index.ts +15 -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 +64 -11
  74. package/.bkit/core/engine/commands/ci/push-gate.ts +101 -43
  75. package/.bkit/core/engine/commands/install/install.ts +28 -25
  76. package/.bkit/core/engine/commands/install/uninstall.ts +42 -30
  77. package/.bkit/core/engine/commands/install/upgrade.ts +14 -2
  78. package/.bkit/core/engine/commands/land.ts +2 -3
  79. package/.bkit/core/engine/commands/lib.ts +394 -39
  80. package/.bkit/core/engine/commands/registry.ts +1 -1
  81. package/.bkit/core/engine/commands/workflow/branches.ts +351 -78
  82. package/.bkit/core/engine/commands/workflow/challenge.ts +63 -14
  83. package/.bkit/core/engine/commands/workflow/context.ts +71 -10
  84. package/.bkit/core/engine/commands/workflow/counters.ts +298 -23
  85. package/.bkit/core/engine/commands/workflow/decisions.ts +260 -125
  86. package/.bkit/core/engine/commands/workflow/disk.ts +2 -1
  87. package/.bkit/core/engine/commands/workflow/feature-base.ts +66 -0
  88. package/.bkit/core/engine/commands/workflow/issues.ts +312 -17
  89. package/.bkit/core/engine/commands/workflow/junit.ts +204 -0
  90. package/.bkit/core/engine/commands/workflow/ledgers.ts +904 -99
  91. package/.bkit/core/engine/commands/workflow/locks.ts +186 -29
  92. package/.bkit/core/engine/commands/workflow/loops.ts +87 -0
  93. package/.bkit/core/engine/commands/workflow/open-decision.ts +251 -0
  94. package/.bkit/core/engine/commands/workflow/plan-blocks.ts +8 -0
  95. package/.bkit/core/engine/commands/workflow/plans.ts +1 -1
  96. package/.bkit/core/engine/commands/workflow/prs.ts +311 -16
  97. package/.bkit/core/engine/commands/workflow/repo.ts +1 -1
  98. package/.bkit/core/engine/commands/workflow/run-facts.ts +6 -0
  99. package/.bkit/core/engine/commands/workflow/runs.ts +877 -174
  100. package/.bkit/core/engine/commands/workflow/runtime.ts +12 -4
  101. package/.bkit/core/engine/commands/workflow/status.ts +324 -11
  102. package/.bkit/core/engine/commands/workflow/step-table.ts +41 -15
  103. package/.bkit/core/engine/commands/workflow/steps.ts +604 -29
  104. package/.bkit/core/engine/commands/workflow/summary-findings.ts +1 -1
  105. package/.bkit/core/engine/commands/workflow/summary.ts +314 -8
  106. package/.bkit/core/engine/commands/workflow/tasks.ts +400 -27
  107. package/.bkit/core/engine/commands/workflow/tests-base.ts +319 -0
  108. package/.bkit/core/engine/commands/workflow/tests-changed.ts +138 -74
  109. package/.bkit/core/engine/commands/workflow/tests-jump.ts +93 -0
  110. package/.bkit/core/engine/commands/workflow/tests.ts +815 -182
  111. package/.bkit/core/engine/commands/workflow/tracker.ts +1134 -137
  112. package/.bkit/core/engine/commands/workflow/workflows.ts +100 -72
  113. package/.bkit/core/engine/commands/workflow/worktrees.ts +421 -57
  114. package/.bkit/core/engine/install/cloud-env.ts +38 -10
  115. package/.bkit/core/engine/install/managed-block.ts +105 -0
  116. package/.bkit/core/engine/install/manifest.ts +7 -1
  117. package/.bkit/core/engine/install/modules/claude.ts +6 -2
  118. package/.bkit/core/engine/install/modules/cloud.ts +84 -95
  119. package/.bkit/core/engine/install/modules/codex.ts +10 -2
  120. package/.bkit/core/engine/install/modules/core.ts +148 -14
  121. package/.bkit/core/engine/install/modules/opencode.ts +18 -23
  122. package/.bkit/core/engine/install/network-allowlist.ts +8 -3
  123. package/.bkit/core/engine/install/project-docs.ts +650 -0
  124. package/.bkit/core/engine/install/template-copies.ts +58 -5
  125. package/.bkit/core/engine/install/write.ts +128 -7
  126. package/.bkit/core/engine/ledgers/journal.ts +18 -10
  127. package/.bkit/core/engine/ledgers/migrate.ts +20 -8
  128. package/.bkit/core/engine/ledgers/status.ts +604 -8
  129. package/.bkit/core/engine/ledgers/telemetry.ts +115 -13
  130. package/.bkit/core/engine/render/trackers.ts +3 -1
  131. package/.bkit/core/engine/shared/package-manager.ts +7 -3
  132. package/.bkit/core/engine/shared/settings.ts +12 -1
  133. package/.bkit/core/engine/shared/text.ts +14 -0
  134. package/.bkit/core/engine/tools/instructions-sources.ts +1 -0
  135. package/.bkit/core/engine/tools/instructions.ts +116 -20
  136. package/.bkit/core/hooks/antigravity-hook.js +20 -4
  137. package/.bkit/core/hooks/gateguard-edit-payload.js +8 -5
  138. package/.bkit/core/hooks/gateguard-engine.js +249 -23
  139. package/.bkit/core/hooks/guardrails-deny.js +167 -0
  140. package/.bkit/core/hooks/guardrails-read.js +3 -3
  141. package/.bkit/core/hooks/guardrails-shell.js +1122 -167
  142. package/.bkit/core/hooks/guardrails-tiers.js +247 -176
  143. package/.bkit/core/hooks/preflight-tracker.sh +219 -0
  144. package/.bkit/core/prompts/bkit-audit-generate.md +23 -6
  145. package/.bkit/core/prompts/bkit-build-challenge-1.md +5 -4
  146. package/.bkit/core/prompts/bkit-build-challenge-2.md +6 -5
  147. package/.bkit/core/prompts/bkit-build-install-skills.md +2 -2
  148. package/.bkit/core/prompts/bkit-build-plan-convert.md +21 -7
  149. package/.bkit/core/prompts/bkit-build-plan-current.md +5 -4
  150. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +22 -17
  151. package/.bkit/core/prompts/bkit-build-plan-tasks.md +16 -12
  152. package/.bkit/core/prompts/bkit-build-plan-tests.md +14 -10
  153. package/.bkit/core/prompts/bkit-build-plan-verify.md +21 -8
  154. package/.bkit/core/prompts/bkit-debug-abort-handover.md +10 -5
  155. package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +22 -6
  156. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +19 -3
  157. package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +22 -6
  158. package/.bkit/core/prompts/bkit-debug-failure-soak.md +10 -7
  159. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +3 -3
  160. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +4 -4
  161. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +3 -3
  162. package/.bkit/core/prompts/bkit-design-generate.md +6 -4
  163. package/.bkit/core/prompts/bkit-design-organise.md +4 -3
  164. package/.bkit/core/prompts/bkit-design-review-1.md +5 -4
  165. package/.bkit/core/prompts/bkit-design-review-2.md +6 -5
  166. package/.bkit/core/prompts/bkit-design-spike.md +4 -3
  167. package/.bkit/core/prompts/bkit-design-update.md +6 -4
  168. package/.bkit/core/prompts/bkit-plan-generate.md +35 -14
  169. package/.bkit/core/prompts/bkit-plan-review-1.md +9 -7
  170. package/.bkit/core/prompts/bkit-plan-review-2.md +9 -7
  171. package/.bkit/core/prompts/bkit-plan-scope-check.md +8 -6
  172. package/.bkit/core/prompts/bkit-plan-update.md +22 -8
  173. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +11 -8
  174. package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +9 -5
  175. package/.bkit/core/prompts/bkit-ship-update-docs.md +26 -4
  176. package/.bkit/core/prompts/bkit-utility-compress-markdown.md +3 -3
  177. package/.bkit/core/prompts/bkit-utility-update-decisions.md +10 -7
  178. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +8 -5
  179. package/.bkit/core/prompts/bkit-utility-update-documentation.md +31 -7
  180. package/.bkit/core/prompts/bkit-utility-update-failures.md +8 -5
  181. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +10 -7
  182. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +4 -4
  183. package/.bkit/core/prompts/bkit-utility-update-tracker.md +4 -4
  184. package/.bkit/core/workflows/bkit-auto.md +23 -11
  185. package/.bkit/core/workflows/bkit-build.md +331 -100
  186. package/.bkit/core/workflows/bkit-debug.md +135 -64
  187. package/.bkit/core/workflows/bkit-design.md +58 -32
  188. package/.bkit/core/workflows/bkit-plan.md +73 -45
  189. package/.bkit/core/workflows/bkit-ship.md +233 -167
  190. package/.bkit/shared/.agents/plugins/bkit/hooks.json +1 -1
  191. package/.bkit/shared/.bkit/.env.example +5 -0
  192. package/.bkit/shared/.claude/bkit-cloud.md +7 -7
  193. package/.bkit/shared/.claude/settings.json +5 -1
  194. package/.bkit/shared/.cursor/bkit-cloud.md +1 -1
  195. package/.bkit/shared/.cursor/hooks.json +1 -1
  196. package/.bkit/shared/.opencode/opencode.json +11 -2
  197. package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +27 -0
  198. package/.bkit/templates/.cursor/Dockerfile +7 -7
  199. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +1 -1
  200. package/.bkit/templates/.github/dependabot.yml +5 -0
  201. package/.bkit/templates/.github/renovate.json5 +5 -3
  202. package/.bkit/templates/.github/workflows/bkit-ci.yml +11 -11
  203. package/.bkit/templates/.github/workflows/bkit-cloud.yml +525 -161
  204. package/.bkit/templates/.github/workflows/bkit-renovate.yml +2 -2
  205. package/.bkit/templates/.husky/pre-push +123 -6
  206. package/.bkit/templates/context/bkit-serena.md +1 -1
  207. package/.bkit/templates/docs/architecture.md +98 -0
  208. package/.bkit/templates/docs/capabilities.md +33 -37
  209. package/.bkit/templates/docs/components.md +142 -0
  210. package/.bkit/templates/docs/data-schema.md +87 -0
  211. package/.bkit/{shared → templates}/docs/deployments.md +128 -142
  212. package/.bkit/templates/docs/design.md +117 -0
  213. package/.bkit/templates/docs/noise.md +54 -0
  214. package/.bkit/templates/docs/observability.md +99 -0
  215. package/.bkit/templates/docs/security.md +137 -0
  216. package/.bkit/templates/docs/setup.md +93 -0
  217. package/.bkit/templates/docs/technology.md +70 -0
  218. package/.bkit/{shared → templates}/docs/testing.md +200 -87
  219. package/.bkit/templates/scripts/ci/bkit-machine-lock.sh +511 -103
  220. package/.bkit/templates/scripts/ci/bkit-test-awake.mjs +228 -35
  221. package/.bkit/templates/scripts/ci/bkit-test-awake.test.mjs +270 -2
  222. package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +1 -1
  223. package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +92 -63
  224. package/.bkit/templates/scripts/graphify/bkit-graphify.sh +59 -11
  225. package/.bkit/templates/slop-scan.config.json +2 -0
  226. package/CHANGELOG.md +64 -0
  227. package/DETAILS.md +24 -19
  228. package/README.md +1 -1
  229. package/dist/checks/after/auth.js +114 -46
  230. package/dist/checks/after/github.js +77 -35
  231. package/dist/checks/after/index.js +12 -3
  232. package/dist/checks/after/tools.js +224 -1
  233. package/dist/checks/before/files.js +59 -1
  234. package/dist/checks/before/index.js +7 -1
  235. package/dist/checks/status-holes.js +20 -21
  236. package/dist/checks/tips/catalogue.js +99 -10
  237. package/dist/checks/tips/detect.js +35 -3
  238. package/dist/checks/tips/index.js +1 -1
  239. package/dist/cli.js +13 -13
  240. package/dist/commands/ci/ci.js +56 -12
  241. package/dist/commands/ci/push-gate.js +79 -44
  242. package/dist/commands/install/install.js +23 -22
  243. package/dist/commands/install/uninstall.js +36 -30
  244. package/dist/commands/install/upgrade.js +10 -2
  245. package/dist/commands/land.js +2 -3
  246. package/dist/commands/lib.js +323 -25
  247. package/dist/commands/workflow/branches.js +312 -72
  248. package/dist/commands/workflow/challenge.js +66 -13
  249. package/dist/commands/workflow/context.js +46 -10
  250. package/dist/commands/workflow/counters.js +231 -23
  251. package/dist/commands/workflow/decisions.js +221 -106
  252. package/dist/commands/workflow/disk.js +2 -1
  253. package/dist/commands/workflow/feature-base.js +60 -0
  254. package/dist/commands/workflow/issues.js +243 -15
  255. package/dist/commands/workflow/junit.js +137 -0
  256. package/dist/commands/workflow/ledgers.js +726 -112
  257. package/dist/commands/workflow/locks.js +150 -29
  258. package/dist/commands/workflow/loops.js +67 -0
  259. package/dist/commands/workflow/open-decision.js +199 -0
  260. package/dist/commands/workflow/plan-blocks.js +6 -0
  261. package/dist/commands/workflow/plans.js +1 -1
  262. package/dist/commands/workflow/prs.js +272 -16
  263. package/dist/commands/workflow/repo.js +1 -1
  264. package/dist/commands/workflow/run-facts.js +6 -0
  265. package/dist/commands/workflow/runs.js +747 -155
  266. package/dist/commands/workflow/runtime.js +8 -4
  267. package/dist/commands/workflow/status.js +259 -13
  268. package/dist/commands/workflow/step-table.js +41 -15
  269. package/dist/commands/workflow/steps.js +530 -26
  270. package/dist/commands/workflow/summary-findings.js +1 -1
  271. package/dist/commands/workflow/summary.js +289 -8
  272. package/dist/commands/workflow/tasks.js +294 -27
  273. package/dist/commands/workflow/tests-base.js +266 -0
  274. package/dist/commands/workflow/tests-changed.js +130 -56
  275. package/dist/commands/workflow/tests-jump.js +77 -0
  276. package/dist/commands/workflow/tests.js +608 -131
  277. package/dist/commands/workflow/tracker.js +920 -112
  278. package/dist/commands/workflow/workflows.js +80 -59
  279. package/dist/commands/workflow/worktrees.js +387 -58
  280. package/dist/install/cloud-env.js +32 -10
  281. package/dist/install/managed-block.js +101 -0
  282. package/dist/install/manifest.js +7 -1
  283. package/dist/install/modules/claude.js +6 -2
  284. package/dist/install/modules/cloud.js +73 -86
  285. package/dist/install/modules/codex.js +9 -2
  286. package/dist/install/modules/core.js +133 -14
  287. package/dist/install/modules/opencode.js +18 -23
  288. package/dist/install/network-allowlist.js +8 -3
  289. package/dist/install/project-docs.js +551 -0
  290. package/dist/install/template-copies.js +55 -5
  291. package/dist/install/write.js +117 -5
  292. package/dist/ledgers/journal.js +10 -8
  293. package/dist/ledgers/migrate.js +20 -9
  294. package/dist/ledgers/status.js +461 -8
  295. package/dist/ledgers/telemetry.js +71 -13
  296. package/dist/render/trackers.js +3 -1
  297. package/dist/shared/package-manager.js +7 -2
  298. package/dist/shared/settings.js +8 -0
  299. package/dist/shared/text.js +13 -0
  300. package/dist/tools/instructions-sources.js +1 -0
  301. package/dist/tools/instructions.js +97 -24
  302. package/package.json +22 -15
  303. package/.bkit/core/hooks/preflight-linear.sh +0 -73
  304. package/.bkit/shared/docs/architecture.md +0 -16
  305. package/.bkit/shared/docs/data-schema.md +0 -16
  306. package/.bkit/shared/docs/design.md +0 -38
  307. package/.bkit/shared/docs/noise.md +0 -20
  308. package/.bkit/shared/docs/observability.md +0 -22
  309. package/.bkit/shared/docs/security.md +0 -62
  310. package/.bkit/shared/docs/setup.md +0 -52
  311. package/.bkit/shared/docs/technology.md +0 -15
  312. /package/.bkit/templates/{.lintstagedrc.json → lintstagedrc.example.json} +0 -0
  313. /package/.bkit/templates/{.prettierignore → prettierignore.example} +0 -0
@@ -246,10 +246,7 @@ export const runtimeCommand = {
246
246
  run: (ctx) => {
247
247
  const workflow = str(ctx.flags.workflow);
248
248
  const events = readStatusEvents(statusFile(ctx));
249
- const rows = events
250
- .filter((r) => r.type === "runtime-resolved")
251
- .filter((r) => workflow === undefined || r.workflow === workflow);
252
- const row = rows[rows.length - 1];
249
+ const row = latestRuntimeRow(events, workflow);
253
250
  if (!row) {
254
251
  ctx.log(`no runtime-resolved row${workflow ? ` for ${workflow}` : ""} — Step 1 never recorded the runtime`);
255
252
  return EXIT_NO_RUNTIME_ROW;
@@ -278,3 +275,10 @@ export const runtimeCommand = {
278
275
  },
279
276
  },
280
277
  };
278
+ /** The latest `runtime-resolved` row, limited to `workflow` when given; undefined with none. */
279
+ export function latestRuntimeRow(events, workflow) {
280
+ const rows = events
281
+ .filter((r) => r.type === "runtime-resolved")
282
+ .filter((r) => workflow === undefined || r.workflow === workflow);
283
+ return rows[rows.length - 1];
284
+ }
@@ -1,12 +1,15 @@
1
1
  // bkit status route|resume|meta|path|row — read and annotate a workflow's `status.jsonl`.
2
+ import { randomBytes } from "node:crypto";
2
3
  import * as fs from "node:fs";
3
4
  import * as path from "node:path";
4
5
  import { BKIT_DEBUG_GATES } from "../../install/manifest.js";
5
6
  import { appendFrictionRow, journalEnabled, pauseFrictionRow } from "../../ledgers/journal.js";
6
7
  import { resolveGitSha } from "../../ledgers/telemetry.js";
7
8
  import { readBkitConfig } from "../../shared/settings.js";
8
- import { activeDoneSteps, validateCiSelection, ciSelectionIdentity, allRunsDoneSteps, appendLine, fold, lastDoneStepAllRuns, lastRun, nextStrategy, runNumber, runOrStepField, statusTimestamp, } from "../../ledgers/status.js";
9
- import { CommandError, EXIT, git, parseJson, resolveActiveRun, statusLocation, } from "../lib.js";
9
+ import { activeDoneSteps, validateCiSelection, ciSelectionIdentity, allRunsDoneSteps, appendLine, fold, lastDoneStepAllRuns, lastRun, repeatStrategy, runNumber, runOrStepField, statusTimestamp, } from "../../ledgers/status.js";
10
+ import { CommandError, EXIT, git, parseJson, resolveActiveRun, statusLocation, worktreeFingerprint, writeInvocation, } from "../lib.js";
11
+ import { fixTestStep, gatedCheckStep } from "./loops.js";
12
+ import { gateRerun, openDecision } from "./open-decision.js";
10
13
  import { WORKFLOW_STEPS, isResumable, resumePoint } from "./step-table.js";
11
14
  // ---------------------------------------------------------------------------
12
15
  // Shared with counters / steps
@@ -151,24 +154,38 @@ const ROUTE_FIELDS = [
151
154
  ];
152
155
  /** Exit code: a `--require`d field is missing or holds a value outside its set. */
153
156
  export const EXIT_ROUTE_MISSING = 4;
154
- function route(runs, workflow, step, group) {
157
+ /** Debug's Step 3 test round, as `counters derive --position=current` and `status route --require=verdict` read it. */
158
+ function debugTestRound(runs, workflow) {
159
+ const rows = workflow === "debug" ? activeDoneSteps(runs, workflow, { step: "debug-run-tests" }) : [];
160
+ const last = rows.at(-1);
161
+ return {
162
+ testVerdict: VERDICTS.includes(String(last?.verdict)) ? last.verdict : null,
163
+ testSource: typeof last?.source === "string" ? last.source : null,
164
+ normalAttempt: rows.length === 0 ? null : rows.length,
165
+ };
166
+ }
167
+ function route(runs, rows, workflow, step, group) {
155
168
  const out = {
156
169
  verdict: null,
157
170
  failures: null,
158
171
  strategy: null,
159
172
  nextStrategy: null,
173
+ repeatTests: [],
160
174
  debugMode: null,
161
175
  pushMode: null,
162
176
  publish: null,
163
177
  publishSource: null,
164
178
  debugAttempt: 0,
165
179
  parentSha: null,
180
+ source: null,
166
181
  };
167
182
  const problems = {};
168
183
  if (step !== undefined) {
169
184
  const last = activeDoneSteps(runs, workflow, { step, group }).at(-1);
170
185
  if (typeof last?.parentSha === "string")
171
186
  out.parentSha = last.parentSha;
187
+ if (typeof last?.source === "string")
188
+ out.source = last.source;
172
189
  if (!last) {
173
190
  problems.verdict = `no DONE ${step} row in the active ${workflow} run`;
174
191
  problems.failures = problems.verdict;
@@ -191,7 +208,17 @@ function route(runs, workflow, step, group) {
191
208
  const prior = lastDoneStepAllRuns(runs, workflow, { step, group })?.strategy;
192
209
  if (prior === undefined || STRATEGIES.includes(prior)) {
193
210
  out.strategy = prior ?? null;
194
- out.nextStrategy = nextStrategy(prior);
211
+ // The next label comes from the tests failing now, not from the previous label.
212
+ const testStep = fixTestStep(step, group);
213
+ const check = gatedCheckStep(step);
214
+ const current = check === undefined
215
+ ? undefined
216
+ : activeDoneSteps(runs, workflow, { step: check, group }).length;
217
+ const next = testStep === undefined
218
+ ? { strategy: "STANDARD", repeatTests: [] }
219
+ : repeatStrategy(rows, workflow, testStep, current);
220
+ out.nextStrategy = next.strategy;
221
+ out.repeatTests = next.repeatTests;
195
222
  }
196
223
  else {
197
224
  problems.strategy = `${step} strategy "${String(prior)}" is not STANDARD|PIVOT|FINAL`;
@@ -350,7 +377,7 @@ export const statusCommand = {
350
377
  },
351
378
  },
352
379
  route: {
353
- summary: "Routing state: last verdict / failures / strategy of a step, debug and push mode; with --prompt-file, debug's start decisions.",
380
+ summary: "Routing state: last verdict / failures / strategy of a step, debug and push mode; with --step, nextStrategy and repeatTests (the next fix round's label, from the tests failing again); with --prompt-file, debug's start decisions.",
354
381
  use: "workflow",
355
382
  flags: [
356
383
  { ...FILE_FLAG, required: false, help: `${FILE_FLAG.help}; or --fid and --month` },
@@ -390,7 +417,8 @@ export const statusCommand = {
390
417
  ciReproduced: "whether the active generation has DONE reproduction with YES",
391
418
  failures: "its failures (absent on PASS|CONCERNS = 0, absent on FAIL = null: count unknown), or null",
392
419
  strategy: "the step's last strategy across ALL runs, or null",
393
- nextStrategy: "next rung: STANDARD, PIVOT, FINAL (null without --step)",
420
+ nextStrategy: "the next fix round's label, from the tests failing now on the fix step's test step: STANDARD when none failed in an earlier attempt, PIVOT when one did in 1, FINAL in 2 or more (null without --step)",
421
+ repeatTests: "the tests failing now that also failed in an earlier attempt, across every run (empty without --step)",
394
422
  debugMode: "NORMAL|SOAK of the active run, or null; with --prompt-file, the mode this invocation runs in (SOAK on [soak] in the prompt, an open run already in SOAK, or bkit.workflows.debug.fix.maxAttempts fix rounds already run across every debug run; else NORMAL)",
395
423
  pushMode: "PR|LOCAL of the active run, or null",
396
424
  debugAttempt: "debugAttempt of the active run (0 when unset); with --prompt-file, this invocation's run number (a resume keeps its number)",
@@ -399,6 +427,7 @@ export const statusCommand = {
399
427
  publish: "with --workflow=build and --prompt-file: whether the build publishes (a publish=true|false token, else publish.local on LOCAL or publish.remote elsewhere; a non-LOCAL false resolves true), else null",
400
428
  publishSource: "with publish: token | local | remote | coerced (a non-LOCAL false forced to true), else null",
401
429
  parentSha: "HEAD when the step's last DONE row in the active run was written — a build-group-start row's is the group's start commit, the base for `context diff` — or null",
430
+ source: "the `source` field of the step's last DONE row in the active run (debug-run-tests: local|ci), or null",
402
431
  },
403
432
  exitCodes: {
404
433
  [EXIT_NO_STATUS]: "status.jsonl missing, unreadable, or not valid NDJSON",
@@ -437,8 +466,9 @@ export const statusCommand = {
437
466
  throw new CommandError(EXIT.USAGE, `--prompt-file ${abs} does not exist`);
438
467
  promptText = fs.readFileSync(abs, "utf-8");
439
468
  }
440
- const runs = promptFile !== undefined && !fs.existsSync(file) ? [] : readRuns(file);
441
- const { out, problems } = route(runs, String(ctx.flags.workflow), step, positiveInt(ctx.flags.group, "group"));
469
+ const statusRows = promptFile !== undefined && !fs.existsSync(file) ? [] : readStatusRows(file);
470
+ const runs = fold(statusRows);
471
+ const { out, problems } = route(runs, statusRows, String(ctx.flags.workflow), step, positiveInt(ctx.flags.group, "group"));
442
472
  if (promptFile !== undefined) {
443
473
  const root = git(ctx.cwd, ["rev-parse", "--show-toplevel"]) ?? ctx.cwd;
444
474
  const config = readBkitConfig(root);
@@ -447,8 +477,7 @@ export const statusCommand = {
447
477
  delete problems.debugMode;
448
478
  }
449
479
  else {
450
- const rows = fs.existsSync(file) ? readStatusRows(file) : [];
451
- Object.assign(out, publishRoute(rows, promptText, config.buildPublish));
480
+ Object.assign(out, publishRoute(statusRows, promptText, config.buildPublish));
452
481
  delete problems.publish;
453
482
  }
454
483
  }
@@ -463,8 +492,202 @@ export const statusCommand = {
463
492
  return failed.length === 0 && differ.length === 0 ? EXIT.OK : EXIT_ROUTE_MISSING;
464
493
  },
465
494
  },
495
+ invocation: {
496
+ summary: "Issue an engine-bound invocation: a run's step (and agent), or a runless audit or utility call.",
497
+ use: "workflow",
498
+ flags: [
499
+ { ...WORKFLOW_FLAG, required: false, help: "workflow name, with --step and --file" },
500
+ { ...STEP_FLAG, required: false, help: "registered step of the workflow" },
501
+ { ...FILE_FLAG, required: false, help: "the run's status.jsonl, relative to the cwd" },
502
+ { name: "group", type: "string", help: "the task group a group-scoped step runs for" },
503
+ { name: "attempt", type: "string", help: "the attempt of that group or remediation round" },
504
+ { name: "agent", type: "string", help: "the subagent this invocation is for" },
505
+ { name: "host", type: "string", help: "the host running the agent" },
506
+ {
507
+ name: "configured-model",
508
+ type: "string",
509
+ help: "the pin the agent was launched with; kept apart from the observed model",
510
+ },
511
+ {
512
+ name: "observed-model",
513
+ type: "string",
514
+ help: "the model the host reported, or `unavailable`",
515
+ },
516
+ { name: "standalone", type: "string", help: "audit|utility: a call with no run" },
517
+ { name: "name", type: "string", help: "with --standalone: the audit or utility name" },
518
+ ],
519
+ output: {
520
+ invocation: "the id to pass as --invocation to later commands",
521
+ receipt: "the outbox file holding the issued context",
522
+ scope: "run (bound to a status.jsonl) or outbox (runless audit or utility)",
523
+ workflow: "the workflow, or null",
524
+ step: "the registered step, or null",
525
+ number: "the step's registered number, or null",
526
+ title: "the step's registered title, or null",
527
+ run: "the workflow's run number, or null without a run",
528
+ statusPath: "absolute path to the run's status.jsonl, or null",
529
+ bookRoot: "root the run's books live under, or null",
530
+ group: "the task group, or null",
531
+ attempt: "the attempt, or null",
532
+ declaredStep: "audit|utility:<name> for a runless call, or null",
533
+ allowedAgent: "the one agent a runless call may write as, or null",
534
+ agent: "the agent, or null",
535
+ host: "the host, or null",
536
+ configuredModel: "the launch pin, or null",
537
+ observedModel: "the reported model or `unavailable`, or null",
538
+ },
539
+ exitCodes: { [EXIT_NO_STATUS]: "status.jsonl missing, unreadable, or not valid NDJSON" },
540
+ run: (ctx) => {
541
+ const top = git(ctx.cwd, ["rev-parse", "--show-toplevel"]);
542
+ if (top === null)
543
+ throw new CommandError(EXIT.USAGE, "not inside a git repository");
544
+ const standalone = str(ctx.flags.standalone);
545
+ const workflow = str(ctx.flags.workflow);
546
+ const step = str(ctx.flags.step);
547
+ const file = str(ctx.flags.file);
548
+ const agent = str(ctx.flags.agent) ?? null;
549
+ if (agent !== null && !/^[a-z0-9][a-z0-9._-]*$/.test(agent))
550
+ throw new CommandError(EXIT.USAGE, `--agent "${agent}" is not an agent name`);
551
+ const group = str(ctx.flags.group);
552
+ const attempt = str(ctx.flags.attempt);
553
+ for (const [flag, v] of [
554
+ ["group", group],
555
+ ["attempt", attempt],
556
+ ])
557
+ if (v !== undefined && !/^[A-Za-z0-9._-]+$/.test(v))
558
+ throw new CommandError(EXIT.USAGE, `--${flag} "${v}" is not a ${flag} id`);
559
+ const base = {
560
+ group: group ?? null,
561
+ attempt: attempt ?? null,
562
+ agent,
563
+ host: str(ctx.flags.host) ?? null,
564
+ configuredModel: str(ctx.flags.configuredModel) ?? null,
565
+ // An agent whose host reported no model is recorded `unavailable`, so its rows stay writable.
566
+ observedModel: str(ctx.flags.observedModel) ?? (agent !== null ? "unavailable" : null),
567
+ };
568
+ let inv;
569
+ if (standalone !== undefined) {
570
+ oneOf(standalone, ["audit", "utility"], "--standalone");
571
+ if ([workflow, step, file].some((v) => v !== undefined))
572
+ throw new CommandError(EXIT.USAGE, "--standalone has no run: drop --workflow, --step and --file");
573
+ const name = str(ctx.flags.name);
574
+ if (name === undefined || name === "")
575
+ throw new CommandError(EXIT.USAGE, "--standalone needs --name");
576
+ if (!/^[a-z0-9][a-z0-9._-]*$/.test(name))
577
+ throw new CommandError(EXIT.USAGE, `--name "${name}" is not an audit or utility name`);
578
+ if (group !== undefined || attempt !== undefined)
579
+ throw new CommandError(EXIT.USAGE, "--standalone has no group or attempt");
580
+ inv = {
581
+ scope: "outbox",
582
+ workflow: null,
583
+ step: null,
584
+ number: null,
585
+ title: null,
586
+ run: null,
587
+ statusPath: null,
588
+ bookRoot: null,
589
+ standalone,
590
+ name,
591
+ declaredStep: `${standalone}:${name}`,
592
+ allowedAgent: agent,
593
+ ...base,
594
+ };
595
+ }
596
+ else {
597
+ if (workflow === undefined || step === undefined || file === undefined)
598
+ throw new CommandError(EXIT.USAGE, "give --workflow, --step and --file, or --standalone=audit|utility with --name");
599
+ if (ctx.flags.name !== undefined)
600
+ throw new CommandError(EXIT.USAGE, "--name is for --standalone");
601
+ if (!isResumable(workflow))
602
+ throw new CommandError(EXIT.USAGE, `--workflow must be ${Object.keys(WORKFLOW_STEPS).join("|")}, got "${workflow}"`);
603
+ const registered = WORKFLOW_STEPS[workflow].find((s) => s.step === step);
604
+ if (registered === undefined)
605
+ throw new CommandError(EXIT.USAGE, `--step ${step} is not a registered ${workflow} step`);
606
+ const statusPath = path.resolve(ctx.cwd, file);
607
+ const realFile = (() => {
608
+ let dir = path.dirname(statusPath);
609
+ const tail = [path.basename(statusPath)];
610
+ while (!fs.existsSync(dir) && path.dirname(dir) !== dir) {
611
+ tail.unshift(path.basename(dir));
612
+ dir = path.dirname(dir);
613
+ }
614
+ return path.join(fs.realpathSync(dir), ...tail);
615
+ })();
616
+ const realTop = fs.realpathSync(top);
617
+ // A status file that is itself a symlink resolves wherever it points; the parent
618
+ // directory alone says nothing about where appends land.
619
+ if (fs.lstatSync(statusPath, { throwIfNoEntry: false })?.isSymbolicLink() === true)
620
+ throw new CommandError(EXIT.USAGE, `--file ${file} is a symbolic link; issue the invocation for the status file itself`);
621
+ // The checkout that owns the file: a worktree nested under this one has its own top
622
+ // folder, so a plain path-prefix test would accept it.
623
+ let ownerDir = path.dirname(realFile);
624
+ while (!fs.existsSync(ownerDir) && path.dirname(ownerDir) !== ownerDir)
625
+ ownerDir = path.dirname(ownerDir);
626
+ const fileTop = git(ownerDir, ["rev-parse", "--show-toplevel"]);
627
+ const ownerTop = fileTop === null ? null : fs.realpathSync(fileTop);
628
+ if ((realFile !== realTop && !realFile.startsWith(realTop + path.sep)) ||
629
+ (ownerTop !== null && ownerTop !== realTop))
630
+ throw new CommandError(EXIT.USAGE, `--file ${file} is outside this checkout (${top}); issue the invocation from the checkout that owns the run`);
631
+ const logs = path.dirname(path.dirname(statusPath));
632
+ if (path.basename(statusPath) !== "status.jsonl" ||
633
+ path.basename(logs) !== "logs" ||
634
+ path.basename(path.dirname(path.dirname(logs))) !== "plans")
635
+ throw new CommandError(EXIT.USAGE, `--file ${file} is not a docs/plans/<month>/logs/<fid>/status.jsonl`);
636
+ inv = {
637
+ scope: "run",
638
+ workflow,
639
+ step,
640
+ number: registered.number,
641
+ title: registered.title,
642
+ run: runNumber(readRuns(statusPath), workflow),
643
+ statusPath,
644
+ bookRoot: path.dirname(path.dirname(path.dirname(path.dirname(logs)))),
645
+ standalone: null,
646
+ name: null,
647
+ declaredStep: null,
648
+ allowedAgent: null,
649
+ ...base,
650
+ };
651
+ }
652
+ const id = `inv-${randomBytes(16).toString("hex")}`;
653
+ const issued = {
654
+ id,
655
+ version: 1,
656
+ ...inv,
657
+ worktree: top,
658
+ issuedAt: statusTimestamp(),
659
+ };
660
+ if (issued.scope === "run" && fs.existsSync(issued.statusPath)) {
661
+ // The run's status log is the authority; the receipt is an index rebuilt from it.
662
+ const event = {
663
+ type: "invocation",
664
+ workflow: issued.workflow,
665
+ at: issued.issuedAt,
666
+ id,
667
+ step: issued.step,
668
+ number: issued.number,
669
+ title: issued.title,
670
+ run: issued.run,
671
+ statusPath: path.relative(top, issued.statusPath),
672
+ bookRoot: path.relative(top, issued.bookRoot) || ".",
673
+ group: issued.group,
674
+ attempt: issued.attempt,
675
+ agent: issued.agent,
676
+ host: issued.host,
677
+ configuredModel: issued.configuredModel,
678
+ observedModel: issued.observedModel,
679
+ worktree: worktreeFingerprint(top),
680
+ };
681
+ fs.appendFileSync(issued.statusPath, appendLine(event));
682
+ }
683
+ const receipt = writeInvocation(ctx.cwd, issued);
684
+ const { id: _id, version: _v, worktree: _w, issuedAt: _at, standalone: _s, name: _n, ...out } = issued;
685
+ ctx.emit({ invocation: id, receipt, ...out });
686
+ return EXIT.OK;
687
+ },
688
+ },
466
689
  resume: {
467
- summary: "The step a stopped run continues at: after its last DONE step, setup steps and retired rows aside.",
690
+ summary: "The step a stopped run continues at: after its last DONE step, setup steps and retired rows aside; gateRerun and rerunFrom say whether an open red-gate pause re-runs its gate first, and which.",
468
691
  use: "by-hand",
469
692
  flags: [
470
693
  { ...FILE_FLAG, help: "path to status.jsonl; a missing file is a run with no rows" },
@@ -479,8 +702,16 @@ export const statusCommand = {
479
702
  active: "whether the latest run is this workflow, still IN_PROGRESS",
480
703
  challengeRound: "build: the round Step 11's challenge runs as (1 up to bkit.workflows.build.challenge.maxAttempts), from the build-challenge rows' round field; null for other workflows",
481
704
  challengeDone: "build: true once the last allowed challenge round has merged, so Step 11 goes on to Step 12; null for other workflows",
705
+ gateRerun: "true when the active run's open decision file (as `workflows start` prints it in openDecision) has a Gate: FAIL header, Status: OPEN, From verify, holistic or tests, and the loop question as its only undecided question: re-run that gate instead of asking again; else false",
706
+ rerunFrom: "verify | holistic | tests: the open decision file's From header, the check whose gate re-runs; null when gateRerun is false",
707
+ testVerdict: "debug: the verdict of the active run's last DONE debug-run-tests row (PASS|CONCERNS|FAIL), or null; other workflows null",
708
+ testSource: "debug: that row's source (local|ci), or null; other workflows null",
709
+ normalAttempt: "debug: the active run's DONE debug-run-tests rows (the round Steps 4-11 name their artifacts by), or null when there is none; other workflows null",
710
+ },
711
+ exitCodes: {
712
+ [EXIT_NO_STATUS]: "status.jsonl unreadable or not valid NDJSON",
713
+ [EXIT_ROUTE_MISSING]: "debug: the run continues after Step 3 and Step 3's test round has no DONE row or no PASS|CONCERNS|FAIL verdict",
482
714
  },
483
- exitCodes: { [EXIT_NO_STATUS]: "status.jsonl unreadable or not valid NDJSON" },
484
715
  run: (ctx) => {
485
716
  const workflow = String(ctx.flags.workflow);
486
717
  if (!isResumable(workflow))
@@ -488,9 +719,24 @@ export const statusCommand = {
488
719
  const file = statusFile(ctx);
489
720
  const root = git(ctx.cwd, ["rev-parse", "--show-toplevel"]) ?? ctx.cwd;
490
721
  const challengeMax = readBkitConfig(root).asks["build.challenge"].max;
722
+ const runs = fs.existsSync(file) ? readRuns(file) : [];
723
+ const point = resumePoint(runs, workflow, challengeMax);
724
+ const current = point.active ? lastRun(runs, workflow) : undefined;
725
+ const open = current === undefined
726
+ ? null
727
+ : openDecision(path.dirname(file), root, workflow, runNumber(runs, workflow), current.steps
728
+ .filter((s) => s.step === `${workflow}-decision`)
729
+ .flatMap((s) => s.artifacts));
730
+ const round = debugTestRound(runs, workflow);
491
731
  ctx.emit({
492
- ...resumePoint(fs.existsSync(file) ? readRuns(file) : [], workflow, challengeMax),
732
+ ...point,
733
+ ...gateRerun(open, open === null ? "" : fs.readFileSync(path.resolve(root, open.file), "utf-8")),
734
+ ...round,
493
735
  });
736
+ if (workflow === "debug" && point.number > 3 && round.testVerdict === null) {
737
+ ctx.log("debug resumes after Step 3, but no DONE debug-run-tests row with a verdict is in the active run");
738
+ return EXIT_ROUTE_MISSING;
739
+ }
494
740
  return EXIT.OK;
495
741
  },
496
742
  },
@@ -72,7 +72,29 @@ export const WORKFLOW_STEPS = {
72
72
  title: "Plan Gaps Remediate",
73
73
  resumeAt: "build-plan-verify",
74
74
  },
75
- { step: "build-plan-verify-holistic", number: 10, title: "Plan Verify Holistic" },
75
+ // Holistic verify never passes on alone: its gate runs after every verdict, so a run
76
+ // stopped between the two runs the round again. Step 10 again.
77
+ {
78
+ step: "build-plan-verify-holistic",
79
+ number: 10,
80
+ title: "Plan Verify Holistic",
81
+ resumeAt: "build-plan-verify-holistic",
82
+ },
83
+ // The holistic gate routes with its verify: Step 10 again.
84
+ {
85
+ step: "build-holistic-gate",
86
+ number: 10,
87
+ title: "Plan Verify Holistic",
88
+ resumeAt: "build-plan-verify-holistic",
89
+ },
90
+ // A holistic fix can add a takeover group: Step 7 runs it, and goes straight on to
91
+ // Step 10 when no group is open.
92
+ {
93
+ step: "build-plan-gaps-remediate-holistic",
94
+ number: 10,
95
+ title: "Plan Verify Holistic",
96
+ resumeAt: "build-plan-tasks",
97
+ },
76
98
  // The reports are written: Step 11 continues at `bkit challenge merge`.
77
99
  { step: "build-challenge", number: 11, title: "Build Challenge", resumeAt: "build-challenge" },
78
100
  // Run Tests routes on its own verdict, and a fix loops back to it.
@@ -141,25 +163,15 @@ export const WORKFLOW_STEPS = {
141
163
  { step: "ship-prune-skills", number: 7, title: "Prune Skills" },
142
164
  { step: "ship-bookkeeping-push", number: 8, title: "Commit + Push Bookkeeping" },
143
165
  { number: 9, title: "Re-validate" },
144
- // The merge gate reads the PR state again: a merged PR goes on to Step 13.
166
+ // The merge gate reads the PR state again: a merged PR goes on to Step 11.
145
167
  {
146
168
  step: "ship-merge-pr",
147
169
  number: 10,
148
170
  title: "Merge Gate + Merge PR",
149
171
  resumeAt: "ship-merge-pr",
150
172
  },
151
- { step: "ship-failure-diagnose", number: 11, title: "Failure Diagnose" },
152
- // A PASS fix is committed and pushed at Step 12 sub-step 4 (a re-run commits nothing
153
- // new), then re-validated at Step 9; any other verdict re-reads the PR at Step 10.
154
- {
155
- step: "ship-failure-remediate",
156
- number: 12,
157
- title: "Failure Remediate",
158
- resumeAt: "ship-merge-pr",
159
- resumeOnVerdict: { PASS: "ship-failure-remediate" },
160
- },
161
- { step: "ship-switch-to-dev", number: 13, title: "Update Local Dev" },
162
- { step: "ship-close-workflow", number: 14, title: "Close Workflow" },
173
+ { step: "ship-switch-to-dev", number: 11, title: "Update Local Dev" },
174
+ { step: "ship-close-workflow", number: 12, title: "Close Workflow" },
163
175
  ],
164
176
  };
165
177
  /**
@@ -186,13 +198,27 @@ export const DECISION_ROUTES = {
186
198
  routes: {
187
199
  fix: "build-plan-tasks",
188
200
  verify: "build-plan-verify",
201
+ holistic: "build-plan-verify-holistic",
189
202
  tests: "build-run-tests",
190
- // Try again: a verify loop goes on to its gaps fix (Step 9), a tests loop to Step 13.
203
+ // Try again: a verify loop goes on to its gaps fix (Step 9 or Step 10's), a tests loop to Step 13.
191
204
  retry: {
192
205
  "build-plan-verify": "build-plan-gaps-remediate",
193
206
  "build-group-gate": "build-plan-gaps-remediate",
207
+ "build-plan-verify-holistic": "build-plan-gaps-remediate-holistic",
208
+ "build-holistic-gate": "build-plan-gaps-remediate-holistic",
209
+ "build-plan-gaps-remediate-holistic": "build-plan-gaps-remediate-holistic",
194
210
  "build-run-tests": "build-failure-diagnose",
195
211
  },
212
+ // Continue: every gap accepted, so the loop is settled. A group verify goes on to the next
213
+ // group's Plan Execute, a holistic round to Build Challenge.
214
+ continue: {
215
+ "build-plan-verify": "build-plan-tasks",
216
+ "build-group-gate": "build-plan-tasks",
217
+ "build-plan-gaps-remediate": "build-plan-tasks",
218
+ "build-plan-verify-holistic": "build-challenge",
219
+ "build-holistic-gate": "build-challenge",
220
+ "build-plan-gaps-remediate-holistic": "build-challenge",
221
+ },
196
222
  },
197
223
  },
198
224
  };