@joshuafolkken/kit 1.1166.0 → 1.1229.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 (437) hide show
  1. package/.claude/.claude-plugin/plugin.json +1 -1
  2. package/.claude/settings.json +2 -2
  3. package/.claude/skills/dependency-update/SKILL.md +4 -8
  4. package/.claude/skills/epic-commands/SKILL.md +2 -2
  5. package/.claude/skills/epic-commands/epic-bundle.md +1 -1
  6. package/.claude/skills/workflow-commands/SKILL.md +2 -4
  7. package/.claude/skills/workflow-commands/backlogrun-child.md +6 -4
  8. package/.claude/skills/workflow-commands/backlogrun-lanes.md +9 -5
  9. package/.claude/skills/workflow-commands/backlogrun-park.md +29 -9
  10. package/.claude/skills/workflow-commands/backlogrun-progress.md +7 -2
  11. package/.claude/skills/workflow-commands/backlogrun-recovery.md +4 -3
  12. package/.claude/skills/workflow-commands/backlogrun-steps.md +24 -15
  13. package/.claude/skills/workflow-commands/chain-rule.md +1 -1
  14. package/.claude/skills/workflow-commands/delegation.md +2 -2
  15. package/.claude/skills/workflow-commands/followup.md +5 -0
  16. package/.claude/skills/workflow-commands/fullrun-steps.md +1 -1
  17. package/.claude/skills/workflow-commands/halfrun.md +1 -1
  18. package/.claude/skills/workflow-commands/issue-scout.md +1 -1
  19. package/.claude/skills/workflow-commands/kickoff.md +1 -1
  20. package/.claude/skills/workflow-commands/observation-ledger.md +3 -3
  21. package/.claude/skills/workflow-commands/pre-gate-cut.md +10 -5
  22. package/.claude/skills/workflow-commands/prerequisite.md +2 -2
  23. package/.claude/skills/workflow-commands/progress-watcher.md +1 -1
  24. package/.claude/skills/workflow-commands/working-tree-hold.md +1 -1
  25. package/.codex/hooks.json +2 -2
  26. package/.cursorrules +6 -41
  27. package/.github/actions/setup-node/action.yml +1 -1
  28. package/.github/workflows/auto-tag.yml +3 -4
  29. package/.github/workflows/ci.yml +47 -33
  30. package/.github/workflows/dependabot-auto-merge.yml +13 -6
  31. package/.github/workflows/publish.yml +48 -4
  32. package/.github/workflows/sonar-qube.yml +3 -0
  33. package/.pnpmfile.mjs +4 -3
  34. package/.prettierignore +8 -2
  35. package/CLAUDE.md +18 -20
  36. package/README.md +26 -19
  37. package/SECURITY.md +15 -1
  38. package/dist/CLAUDE.md +18 -20
  39. package/dist/commands/document-section-cli.js +734 -0
  40. package/dist/hooks/audit-provision.js +346 -0
  41. package/dist/hooks/batch-guard.js +5 -4
  42. package/dist/hooks/{chunk-DYAVAM6S.js → chunk-55HHG5PX.js} +1405 -631
  43. package/dist/hooks/{chunk-A6P7PN7P.js → chunk-5VMKCCC4.js} +25 -10
  44. package/dist/hooks/chunk-5VNDSNG3.js +12 -0
  45. package/dist/hooks/{chunk-5KTCMCOT.js → chunk-6HJJXRBX.js} +4 -2
  46. package/dist/hooks/chunk-CDY4NFQG.js +15 -0
  47. package/dist/hooks/chunk-ELCN5LCH.js +135 -0
  48. package/dist/hooks/{chunk-ENA7P5FB.js → chunk-F56MFS4B.js} +3 -3
  49. package/dist/hooks/{chunk-ANJ2WGFD.js → chunk-FIVDHQGT.js} +7 -6
  50. package/dist/hooks/{chunk-3V37IID6.js → chunk-JBBMAPC4.js} +23 -14
  51. package/dist/hooks/{chunk-GU5MATVE.js → chunk-JUDKDCDP.js} +499 -389
  52. package/dist/hooks/{chunk-ZDZ555YH.js → chunk-NV2JRZZO.js} +743 -909
  53. package/dist/hooks/{chunk-V2BTOZHT.js → chunk-RNWHN5BP.js} +3 -3
  54. package/dist/hooks/{chunk-URJA6XY4.js → chunk-TQNPDZNH.js} +4 -4
  55. package/dist/hooks/{chunk-GYNGP7HI.js → chunk-VC3PZPZO.js} +1 -1
  56. package/dist/hooks/codex-hook-adapter.js +14 -12
  57. package/dist/hooks/duplicate-read-guard.js +6 -5
  58. package/dist/hooks/format-edited.js +4 -3
  59. package/dist/hooks/inputs.json +232 -210
  60. package/dist/hooks/investigation-guard.js +6 -5
  61. package/dist/hooks/pretool-guard.js +12 -10
  62. package/dist/hooks/session-lang.js +2 -4
  63. package/dist/hooks/stop-guard.js +81 -59
  64. package/dist/josh.js +872 -75
  65. package/dist/version/index.d.ts +7 -2
  66. package/dist/version/index.js +152 -75
  67. package/eslint/base.js +23 -1
  68. package/eslint/rules/code-quality.js +3 -0
  69. package/eslint/rules/early-return-one-liner.js +98 -0
  70. package/eslint/rules/unicorn.js +16 -1
  71. package/package.json +7 -6
  72. package/pnpm-workspace.yaml +9 -4
  73. package/prettier/basic.d.ts +3 -1
  74. package/prettier/index.d.ts +3 -1
  75. package/prettier/static.d.ts +3 -1
  76. package/prompts/coding-standards.md +1 -1
  77. package/prompts/collaboration-workflow/file-edits.md +4 -4
  78. package/prompts/collaboration-workflow/glossary.md +1 -1
  79. package/prompts/collaboration-workflow/operating-rules.md +17 -9
  80. package/prompts/collaboration-workflow/overview.md +2 -2
  81. package/prompts/collaboration-workflow/principles.md +14 -12
  82. package/prompts/collaboration-workflow/report-format.md +1 -1
  83. package/prompts/collaboration-workflow/residency.md +1 -1
  84. package/prompts/collaboration-workflow/rule-delivery.md +6 -6
  85. package/prompts/collaboration-workflow/shell-body.md +6 -6
  86. package/prompts/collaboration-workflow/turn-batching.md +1 -1
  87. package/prompts/collaboration-workflow/upstream-interrupt.md +12 -2
  88. package/prompts/collaboration-workflow/wip-cap.md +10 -10
  89. package/prompts/review-rubric.md +1 -2
  90. package/prompts/review.md +1 -1
  91. package/scripts/agent/agent-headless.ts +29 -0
  92. package/scripts/agent/agent-launch-environment.ts +6 -2
  93. package/scripts/agent/codex-agent-argv.ts +2 -1
  94. package/scripts/auto-ok/auto-ok-cli.ts +1 -1
  95. package/scripts/backlog/backlog-arrival.ts +3 -3
  96. package/scripts/backlog/backlog-budget.ts +1 -1
  97. package/scripts/backlog/backlog-drive-args.ts +135 -0
  98. package/scripts/backlog/backlog-drive-cli.ts +11 -137
  99. package/scripts/backlog/backlog-drive-launch.ts +39 -0
  100. package/scripts/backlog/backlog-drive-named-offer.ts +3 -5
  101. package/scripts/backlog/backlog-drive-named.ts +3 -3
  102. package/scripts/backlog/backlog-drive-offer-argv.ts +1 -1
  103. package/scripts/backlog/backlog-drive-owner.ts +1 -1
  104. package/scripts/backlog/backlog-drive-restore.ts +1 -1
  105. package/scripts/backlog/backlog-drive-retrospective.ts +1 -1
  106. package/scripts/backlog/backlog-drive.ts +1 -1
  107. package/scripts/backlog/backlog-next.ts +31 -9
  108. package/scripts/backlog/backlog-offer-cli.ts +6 -6
  109. package/scripts/backlog/backlog-offer.ts +1 -1
  110. package/scripts/backlog/backlog-plan-cli.ts +7 -6
  111. package/scripts/backlog/backlog-pool.ts +57 -11
  112. package/scripts/backlog/backlog-rank.ts +18 -9
  113. package/scripts/backlog/backlog-ready.ts +1 -1
  114. package/scripts/backlog/backlog-restructure.ts +152 -0
  115. package/scripts/backlog/backlog-scope.ts +1 -1
  116. package/scripts/backlog/backlog-stalled-detect.ts +2 -2
  117. package/scripts/backlog/backlog-stalled.ts +1 -1
  118. package/scripts/backlog/backlog-waves.ts +15 -17
  119. package/scripts/build/build-codex-hooks.ts +3 -1
  120. package/scripts/build/build-commands.ts +66 -0
  121. package/scripts/build/build-hooks.ts +2 -1
  122. package/scripts/build/build-library.ts +12 -3
  123. package/scripts/build/build.ts +70 -0
  124. package/scripts/build/local-bin.ts +3 -13
  125. package/scripts/cost-runtime/context-cut-threshold.ts +1 -9
  126. package/scripts/cost-runtime/cost-verdict.ts +15 -28
  127. package/scripts/delegation/investigation-reads.ts +3 -1
  128. package/scripts/discovery/repo-origin.ts +5 -5
  129. package/scripts/doctor/doctor-consumer.ts +2 -2
  130. package/scripts/doctor/doctor-io.ts +2 -3
  131. package/scripts/document/capped-print-part.ts +30 -0
  132. package/scripts/document/capped-print.ts +3 -4
  133. package/scripts/document/document-byte-budget.ts +11 -2
  134. package/scripts/document/document-scan.ts +117 -0
  135. package/scripts/document/document-section.ts +143 -16
  136. package/scripts/document/entry-read-budget.ts +5 -3
  137. package/scripts/document/entry-read-set.ts +10 -89
  138. package/scripts/document/read-set-cost.ts +98 -0
  139. package/scripts/epic/epic-add-body.ts +1 -0
  140. package/scripts/epic/epic-audit-checks.ts +1 -1
  141. package/scripts/epic/epic-audit-rationale.ts +4 -3
  142. package/scripts/epic/epic-bundle-cli.ts +14 -3
  143. package/scripts/epic/epic-bundle-poll.ts +41 -0
  144. package/scripts/epic/epic-busy.ts +1 -1
  145. package/scripts/epic/epic-candidate-confirm.ts +3 -2
  146. package/scripts/epic/epic-classify.ts +1 -1
  147. package/scripts/epic/epic-cli-argv.ts +78 -46
  148. package/scripts/epic/epic-cli-remove.ts +11 -19
  149. package/scripts/epic/epic-cli.ts +74 -73
  150. package/scripts/epic/epic-close-comment.ts +1 -1
  151. package/scripts/epic/epic-close.ts +1 -1
  152. package/scripts/epic/epic-cross-repo.ts +5 -5
  153. package/scripts/epic/epic-graph.ts +1 -1
  154. package/scripts/epic/epic-index.ts +1 -1
  155. package/scripts/epic/epic-issue.ts +2 -6
  156. package/scripts/epic/epic-lane-offer.ts +2 -2
  157. package/scripts/epic/epic-next.ts +29 -42
  158. package/scripts/epic/epic-solo-stale.ts +1 -1
  159. package/scripts/epic/epic-triage.ts +8 -4
  160. package/scripts/epic/epic-validate.ts +1 -1
  161. package/scripts/followup/git-followup-finish.ts +2 -2
  162. package/scripts/followup/git-followup-label.ts +2 -2
  163. package/scripts/followup/git-followup-merged.ts +2 -2
  164. package/scripts/followup/git-followup-stages.ts +9 -0
  165. package/scripts/followup/git-pr-followup-checks.ts +142 -0
  166. package/scripts/followup/git-pr-followup.ts +5 -130
  167. package/scripts/gate/core-budget.ts +69 -1
  168. package/scripts/gate/gate-plan.ts +47 -7
  169. package/scripts/gate/gate-skip.ts +38 -7
  170. package/scripts/gate/hook-gate-reuse.ts +12 -10
  171. package/scripts/gate/pre-commit-type-check.ts +4 -1
  172. package/scripts/gate/project-checks.ts +6 -9
  173. package/scripts/gate/type-check-step.ts +2 -3
  174. package/scripts/gate/verification-gate.ts +27 -8
  175. package/scripts/gh/git-gh-api-path.ts +2 -2
  176. package/scripts/gh/git-gh-issue-rest.ts +3 -3
  177. package/scripts/gh/git-gh-issue-write.ts +53 -7
  178. package/scripts/gh/git-gh-issue.ts +5 -3
  179. package/scripts/gh/git-gh-pr-read.ts +68 -19
  180. package/scripts/gh/git-gh-pr-rest.ts +1 -1
  181. package/scripts/gh/git-gh-pr.ts +5 -1
  182. package/scripts/gh/git-pr-ai-review.ts +1 -1
  183. package/scripts/gh/git-pr-checks-eval.ts +9 -3
  184. package/scripts/gh/git-pr-checks-parse.ts +1 -1
  185. package/scripts/gh/git-pr-checks-watch.ts +6 -5
  186. package/scripts/gh/git-pr-checks.ts +18 -6
  187. package/scripts/gh/git-pr-coderabbit.ts +1 -1
  188. package/scripts/gh/git-pr-error.ts +1 -3
  189. package/scripts/gh/git-pr.ts +9 -13
  190. package/scripts/gh/github-issue-url.ts +2 -2
  191. package/scripts/git/constants.ts +12 -6
  192. package/scripts/git/git-command.ts +20 -218
  193. package/scripts/git/git-diff-reads.ts +225 -0
  194. package/scripts/git/git-error.ts +4 -12
  195. package/scripts/git/git-pre-push-hook.ts +139 -0
  196. package/scripts/git/git-prompt.ts +2 -6
  197. package/scripts/git/{schemas.ts → git-schemas.ts} +2 -0
  198. package/scripts/git/git-spawn-sync.ts +3 -1
  199. package/scripts/git/git-spawn.ts +1 -1
  200. package/scripts/git/git-staging.ts +4 -6
  201. package/scripts/git/git-status.ts +3 -9
  202. package/scripts/git/main-merge.ts +57 -21
  203. package/scripts/hooks/codex-hook-adapter.ts +1 -1
  204. package/scripts/hooks/edited-cspell.ts +2 -4
  205. package/scripts/hooks/format-edited-file.ts +3 -12
  206. package/scripts/hooks/pre-push-unit.ts +31 -9
  207. package/scripts/hooks/reserved-run.ts +2 -2
  208. package/scripts/hooks/run-hook.sh +5 -4
  209. package/scripts/hooks/stop-guard.ts +5 -3
  210. package/scripts/init/init-actions.ts +0 -5
  211. package/scripts/init/init-ai-copy.ts +13 -2
  212. package/scripts/init/init-logic-json-merge.ts +19 -0
  213. package/scripts/init/init-logic-secretlint.ts +7 -7
  214. package/scripts/init/init-logic-workspace.ts +41 -2
  215. package/scripts/init/init-logic.ts +16 -26
  216. package/scripts/init/init.ts +5 -15
  217. package/scripts/init/initial-commit.ts +4 -4
  218. package/scripts/init/kit-development-versions.ts +40 -0
  219. package/scripts/init/kit-setup-state.ts +2 -2
  220. package/scripts/init/start-exec.ts +68 -19
  221. package/scripts/init/start-setup-pr.ts +9 -9
  222. package/scripts/init/start-steps.ts +6 -10
  223. package/scripts/issue/defect-rate-cli.ts +1 -1
  224. package/scripts/issue/git-next-issues.ts +1 -1
  225. package/scripts/issue/issue-auto-ok.ts +1 -1
  226. package/scripts/issue/issue-backlinks-cli.ts +2 -2
  227. package/scripts/issue/issue-backlinks.ts +9 -9
  228. package/scripts/issue/issue-comment-cli.ts +19 -13
  229. package/scripts/issue/issue-file-cli.ts +45 -18
  230. package/scripts/issue/issue-file.ts +24 -1
  231. package/scripts/issue/issue-scout-closed.ts +1 -1
  232. package/scripts/issue/issue-state-cli.ts +30 -74
  233. package/scripts/josh/josh-command-map.ts +2 -0
  234. package/scripts/josh/josh-command-types.ts +11 -0
  235. package/scripts/josh/josh-commands-ai.ts +4 -4
  236. package/scripts/josh/josh-commands-backlog.ts +4 -1
  237. package/scripts/josh/josh-commands-development.ts +11 -1
  238. package/scripts/josh/josh-commands-document.ts +1 -0
  239. package/scripts/josh/josh-commands-lane.ts +22 -0
  240. package/scripts/josh/josh-commands-maintenance.ts +4 -4
  241. package/scripts/josh/josh-commands-run.ts +12 -7
  242. package/scripts/josh/josh-in-process.ts +28 -9
  243. package/scripts/josh/josh-logic.ts +33 -15
  244. package/scripts/josh/process-identity.ts +1 -3
  245. package/scripts/josh/session-language-cli.ts +3 -4
  246. package/scripts/lane/lane-await.ts +5 -1
  247. package/scripts/lane/lane-child-invocation.ts +2 -2
  248. package/scripts/lane/lane-cli.ts +3 -3
  249. package/scripts/lane/lane-dispatch.ts +14 -10
  250. package/scripts/lane/lane-environment.ts +5 -1
  251. package/scripts/lane/lane-handoff.ts +1 -1
  252. package/scripts/lane/lane-install.ts +2 -13
  253. package/scripts/lane/lane-launch-cli.ts +35 -3
  254. package/scripts/lane/lane-ledger.ts +145 -0
  255. package/scripts/lane/lane-leftover.ts +1 -1
  256. package/scripts/lane/lane-load.ts +108 -0
  257. package/scripts/lane/lane-measure-cli.ts +149 -0
  258. package/scripts/lane/lane-occupancy.ts +3 -0
  259. package/scripts/lane/lane-reap.ts +1 -3
  260. package/scripts/lane/lane-relaunch.ts +1 -1
  261. package/scripts/lane/lane-stats.ts +224 -0
  262. package/scripts/lane/lane-vacant.ts +36 -0
  263. package/scripts/lane/openai-lane-ship.ts +2 -2
  264. package/scripts/lane/openai-lane-supervisor-owner.ts +180 -0
  265. package/scripts/lane/openai-lane-supervisor.ts +7 -165
  266. package/scripts/lane/openai-review-broker.ts +2 -4
  267. package/scripts/lib/ancestor-directories.ts +35 -0
  268. package/scripts/lib/animation-helpers.ts +2 -2
  269. package/scripts/lib/buffered-process.ts +3 -7
  270. package/scripts/lib/cli-flags.ts +71 -1
  271. package/scripts/lib/spawn-exit.ts +2 -2
  272. package/scripts/lib/timeouts.ts +35 -2
  273. package/scripts/lines/line-budget.ts +4 -6
  274. package/scripts/notify/telegram-notify.ts +26 -1
  275. package/scripts/notify/telegram-test.ts +6 -0
  276. package/scripts/observations/observation-ledger-line.ts +6 -6
  277. package/scripts/observations/observation-ledger-migrate.ts +55 -4
  278. package/scripts/observations/observation-ledger.ts +26 -7
  279. package/scripts/overrides/lockfile-overrides.ts +1 -1
  280. package/scripts/overrides/overrides-logic.ts +1 -1
  281. package/scripts/propagate/propagate-git.ts +1 -1
  282. package/scripts/propagate/propagate-publish.ts +2 -2
  283. package/scripts/propagate/propagate-steps.ts +20 -15
  284. package/scripts/propagate/propagate.ts +36 -27
  285. package/scripts/refactor/import-graph.ts +18 -1
  286. package/scripts/refactor/refactor-lint.ts +4 -4
  287. package/scripts/repo/repository-labels.ts +2 -2
  288. package/scripts/repo/required-checks-logic.ts +1 -3
  289. package/scripts/review/live-evidence.ts +2 -4
  290. package/scripts/review/review-brief-cli.ts +1 -1
  291. package/scripts/review/review-finding-ledger.ts +1 -1
  292. package/scripts/review/review-findings-cli.ts +1 -3
  293. package/scripts/rules/decision-oracle-batch.ts +128 -0
  294. package/scripts/rules/decision-oracle-tokens.ts +21 -0
  295. package/scripts/rules/decision-oracle.ts +8 -120
  296. package/scripts/rules/delivered-rules.ts +26 -182
  297. package/scripts/rules/direct-filing.ts +1 -1
  298. package/scripts/rules/early-heartbeat.ts +3 -3
  299. package/scripts/rules/git-argv.ts +1 -1
  300. package/scripts/rules/git-force.ts +1 -1
  301. package/scripts/rules/implementation-cut.ts +2 -2
  302. package/scripts/rules/index-guard.ts +1 -1
  303. package/scripts/rules/issue-comments.ts +118 -0
  304. package/scripts/rules/{issue-fold.ts → issue-fold-rule.ts} +2 -2
  305. package/scripts/rules/lane-background.ts +2 -2
  306. package/scripts/rules/lane-park.ts +18 -0
  307. package/scripts/rules/lane-split-park.ts +128 -0
  308. package/scripts/rules/oracle-firing.ts +1 -1
  309. package/scripts/rules/poll-loop.ts +1 -1
  310. package/scripts/rules/pre-gate-cut.ts +3 -3
  311. package/scripts/rules/protected-files.ts +59 -4
  312. package/scripts/rules/{run-tail.ts → run-tail-rule.ts} +2 -2
  313. package/scripts/rules/shell-body-trigger.ts +1 -1
  314. package/scripts/rules/stop-rules.ts +18 -7
  315. package/scripts/rules/test-declared-commit.ts +4 -4
  316. package/scripts/rules/wip-cap.ts +63 -0
  317. package/scripts/run/{run-carry-args.ts → carry/run-carry-args.ts} +37 -13
  318. package/scripts/run/{run-carry-change.ts → carry/run-carry-change.ts} +29 -7
  319. package/scripts/run/{run-carry-cli.ts → carry/run-carry-cli.ts} +4 -6
  320. package/scripts/run/{run-carry.ts → carry/run-carry.ts} +12 -6
  321. package/scripts/run/{run-cut-args.ts → cut/run-cut-args.ts} +1 -1
  322. package/scripts/run/{run-cut-cli.ts → cut/run-cut-cli.ts} +3 -3
  323. package/scripts/run/{run-cut-report.ts → cut/run-cut-report.ts} +2 -2
  324. package/scripts/run/{run-cut.ts → cut/run-cut.ts} +1 -1
  325. package/scripts/run/{run-entry-cli.ts → entry/run-entry-cli.ts} +11 -11
  326. package/scripts/run/{run-entry.ts → entry/run-entry.ts} +2 -2
  327. package/scripts/run/{run-event-scope.ts → event/run-event-scope.ts} +1 -1
  328. package/scripts/run/{run-event-stream-emit.ts → event/run-event-stream-emit.ts} +1 -1
  329. package/scripts/run/{run-event-stream.ts → event/run-event-stream.ts} +16 -2
  330. package/scripts/run/{run-hold-cli.ts → hold/run-hold-cli.ts} +5 -5
  331. package/scripts/run/{run-merge-cli.ts → merge/run-merge-cli.ts} +10 -5
  332. package/scripts/run/{run-merge-steps.ts → merge/run-merge-steps.ts} +53 -5
  333. package/scripts/run/{run-merge.ts → merge/run-merge.ts} +1 -1
  334. package/scripts/run/{run-progress-cli.ts → progress/run-progress-cli.ts} +1 -1
  335. package/scripts/run/{run-progress-config.ts → progress/run-progress-config.ts} +2 -17
  336. package/scripts/run/{run-progress-read.ts → progress/run-progress-read.ts} +5 -5
  337. package/scripts/run/{run-progress.ts → progress/run-progress.ts} +1 -1
  338. package/scripts/run/{run-review-steps.ts → review/run-review-steps.ts} +2 -3
  339. package/scripts/run/run-ending.ts +2 -2
  340. package/scripts/run/run-halfrun-resume.ts +6 -1
  341. package/scripts/run/run-headless.ts +1 -1
  342. package/scripts/run/run-invocation.ts +85 -84
  343. package/scripts/run/run-liveness.ts +1 -1
  344. package/scripts/run/run-parent-cut-hook.ts +1 -1
  345. package/scripts/run/run-preflight.ts +6 -6
  346. package/scripts/run/run-prep-cli.ts +1 -1
  347. package/scripts/run/run-prrun-resume.ts +1 -1
  348. package/scripts/run/run-report-cli.ts +4 -4
  349. package/scripts/run/run-report.ts +2 -2
  350. package/scripts/run/run-status-cli.ts +1 -1
  351. package/scripts/run/run-step-cli.ts +3 -3
  352. package/scripts/run/run-step.ts +2 -2
  353. package/scripts/run/run-stop-notify.ts +1 -1
  354. package/scripts/run/run-stranded-detect.ts +4 -4
  355. package/scripts/run/run-stranded.ts +2 -2
  356. package/scripts/run/run-watcher-guard-cli.ts +1 -1
  357. package/scripts/run/run-watcher-guard.ts +5 -3
  358. package/scripts/run/run-watcher-hook.ts +1 -1
  359. package/scripts/run/{run-ship-cli.ts → ship/run-ship-cli.ts} +29 -8
  360. package/scripts/run/{run-ship-detach.ts → ship/run-ship-detach.ts} +3 -3
  361. package/scripts/run/ship/run-ship-lock.ts +50 -0
  362. package/scripts/run/{run-ship-next.ts → ship/run-ship-next.ts} +13 -0
  363. package/scripts/run/ship/run-ship-pre-detach.ts +66 -0
  364. package/scripts/run/{run-ship-preflight.ts → ship/run-ship-preflight.ts} +6 -2
  365. package/scripts/run/{run-ship-probe.ts → ship/run-ship-probe.ts} +2 -2
  366. package/scripts/run/{run-ship-return.ts → ship/run-ship-return.ts} +10 -6
  367. package/scripts/run/{run-ship-review-steps.ts → ship/run-ship-review-steps.ts} +3 -3
  368. package/scripts/run/{run-ship-scoped.ts → ship/run-ship-scoped.ts} +10 -1
  369. package/scripts/run/{run-ship-stage.ts → ship/run-ship-stage.ts} +13 -0
  370. package/scripts/run/{run-ship-steps.ts → ship/run-ship-steps.ts} +15 -8
  371. package/scripts/run/ship/run-ship-stop-text.ts +13 -0
  372. package/scripts/run/ship/run-ship-sync.ts +128 -0
  373. package/scripts/run/{run-ship.ts → ship/run-ship.ts} +6 -0
  374. package/scripts/run/{run-tidy-lanes.ts → tidy/run-tidy-lanes.ts} +1 -1
  375. package/scripts/run/{run-wake-cli.ts → wake/run-wake-cli.ts} +31 -9
  376. package/scripts/run/{run-wake-describe.ts → wake/run-wake-describe.ts} +3 -3
  377. package/scripts/run/{run-wake-driver.ts → wake/run-wake-driver.ts} +99 -17
  378. package/scripts/run/{run-wake-handoff.ts → wake/run-wake-handoff.ts} +1 -1
  379. package/scripts/run/{run-wake-loop.ts → wake/run-wake-loop.ts} +8 -2
  380. package/scripts/run/wake/run-wake-restart.ts +58 -0
  381. package/scripts/run/{run-wake-session.ts → wake/run-wake-session.ts} +3 -3
  382. package/scripts/run/{run-wake.ts → wake/run-wake.ts} +1 -1
  383. package/scripts/safe-chain/preinstall-command.ts +20 -21
  384. package/scripts/safe-chain/project-config.ts +19 -15
  385. package/scripts/sync/sync-ai-files.ts +1 -1
  386. package/scripts/sync/sync-configs.ts +2 -1
  387. package/scripts/sync/sync.ts +15 -2
  388. package/scripts/test/test-red-logic.ts +17 -2
  389. package/scripts/test/test-red.ts +8 -7
  390. package/scripts/test/unit-worker-share.ts +1 -0
  391. package/scripts/time-runtime/time-background.ts +5 -1
  392. package/scripts/time-runtime/time-instant.ts +3 -1
  393. package/scripts/time-runtime/time-spans.ts +6 -139
  394. package/scripts/time-runtime/time-tool-call.ts +160 -0
  395. package/scripts/time-runtime/time-transcript-line.ts +27 -1
  396. package/scripts/version/effective-upstream.ts +2 -20
  397. package/scripts/version/latest-corepack.ts +17 -17
  398. package/scripts/version/latest-regression.ts +1 -1
  399. package/scripts/version/latest-update.ts +4 -4
  400. package/scripts/version/npm-registry.ts +20 -5
  401. package/scripts/version/publishable-range-check.ts +2 -2
  402. package/scripts/version/publishable-range.ts +1 -1
  403. package/scripts/version/release-age.ts +48 -38
  404. package/scripts/version/release-hold.ts +1 -1
  405. package/scripts/version/safe-chain-version-update.ts +40 -0
  406. package/scripts/version/upgrade-shell-command.ts +48 -8
  407. package/scripts/version/version-check-logic.ts +23 -14
  408. package/scripts/version/version-commands.ts +23 -11
  409. package/scripts/version/version-remote.ts +28 -13
  410. package/templates/pnpm-workspace.basic.yaml +4 -0
  411. package/templates/workflows/dependabot-auto-merge.yml +5 -5
  412. package/templates/workflows/github-release.yml +2 -0
  413. package/scripts/build/build-config-merge.ts +0 -27
  414. package/scripts/build/build-managed-marker.ts +0 -27
  415. package/scripts/build/build-self-sync-guard.ts +0 -27
  416. package/scripts/build/build-version.ts +0 -26
  417. package/scripts/version/preinstall-version-update.ts +0 -86
  418. /package/scripts/overrides/{schemas.ts → overrides-schemas.ts} +0 -0
  419. /package/scripts/run/{run-carry-conversation.ts → carry/run-carry-conversation.ts} +0 -0
  420. /package/scripts/run/{run-carry-reclaim.ts → carry/run-carry-reclaim.ts} +0 -0
  421. /package/scripts/run/{run-carry-stash.ts → carry/run-carry-stash.ts} +0 -0
  422. /package/scripts/run/{run-carry-streak.ts → carry/run-carry-streak.ts} +0 -0
  423. /package/scripts/run/{run-cut-handoff.ts → cut/run-cut-handoff.ts} +0 -0
  424. /package/scripts/run/{run-entry-stop.ts → entry/run-entry-stop.ts} +0 -0
  425. /package/scripts/run/{run-event-cli.ts → event/run-event-cli.ts} +0 -0
  426. /package/scripts/run/{run-event-follow.ts → event/run-event-follow.ts} +0 -0
  427. /package/scripts/run/{run-event-render.ts → event/run-event-render.ts} +0 -0
  428. /package/scripts/run/{run-event-watch.ts → event/run-event-watch.ts} +0 -0
  429. /package/scripts/run/{run-hold.ts → hold/run-hold.ts} +0 -0
  430. /package/scripts/run/{run-progress-args.ts → progress/run-progress-args.ts} +0 -0
  431. /package/scripts/run/{run-progress-clock.ts → progress/run-progress-clock.ts} +0 -0
  432. /package/scripts/run/{run-review-cli.ts → review/run-review-cli.ts} +0 -0
  433. /package/scripts/run/{run-review.ts → review/run-review.ts} +0 -0
  434. /package/scripts/run/{run-ship-review.ts → ship/run-ship-review.ts} +0 -0
  435. /package/scripts/run/{run-tidy-cli.ts → tidy/run-tidy-cli.ts} +0 -0
  436. /package/scripts/run/{run-tidy-stashes.ts → tidy/run-tidy-stashes.ts} +0 -0
  437. /package/scripts/run/{run-tidy.ts → tidy/run-tidy.ts} +0 -0
@@ -0,0 +1,128 @@
1
+ import type { DecisionOracle } from './decision-oracle'
2
+ import { oracle_tokens } from './decision-oracle-tokens'
3
+
4
+ // The batch oracles — the lane cut, the backlog budget and offer, the epic and post-merge steps, and
5
+ // `run:step` — kept beside the enumeration rather than inside it because `decision-oracle.ts` reached
6
+ // its file-size limit (joshuafolkken/kit#3264). They are one contiguous run of `DECISION_ORACLES`, so
7
+ // spreading them back in at the same position keeps the printed listing's order unchanged.
8
+
9
+ const {
10
+ BUSY,
11
+ EXCLUDE_ARG,
12
+ HUMAN_REVIEW,
13
+ ISSUE_N_ARG,
14
+ NONE,
15
+ NOT_A_LANE,
16
+ OVER,
17
+ RETRY,
18
+ STOP,
19
+ UNKNOWN,
20
+ WAIT,
21
+ } = oracle_tokens
22
+
23
+ const PRE_GATE_CUT_MD = '.claude/skills/workflow-commands/pre-gate-cut.md'
24
+ const BACKLOGRUN_MD = '.claude/skills/workflow-commands/backlogrun.md'
25
+
26
+ // The command reference in `docs/josh-commands.md` — one section per command, headed by the command
27
+ // itself. joshuafolkken/kit#2190 cut `backlogrun.md` back to a manifest of pointers, so a decision it
28
+ // used to carry inline (`run:merge`, `epic:next`, `backlog:budget`, `run:liveness`, `auto-ok:next`)
29
+ // now has its verdict contract only in this reference. That makes it the single source and the section
30
+ // a reader is routed to, in the same `file.md → \`josh <command>\`` form the `epic:reconcile` and
31
+ // `lane:list` entries already use. joshuafolkken/kit#2254.
32
+ const RUN_MERGE_REFERENCE = 'docs/josh-commands-run.md → `josh run:merge`'
33
+ const EPIC_NEXT_REFERENCE = 'docs/josh-commands-backlog.md → `josh epic:next`'
34
+ const BACKLOG_BUDGET_REFERENCE = 'docs/josh-commands-backlog.md → `josh backlog:budget`'
35
+ const RUN_LIVENESS_REFERENCE = 'docs/josh-commands-run.md → `josh run:liveness`'
36
+ const AUTO_OK_NEXT_REFERENCE = 'docs/josh-commands-backlog.md → `josh auto-ok:next`'
37
+
38
+ // Command used by two separate oracle entries (run:cut:resume and run:cut:gate).
39
+ const RUN_CUT_CMD = 'run:cut'
40
+
41
+ const BATCH_ORACLES: ReadonlyArray<DecisionOracle> = [
42
+ {
43
+ name: 'run:cut:resume',
44
+ command: RUN_CUT_CMD,
45
+ decision: 'Whether a lane child is resuming prior work or starting fresh',
46
+ args: `--resume ${ISSUE_N_ARG}`,
47
+ vocabulary: ['fresh', 'resume', NOT_A_LANE],
48
+ single_source: PRE_GATE_CUT_MD,
49
+ },
50
+ {
51
+ name: 'run:cut:gate',
52
+ command: RUN_CUT_CMD,
53
+ decision: 'Whether a lane child should take its pre-gate cut now',
54
+ args: ISSUE_N_ARG,
55
+ vocabulary: ['cut', NOT_A_LANE],
56
+ single_source: PRE_GATE_CUT_MD,
57
+ },
58
+ {
59
+ name: 'backlog:budget',
60
+ decision: 'Whether a backlogrun may start more work, keep watching, or finish',
61
+ args: '',
62
+ vocabulary: ['run', 'watch', STOP],
63
+ single_source: BACKLOG_BUDGET_REFERENCE,
64
+ },
65
+ {
66
+ name: 'run:liveness',
67
+ decision: 'Whether a delegated unit is still working or has stopped without reporting',
68
+ args: `${ISSUE_N_ARG} --output <path>`,
69
+ vocabulary: ['alive', 'stopped', 'settled', 'undetermined'],
70
+ single_source: RUN_LIVENESS_REFERENCE,
71
+ },
72
+ {
73
+ name: 'stash:pop',
74
+ decision: 'Whether a named stash entry exists and can be applied',
75
+ args: '<message>',
76
+ vocabulary: ['popped', 'conflicted', 'no-match', 'ambiguous'],
77
+ single_source: '.claude/skills/workflow-commands/prerequisite.md',
78
+ },
79
+ {
80
+ name: 'backlog:next',
81
+ decision: 'Which issue the backlog offers next, or whether to wait or stop',
82
+ args: EXCLUDE_ARG,
83
+ vocabulary: [WAIT, STOP, RETRY, 'error', NONE],
84
+ single_source: BACKLOGRUN_MD,
85
+ },
86
+ {
87
+ name: 'auto-ok:next',
88
+ decision: 'The next opted-in issue outside any epic, or none',
89
+ args: EXCLUDE_ARG,
90
+ vocabulary: [NONE],
91
+ single_source: AUTO_OK_NEXT_REFERENCE,
92
+ },
93
+ {
94
+ name: 'epic:next',
95
+ decision: "The next runnable child of an epic, or the epic's status",
96
+ args: '<epic>',
97
+ vocabulary: [WAIT, STOP, 'complete'],
98
+ single_source: EPIC_NEXT_REFERENCE,
99
+ },
100
+ {
101
+ name: 'run:merge',
102
+ decision: 'The post-merge batch step: confirm child, advance, or report a stop condition',
103
+ args: ISSUE_N_ARG,
104
+ vocabulary: [OVER, HUMAN_REVIEW, STOP, RETRY, BUSY],
105
+ single_source: RUN_MERGE_REFERENCE,
106
+ },
107
+ {
108
+ name: 'run:step',
109
+ decision: 'The run’s next single action, computed from the event stream, carry and issue state',
110
+ args: ISSUE_N_ARG,
111
+ // The non-command answers: `run:step` prints a runnable command for a phase with one to run, and
112
+ // one of these verdicts otherwise. A command line is not a vocabulary token, exactly as an issue
113
+ // number is not one for `backlog:next`.
114
+ vocabulary: [
115
+ 'implement',
116
+ HUMAN_REVIEW,
117
+ 'update-deps',
118
+ 'already-done',
119
+ 'keep-work',
120
+ WAIT,
121
+ STOP,
122
+ UNKNOWN,
123
+ ],
124
+ single_source: BACKLOGRUN_MD,
125
+ },
126
+ ]
127
+
128
+ export { BATCH_ORACLES }
@@ -0,0 +1,21 @@
1
+ // Vocabulary tokens and arguments that appear in more than one oracle entry, shared by
2
+ // `decision-oracle.ts` and `decision-oracle-batch.ts` so each string has one source
3
+ // (joshuafolkken/kit#3264).
4
+
5
+ const oracle_tokens = {
6
+ REQUIRED: 'required',
7
+ SKIP: 'skip',
8
+ STOP: 'stop',
9
+ WAIT: 'wait',
10
+ RETRY: 'retry',
11
+ OVER: 'over',
12
+ UNKNOWN: 'unknown',
13
+ NONE: 'none',
14
+ NOT_A_LANE: 'not-a-lane',
15
+ BUSY: 'busy',
16
+ HUMAN_REVIEW: 'human-review',
17
+ ISSUE_N_ARG: '<N>',
18
+ EXCLUDE_ARG: '[--exclude <n>...]',
19
+ } as const
20
+
21
+ export { oracle_tokens }
@@ -6,7 +6,11 @@
6
6
  // not by prose. Single source: `prompts/collaboration-workflow/residency.md` → question 0.
7
7
  //
8
8
  // Anything not on this list is answered by prose or by a hook-delivered rule, never by a command.
9
+ import { BATCH_ORACLES } from './decision-oracle-batch'
9
10
  import { RUN_ENTRY_ORACLE } from './decision-oracle-stage'
11
+ import { oracle_tokens } from './decision-oracle-tokens'
12
+
13
+ const { BUSY, ISSUE_N_ARG, NONE, OVER, REQUIRED, SKIP, UNKNOWN } = oracle_tokens
10
14
 
11
15
  // Paths that appear in more than one entry's `single_source` field.
12
16
  const CHAIN_RULE_MD = '.claude/skills/workflow-commands/chain-rule.md'
@@ -14,36 +18,7 @@ const BACKLOGRUN_PROGRESS_MD = '.claude/skills/workflow-commands/backlogrun-prog
14
18
  const SKILL_2E = '.claude/skills/workflow-commands/issue-scout.md'
15
19
  const SPLIT_ASSESSMENT_QUESTION =
16
20
  '.claude/skills/workflow-commands/split-assessment.md → The question'
17
- const PRE_GATE_CUT_MD = '.claude/skills/workflow-commands/pre-gate-cut.md'
18
- const BACKLOGRUN_MD = '.claude/skills/workflow-commands/backlogrun.md'
19
-
20
- // The command reference in `docs/josh-commands.md` — one section per command, headed by the command
21
- // itself. joshuafolkken/kit#2190 cut `backlogrun.md` back to a manifest of pointers, so a decision it
22
- // used to carry inline (`run:merge`, `epic:next`, `backlog:budget`, `run:liveness`, `auto-ok:next`)
23
- // now has its verdict contract only in this reference. That makes it the single source and the section
24
- // a reader is routed to, in the same `file.md → \`josh <command>\`` form the `epic:reconcile` and
25
- // `lane:list` entries already use. joshuafolkken/kit#2254.
26
- const RUN_MERGE_REFERENCE = 'docs/josh-commands-automation.md → `josh run:merge`'
27
- const EPIC_NEXT_REFERENCE = 'docs/josh-commands-automation.md → `josh epic:next`'
28
- const BACKLOG_BUDGET_REFERENCE = 'docs/josh-commands-automation.md → `josh backlog:budget`'
29
- const RUN_LIVENESS_REFERENCE = 'docs/josh-commands-automation.md → `josh run:liveness`'
30
- const AUTO_OK_NEXT_REFERENCE = 'docs/josh-commands-automation.md → `josh auto-ok:next`'
31
21
 
32
- // Command used by two separate oracle entries (run:cut:resume and run:cut:gate).
33
- const RUN_CUT_CMD = 'run:cut'
34
-
35
- // Vocabulary tokens that appear in more than one oracle's vocabulary array.
36
- const REQUIRED = 'required'
37
- const SKIP = 'skip'
38
- const STOP = 'stop'
39
- const WAIT = 'wait'
40
- const RETRY = 'retry'
41
- const OVER = 'over'
42
- const UNKNOWN = 'unknown'
43
- const NONE = 'none'
44
- const NOT_A_LANE = 'not-a-lane'
45
- const BUSY = 'busy'
46
- const HUMAN_REVIEW = 'human-review'
47
22
  // Lane liveness verdicts shared by the lane:list oracle and asserted against `lane_occupancy` in its
48
23
  // test. `LIVE` is the silent norm; `STOPPED` and `UNKNOWN` lead the difference lines.
49
24
  const LIVE = 'live'
@@ -53,10 +28,6 @@ const STOPPED = 'stopped'
53
28
  const RECONCILED = 'reconciled'
54
29
  const NOTHING_TO_RECONCILE = 'nothing to reconcile'
55
30
 
56
- // Arguments shared by more than one oracle entry.
57
- const ISSUE_N_ARG = '<N>'
58
- const EXCLUDE_ARG = '[--exclude <n>...]'
59
-
60
31
  interface DecisionOracle {
61
32
  // Short identifier used by the CLI and tests.
62
33
  name: string
@@ -193,90 +164,7 @@ const DECISION_ORACLES: ReadonlyArray<DecisionOracle> = [
193
164
  vocabulary: ['human_review: yes', 'human_review: no'],
194
165
  single_source: '.claude/skills/workflow-commands/needs-human-review.md',
195
166
  },
196
- {
197
- name: 'run:cut:resume',
198
- command: RUN_CUT_CMD,
199
- decision: 'Whether a lane child is resuming prior work or starting fresh',
200
- args: `--resume ${ISSUE_N_ARG}`,
201
- vocabulary: ['fresh', 'resume', NOT_A_LANE],
202
- single_source: PRE_GATE_CUT_MD,
203
- },
204
- {
205
- name: 'run:cut:gate',
206
- command: RUN_CUT_CMD,
207
- decision: 'Whether a lane child should take its pre-gate cut now',
208
- args: ISSUE_N_ARG,
209
- vocabulary: ['cut', NOT_A_LANE],
210
- single_source: PRE_GATE_CUT_MD,
211
- },
212
- {
213
- name: 'backlog:budget',
214
- decision: 'Whether a backlogrun may start more work, keep watching, or finish',
215
- args: '',
216
- vocabulary: ['run', 'watch', STOP],
217
- single_source: BACKLOG_BUDGET_REFERENCE,
218
- },
219
- {
220
- name: 'run:liveness',
221
- decision: 'Whether a delegated unit is still working or has stopped without reporting',
222
- args: `${ISSUE_N_ARG} --output <path>`,
223
- vocabulary: ['alive', 'stopped', 'settled', 'undetermined'],
224
- single_source: RUN_LIVENESS_REFERENCE,
225
- },
226
- {
227
- name: 'stash:pop',
228
- decision: 'Whether a named stash entry exists and can be applied',
229
- args: '<message>',
230
- vocabulary: ['popped', 'conflicted', 'no-match', 'ambiguous'],
231
- single_source: '.claude/skills/workflow-commands/prerequisite.md',
232
- },
233
- {
234
- name: 'backlog:next',
235
- decision: 'Which issue the backlog offers next, or whether to wait or stop',
236
- args: EXCLUDE_ARG,
237
- vocabulary: [WAIT, STOP, RETRY, 'error', NONE],
238
- single_source: BACKLOGRUN_MD,
239
- },
240
- {
241
- name: 'auto-ok:next',
242
- decision: 'The next opted-in issue outside any epic, or none',
243
- args: EXCLUDE_ARG,
244
- vocabulary: [NONE],
245
- single_source: AUTO_OK_NEXT_REFERENCE,
246
- },
247
- {
248
- name: 'epic:next',
249
- decision: "The next runnable child of an epic, or the epic's status",
250
- args: '<epic>',
251
- vocabulary: [WAIT, STOP, 'complete'],
252
- single_source: EPIC_NEXT_REFERENCE,
253
- },
254
- {
255
- name: 'run:merge',
256
- decision: 'The post-merge batch step: confirm child, advance, or report a stop condition',
257
- args: ISSUE_N_ARG,
258
- vocabulary: [OVER, HUMAN_REVIEW, STOP, RETRY, BUSY],
259
- single_source: RUN_MERGE_REFERENCE,
260
- },
261
- {
262
- name: 'run:step',
263
- decision: 'The run’s next single action, computed from the event stream, carry and issue state',
264
- args: ISSUE_N_ARG,
265
- // The non-command answers: `run:step` prints a runnable command for a phase with one to run, and
266
- // one of these verdicts otherwise. A command line is not a vocabulary token, exactly as an issue
267
- // number is not one for `backlog:next`.
268
- vocabulary: [
269
- 'implement',
270
- HUMAN_REVIEW,
271
- 'update-deps',
272
- 'already-done',
273
- 'keep-work',
274
- WAIT,
275
- STOP,
276
- UNKNOWN,
277
- ],
278
- single_source: BACKLOGRUN_MD,
279
- },
167
+ ...BATCH_ORACLES,
280
168
  {
281
169
  name: 'refactor:scan',
282
170
  decision: 'Whether the refactoring scope still holds high- or medium-priority candidates',
@@ -303,7 +191,7 @@ const DECISION_ORACLES: ReadonlyArray<DecisionOracle> = [
303
191
  decision: 'Whether cross-file or cross-repository code duplication exists',
304
192
  args: '',
305
193
  vocabulary: ['clean', 'clones:'],
306
- single_source: 'prompts/collaboration-workflow/principles.md → クローン禁止',
194
+ single_source: 'prompts/collaboration-workflow/principles.md → no-clones',
307
195
  },
308
196
  {
309
197
  name: 'epic:reconcile',
@@ -312,7 +200,7 @@ const DECISION_ORACLES: ReadonlyArray<DecisionOracle> = [
312
200
  "Whether an epic's declaration matches its recorded relations, and the repair when it does not",
313
201
  args: '--reconcile <E>',
314
202
  vocabulary: [RECONCILED, NOTHING_TO_RECONCILE],
315
- single_source: 'docs/josh-commands-automation.md → `josh epic --reconcile`',
203
+ single_source: 'docs/josh-commands-backlog.md → `josh epic --reconcile`',
316
204
  },
317
205
  {
318
206
  name: 'lane:list',
@@ -320,7 +208,7 @@ const DECISION_ORACLES: ReadonlyArray<DecisionOracle> = [
320
208
  'Whether each in-progress issue holds a live lane, and the two-directional difference',
321
209
  args: '',
322
210
  vocabulary: [LIVE, STOPPED, UNKNOWN],
323
- single_source: 'docs/josh-commands-automation.md → The `in-progress` / lane difference',
211
+ single_source: 'docs/josh-commands-run.md → The `in-progress` / lane difference',
324
212
  },
325
213
  RUN_ENTRY_ORACLE,
326
214
  ]
@@ -7,29 +7,29 @@ import { direct_filing } from './direct-filing'
7
7
  import { early_heartbeat } from './early-heartbeat'
8
8
  import { file_body } from './file-body'
9
9
  import { filing_cap } from './filing-cap'
10
- import { gh_api } from './gh-api'
11
10
  import { git_force } from './git-force'
12
11
  import { implementation_cut } from './implementation-cut'
13
- import { issue_fold } from './issue-fold'
12
+ import { issue_comments } from './issue-comments'
13
+ import { issue_fold_rule } from './issue-fold-rule'
14
14
  import { josh_git_bare } from './josh-git-bare'
15
15
  import { lane_background } from './lane-background'
16
16
  import { lane_carry_conflict } from './lane-carry-conflict'
17
17
  import { lane_interactive_ask } from './lane-interactive-ask'
18
18
  import { lane_park } from './lane-park'
19
+ import { lane_split_park } from './lane-split-park'
19
20
  import { lane_switch_main } from './lane-switch-main'
20
21
  import { oracle_consulted } from './oracle-consulted'
21
22
  import { permission_guards } from './permission-guards'
22
23
  import { piped_verification } from './piped-verification'
23
24
  import { poll_loop } from './poll-loop'
24
25
  import { pre_gate_cut } from './pre-gate-cut'
25
- import { prior_comment_read } from './prior-comment-read'
26
26
  import { raw_field_body } from './raw-field-body'
27
27
  import { rule_body_guard } from './rule-body-guard'
28
- import { run_tail } from './run-tail'
28
+ import { run_tail_rule } from './run-tail-rule'
29
29
  import { shell_body_trigger } from './shell-body-trigger'
30
- import { shell_segments } from './shell-segments'
31
30
  import { test_declared_commit } from './test-declared-commit'
32
31
  import { third_party_write } from './third-party-write'
32
+ import { wip_cap } from './wip-cap'
33
33
  import { worktree_guard } from './worktree-guard'
34
34
 
35
35
  // The enumeration of rules delivered at the moment they bind, rather than carried resident in
@@ -140,149 +140,12 @@ const STAMP_PREFIX = 'josh-rule-guard-'
140
140
  // function of it. `on_bash_command` went with it because those modules build their own rows.
141
141
  const { is_issue_filing, on_bash_command } = bash_triggers
142
142
 
143
- // The whole of the WIP cap, in the shape a refusal can carry: the count, the refusal, the two
144
- // exemptions and the three tests that decide the second one. The three tests are spelled out rather
145
- // than named, because a delivery that said only "an interrupt is exempt" would hand the deciding back
146
- // to judgement at exactly the moment nothing else is open to read (joshuafolkken/kit#1518).
147
- // `WIP_CAP` is the number's single source; `wip-cap.md` states it once and a test pins the two equal.
148
- const WIP_CAP = 30
149
- const WIP_CAP_REASON =
150
- `⛔ backlog WIP cap: \`pnpm josh issue:file\` counts the target repository's open Issues before filing. With more than ${String(WIP_CAP)} ` +
151
- 'open, close one first; nothing honestly closable means do not file — the command holds such a filing. ' +
152
- 'Two filings are exempt and proceed while stating the overage — one the run is blocked by (`--over-cap`, ' +
153
- 'or the `tier-a` / `split` route), and an interrupt (`--route interrupt`), decided by three tests rather ' +
154
- 'than judgement: a verification answers wrongly, a documented workflow cannot complete, or data is lost ' +
155
- 'or written outside the repository. Meeting none of the three, the finding is discretionary and waits. ' +
156
- 'Both procedures are in `prompts/collaboration-workflow/wip-cap.md`. Reissue this call and let the ' +
157
- 'command count — it fires once per run and cannot repeat on the call in hand.'
158
-
159
- // **A shell line carries several commands, and the subcommand has to be the one being invoked.**
160
- // Each segment is judged on its own, anchored at its start, so `gh issue comment <N> -b "… gh issue
161
- // view <N> …"` is read as the write it is rather than as the read it quotes. The cut itself is
162
- // `shell-segments.ts`, shared with the triggers that need the same one.
163
- // Global flags may precede the subcommand (`gh --repo o/r issue view 1`), so they are skipped —
164
- // the same optional-flag prefix `gh-api.ts` skips in front of `api`, shared from there.
165
- const ISSUE_VIEW_COMMAND = new RegExp(String.raw`^gh\s+${gh_api.GH_FLAGS}issue\s+view\s`, 'u')
166
- // `…/issues/<N>` — **one** Issue's body. The number has to end the path, so the listing
167
- // (`…/issues`) and every sub-resource under it (`…/issues/1319/comments`) are left alone.
168
- const ISSUE_BODY_PATH = /repos\/[^\s'"]*\/issues\/\d+(?=$|["'\s])/u
169
- // **A write to that path is not a read of it**, which is why the body read below asks `gh_api.is_read`:
170
- // `gh api` sends POST as soon as any field flag appears, and `kickoff` PATCHes `…/issues/<N>` to
171
- // normalize a title and to fill a blank body — so without the read check the delivery would be spent
172
- // refusing a write, and the genuine body read later in the same run would never be guarded.
173
- // A segment that fetches comments: the flag, a `comments` field in a `--json` projection, or the
174
- // comments endpoint. The short `-c` is deliberately absent — it belongs to `wc`, `grep` and `sort`
175
- // far more often than to `gh`, and reading it as "comments included" silenced the rule on any line
176
- // that ended in a pipe. A run that types it pays one round trip instead.
177
- const FETCHES_COMMENTS = /--comments\b|--json\s[\w,]*\bcomments\b|\/comments\b/u
178
- const ISSUES_PATH = /repos\/[^\s'"]*\/issues\//u
179
-
180
- // A field projection — `--jq` for `gh api`, `--json` for `gh issue view` — whose value never names the
181
- // body. `gh api …/issues/<N> --jq '{state, labels}'` fetches the Issue only to read its state or its
182
- // labels, which is a state check and not the body read this rule guards (joshuafolkken/kit#1905); a
183
- // `--jq '.body'` still names the body and stays a body read. The value is taken quoted or bare, so the
184
- // comma list `--json state,labels` and the expression `'{state, labels}'` are read the same way.
185
- const FIELD_PROJECTION = /(?:--jq|--json)[= ]\s*('[^']*'|"[^"]*"|\S+)/u
186
- const NAMES_THE_BODY = /\bbody\b/u
187
-
188
- function projects_away_body(segment: string): boolean {
189
- const projection = FIELD_PROJECTION.exec(segment)
190
-
191
- return projection !== null && !NAMES_THE_BODY.test(projection[1] ?? '')
192
- }
193
-
194
- function is_body_read_segment(segment: string): boolean {
195
- if (projects_away_body(segment)) return false
196
-
197
- if (ISSUE_VIEW_COMMAND.test(segment)) return true
198
-
199
- return gh_api.is_gh_api(segment) && ISSUE_BODY_PATH.test(segment) && gh_api.is_read(segment)
200
- }
201
-
202
- // **An Issue's comments, not just any comments.** Batching pushes a run to fetch the body and the
203
- // comments on one line, so the allowance has to reach across segments — but `gh pr view 42 --json
204
- // comments` says nothing about whether *this* Issue was read whole, so the segment doing the
205
- // fetching has to be an Issue read itself.
206
- function fetches_issue_comments(segment: string): boolean {
207
- if (!FETCHES_COMMENTS.test(segment)) return false
208
-
209
- return (
210
- ISSUE_VIEW_COMMAND.test(segment) || (gh_api.is_gh_api(segment) && ISSUES_PATH.test(segment))
211
- )
212
- }
213
-
214
- // **The trigger is the body read, not the start of implementation.** The moment an Issue's body
215
- // reaches a run is the moment the rule binds, and it is one shell call — the test
216
- // `prompts/collaboration-workflow/rule-delivery.md` sets for leaving residency.
217
- function is_body_only_issue_read(command: string): boolean {
218
- const segments = shell_segments.segments_of(command)
219
-
220
- if (segments.some((segment) => fetches_issue_comments(segment))) return false
221
-
222
- return segments.some((segment) => is_body_read_segment(segment))
223
- }
224
-
225
- // **The refusal hands over the command that fixes it**, because reading is not the same as
226
- // obeying: a sentence saying "also read the comments" is prose of exactly the kind
227
- // joshuafolkken/kit#1344 measured as moving nothing, while a refused body read leaves the run
228
- // holding the reissue that makes the comments *present*. The conflict rule ships with it — a
229
- // delivery that said only "read them" would hand back the deciding at the moment nothing else is
230
- // open to read, the mistake joshuafolkken/kit#1518 corrected for the WIP cap.
231
- const ISSUE_COMMENTS_REASON =
232
- "⛔ an Issue's comments are part of the Issue: read them before implementing, not only the body. " +
233
- 'A decision recorded after the body was written lives only in a comment — a corrected diagnosis ' +
234
- '(joshuafolkken/kit#1537), a changed default and an added acceptance criterion ' +
235
- '(joshuafolkken/kit#1520), a scope handed to another Issue (joshuafolkken/kit#1304) — and ' +
236
- 'nothing in the body says it was superseded, so a body-only reader builds the wrong thing and ' +
237
- 'sees no contradiction. Reissue this read with the comments included: ' +
238
- "`gh api repos/{owner}/{repo}/issues/<N>/comments --jq '.[] | {user: .user.login, created_at, " +
239
- "body}'` beside the body read, or `gh issue view <N> --comments` where GraphQL is reachable. " +
240
- 'Then the later text is the agreement in force — a comment supersedes the body it contradicts — ' +
241
- "except for two answers that are not the run's to make: work a comment reassigns to another " +
242
- 'Issue is out of scope and is not implemented, and a comment saying the Issue no longer has a ' +
243
- 'reason to exist stops the run with a `confirmation` Telegram. The procedure is ' +
244
- '`.claude/skills/workflow-commands/issue-comments.md`. ' +
245
- 'Every body-only read is refused until the comments are read.'
246
-
247
143
  // The reading of the call itself — which spellings carry a body inline, and what the shell does to
248
144
  // the value — is `shell-body-trigger.ts`, beside its own cases, as is the refusal text. A row states
249
145
  // its trigger and its text; a model of zsh quoting is more than a row.
250
146
  const { SHELL_BODY_REASON, carries_a_body, is_shell_evaluated_body, keeps_body_safe } =
251
147
  shell_body_trigger
252
148
 
253
- // **Keeping the WIP cap is counting the open Issues**, which is the one act the rule asks for before
254
- // a filing.
255
- //
256
- // **It has to be Issues, open, and a listing — all three, in one segment.** A pattern that took any
257
- // of them alone scored `gh pr list --state open` and `epic:bundle`'s candidate search as the count,
258
- // and those inflate exactly the ratio the retirement decision reads. `gh issue list` alone is not
259
- // enough either: the cap is about *open* Issues, and a listing that does not say so is some other
260
- // question. Segment-wise like the comments predicate, so a spelling quoted inside a filing's body
261
- // is not read as the count that filing skipped.
262
- const ISSUE_LISTING = /^gh\s+(?:-{1,2}[\w-]+(?:[= ]\S+)?\s+)*issue\s+list\b/u
263
- const ISSUES_QUERY = /repos\/[^\s'"]*\/issues\?[^\s'"]*state=open/u
264
- const OPEN_STATE = /--state[= ]open|state=open/u
265
- // **A label filter makes it a different question.** `gh issue list --label epic --state open` and
266
- // `…/issues?labels=epic&state=open` ask which epics are open, which is what `epic:bundle` and the
267
- // Issue template do; counting either as the WIP count would credit the cap as kept by a run that
268
- // never counted the backlog. The residual the pattern cannot separate is named in
269
- // `docs/josh-commands.md`: the inventory command in the `diag` skill is byte-identical to a hand count
270
- // of the backlog, so no pattern can tell those two apart.
271
- const LABEL_FILTER = /--label\b|[?&]labels=/u
272
-
273
- function counts_open_issues(command: string): boolean {
274
- return shell_segments.segments_of(command).some((segment) => {
275
- if (LABEL_FILTER.test(segment)) return false
276
-
277
- return (ISSUE_LISTING.test(segment) && OPEN_STATE.test(segment)) || ISSUES_QUERY.test(segment)
278
- })
279
- }
280
-
281
- // **Keeping the comments rule is fetching them**, in any of the spellings the refusal hands back.
282
- function reads_issue_comments(command: string): boolean {
283
- return shell_segments.segments_of(command).some((segment) => fetches_issue_comments(segment))
284
- }
285
-
286
149
  // **The occasion the pre-gate cut governs, in the one shape that separates a cut run's two halves**
287
150
  // (joshuafolkken/kit#1867). Asking about the cut is what a lane child does whatever it goes on to do;
288
151
  // claiming the working tree is what only the process on the near side of the boundary does, because
@@ -302,12 +165,7 @@ const DELIVERED_RULES: ReadonlyArray<DeliveredRule> = [
302
165
  // `epic:bundle` itself. It claims the direct call only, so the rows below — which trigger on the
303
166
  // `issue:file` call — never overlap it.
304
167
  direct_filing.ROW,
305
- {
306
- id: 'wip-cap',
307
- is_trigger: on_bash_command(is_issue_filing),
308
- reason: WIP_CAP_REASON,
309
- keeps: on_bash_command(counts_open_issues),
310
- },
168
+ wip_cap.ROW,
311
169
  // **Two more rows share the filing trigger** (joshuafolkken/kit#2119, joshuafolkken/kit#2213), listed
312
170
  // after `wip-cap` so the backlog count still speaks first: `filing-cap` refuses every filing past
313
171
  // the per-run ceiling, and `issue-fold` refuses a *second* filing the run has not folded. Each is a
@@ -315,14 +173,8 @@ const DELIVERED_RULES: ReadonlyArray<DeliveredRule> = [
315
173
  // delivery is still correct one reissue later — so an unfolded, over-cap second filing is delivered
316
174
  // `wip-cap`, then `filing-cap`, then `issue-fold` across its reissues.
317
175
  filing_cap.ROW,
318
- issue_fold.ROW,
319
- {
320
- id: 'issue-comments',
321
- is_trigger: on_bash_command(is_body_only_issue_read),
322
- reason: ISSUE_COMMENTS_REASON,
323
- already_satisfied: prior_comment_read.already_read_for_call,
324
- keeps: on_bash_command(reads_issue_comments),
325
- },
176
+ issue_fold_rule.ROW,
177
+ issue_comments.ROW,
326
178
  {
327
179
  id: 'shell-body',
328
180
  is_trigger: on_bash_command(is_shell_evaluated_body),
@@ -377,11 +229,11 @@ const DELIVERED_RULES: ReadonlyArray<DeliveredRule> = [
377
229
  // second inside one `fullrun` when round 2 fixes a finding in place.
378
230
  {
379
231
  id: 'run-tail',
380
- is_trigger: run_tail.is_foreground_push_step,
381
- reason: run_tail.RUN_TAIL_REASON,
382
- decide: run_tail.decide,
383
- keeps: run_tail.is_backgrounded_push_step,
384
- reaches: run_tail.is_push_step_call,
232
+ is_trigger: run_tail_rule.is_foreground_push_step,
233
+ reason: run_tail_rule.RUN_TAIL_REASON,
234
+ decide: run_tail_rule.decide,
235
+ keeps: run_tail_rule.is_backgrounded_push_step,
236
+ reaches: run_tail_rule.is_push_step_call,
385
237
  },
386
238
  // **The one row whose trigger consults the world beside the command**, because "is this a lane that
387
239
  // has not cut" is not readable from the call: it is the working directory's own name and the cut
@@ -424,22 +276,14 @@ const DELIVERED_RULES: ReadonlyArray<DeliveredRule> = [
424
276
  // "is this a dispatched lane child" is the dispatch mark against this checkout's own issue, read
425
277
  // synchronously by `lane_child_marker.is_child_of`, and the command match runs first so an ordinary
426
278
  // run pays nothing for it.
279
+ // Its once-per-run disposition is stated beside the row in `lane-park.ts`.
427
280
  //
428
- // **Once per run rather than `decide`, and no `already_satisfied`.** The stop ends the turn, so it
429
- // is not the recurring act joshuafolkken/kit#1570 wrote `decide` for. It carries no
430
- // `already_satisfied` because the park it asks for is a GitHub label a synchronous guard cannot
431
- // read, and the transcript-tail alternative would read a child that merely *read*
432
- // `backlogrun-park.md` — whose prose carries the `labels[]=needs-decision` command — as compliant
433
- // and fall silent on a real violation. `lane-park.ts` states why one wasted reissue on the compliant
434
- // path is the safe direction. `keeps` reads an actual label-application `Bash` command, never the
435
- // tail, so it is not fooled the same way; `reaches` stays `is_trigger`, since a compliant run issues
436
- // the same confirmation notify and belongs in the denominator.
437
- {
438
- id: 'lane-park',
439
- is_trigger: on_bash_command(lane_park.is_unparked_stop),
440
- reason: lane_park.LANE_PARK_REASON,
441
- keeps: on_bash_command(lane_park.records_the_park),
442
- },
281
+ // **A split child's park is refused first** (joshuafolkken/kit#3296): a lane child that promoted its
282
+ // own Issue to an epic this run has nothing to park, so `lane-split-park` refuses the label write
283
+ // and the confirmation notify onto that epic on every occurrence. It shares the notify with
284
+ // `lane-park` and is listed first; a run that promoted nothing falls through to `lane-park`.
285
+ lane_split_park.ROW,
286
+ lane_park.ROW,
443
287
  // **joshuafolkken/kit#2034's rule, one tool-call earlier** (joshuafolkken/kit#2201). `lane-park`
444
288
  // fires on the `confirmation` notify a routed child reaches; a child that reaches for
445
289
  // `AskUserQuestion` never gets there, because the harness ends its turn at the refused ask. This
@@ -782,8 +626,8 @@ const delivered_rules = {
782
626
  DIRECT_FILING_REASON: direct_filing.DIRECT_FILING_REASON,
783
627
  FILING_CAP_REASON: filing_cap.FILING_CAP_REASON,
784
628
  GIT_FORCE_REASON: git_force.GIT_FORCE_REASON,
785
- ISSUE_COMMENTS_REASON,
786
- ISSUE_FOLD_REASON: issue_fold.ISSUE_FOLD_REASON,
629
+ ISSUE_COMMENTS_REASON: issue_comments.ISSUE_COMMENTS_REASON,
630
+ ISSUE_FOLD_REASON: issue_fold_rule.ISSUE_FOLD_REASON,
787
631
  LANE_INTERACTIVE_ASK_REASON: lane_interactive_ask.LANE_INTERACTIVE_ASK_REASON,
788
632
  LANE_PARK_REASON: lane_park.LANE_PARK_REASON,
789
633
  MEASURED_RULES,
@@ -791,16 +635,16 @@ const delivered_rules = {
791
635
  POLL_LOOP_REASON: poll_loop.POLL_LOOP_REASON,
792
636
  PRE_GATE_CUT_REASON: pre_gate_cut.PRE_GATE_CUT_REASON,
793
637
  RAW_FIELD_BODY_REASON: raw_field_body.RAW_FIELD_BODY_REASON,
794
- RUN_TAIL_REASON: run_tail.RUN_TAIL_REASON,
638
+ RUN_TAIL_REASON: run_tail_rule.RUN_TAIL_REASON,
795
639
  SHELL_BODY_REASON,
796
640
  SWITCH_ENV_KEY,
797
641
  THIRD_PARTY_WRITE_REASON: third_party_write.THIRD_PARTY_WRITE_REASON,
798
- WIP_CAP,
799
- WIP_CAP_REASON,
642
+ WIP_CAP: wip_cap.WIP_CAP,
643
+ WIP_CAP_REASON: wip_cap.WIP_CAP_REASON,
800
644
  WORKTREE_MUTATION_REASON: worktree_guard.WORKTREE_MUTATION_REASON,
801
645
  delivery,
802
646
  delivery_path,
803
- is_body_only_issue_read,
647
+ is_body_only_issue_read: issue_comments.is_body_only_issue_read,
804
648
  is_enabled,
805
649
  is_issue_filing,
806
650
  }
@@ -14,7 +14,7 @@ const DIRECT_FILING_REASON =
14
14
  'lint and its classification labels, the depth and `route:` labels, the `## Origin` check when filing ' +
15
15
  'into another repository, and `epic:bundle` after the create — so none of them is a step to remember. ' +
16
16
  'When the scout prints candidates it holds the filing: read each, then reissue with `--distinct <N,…>` ' +
17
- 'for the ones that are separate deliverables. Reference: `docs/josh-commands-automation.md` → "`josh issue:file`". ' +
17
+ 'for the ones that are separate deliverables. Reference: `docs/josh-commands-backlog.md` → "`josh issue:file`". ' +
18
18
  '**This rule fires on every occurrence, not once per run.**'
19
19
 
20
20
  function is_any_filing(command: string): boolean {
@@ -1,7 +1,7 @@
1
1
  import { hook_decision, type GuardRun } from '#scripts/josh/hook-decision'
2
- import { run_progress } from '#scripts/run/run-progress'
3
- import { run_progress_clock } from '#scripts/run/run-progress-clock'
4
- import { run_progress_config } from '#scripts/run/run-progress-config'
2
+ import { run_progress } from '#scripts/run/progress/run-progress'
3
+ import { run_progress_clock } from '#scripts/run/progress/run-progress-clock'
4
+ import { run_progress_config } from '#scripts/run/progress/run-progress-config'
5
5
  import type { GuardedCall } from '#scripts/time-runtime/time-batch-guard'
6
6
  import { time_shell } from '#scripts/time-runtime/time-shell'
7
7
  import { shell_segments } from './shell-segments'
@@ -11,7 +11,7 @@
11
11
  // :branch`), because none of those put the literal the glob keys on where the glob looks. Parsing the
12
12
  // arguments is what makes the judgement independent of the spelling.
13
13
 
14
- // The wrapper words that may stand in front of `git`, the same ones `run-tail.ts` skips in front of
14
+ // The wrapper words that may stand in front of `git`, the same ones `run-tail-rule.ts` skips in front of
15
15
  // `josh`: environment assignments, the package-manager launchers, `sudo`, `env`, and an opening
16
16
  // subshell parenthesis. Left in, `sudo git push --force`, `env git commit` and `(git push -f)` are
17
17
  // silently not a git command (joshuafolkken/kit#2983).