@cbartens/bkit 5.5.0 → 6.0.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 (297) hide show
  1. package/.bkit/README.md +30 -20
  2. package/.bkit/core/.agents/docs.md +1 -0
  3. package/.bkit/core/.agents/rules.md +51 -26
  4. package/.bkit/core/.bkit/README.md +29 -19
  5. package/.bkit/core/.bkit/authoring.md +117 -0
  6. package/.bkit/core/.bkit/cloud.md +11 -11
  7. package/.bkit/core/.bkit/comparison.md +5 -5
  8. package/.bkit/core/.bkit/install.md +20 -20
  9. package/.bkit/core/.bkit/jsonl.md +202 -122
  10. package/.bkit/core/.bkit/lite.md +1 -1
  11. package/.bkit/core/.bkit/pipeline.md +49 -52
  12. package/.bkit/core/.bkit/prompts.md +106 -167
  13. package/.bkit/core/.bkit/providers.md +29 -32
  14. package/.bkit/core/.bkit/templates.md +44 -18
  15. package/.bkit/core/.bkit/trackers.md +60 -28
  16. package/.bkit/core/.bkit/workflows.md +399 -359
  17. package/.bkit/core/AGENTS.md +16 -22
  18. package/.bkit/core/docs/templates/bkit-audit-accessibility.md +14 -38
  19. package/.bkit/core/docs/templates/bkit-audit-adoption.md +16 -40
  20. package/.bkit/core/docs/templates/bkit-audit-agents.md +19 -43
  21. package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +16 -40
  22. package/.bkit/core/docs/templates/bkit-audit-analytics.md +14 -38
  23. package/.bkit/core/docs/templates/bkit-audit-annotations.md +11 -35
  24. package/.bkit/core/docs/templates/bkit-audit-app-performance.md +15 -39
  25. package/.bkit/core/docs/templates/bkit-audit-app-store.md +12 -36
  26. package/.bkit/core/docs/templates/bkit-audit-architecture.md +16 -40
  27. package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +16 -40
  28. package/.bkit/core/docs/templates/bkit-audit-config.md +18 -42
  29. package/.bkit/core/docs/templates/bkit-audit-cost.md +16 -40
  30. package/.bkit/core/docs/templates/bkit-audit-coverage.md +15 -39
  31. package/.bkit/core/docs/templates/bkit-audit-database.md +16 -40
  32. package/.bkit/core/docs/templates/bkit-audit-dead-code.md +15 -39
  33. package/.bkit/core/docs/templates/bkit-audit-deferrals.md +15 -38
  34. package/.bkit/core/docs/templates/bkit-audit-dependencies.md +16 -40
  35. package/.bkit/core/docs/templates/bkit-audit-documentation.md +11 -35
  36. package/.bkit/core/docs/templates/bkit-audit-duplication.md +18 -42
  37. package/.bkit/core/docs/templates/bkit-audit-failures.md +13 -37
  38. package/.bkit/core/docs/templates/bkit-audit-flakes.md +12 -36
  39. package/.bkit/core/docs/templates/bkit-audit-gates.md +14 -38
  40. package/.bkit/core/docs/templates/bkit-audit-issues.md +15 -39
  41. package/.bkit/core/docs/templates/bkit-audit-llm.md +16 -40
  42. package/.bkit/core/docs/templates/bkit-audit-logs.md +14 -38
  43. package/.bkit/core/docs/templates/bkit-audit-models.md +12 -36
  44. package/.bkit/core/docs/templates/bkit-audit-privacy.md +12 -36
  45. package/.bkit/core/docs/templates/bkit-audit-prompts.md +15 -39
  46. package/.bkit/core/docs/templates/bkit-audit-red-team.md +15 -39
  47. package/.bkit/core/docs/templates/bkit-audit-reliability.md +15 -39
  48. package/.bkit/core/docs/templates/bkit-audit-repo.md +12 -36
  49. package/.bkit/core/docs/templates/bkit-audit-security.md +13 -37
  50. package/.bkit/core/docs/templates/bkit-audit-slop.md +14 -38
  51. package/.bkit/core/docs/templates/bkit-audit-testing.md +12 -36
  52. package/.bkit/core/docs/templates/bkit-audit-usability.md +16 -40
  53. package/.bkit/core/docs/templates/bkit-plan.md +97 -226
  54. package/.bkit/core/engine/checks/after/ci-yml.ts +39 -30
  55. package/.bkit/core/engine/checks/after/github.ts +101 -72
  56. package/.bkit/core/engine/checks/after/index.ts +10 -12
  57. package/.bkit/core/engine/checks/after/suppression.ts +8 -5
  58. package/.bkit/core/engine/checks/after/tools.ts +47 -92
  59. package/.bkit/core/engine/checks/before/env.ts +2 -2
  60. package/.bkit/core/engine/checks/before/files.ts +5 -4
  61. package/.bkit/core/engine/checks/before/index.ts +18 -1
  62. package/.bkit/core/engine/checks/before/repo.ts +168 -2
  63. package/.bkit/core/engine/checks/tips/catalogue.ts +16 -5
  64. package/.bkit/core/engine/checks/tips/detect.ts +34 -0
  65. package/.bkit/core/engine/checks/tips/index.ts +10 -7
  66. package/.bkit/core/engine/cli.ts +20 -53
  67. package/.bkit/core/engine/commands/analysis.ts +171 -140
  68. package/.bkit/core/engine/commands/ci/ci.ts +6 -6
  69. package/.bkit/core/engine/commands/comply.ts +77 -103
  70. package/.bkit/core/engine/commands/install/doctor.ts +2 -2
  71. package/.bkit/core/engine/commands/install/install.ts +57 -18
  72. package/.bkit/core/engine/commands/install/uninstall.ts +65 -28
  73. package/.bkit/core/engine/commands/land.ts +18 -12
  74. package/.bkit/core/engine/commands/lib.ts +79 -17
  75. package/.bkit/core/engine/commands/registry.ts +4 -0
  76. package/.bkit/core/engine/commands/setup/setup.ts +7 -7
  77. package/.bkit/core/engine/commands/stats.ts +204 -0
  78. package/.bkit/core/engine/commands/tips.ts +10 -5
  79. package/.bkit/core/engine/commands/workflow/branches.ts +741 -62
  80. package/.bkit/core/engine/commands/workflow/challenge.ts +673 -0
  81. package/.bkit/core/engine/commands/workflow/context.ts +853 -29
  82. package/.bkit/core/engine/commands/workflow/counters.ts +267 -84
  83. package/.bkit/core/engine/commands/workflow/decisions.ts +541 -0
  84. package/.bkit/core/engine/commands/workflow/disk.ts +2 -2
  85. package/.bkit/core/engine/commands/workflow/fids.ts +793 -33
  86. package/.bkit/core/engine/commands/workflow/issues.ts +427 -105
  87. package/.bkit/core/engine/commands/workflow/ledgers.ts +884 -27
  88. package/.bkit/core/engine/commands/workflow/locks.ts +26 -2
  89. package/.bkit/core/engine/commands/workflow/plan-blocks.ts +582 -0
  90. package/.bkit/core/engine/commands/workflow/plan-versions.ts +21 -0
  91. package/.bkit/core/engine/commands/workflow/prs.ts +166 -30
  92. package/.bkit/core/engine/commands/workflow/repo.ts +59 -7
  93. package/.bkit/core/engine/commands/workflow/roadmap.ts +16 -7
  94. package/.bkit/core/engine/commands/workflow/run-facts.ts +501 -0
  95. package/.bkit/core/engine/commands/workflow/runs.ts +179 -49
  96. package/.bkit/core/engine/commands/workflow/runtime.ts +22 -1
  97. package/.bkit/core/engine/commands/workflow/status.ts +142 -29
  98. package/.bkit/core/engine/commands/workflow/step-table.ts +339 -0
  99. package/.bkit/core/engine/commands/workflow/steps.ts +213 -88
  100. package/.bkit/core/engine/commands/workflow/summary.ts +398 -0
  101. package/.bkit/core/engine/commands/workflow/tests.ts +1013 -148
  102. package/.bkit/core/engine/commands/workflow/tracker.ts +1195 -0
  103. package/.bkit/core/engine/commands/workflow/workflows.ts +984 -207
  104. package/.bkit/core/engine/commands/workflow/workstreams.ts +11 -5
  105. package/.bkit/core/engine/commands/workflow/worktrees.ts +276 -22
  106. package/.bkit/core/engine/install/manifest.ts +11 -9
  107. package/.bkit/core/engine/install/modules/cloud.ts +21 -13
  108. package/.bkit/core/engine/install/modules/core.ts +325 -7
  109. package/.bkit/core/engine/install/modules/opencode.ts +2 -2
  110. package/.bkit/core/engine/install/version-file.ts +6 -2
  111. package/.bkit/core/engine/ledgers/migrate.ts +92 -0
  112. package/.bkit/core/engine/ledgers/status.ts +92 -15
  113. package/.bkit/core/engine/ledgers/telemetry.ts +1261 -254
  114. package/.bkit/core/engine/render/hosts.ts +4 -0
  115. package/.bkit/core/engine/render/models.ts +12 -0
  116. package/.bkit/core/engine/shared/branches.ts +4 -1
  117. package/.bkit/core/engine/shared/egress.ts +7 -0
  118. package/.bkit/core/engine/shared/json.ts +25 -7
  119. package/.bkit/core/engine/shared/settings.ts +202 -33
  120. package/.bkit/core/engine/shared/text.ts +361 -0
  121. package/.bkit/core/engine/tools/grammar-density.ts +215 -0
  122. package/.bkit/core/engine/tools/instructions-sources.ts +834 -0
  123. package/.bkit/core/engine/tools/instructions.ts +1751 -0
  124. package/.bkit/core/hooks/gateguard-engine.js +24 -23
  125. package/.bkit/core/hooks/guardrails-shell.js +2 -3
  126. package/.bkit/core/hooks/guardrails-tiers.js +7 -1
  127. package/.bkit/core/hooks/readguard-engine.js +2 -2
  128. package/.bkit/core/prompts/bkit-audit-generate.md +62 -25
  129. package/.bkit/core/prompts/bkit-build-challenge-1.md +40 -17
  130. package/.bkit/core/prompts/bkit-build-challenge-2.md +44 -17
  131. package/.bkit/core/prompts/bkit-build-install-skills.md +26 -13
  132. package/.bkit/core/prompts/bkit-build-plan-convert.md +74 -0
  133. package/.bkit/core/prompts/bkit-build-plan-current.md +26 -13
  134. package/.bkit/core/prompts/bkit-build-plan-execute.md +74 -26
  135. package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +64 -23
  136. package/.bkit/core/prompts/bkit-build-plan-verify.md +57 -33
  137. package/.bkit/core/prompts/bkit-debug-abort-handover.md +30 -14
  138. package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +34 -14
  139. package/.bkit/core/prompts/bkit-debug-failure-remediate.md +34 -17
  140. package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +26 -13
  141. package/.bkit/core/prompts/bkit-debug-failure-soak.md +31 -16
  142. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +21 -11
  143. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +20 -11
  144. package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +20 -11
  145. package/.bkit/core/prompts/bkit-design-generate.md +33 -13
  146. package/.bkit/core/prompts/bkit-design-organise.md +25 -12
  147. package/.bkit/core/prompts/bkit-design-review-1.md +31 -15
  148. package/.bkit/core/prompts/bkit-design-review-2.md +28 -13
  149. package/.bkit/core/prompts/bkit-design-spike.md +30 -13
  150. package/.bkit/core/prompts/bkit-design-update.md +33 -19
  151. package/.bkit/core/prompts/bkit-plan-generate.md +75 -19
  152. package/.bkit/core/prompts/bkit-plan-review-1.md +50 -27
  153. package/.bkit/core/prompts/bkit-plan-review-2.md +59 -28
  154. package/.bkit/core/prompts/bkit-plan-scope-check.md +109 -0
  155. package/.bkit/core/prompts/bkit-plan-update.md +61 -24
  156. package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +27 -15
  157. package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +31 -16
  158. package/.bkit/core/prompts/bkit-ship-update-docs.md +30 -15
  159. package/.bkit/core/prompts/bkit-utility-compress-markdown.md +24 -14
  160. package/.bkit/core/prompts/bkit-utility-update-decisions.md +32 -14
  161. package/.bkit/core/prompts/bkit-utility-update-deferrals.md +29 -14
  162. package/.bkit/core/prompts/bkit-utility-update-documentation.md +28 -13
  163. package/.bkit/core/prompts/bkit-utility-update-failures.md +31 -14
  164. package/.bkit/core/prompts/bkit-utility-update-knowledge.md +33 -14
  165. package/.bkit/core/prompts/bkit-utility-update-roadmap.md +38 -17
  166. package/.bkit/core/prompts/bkit-utility-update-tracker.md +43 -20
  167. package/.bkit/core/workflows/bkit-auto.md +54 -46
  168. package/.bkit/core/workflows/bkit-build.md +577 -458
  169. package/.bkit/core/workflows/bkit-debug.md +348 -333
  170. package/.bkit/core/workflows/bkit-design.md +201 -237
  171. package/.bkit/core/workflows/bkit-plan.md +210 -321
  172. package/.bkit/core/workflows/bkit-ship.md +328 -278
  173. package/.bkit/shared/.bkit/.env.example +2 -2
  174. package/.bkit/shared/.claude/settings.json +11 -0
  175. package/.bkit/shared/.cursor/mcp.json +1 -1
  176. package/.bkit/shared/.cursor/rules/bkit-rules.mdc +1 -1
  177. package/.bkit/shared/.gitattributes +1 -1
  178. package/.bkit/shared/.mcp.json +1 -1
  179. package/.bkit/shared/.opencode/opencode.json +11 -0
  180. package/.bkit/shared/CLAUDE.md +2 -2
  181. package/.bkit/shared/GEMINI.md +2 -2
  182. package/.bkit/shared/docs/architecture.md +1 -1
  183. package/.bkit/shared/docs/data-schema.md +1 -1
  184. package/.bkit/shared/docs/deployments.md +16 -28
  185. package/.bkit/shared/docs/design.md +1 -1
  186. package/.bkit/shared/docs/noise.md +1 -1
  187. package/.bkit/shared/docs/observability.md +2 -2
  188. package/.bkit/shared/docs/security.md +1 -1
  189. package/.bkit/shared/docs/setup.md +1 -1
  190. package/.bkit/shared/docs/technology.md +1 -1
  191. package/.bkit/shared/docs/testing.md +27 -10
  192. package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +1 -1
  193. package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +26 -5
  194. package/.bkit/templates/.github/workflows/bkit-ci.yml +22 -84
  195. package/.bkit/templates/.github/workflows/bkit-cloud.yml +21 -19
  196. package/.bkit/templates/.husky/pre-push +52 -13
  197. package/.bkit/templates/.prettierignore +7 -0
  198. package/.bkit/templates/scripts/ci/bkit-local-stack-lock.sh +194 -0
  199. package/.bkit/templates/scripts/ci/check-capstone.mjs +2 -4
  200. package/.bkit/templates/scripts/ci/check-capstone.test.mjs +4 -23
  201. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.mjs +104 -23
  202. package/.bkit/templates/scripts/ci/lanes/resolve-push-base.test.mjs +103 -6
  203. package/.bkit/templates/scripts/cleanup/bkit-disk-prune.mjs +1 -1
  204. package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +3 -1
  205. package/.bkit/templates/scripts/prettier/bkit-insert-ignore.mjs +49 -29
  206. package/CHANGELOG.md +142 -0
  207. package/README.md +58 -34
  208. package/dist/checks/after/ci-yml.js +39 -29
  209. package/dist/checks/after/github.js +99 -72
  210. package/dist/checks/after/index.js +11 -13
  211. package/dist/checks/after/suppression.js +8 -5
  212. package/dist/checks/after/tools.js +40 -83
  213. package/dist/checks/before/env.js +2 -2
  214. package/dist/checks/before/files.js +5 -3
  215. package/dist/checks/before/index.js +15 -2
  216. package/dist/checks/before/repo.js +163 -2
  217. package/dist/checks/tips/catalogue.js +14 -5
  218. package/dist/checks/tips/detect.js +32 -0
  219. package/dist/checks/tips/index.js +7 -5
  220. package/dist/cli.js +19 -47
  221. package/dist/commands/analysis.js +109 -100
  222. package/dist/commands/ci/ci.js +6 -6
  223. package/dist/commands/comply.js +54 -91
  224. package/dist/commands/install/doctor.js +2 -2
  225. package/dist/commands/install/install.js +50 -19
  226. package/dist/commands/install/uninstall.js +59 -28
  227. package/dist/commands/land.js +16 -12
  228. package/dist/commands/lib.js +51 -16
  229. package/dist/commands/registry.js +4 -0
  230. package/dist/commands/setup/setup.js +7 -7
  231. package/dist/commands/stats.js +136 -0
  232. package/dist/commands/tips.js +7 -3
  233. package/dist/commands/workflow/branches.js +656 -56
  234. package/dist/commands/workflow/challenge.js +556 -0
  235. package/dist/commands/workflow/context.js +709 -30
  236. package/dist/commands/workflow/counters.js +208 -75
  237. package/dist/commands/workflow/decisions.js +441 -0
  238. package/dist/commands/workflow/disk.js +2 -2
  239. package/dist/commands/workflow/fids.js +689 -33
  240. package/dist/commands/workflow/issues.js +362 -99
  241. package/dist/commands/workflow/ledgers.js +762 -27
  242. package/dist/commands/workflow/locks.js +24 -2
  243. package/dist/commands/workflow/plan-blocks.js +437 -0
  244. package/dist/commands/workflow/plan-versions.js +22 -0
  245. package/dist/commands/workflow/prs.js +142 -32
  246. package/dist/commands/workflow/repo.js +52 -7
  247. package/dist/commands/workflow/roadmap.js +9 -7
  248. package/dist/commands/workflow/run-facts.js +426 -0
  249. package/dist/commands/workflow/runs.js +144 -43
  250. package/dist/commands/workflow/runtime.js +12 -1
  251. package/dist/commands/workflow/status.js +130 -29
  252. package/dist/commands/workflow/step-table.js +276 -0
  253. package/dist/commands/workflow/steps.js +171 -80
  254. package/dist/commands/workflow/summary.js +275 -0
  255. package/dist/commands/workflow/tests.js +834 -136
  256. package/dist/commands/workflow/tracker.js +983 -0
  257. package/dist/commands/workflow/workflows.js +834 -195
  258. package/dist/commands/workflow/workstreams.js +11 -5
  259. package/dist/commands/workflow/worktrees.js +221 -22
  260. package/dist/install/manifest.js +11 -9
  261. package/dist/install/modules/cloud.js +22 -13
  262. package/dist/install/modules/core.js +326 -7
  263. package/dist/install/modules/opencode.js +2 -2
  264. package/dist/install/version-file.js +6 -2
  265. package/dist/ledgers/migrate.js +81 -0
  266. package/dist/ledgers/status.js +61 -8
  267. package/dist/ledgers/telemetry.js +905 -124
  268. package/dist/render/hosts.js +4 -0
  269. package/dist/render/models.js +12 -0
  270. package/dist/shared/branches.js +3 -1
  271. package/dist/shared/egress.js +7 -0
  272. package/dist/shared/json.js +20 -7
  273. package/dist/shared/settings.js +147 -26
  274. package/dist/shared/text.js +333 -0
  275. package/dist/tools/grammar-density.js +183 -0
  276. package/dist/tools/instructions-sources.js +721 -0
  277. package/dist/tools/instructions.js +1579 -0
  278. package/package.json +114 -23
  279. package/.bkit/core/engine/commands/harvest.ts +0 -459
  280. package/.bkit/core/engine/tools/wording.ts +0 -748
  281. package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +0 -69
  282. package/.bkit/core/prompts/bkit-build-challenge-remediate.md +0 -71
  283. package/.bkit/core/prompts/bkit-build-challenge-tests.md +0 -74
  284. package/.bkit/core/prompts/bkit-build-summary.md +0 -94
  285. package/.bkit/core/prompts/bkit-debug-summary.md +0 -96
  286. package/.bkit/core/prompts/bkit-design-summary.md +0 -107
  287. package/.bkit/core/prompts/bkit-plan-complexity-check.md +0 -67
  288. package/.bkit/core/prompts/bkit-plan-complexity-split.md +0 -88
  289. package/.bkit/core/prompts/bkit-plan-review-3.md +0 -93
  290. package/.bkit/core/prompts/bkit-plan-scope-check-1.md +0 -85
  291. package/.bkit/core/prompts/bkit-plan-scope-check-2.md +0 -85
  292. package/.bkit/core/prompts/bkit-plan-summary.md +0 -107
  293. package/.bkit/core/prompts/bkit-ship-summary.md +0 -78
  294. package/.bkit/templates/scripts/ci/lanes/check-tree-cache.mjs +0 -138
  295. package/.bkit/templates/scripts/ci/lanes/check-tree-cache.test.mjs +0 -181
  296. package/dist/commands/harvest.js +0 -353
  297. package/dist/tools/wording.js +0 -680
@@ -14,8 +14,11 @@ import * as fs from "node:fs";
14
14
  import * as path from "node:path";
15
15
 
16
16
  import {
17
+ actionKey,
17
18
  activeDoneSteps,
19
+ allRunsDoneSteps,
18
20
  appendLine,
21
+ runNumber,
19
22
  runOrStepField,
20
23
  statusTimestamp,
21
24
  type Step,
@@ -26,6 +29,8 @@ import { getPromptsRoot } from "../../shared/package-roots.js";
26
29
  import {
27
30
  CommandError,
28
31
  EXIT,
32
+ git,
33
+ isSharedBranch,
29
34
  repoRoot,
30
35
  runGit,
31
36
  type CommandSpec,
@@ -33,14 +38,22 @@ import {
33
38
  type FlagValue,
34
39
  type RunContext,
35
40
  } from "../lib.js";
36
- import { FID_PATTERNS, normaliseFid, readIssueTracker } from "./fids.js";
41
+ import { fidProblem, normaliseFid, readIssueTracker } from "./fids.js";
37
42
  import { buildComment } from "./issues.js";
43
+ import {
44
+ EXIT_FOREIGN_PATH,
45
+ activeRecord,
46
+ ownPathCommit,
47
+ ownSet,
48
+ type OwnCommit,
49
+ type SharedCheckoutRecord,
50
+ } from "./ledgers.js";
38
51
  import { readHolder, resolveMonth, workflowLockPath } from "./locks.js";
39
52
  import {
40
53
  EXIT_NO_STATUS,
41
54
  FILE_FLAG,
55
+ GROUP_FLAG,
42
56
  STEP_FLAG,
43
- SUB_PLAN_FLAG,
44
57
  WORKFLOW_FLAG,
45
58
  extraField,
46
59
  nonNegativeInt,
@@ -50,6 +63,15 @@ import {
50
63
  statusFile,
51
64
  str,
52
65
  } from "./status.js";
66
+ import {
67
+ COMMENT_FILE_OUTPUT,
68
+ POST_FLAG,
69
+ TRACKER_OUTPUT,
70
+ commentFileOf,
71
+ postForVerb,
72
+ type TrackerOutcome,
73
+ } from "./tracker.js";
74
+ import { addAllButCopied } from "./worktrees.js";
53
75
 
54
76
  const VERDICT_END = "<!-- verdict:end -->";
55
77
  const DEFAULT_VERDICTS = ["PASS", "CONCERNS", "FAIL"];
@@ -281,22 +303,17 @@ export const ROW_FIELDS: Record<string, readonly RowField[]> = {
281
303
  "plan/plan-fetch-context": ["attempt"],
282
304
  "plan/plan-review": ["attempt"],
283
305
  "plan/plan-apply-review": ["attempt"],
284
- "plan/plan-scope-check": ["attempt"],
285
- "plan/plan-apply-scope": ["attempt"],
286
- "plan/plan-complexity-check": ["attempt"],
287
- "plan/plan-complexity-split": ["attempt"],
288
306
  "plan/plan-summary": ["attempt"],
307
+ "build/build-plan-convert": ["attempt"],
289
308
  "build/build-plan-current": ["attempt"],
290
309
  "build/build-install-skills": ["attempt"],
291
310
  "build/build-plan-execute": ["attempt"],
292
311
  "build/build-plan-verify": ["attempt"],
293
- "build/build-subplan-gate": ["attempt", "scope"],
312
+ "build/build-group-gate": ["attempt", "scope"],
294
313
  "build/build-plan-gaps-remediate": ["attempt", "strategy"],
295
314
  "build/build-plan-verify-holistic": ["attempt"],
296
315
  "build/build-challenge": ["attempt"],
297
- "build/build-challenge-reconcile": ["attempt"],
298
- "build/build-challenge-remediate": ["attempt"],
299
- "build/build-challenge-tests": ["attempt"],
316
+ "build/build-decision": ["attempt"],
300
317
  "build/build-run-tests": ["attempt", "scope"],
301
318
  "build/build-failure-diagnose": ["attempt", "strategy"],
302
319
  "build/build-failure-remediate": ["attempt", "strategy"],
@@ -336,7 +353,7 @@ const CORE_ROW_KEYS = new Set([
336
353
  "artifacts",
337
354
  "verdict",
338
355
  "attempt",
339
- "subPlan",
356
+ "group",
340
357
  "failures",
341
358
  "strategy",
342
359
  ]);
@@ -345,6 +362,13 @@ const CORE_ROW_KEYS = new Set([
345
362
  // Writing the row
346
363
  // ---------------------------------------------------------------------------
347
364
 
365
+ /** The FID a `docs/plans/{month}/logs/{fid}/status.jsonl` path belongs to; undefined for any other file. */
366
+ function fidOfStatusFile(file: string): string | undefined {
367
+ return /(?:^|\/)docs\/plans\/[0-9]{6}\/logs\/([^/]+)\/status\.jsonl$/.exec(
368
+ file.split(path.sep).join("/"),
369
+ )?.[1];
370
+ }
371
+
348
372
  export interface StepRow {
349
373
  file: string;
350
374
  workflow: string;
@@ -353,17 +377,39 @@ export interface StepRow {
353
377
  verdict?: string;
354
378
  failures?: number;
355
379
  attempt?: number;
356
- subPlan?: number;
380
+ group?: number;
357
381
  strategy?: string;
358
382
  artifacts: string[];
359
383
  extras?: Record<string, unknown>;
360
384
  /** Default: HEAD now, before this step's commit. */
361
385
  parentSha?: string;
362
- /** auto: `git add -A` + commit `message`; none: the row only. */
386
+ /** auto: `git add -A` minus the `bkit.workflows.worktree.copy` entries + commit `message` (an in-place shared-branch run: its own paths only); none: the row only. */
363
387
  commit: "auto" | "none";
364
388
  message?: string;
365
389
  }
366
390
 
391
+ /** Exit code: a debug run on a shared branch has no shared-checkout record, so nothing was written or committed. */
392
+ export const EXIT_NO_RECORD = 14;
393
+
394
+ /**
395
+ * A debug run on `dev` / `main` works in place, so its record must exist before
396
+ * it writes or commits (`git add -A` there would carry work the run does not own).
397
+ * Throws EXIT_NO_RECORD when the checkout is on a shared branch and `rec` is null.
398
+ */
399
+ export function requireRecordOnShared(
400
+ cwd: string,
401
+ workflow: string,
402
+ rec: SharedCheckoutRecord | null,
403
+ ): void {
404
+ if (workflow !== "debug" || rec !== null) return;
405
+ const branch = git(cwd, ["branch", "--show-current"]) ?? "";
406
+ if (!isSharedBranch(branch)) return;
407
+ throw new CommandError(
408
+ EXIT_NO_RECORD,
409
+ `no shared-checkout record for this run on ${branch} — nothing written or committed (the record is gone or belongs to another run); a plain commit here would carry work the run does not own`,
410
+ );
411
+ }
412
+
367
413
  /**
368
414
  * Append one `step-done` row, then commit (parentSha first, the row, then the
369
415
  * commit — the order the fold's de-dup relies on). Returns the row and the new
@@ -393,16 +439,45 @@ export function writeStepRow(
393
439
  artifacts: r.artifacts,
394
440
  ...(r.verdict === undefined ? {} : { verdict: r.verdict as Step["verdict"] }),
395
441
  ...(r.attempt === undefined ? {} : { attempt: r.attempt }),
396
- ...(r.subPlan === undefined ? {} : { subPlan: r.subPlan }),
442
+ ...(r.group === undefined ? {} : { group: r.group }),
397
443
  ...(r.failures === undefined ? {} : { failures: r.failures }),
398
444
  ...(r.strategy === undefined ? {} : { strategy: r.strategy as Step["strategy"] }),
399
445
  ...(r.extras ?? {}),
400
446
  };
447
+ // An in-place run on a shared branch commits its own paths only; a refusal
448
+ // comes before the append, so a re-run after the human's fix writes the row once.
449
+ const fid = r.commit === "auto" ? fidOfStatusFile(r.file) : undefined;
450
+ const rec = fid === undefined ? null : activeRecord(cwd, fid);
451
+ if (r.commit === "auto") requireRecordOnShared(cwd, r.workflow, rec);
452
+ if (rec !== null) {
453
+ try {
454
+ ownSet(cwd, rec);
455
+ } catch (err) {
456
+ if (!(err instanceof CommandError) || err.code !== EXIT_FOREIGN_PATH) throw err;
457
+ log(`no row written to ${r.file}: the commit would be refused: ${err.message}`);
458
+ return { row, commit: null, code: EXIT_FOREIGN_PATH };
459
+ }
460
+ }
401
461
  fs.mkdirSync(path.dirname(r.file), { recursive: true });
402
462
  fs.appendFileSync(r.file, appendLine(row));
403
463
 
404
464
  if (r.commit === "none") return { row, commit: null, code: EXIT.OK };
405
- const add = runGit(cwd, ["add", "-A"]);
465
+ if (rec !== null) {
466
+ let own: OwnCommit;
467
+ try {
468
+ own = ownPathCommit(cwd, rec, r.message!, { allowEmpty: true });
469
+ } catch (err) {
470
+ if (!(err instanceof CommandError) || err.code !== EXIT_FOREIGN_PATH) throw err;
471
+ log(`row written to ${r.file} but the commit was refused: ${err.message}`);
472
+ return { row, commit: null, code: EXIT_FOREIGN_PATH };
473
+ }
474
+ if (!own.ok) {
475
+ log(`row written to ${r.file} but the commit failed: ${own.error}`);
476
+ return { row, commit: null, code: EXIT_COMMIT };
477
+ }
478
+ return { row, commit: runGit(cwd, ["rev-parse", "HEAD"]).stdout, code: EXIT.OK };
479
+ }
480
+ const add = addAllButCopied(cwd);
406
481
  const made = add.ok ? runGit(cwd, ["commit", "--allow-empty", "-m", r.message!]) : add;
407
482
  if (!made.ok) {
408
483
  log(`row written to ${r.file} but the commit failed: ${made.stderr || made.stdout}`);
@@ -427,12 +502,14 @@ interface GateOptions {
427
502
  ref?: string;
428
503
  workflow: string;
429
504
  step: string;
430
- subPlan?: number;
505
+ group?: number;
431
506
  attempt?: number;
432
507
  artifacts: string[];
433
508
  verdictRequired: boolean;
434
509
  allowed: string[];
435
510
  fid?: string;
511
+ /** The run's issue id, "" for a run with no issue; absent checks the tracker shape alone. */
512
+ issue?: string;
436
513
  month?: string;
437
514
  token?: string;
438
515
  placeholders: string[];
@@ -459,10 +536,8 @@ function gateChecks(cwd: string, o: GateOptions): Check[] {
459
536
  const fid = normaliseFid(o.fid, tracker);
460
537
  add(
461
538
  `fid ${fid}`,
462
- FID_PATTERNS[tracker].test(fid)
463
- ? undefined
464
- : `does not match the ${tracker} shape ${FID_PATTERNS[tracker].source}`,
465
- `${tracker} shape`,
539
+ fidProblem(fid, tracker, o.issue),
540
+ o.issue === "" && tracker !== "none" ? "issue-less shape" : `${tracker} shape`,
466
541
  );
467
542
  if (o.token !== undefined) {
468
543
  const root = repoRoot(cwd);
@@ -480,6 +555,8 @@ function gateChecks(cwd: string, o: GateOptions): Check[] {
480
555
  }
481
556
  } else if (o.token !== undefined) {
482
557
  throw new CommandError(EXIT.USAGE, "--token needs --fid");
558
+ } else if (o.issue !== undefined) {
559
+ throw new CommandError(EXIT.USAGE, "--issue needs --fid");
483
560
  }
484
561
 
485
562
  for (const a of o.artifacts) {
@@ -513,7 +590,7 @@ function gateChecks(cwd: string, o: GateOptions): Check[] {
513
590
 
514
591
  if (o.file === undefined) return checks;
515
592
  const runs = o.ref === undefined ? readRuns(o.file) : readRunsAt(o.file, o.ref);
516
- const rows = activeDoneSteps(runs, o.workflow, { step: o.step, subPlan: o.subPlan });
593
+ const rows = activeDoneSteps(runs, o.workflow, { step: o.step, group: o.group });
517
594
  const row = rows.filter((r) => o.attempt === undefined || r.attempt === o.attempt).at(-1);
518
595
  const rowProblems: string[] = [];
519
596
  if (!row) {
@@ -549,20 +626,29 @@ function gateChecks(cwd: string, o: GateOptions): Check[] {
549
626
 
550
627
  const POSITIONS = ["next", "current", "count"] as const;
551
628
 
552
- /** `<step>:<next|current|count>[:<since>]` → the counter it names, from the active run. */
629
+ /**
630
+ * `<step>:<next|current|count>[:all]` → the counter it names, from the active run, or
631
+ * from every run of the workflow with `:all`.
632
+ */
553
633
  function derivedCounter(
554
634
  file: string,
555
635
  workflow: string,
556
636
  spec: string,
557
- subPlan: number | undefined,
558
- since: string | undefined,
637
+ group: number | undefined,
559
638
  ): number {
560
- const [step, position, specSince] = spec.split(":");
561
- if (!step || !(POSITIONS as readonly string[]).includes(position ?? "")) {
562
- throw new CommandError(EXIT.USAGE, `"${spec}" must be <step>:<next|current|count>[:<since>]`);
639
+ const [step, position, scope] = spec.split(":");
640
+ if (
641
+ !step ||
642
+ !(POSITIONS as readonly string[]).includes(position ?? "") ||
643
+ (scope !== undefined && scope !== "all")
644
+ ) {
645
+ throw new CommandError(EXIT.USAGE, `"${spec}" must be <step>:<next|current|count>[:all]`);
563
646
  }
564
647
  const count = fs.existsSync(file)
565
- ? activeDoneSteps(readRuns(file), workflow, { step, subPlan }, specSince ?? since).length
648
+ ? (scope === "all" ? allRunsDoneSteps : activeDoneSteps)(readRuns(file), workflow, {
649
+ step,
650
+ group,
651
+ }).length
566
652
  : 0;
567
653
  if (position === "current" && count === 0) {
568
654
  throw new CommandError(
@@ -603,13 +689,12 @@ const fill = (s: string, attempt: number | undefined) =>
603
689
 
604
690
  const list = (v: FlagValue) => (v as string[] | undefined) ?? [];
605
691
 
606
- function finish(ctx: RunContext): number {
692
+ async function finish(ctx: RunContext): Promise<number> {
607
693
  const f = ctx.flags;
608
694
  const file = statusFile(ctx);
609
695
  const workflow = String(f.workflow);
610
696
  const step = String(f.step);
611
- const subPlan = positiveInt(f.subPlan, "sub-plan");
612
- const since = str(f.since);
697
+ const group = positiveInt(f.group, "group");
613
698
  const agents = list(f.agent);
614
699
 
615
700
  // Attempt: given, next from the log, or another step's counter.
@@ -618,10 +703,10 @@ function finish(ctx: RunContext): number {
618
703
  let attempt: number | undefined;
619
704
  let derived = false;
620
705
  if (f.attemptOf !== undefined) {
621
- attempt = derivedCounter(file, workflow, String(f.attemptOf), subPlan, since);
706
+ attempt = derivedCounter(file, workflow, String(f.attemptOf), group);
622
707
  derived = true;
623
708
  } else if (f.attempt === "next") {
624
- attempt = derivedCounter(file, workflow, `${step}:next`, subPlan, since);
709
+ attempt = derivedCounter(file, workflow, `${step}:next`, group);
625
710
  derived = true;
626
711
  } else {
627
712
  attempt = nonNegativeInt(f.attempt, "attempt");
@@ -631,7 +716,7 @@ function finish(ctx: RunContext): number {
631
716
  const eq = spec.indexOf("=");
632
717
  if (eq <= 0)
633
718
  throw new CommandError(EXIT.USAGE, `--count-field "${spec}" must be key=<counter>`);
634
- extras[spec.slice(0, eq)] = derivedCounter(file, workflow, spec.slice(eq + 1), subPlan, since);
719
+ extras[spec.slice(0, eq)] = derivedCounter(file, workflow, spec.slice(eq + 1), group);
635
720
  }
636
721
  const scope = str(f.scope);
637
722
  if (scope !== undefined) extras.scope = scope;
@@ -736,7 +821,7 @@ function finish(ctx: RunContext): number {
736
821
  if (!["auto", "none"].includes(commit))
737
822
  throw new CommandError(EXIT.USAGE, "--commit must be auto or none");
738
823
  if (f.docsOnly === true && commit === "auto") {
739
- runGit(ctx.cwd, ["add", "-A"]);
824
+ addAllButCopied(ctx.cwd);
740
825
  const outside = runGit(ctx.cwd, ["diff", "--cached", "--name-only"])
741
826
  .stdout.split("\n")
742
827
  .filter((p) => p !== "" && !DOCS_ONLY.test(p));
@@ -760,53 +845,20 @@ function finish(ctx: RunContext): number {
760
845
  message += " bkit [verbose ci]";
761
846
  }
762
847
 
763
- const written = writeStepRow(
764
- ctx.cwd,
765
- {
766
- file,
767
- workflow,
768
- step,
769
- verdict,
770
- failures,
771
- attempt,
772
- subPlan,
773
- strategy,
774
- artifacts,
775
- extras,
776
- parentSha: str(f.parentSha),
777
- commit: commit as "auto" | "none",
778
- message,
779
- },
780
- ctx.log,
781
- );
782
- const checks = gateChecks(ctx.cwd, {
783
- file,
784
- workflow,
785
- step,
786
- subPlan,
787
- attempt,
788
- artifacts,
789
- verdictRequired: false,
790
- allowed,
791
- placeholders: [],
792
- });
793
-
794
848
  // The step's tracker comment: header fields in one fixed order.
795
849
  let comment: string | null = null;
796
850
  const number = str(f.number);
797
851
  if (number !== undefined) {
798
852
  const title = str(f.title);
799
853
  if (title === undefined) throw new CommandError(EXIT.USAGE, "--number needs --title");
800
- const count = str(f.subPlanCount);
854
+ const count = str(f.groupCount);
801
855
  const header: Array<[string, string]> = [
802
856
  ...(verdict === undefined ? [] : [["Verdict", verdict] as [string, string]]),
803
857
  ...(failures === undefined ? [] : [["Failures", String(failures)] as [string, string]]),
804
858
  ...(scope === undefined ? [] : [["Scope", scope] as [string, string]]),
805
- ...(subPlan === undefined
859
+ ...(group === undefined
806
860
  ? []
807
- : [
808
- ["Sub-plan", `${subPlan}${count === undefined ? "" : `/${count}`}`] as [string, string],
809
- ]),
861
+ : [["Group", `${group}${count === undefined ? "" : `/${count}`}`] as [string, string]]),
810
862
  ...(derived && attempt !== undefined
811
863
  ? [["Attempt", String(attempt)] as [string, string]]
812
864
  : []),
@@ -841,6 +893,53 @@ function finish(ctx: RunContext): number {
841
893
  });
842
894
  }
843
895
 
896
+ // --post: post, then record the engine-action row, then the step row and commit
897
+ // carry both. A re-run with the same key and body is deduped, never posted twice.
898
+ let tracker: TrackerOutcome | undefined;
899
+ if (f.post === true) {
900
+ if (comment === null) throw new CommandError(EXIT.USAGE, "--post needs --number");
901
+ const key = actionKey(
902
+ workflow,
903
+ fs.existsSync(file) ? runNumber(readRuns(file), workflow) : 1,
904
+ step,
905
+ group,
906
+ attempt,
907
+ "comment",
908
+ );
909
+ tracker = await postForVerb(ctx, comment, { fid: fidOfStatusFile(file), file, key });
910
+ }
911
+
912
+ const written = writeStepRow(
913
+ ctx.cwd,
914
+ {
915
+ file,
916
+ workflow,
917
+ step,
918
+ verdict,
919
+ failures,
920
+ attempt,
921
+ group,
922
+ strategy,
923
+ artifacts,
924
+ extras,
925
+ parentSha: str(f.parentSha),
926
+ commit: commit as "auto" | "none",
927
+ message,
928
+ },
929
+ ctx.log,
930
+ );
931
+ const checks = gateChecks(ctx.cwd, {
932
+ file,
933
+ workflow,
934
+ step,
935
+ group,
936
+ attempt,
937
+ artifacts,
938
+ verdictRequired: false,
939
+ allowed,
940
+ placeholders: [],
941
+ });
942
+
844
943
  const pass = checks.every((c) => c.ok);
845
944
  for (const c of checks.filter((x) => !x.ok)) ctx.log(`${c.check}: ${c.detail}`);
846
945
  ctx.emit({
@@ -849,10 +948,14 @@ function finish(ctx: RunContext): number {
849
948
  attempt: attempt ?? null,
850
949
  fields,
851
950
  row: written.row,
951
+ parentSha: written.row.parentSha,
852
952
  commit: written.commit,
853
953
  pass,
854
954
  checks,
855
955
  comment,
956
+ // Written after the step's commit, so the commit never carries it.
957
+ commentFile: commentFileOf(ctx.cwd, comment),
958
+ ...(tracker === undefined ? {} : { tracker }),
856
959
  });
857
960
  if (written.code !== EXIT.OK) return written.code;
858
961
  return pass ? EXIT.OK : EXIT.NO;
@@ -882,7 +985,11 @@ const COMMIT_FLAGS: FlagSpec[] = [
882
985
  type: "string",
883
986
  help: "commit the step started from (default: HEAD now, before this commit)",
884
987
  },
885
- { name: "commit", type: "string", help: "auto (default: git add -A + commit) or none" },
988
+ {
989
+ name: "commit",
990
+ type: "string",
991
+ help: "auto (default: git add -A, never the worktree.copy entries, + commit) or none",
992
+ },
886
993
  { name: "message", type: "string", help: "commit message (required unless --commit=none)" },
887
994
  ];
888
995
 
@@ -914,7 +1021,7 @@ export const stepsCommand: CommandSpec = {
914
1021
  type: "string",
915
1022
  help: "non-negative integer (0 included), or `next` to derive it from the log",
916
1023
  },
917
- SUB_PLAN_FLAG,
1024
+ GROUP_FLAG,
918
1025
  { name: "strategy", type: "string", help: "STANDARD|PIVOT|FINAL" },
919
1026
  {
920
1027
  name: "artifact",
@@ -934,10 +1041,15 @@ export const stepsCommand: CommandSpec = {
934
1041
  row: "the appended step-done row",
935
1042
  commit: "the new commit's sha, or null with --commit=none",
936
1043
  },
1044
+ textOmit: ["row"],
937
1045
  exitCodes: {
938
1046
  [EXIT_NO_STATUS]: "--attempt=next could not read status.jsonl",
939
1047
  [EXIT_ARTIFACT]: "an --artifact is missing, empty, or outside the working directory",
940
1048
  [EXIT_COMMIT]: "the row was written but the commit failed",
1049
+ [EXIT_FOREIGN_PATH]:
1050
+ "nothing written, nothing committed: a path that was dirty before an in-place run changed during it",
1051
+ [EXIT_NO_RECORD]:
1052
+ "a debug run on dev/main with no shared-checkout record: nothing written or committed",
941
1053
  },
942
1054
  run: (ctx) => {
943
1055
  const f = ctx.flags;
@@ -959,7 +1071,7 @@ export const stepsCommand: CommandSpec = {
959
1071
  if (strategy !== undefined && !STRATEGIES.includes(strategy)) {
960
1072
  throw new CommandError(EXIT.USAGE, "--strategy must be STANDARD|PIVOT|FINAL");
961
1073
  }
962
- const subPlan = positiveInt(f.subPlan, "sub-plan");
1074
+ const group = positiveInt(f.group, "group");
963
1075
  const commit = str(f.commit) ?? "auto";
964
1076
  if (!["auto", "none"].includes(commit))
965
1077
  throw new CommandError(EXIT.USAGE, "--commit must be auto or none");
@@ -970,7 +1082,7 @@ export const stepsCommand: CommandSpec = {
970
1082
 
971
1083
  const attempt =
972
1084
  f.attempt === "next"
973
- ? derivedCounter(file, workflow, `${step}:next`, subPlan, undefined)
1085
+ ? derivedCounter(file, workflow, `${step}:next`, group)
974
1086
  : nonNegativeInt(f.attempt, "attempt");
975
1087
 
976
1088
  const written = writeStepRow(
@@ -983,7 +1095,7 @@ export const stepsCommand: CommandSpec = {
983
1095
  verdict,
984
1096
  failures,
985
1097
  attempt,
986
- subPlan,
1098
+ group,
987
1099
  strategy,
988
1100
  artifacts,
989
1101
  extras: Object.fromEntries(list(f.field).map(extraField)),
@@ -1039,18 +1151,13 @@ export const stepsCommand: CommandSpec = {
1039
1151
  type: "string",
1040
1152
  help: "<step>:<next|current|count> — the attempt is that step's counter in the active run",
1041
1153
  },
1042
- {
1043
- name: "since",
1044
- type: "string",
1045
- help: "run field holding a timestamp (soakEntryAt); only rows after it count",
1046
- },
1047
1154
  {
1048
1155
  name: "count-field",
1049
1156
  type: "string",
1050
1157
  repeatable: true,
1051
- help: "key=<step>:<next|current|count>[:<since>] — a row field holding another counter",
1158
+ help: "key=<step>:<next|current|count>[:all] — a row field holding another counter; :all counts every run",
1052
1159
  },
1053
- SUB_PLAN_FLAG,
1160
+ GROUP_FLAG,
1054
1161
  {
1055
1162
  name: "strategy",
1056
1163
  type: "string",
@@ -1093,7 +1200,11 @@ export const stepsCommand: CommandSpec = {
1093
1200
  },
1094
1201
  { name: "number", type: "string", help: "step number: print the step's tracker comment" },
1095
1202
  { name: "title", type: "string", help: "step title for the comment heading" },
1096
- { name: "sub-plan-count", type: "string", help: "y of the comment's Sub-plan x/y" },
1203
+ {
1204
+ ...POST_FLAG,
1205
+ help: "post the comment (needs --number) to the issue the status file's FID names, before the row and commit; prints `tracker`",
1206
+ },
1207
+ { name: "group-count", type: "string", help: "y of the comment's Group x/y" },
1097
1208
  {
1098
1209
  name: "link-ref",
1099
1210
  type: "string",
@@ -1123,13 +1234,17 @@ export const stepsCommand: CommandSpec = {
1123
1234
  attempt: "the attempt recorded, or null",
1124
1235
  fields: "the other header fields the agents' prompts declare (Spike, Mode, Affected)",
1125
1236
  row: "the appended step-done row",
1237
+ parentSha: "the row's parentSha: HEAD before the step's commit",
1126
1238
  commit: "the new commit's sha, or null with --commit=none",
1127
1239
  pass: "every gate check passed",
1128
1240
  checks: "[{check, ok, detail}] per gate check",
1129
1241
  comment: "the step's tracker comment body (with --number), else null",
1242
+ commentFile: COMMENT_FILE_OUTPUT,
1243
+ tracker: TRACKER_OUTPUT,
1130
1244
  reask: "verdict read failed: {agent, artifact} to re-ask (exit 4 / 5 / 6 only)",
1131
1245
  problem: "why the verdict read failed (exit 4 / 5 / 6 only)",
1132
1246
  },
1247
+ textOmit: ["row", { key: "checks", when: (_checks, out) => out.pass === true }],
1133
1248
  exitCodes: {
1134
1249
  [EXIT_NO_STATUS]: "status.jsonl is not valid NDJSON",
1135
1250
  [EXIT_EMPTY]: "an --agent's artifact is missing or empty (nothing written)",
@@ -1140,6 +1255,10 @@ export const stepsCommand: CommandSpec = {
1140
1255
  [EXIT_ARTIFACT]:
1141
1256
  "an --artifact is missing, empty, or outside the working directory (nothing written)",
1142
1257
  [EXIT_COMMIT]: "the row was written but the commit failed",
1258
+ [EXIT_FOREIGN_PATH]:
1259
+ "nothing written, nothing committed: a path that was dirty before an in-place run changed during it",
1260
+ [EXIT_NO_RECORD]:
1261
+ "a debug run on dev/main with no shared-checkout record: nothing written or committed",
1143
1262
  [EXIT_OUTSIDE_DOCS]:
1144
1263
  "--docs-only and the step staged a file outside the artifact tree (nothing written)",
1145
1264
  },
@@ -1194,7 +1313,7 @@ export const stepsCommand: CommandSpec = {
1194
1313
  },
1195
1314
  WORKFLOW_FLAG,
1196
1315
  STEP_FLAG,
1197
- SUB_PLAN_FLAG,
1316
+ GROUP_FLAG,
1198
1317
  {
1199
1318
  name: "attempt",
1200
1319
  type: "string",
@@ -1224,6 +1343,11 @@ export const stepsCommand: CommandSpec = {
1224
1343
  help: "NAME=value — the held placeholder must be non-empty",
1225
1344
  },
1226
1345
  { name: "fid", type: "string", help: "the FID must match the wired tracker's shape" },
1346
+ {
1347
+ name: "issue",
1348
+ type: "string",
1349
+ help: 'the run\'s issue id, or "" for a run with no issue (then the FID must be issue-less); needs --fid',
1350
+ },
1227
1351
  { name: "month", type: "string", help: "month bucket of the lock (with --token)" },
1228
1352
  {
1229
1353
  name: "token",
@@ -1240,7 +1364,7 @@ export const stepsCommand: CommandSpec = {
1240
1364
  const f = ctx.flags;
1241
1365
  const file = str(f.file) === undefined ? undefined : statusFile(ctx);
1242
1366
  const workflow = String(f.workflow);
1243
- const subPlan = positiveInt(f.subPlan, "sub-plan");
1367
+ const group = positiveInt(f.group, "group");
1244
1368
  if (f.attempt !== undefined && f.attemptOf !== undefined)
1245
1369
  throw new CommandError(EXIT.USAGE, "give --attempt or --attempt-of, not both");
1246
1370
  if (f.attemptOf !== undefined && file === undefined)
@@ -1255,19 +1379,20 @@ export const stepsCommand: CommandSpec = {
1255
1379
  );
1256
1380
  const attempt =
1257
1381
  f.attemptOf !== undefined
1258
- ? derivedCounter(file!, workflow, String(f.attemptOf), subPlan, undefined)
1382
+ ? derivedCounter(file!, workflow, String(f.attemptOf), group)
1259
1383
  : nonNegativeInt(f.attempt, "attempt");
1260
1384
  const checks = gateChecks(ctx.cwd, {
1261
1385
  file,
1262
1386
  ref,
1263
1387
  workflow,
1264
1388
  step: String(f.step),
1265
- subPlan,
1389
+ group,
1266
1390
  attempt,
1267
1391
  artifacts: list(f.artifact).map((a) => fill(a, attempt)),
1268
1392
  verdictRequired: f.verdictRequired === true,
1269
1393
  allowed: allowedVerdicts(f),
1270
1394
  fid: str(f.fid),
1395
+ issue: str(f.issue),
1271
1396
  month: str(f.month),
1272
1397
  token: str(f.token),
1273
1398
  placeholders: list(f.placeholder),