@joshuafolkken/kit 1.1471.0 → 1.1514.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 (267) hide show
  1. package/.claude/settings.json +6 -6
  2. package/.claude/skills/epic-commands/SKILL.md +2 -14
  3. package/.claude/skills/epic-commands/epic-bundle.md +9 -5
  4. package/.claude/skills/epic-commands/execution-waves.md +1 -2
  5. package/.claude/skills/verify-ui/SKILL.md +1 -2
  6. package/.claude/skills/workflow-commands/SKILL.md +7 -9
  7. package/.claude/skills/workflow-commands/background-commands.md +3 -7
  8. package/.claude/skills/workflow-commands/backlogrun-child.md +3 -10
  9. package/.claude/skills/workflow-commands/backlogrun-lanes.md +6 -15
  10. package/.claude/skills/workflow-commands/backlogrun-park.md +2 -8
  11. package/.claude/skills/workflow-commands/backlogrun-progress.md +10 -19
  12. package/.claude/skills/workflow-commands/backlogrun-recovery.md +8 -8
  13. package/.claude/skills/workflow-commands/backlogrun-steps.md +2 -10
  14. package/.claude/skills/workflow-commands/backlogrun.md +31 -50
  15. package/.claude/skills/workflow-commands/chain-rule.md +7 -6
  16. package/.claude/skills/workflow-commands/delegation.md +12 -8
  17. package/.claude/skills/workflow-commands/entry-sequence.md +1 -3
  18. package/.claude/skills/workflow-commands/followup.md +3 -6
  19. package/.claude/skills/workflow-commands/fullrun-steps.md +3 -5
  20. package/.claude/skills/workflow-commands/fullrun.md +4 -6
  21. package/.claude/skills/workflow-commands/halfrun.md +3 -7
  22. package/.claude/skills/workflow-commands/into-target.md +1 -2
  23. package/.claude/skills/workflow-commands/issue-comments.md +3 -3
  24. package/.claude/skills/workflow-commands/issue-scout.md +3 -2
  25. package/.claude/skills/workflow-commands/latest-gate.md +2 -6
  26. package/.claude/skills/workflow-commands/needs-human-review.md +2 -5
  27. package/.claude/skills/workflow-commands/observation-filing.md +0 -14
  28. package/.claude/skills/workflow-commands/observation-ledger.md +4 -9
  29. package/.claude/skills/workflow-commands/pre-gate-cut.md +11 -16
  30. package/.claude/skills/workflow-commands/prerequisite.md +1 -2
  31. package/.claude/skills/workflow-commands/progress-watcher.md +2 -7
  32. package/.claude/skills/workflow-commands/prrun.md +3 -5
  33. package/.claude/skills/workflow-commands/retrospective.md +4 -4
  34. package/.claude/skills/workflow-commands/split-assessment.md +1 -3
  35. package/.claude/skills/workflow-commands/target-repository.md +1 -2
  36. package/.claude/skills/workflow-commands/working-tree-hold.md +2 -4
  37. package/.codex/hooks.json +6 -6
  38. package/.github/actions/setup-node/action.yml +1 -1
  39. package/.github/workflows/ci.yml +1 -1
  40. package/.github/workflows/publish.yml +2 -2
  41. package/CLAUDE.md +1 -1
  42. package/cspell/index.yaml +7 -0
  43. package/dist/CLAUDE.md +1 -1
  44. package/dist/commands/document-section-cli.js +67 -34
  45. package/dist/hooks/batch-guard.js +6 -6
  46. package/dist/hooks/chunk-4KKD2UTK.js +66 -0
  47. package/dist/hooks/{chunk-J47HU5H5.js → chunk-6TS2JD6D.js} +3 -3
  48. package/dist/hooks/chunk-7DSBJVFH.js +50 -0
  49. package/dist/hooks/{chunk-YHBZAJSV.js → chunk-A65Y4YOR.js} +3 -3
  50. package/dist/hooks/{chunk-E7OIKX5Z.js → chunk-APUO6U4J.js} +85 -7
  51. package/dist/hooks/{chunk-IX6TTTI6.js → chunk-EFXE6C37.js} +8 -22
  52. package/dist/hooks/chunk-GP4IEC4O.js +20 -0
  53. package/dist/hooks/{chunk-SHGPANFB.js → chunk-JP45SOCJ.js} +3 -3
  54. package/dist/hooks/{chunk-K4EOONYM.js → chunk-LAOV7NLM.js} +1 -1
  55. package/dist/hooks/chunk-M4HGZV7U.js +83 -0
  56. package/dist/hooks/{chunk-KC5AK2GF.js → chunk-O6GDRNJB.js} +3 -3
  57. package/dist/hooks/{chunk-YYPI7SJZ.js → chunk-PF2NZL2A.js} +5 -5
  58. package/dist/hooks/{chunk-H5HVWYXK.js → chunk-PTICX4OL.js} +3 -4
  59. package/dist/hooks/{chunk-IIGFYXKC.js → chunk-RT27QRJW.js} +581 -1438
  60. package/dist/hooks/{chunk-43ZHT22P.js → chunk-SYOTDYCI.js} +1127 -1089
  61. package/dist/hooks/{chunk-AS74OU3D.js → chunk-TNUMY6NL.js} +1507 -1336
  62. package/dist/hooks/chunk-UPUZF3AN.js +279 -0
  63. package/dist/hooks/{chunk-EUMACUK2.js → chunk-WK6SMBIC.js} +1948 -806
  64. package/dist/hooks/codex-hook-adapter.js +17 -14
  65. package/dist/hooks/duplicate-read-guard.js +7 -7
  66. package/dist/hooks/format-edited.js +5 -4
  67. package/dist/hooks/inputs.json +317 -264
  68. package/dist/hooks/investigation-guard.js +8 -11
  69. package/dist/hooks/pretool-guard.js +16 -13
  70. package/dist/hooks/session-lang.js +370 -25
  71. package/dist/hooks/stop-guard.js +2576 -176
  72. package/dist/josh.js +2124 -277
  73. package/lefthook/base.yml +5 -3
  74. package/package.json +12 -10
  75. package/prompts/collaboration-workflow/file-edits.md +1 -3
  76. package/prompts/collaboration-workflow/gh-rest.md +1 -2
  77. package/prompts/collaboration-workflow/issue-citation.md +2 -4
  78. package/prompts/collaboration-workflow/issue-template.md +10 -2
  79. package/prompts/collaboration-workflow/lane-instructions.md +35 -0
  80. package/prompts/collaboration-workflow/operating-rules.md +2 -6
  81. package/prompts/collaboration-workflow/output-bounds.md +3 -3
  82. package/prompts/collaboration-workflow/overview.md +1 -1
  83. package/prompts/collaboration-workflow/principles.md +14 -8
  84. package/prompts/collaboration-workflow/report-format.md +9 -0
  85. package/prompts/collaboration-workflow/residency.md +12 -8
  86. package/prompts/collaboration-workflow/rule-delivery.md +3 -11
  87. package/prompts/collaboration-workflow/shell-body.md +6 -6
  88. package/prompts/collaboration-workflow/turn-batching.md +5 -5
  89. package/prompts/collaboration-workflow/upstream-interrupt.md +2 -2
  90. package/prompts/collaboration-workflow/wip-cap.md +6 -6
  91. package/prompts/collaboration-workflow.md +1 -0
  92. package/prompts/review.md +4 -5
  93. package/prompts/testing-guide.md +2 -2
  94. package/scripts/agent/agent-argv.ts +20 -4
  95. package/scripts/agent/agent-role-profile.ts +101 -45
  96. package/scripts/agent/agent-safe-text.ts +60 -0
  97. package/scripts/agent/claude-agent-argv.ts +14 -0
  98. package/scripts/agent/codex-agent-argv.ts +2 -0
  99. package/scripts/agent/lane-instructions.ts +144 -0
  100. package/scripts/backlog/backlog-budget.ts +4 -4
  101. package/scripts/backlog/backlog-drive-named.ts +1 -1
  102. package/scripts/backlog/backlog-drive-restore.ts +9 -1
  103. package/scripts/backlog/backlog-occupied.ts +56 -0
  104. package/scripts/backlog/backlog-ready.ts +47 -10
  105. package/scripts/delegation/duplicate-read-guard.ts +2 -2
  106. package/scripts/delegation/investigation-guard.ts +15 -65
  107. package/scripts/delegation/investigation-reads.ts +0 -1
  108. package/scripts/document/document-byte-budget.ts +6 -5
  109. package/scripts/document/document-section-cli.ts +17 -5
  110. package/scripts/document/entry-read-budget.ts +2 -2
  111. package/scripts/document/read-set-cli.ts +4 -1
  112. package/scripts/epic/epic-audit-orphans.ts +5 -8
  113. package/scripts/epic/epic-audit.ts +52 -1
  114. package/scripts/epic/epic-bundle-evidence.ts +49 -26
  115. package/scripts/epic/epic-bundle-referenced.ts +14 -3
  116. package/scripts/epic/epic-bundle.ts +17 -9
  117. package/scripts/followup/git-followup-workflow.ts +19 -1
  118. package/scripts/gate/check-inputs.ts +129 -0
  119. package/scripts/gate/check-reuse.ts +162 -0
  120. package/scripts/gate/core-budget.ts +93 -44
  121. package/scripts/gate/core-wait.ts +130 -0
  122. package/scripts/gate/free-cores.ts +49 -0
  123. package/scripts/gate/gate-ledger.ts +17 -3
  124. package/scripts/gate/gate-plan.ts +23 -1
  125. package/scripts/gate/gate-report.ts +15 -2
  126. package/scripts/gate/gate-run-steps.ts +150 -0
  127. package/scripts/gate/held-mark.ts +55 -0
  128. package/scripts/gate/machine-capacity.ts +70 -11
  129. package/scripts/gate/pre-commit-type-check.ts +14 -1
  130. package/scripts/gate/verification-gate.ts +58 -125
  131. package/scripts/gh/git-gh-issue-rest.ts +1 -0
  132. package/scripts/gh/git-gh-issue-write.ts +24 -2
  133. package/scripts/gh/git-pr.ts +13 -1
  134. package/scripts/git/main-merge-regenerate.ts +78 -0
  135. package/scripts/git/main-merge.ts +14 -5
  136. package/scripts/hooks/batch-guard.ts +5 -8
  137. package/scripts/hooks/pre-commit-lint.ts +91 -0
  138. package/scripts/hooks/pre-push-unit.ts +1 -1
  139. package/scripts/hooks/pretool-guard.ts +27 -52
  140. package/scripts/hooks/reserved-run.ts +1 -0
  141. package/scripts/hooks/run-hook.sh +10 -12
  142. package/scripts/hooks/stop-actions.ts +204 -0
  143. package/scripts/hooks/stop-guard.ts +62 -21
  144. package/scripts/init/hook-launch.ts +12 -7
  145. package/scripts/issue/expected-effect-lint.ts +59 -0
  146. package/scripts/issue/issue-cite-cli.ts +35 -15
  147. package/scripts/issue/issue-classification.ts +1 -1
  148. package/scripts/issue/issue-lint-cli.ts +5 -3
  149. package/scripts/issue/issue-scout-cli.ts +19 -14
  150. package/scripts/issue/markdown-section.ts +19 -5
  151. package/scripts/josh/command-usage.ts +110 -0
  152. package/scripts/josh/josh-command-map.ts +2 -0
  153. package/scripts/josh/josh-command-types.ts +55 -9
  154. package/scripts/josh/josh-commands-ai.ts +13 -0
  155. package/scripts/josh/josh-commands-development.ts +1 -1
  156. package/scripts/josh/josh-commands-hooks.ts +6 -0
  157. package/scripts/josh/josh-commands-lane.ts +10 -1
  158. package/scripts/josh/josh-commands-workflow.ts +5 -0
  159. package/scripts/josh/josh-logic.ts +6 -15
  160. package/scripts/josh/josh-usage-automation.ts +121 -0
  161. package/scripts/josh/josh-usage-backlog.ts +180 -0
  162. package/scripts/josh/josh-usage-developer.ts +230 -0
  163. package/scripts/josh/josh-usage-hooks.ts +38 -0
  164. package/scripts/josh/josh-usage-issue.ts +205 -0
  165. package/scripts/josh/josh-usage-review.ts +101 -0
  166. package/scripts/josh/josh-usage-run.ts +252 -0
  167. package/scripts/josh/josh-usage-session.ts +238 -0
  168. package/scripts/josh/josh-usage-workflow.ts +212 -0
  169. package/scripts/josh/josh.ts +14 -5
  170. package/scripts/josh/package-directory.ts +20 -0
  171. package/scripts/lane/lane-capacity.ts +8 -2
  172. package/scripts/lane/lane-check-stats.ts +56 -0
  173. package/scripts/lane/lane-child-invocation.ts +35 -4
  174. package/scripts/lane/lane-dispatch.ts +3 -3
  175. package/scripts/lane/lane-guard-policy.ts +2 -2
  176. package/scripts/lane/lane-handoff.ts +8 -1
  177. package/scripts/lane/lane-install.ts +12 -4
  178. package/scripts/lane/lane-ledger.ts +43 -1
  179. package/scripts/lane/lane-limit-cli.ts +8 -9
  180. package/scripts/lane/lane-measure-cli.ts +2 -0
  181. package/scripts/lane/lane-preserve.ts +29 -1
  182. package/scripts/lane/lane-registry.ts +9 -7
  183. package/scripts/lane/lane-restart.ts +5 -26
  184. package/scripts/lane/lane-session-action.ts +146 -0
  185. package/scripts/lane/lane-session-broker.ts +57 -138
  186. package/scripts/lane/lane-withdraw-cli.ts +71 -0
  187. package/scripts/lane/lane-withdraw.ts +182 -0
  188. package/scripts/lint/format.ts +4 -4
  189. package/scripts/lint/lint-parallel.ts +10 -3
  190. package/scripts/lint/lint-related-scope.ts +4 -1
  191. package/scripts/notify/telegram-test.ts +10 -5
  192. package/scripts/report/report-format-reference.ts +2 -0
  193. package/scripts/review/acceptance-map-check.ts +61 -0
  194. package/scripts/review/acceptance-map.ts +205 -0
  195. package/scripts/review/review-brief-cli.ts +1 -1
  196. package/scripts/rules/agent-model.ts +59 -0
  197. package/scripts/rules/delivered-rules.ts +11 -2
  198. package/scripts/rules/filing-cap.ts +1 -0
  199. package/scripts/rules/firing-point.ts +6 -5
  200. package/scripts/rules/guard-remedy.ts +117 -0
  201. package/scripts/rules/issue-comments.ts +67 -6
  202. package/scripts/rules/last-prompt.ts +50 -5
  203. package/scripts/rules/oracle-list-cli.ts +7 -0
  204. package/scripts/rules/piped-verification.ts +3 -1
  205. package/scripts/rules/rule-list.ts +4 -1
  206. package/scripts/rules/rule-registry-rows.ts +10 -0
  207. package/scripts/rules/rule-registry.ts +7 -4
  208. package/scripts/rules/rule-rewrite.ts +114 -0
  209. package/scripts/rules/rule-value.ts +7 -1
  210. package/scripts/rules/shell-segments.ts +15 -0
  211. package/scripts/rules/stop-decision.ts +77 -0
  212. package/scripts/rules/stop-rules.ts +147 -47
  213. package/scripts/rules/tail-commands.ts +15 -1
  214. package/scripts/run/board/run-board-cli.ts +2 -0
  215. package/scripts/run/board/run-board-closed.ts +8 -2
  216. package/scripts/run/board/run-board-github.ts +9 -1
  217. package/scripts/run/board/run-board-header.ts +4 -1
  218. package/scripts/run/board/run-board-labels.ts +2 -0
  219. package/scripts/run/board/run-board-layout.ts +1 -1
  220. package/scripts/run/board/run-board-read.ts +16 -0
  221. package/scripts/run/board/run-board-reason.ts +10 -1
  222. package/scripts/run/board/run-board-render-legend.ts +1 -0
  223. package/scripts/run/board/run-board-render-slot.ts +1 -1
  224. package/scripts/run/board/run-board-render-waits.ts +41 -0
  225. package/scripts/run/board/run-board-render.ts +6 -1
  226. package/scripts/run/board/run-board-row-yield.ts +1 -0
  227. package/scripts/run/board/run-board-state.ts +5 -0
  228. package/scripts/run/board/run-board-status.ts +72 -21
  229. package/scripts/run/board/run-board-tick.ts +5 -1
  230. package/scripts/run/cut/run-cut-cli.ts +3 -2
  231. package/scripts/run/cut/run-cut-report.ts +16 -0
  232. package/scripts/run/detached-launch.ts +23 -4
  233. package/scripts/run/entry/run-entry-cli.ts +8 -1
  234. package/scripts/run/event/run-event-render.ts +1 -0
  235. package/scripts/run/event/run-event-scope.ts +19 -1
  236. package/scripts/run/event/run-event-stream-emit.ts +13 -6
  237. package/scripts/run/event/run-event-stream.ts +4 -0
  238. package/scripts/run/hold/run-hold-session.ts +46 -0
  239. package/scripts/run/hold/run-hold.ts +7 -1
  240. package/scripts/run/launch-priority.ts +32 -0
  241. package/scripts/run/merge/run-merge-cli.ts +16 -65
  242. package/scripts/run/merge/run-merge-signals.ts +99 -0
  243. package/scripts/run/merge/run-merge-steps.ts +11 -1
  244. package/scripts/run/merge/run-merge.ts +21 -9
  245. package/scripts/run/run-liveness.ts +1 -1
  246. package/scripts/run/run-poll-hook.ts +157 -0
  247. package/scripts/run/run-step-cli.ts +22 -15
  248. package/scripts/run/run-step-section.ts +85 -0
  249. package/scripts/run/ship/run-ship-cli.ts +5 -12
  250. package/scripts/run/ship/run-ship-detach.ts +9 -0
  251. package/scripts/run/ship/run-ship-next.ts +10 -2
  252. package/scripts/run/ship/run-ship-overlap.ts +195 -0
  253. package/scripts/run/ship/run-ship-pre-detach.ts +33 -15
  254. package/scripts/run/ship/run-ship-preflight.ts +28 -2
  255. package/scripts/run/ship/run-ship-return.ts +31 -7
  256. package/scripts/run/ship/run-ship-review-steps.ts +12 -10
  257. package/scripts/run/ship/run-ship-steps.ts +1 -1
  258. package/scripts/run/ship/run-ship-stop-context.ts +206 -0
  259. package/scripts/run/ship/run-ship-sync.ts +14 -6
  260. package/scripts/test/test-e2e-guard.ts +30 -5
  261. package/scripts/test/test-unit-guard.ts +16 -1
  262. package/scripts/test/unit-worker-share.ts +26 -4
  263. package/scripts/time-runtime/time-shell.ts +29 -4
  264. package/scripts/time-runtime/time-spans.ts +1 -0
  265. package/scripts/time-runtime/time-tool-call.ts +7 -0
  266. package/templates/gitignore +6 -2
  267. package/dist/hooks/chunk-K4LMBQC2.js +0 -68
@@ -3,7 +3,6 @@ import path from 'node:path'
3
3
  import { fileURLToPath } from 'node:url'
4
4
  import { resolve_local_bin, resolve_package_bin } from '#scripts/build/local-bin'
5
5
  import { core_budget } from '#scripts/gate/core-budget'
6
- import { ancestor_directories } from '#scripts/lib/ancestor-directories'
7
6
  import { package_version_schema } from '#scripts/lib/schemas'
8
7
  import { resolve_spawn_exit } from '#scripts/lib/spawn-exit'
9
8
  import { execaSync } from 'execa'
@@ -18,6 +17,7 @@ import {
18
17
  import { composite_arguments, USAGE_ERROR_EXIT_CODE } from './josh-composite-arguments'
19
18
  import { josh_in_process } from './josh-in-process'
20
19
  import { kit_only } from './kit-only'
20
+ import { find_package_directory } from './package-directory'
21
21
  import { run_github_prerequisite } from './run-github-prerequisite'
22
22
 
23
23
  const COLUMN_WIDTH = 26
@@ -35,17 +35,6 @@ interface TsxRunner {
35
35
  leading_arguments: ReadonlyArray<string>
36
36
  }
37
37
 
38
- // Resolve the kit package root by ascending to the nearest package.json. This works both
39
- // from the bundled dist/josh.js (one level under the root) and from the tsx source at
40
- // scripts/josh/ (two levels), so this file's depth no longer has to be hard-coded.
41
- function find_package_directory(start_directory: string): string {
42
- return (
43
- ancestor_directories.nearest(start_directory, (directory) =>
44
- existsSync(path.join(directory, PACKAGE_JSON)),
45
- ) ?? start_directory
46
- )
47
- }
48
-
49
38
  const PACKAGE_DIR = find_package_directory(path.dirname(fileURLToPath(import.meta.url)))
50
39
 
51
40
  function resolve_tsx_executable(): string {
@@ -287,6 +276,7 @@ function declared(value: number | (() => number) | undefined): number | undefine
287
276
  // without claiming a place. A command under a parent that already holds its cores claims nothing:
288
277
  // `core_budget.with_command_reservation` reads the mark that parent set.
289
278
  async function dispatch_entry(
279
+ command: string,
290
280
  entry: CommandEntry,
291
281
  subcommand_arguments: Array<string>,
292
282
  ): Promise<number> {
@@ -297,7 +287,7 @@ async function dispatch_entry(
297
287
  return await core_budget.with_command_reservation(
298
288
  weight,
299
289
  async () => await run_entry(entry, subcommand_arguments),
300
- { memory_mb: declared(entry.memory_mb) },
290
+ { memory_mb: declared(entry.memory_mb), command },
301
291
  )
302
292
  }
303
293
 
@@ -314,7 +304,7 @@ async function run_command(
314
304
  const early_exit = pre_dispatch_exit(resolved, entry, subcommand_arguments, is_consumer)
315
305
  if (early_exit !== undefined) return early_exit
316
306
 
317
- return await dispatch_entry(entry, subcommand_arguments)
307
+ return await dispatch_entry(resolved, entry, subcommand_arguments)
318
308
  }
319
309
 
320
310
  const josh_logic = {
@@ -330,10 +320,11 @@ export { ALIASES, COMMAND_MAP } from './josh-command-map'
330
320
  export { SPAWN_ERROR_EXIT_CODE } from '#scripts/lib/spawn-exit'
331
321
  export { composite_arguments, USAGE_ERROR_EXIT_CODE } from './josh-composite-arguments'
332
322
  export {
333
- find_package_directory,
334
323
  josh_logic,
335
324
  resolve_alias,
336
325
  resolve_tsx_executable,
337
326
  resolve_tsx_runner,
338
327
  UNKNOWN_COMMAND_EXIT_CODE,
339
328
  }
329
+
330
+ export { find_package_directory } from './package-directory'
@@ -0,0 +1,121 @@
1
+ import type { CommandUsage } from './josh-command-types'
2
+
3
+ // The usage of the commands `docs/josh-commands-automation.md` documents under "Development",
4
+ // "Project" and "AI tools", keyed by command name. The page's usage blocks are generated from this
5
+ // table and `josh help <command>` prints it, so an example or a flag is written once, here (#3939).
6
+ const STAGED = '--staged'
7
+ const JSON_FLAG = '--json'
8
+ const BRANCH_DIFF = 'the branch diff'
9
+ const STAGED_DIFF = 'the staged diff instead'
10
+ const PR_NUMBER = '42'
11
+ const DRY_RUN = '--dry-run'
12
+ const SKIP_PUBLISH_WAIT = '--skip-publish-wait'
13
+
14
+ /* eslint-disable @typescript-eslint/naming-convention */
15
+ const AUTOMATION_USAGE: Readonly<Record<string, CommandUsage>> = {
16
+ 'refactor:scan': { examples: [{ arguments: '' }] },
17
+ 'time:density': {
18
+ examples: [{ arguments: '' }, { arguments: '--lanes 5', note: 'the five most recent lanes' }],
19
+ flags: [
20
+ {
21
+ names: ['--lanes <n>'],
22
+ description: 'average over a different count of recent qualifying lanes (default 10).',
23
+ },
24
+ {
25
+ names: ['--path <dir>'],
26
+ description:
27
+ "read another project's lane transcripts, as `josh time` does. Run it from the main checkout — a lane reads only its own transcript.",
28
+ },
29
+ ],
30
+ },
31
+ 'e2e:retry-check': { examples: [{ arguments: '' }] },
32
+ 'sync:scope': {
33
+ examples: [
34
+ { arguments: '', note: BRANCH_DIFF },
35
+ { arguments: STAGED, note: STAGED_DIFF },
36
+ { arguments: JSON_FLAG, note: '{"scope":"managed","reason":"..."}' },
37
+ ],
38
+ flags: [
39
+ { names: [STAGED], description: 'inspect the staged diff instead of the branch diff.' },
40
+ { names: [JSON_FLAG], description: 'emit `{"scope","reason"}` as JSON.' },
41
+ ],
42
+ },
43
+ 'dogfood:commit': { examples: [{ arguments: '~/Development/kit-test-html-start' }] },
44
+ 'fresh:run': {
45
+ examples: [
46
+ { arguments: '--list', note: "kit's six patterns" },
47
+ { arguments: 'kit-test-html-init', note: 'one pattern, the packed checkout' },
48
+ {
49
+ arguments: 'kit-test-html-start',
50
+ note: 'a GitHub pattern, the latest published version',
51
+ },
52
+ { arguments: '--spec fresh/html-init.json', note: 'a scenario another toolkit wrote' },
53
+ ],
54
+ flags: [
55
+ { names: ['--list'], description: 'print the pattern names and run nothing.' },
56
+ {
57
+ names: ['--spec <file.json>'],
58
+ description:
59
+ 'run the scenario in this file instead of a named pattern; the path is relative to the project root.',
60
+ },
61
+ {
62
+ names: ['--package-version <version>'],
63
+ description:
64
+ "the published version a `package_source: published` scenario installs. Default: the registry's latest version of the package the command is run from.",
65
+ },
66
+ {
67
+ names: ['--log-dir <dir>'],
68
+ description: 'where the log is written. Default: `.claude/tmp/fresh-machine`.',
69
+ },
70
+ { names: ['--rebuild'], description: 'build the machine image without the layer cache.' },
71
+ ],
72
+ },
73
+ 'auth:setup': {
74
+ examples: [
75
+ { arguments: '', note: 'sign in and save the token' },
76
+ { arguments: '--check', note: 'ok: … saved on <date>, or missing: … and exit 1' },
77
+ ],
78
+ },
79
+ 'sonar:hotspots': { examples: [{ arguments: PR_NUMBER }] },
80
+ 'sonar:new-code': { examples: [{ arguments: PR_NUMBER }] },
81
+ 'ui:routes': {
82
+ examples: [
83
+ { arguments: '', note: BRANCH_DIFF },
84
+ { arguments: STAGED, note: STAGED_DIFF },
85
+ ],
86
+ },
87
+ propagate: {
88
+ examples: [
89
+ { arguments: '' },
90
+ { arguments: DRY_RUN, note: 'report targets and steps, write nothing' },
91
+ { arguments: SKIP_PUBLISH_WAIT, note: 'release already known to be published' },
92
+ { arguments: '--target app-kit', note: 'carry the release into one consumer only' },
93
+ ],
94
+ flags: [
95
+ {
96
+ names: [DRY_RUN],
97
+ description:
98
+ 'report targets and steps without writing; skips the publish wait, opens no issues.',
99
+ },
100
+ {
101
+ names: [SKIP_PUBLISH_WAIT],
102
+ description: 'skip the registry poll for an already-published release.',
103
+ },
104
+ {
105
+ names: ['--target <repo>'],
106
+ description:
107
+ 'process only that consumer (`app-kit` or `joshuafolkken/app-kit`); the rest are reported `skipped` and left untouched. An unknown, ambiguous or non-dependent name fails before the publish wait, writing nothing.',
108
+ },
109
+ ],
110
+ },
111
+ 'repo:party': {
112
+ examples: [
113
+ { arguments: 'joshuafolkken/kit', note: '→ first-party (in the kit session)' },
114
+ { arguments: 'sveltejs/kit', note: '→ third-party' },
115
+ { arguments: '', note: "no argument: the session's own repository" },
116
+ ],
117
+ },
118
+ }
119
+ /* eslint-enable @typescript-eslint/naming-convention */
120
+
121
+ export { AUTOMATION_USAGE }
@@ -0,0 +1,180 @@
1
+ import type { CommandUsage } from './josh-command-types'
2
+
3
+ // The usage of the epic and backlog commands `docs/josh-commands-backlog.md` documents under "Epics
4
+ // and backlog", keyed by command name. The page's usage blocks are generated from this table and
5
+ // `josh help <command>` prints it, so an example or a flag is written once, here (#3938).
6
+ const EXCLUDE = '--exclude <N>'
7
+ const BUDGET = '--answer candidates --started "$started" --active "$active"'
8
+ const REPO = '--repo <owner/repo>'
9
+ const JUST_MERGED = 'skip the issue just merged'
10
+ const EXCLUDE_1630 = '--exclude 1630'
11
+
12
+ /* eslint-disable @typescript-eslint/naming-convention */
13
+ const BACKLOG_USAGE: Readonly<Record<string, CommandUsage>> = {
14
+ epic: {
15
+ examples: [
16
+ { arguments: '"Epic: split the parser work" 101 102 103' },
17
+ { arguments: '"Epic: staged rollout" 101 102 --ordered' },
18
+ { arguments: '"Epic: ..." 101 102 --rationale-file rationale.md' },
19
+ { arguments: '--promote 858 101 102 103', note: 'turn an existing issue into an epic' },
20
+ { arguments: '--add 893 894', note: 'track #894, declaring no order for it' },
21
+ { arguments: '--add 893 894 --before 891', note: '#894 must finish before #891' },
22
+ { arguments: '--add 893 894 --after 890', note: '#894 starts once #890 is done' },
23
+ { arguments: '--add 893 894 --decision-file why.md', note: '…and record why, in one call' },
24
+ {
25
+ arguments: '--reconcile 2184',
26
+ note: 'rewrite the body to match the recorded blocked-by, and record any order the body declared',
27
+ },
28
+ ],
29
+ flags: [
30
+ {
31
+ names: ['--ordered'],
32
+ description:
33
+ 'argument order is the dependency order; writes the arrow chain, records the matching `blocked-by` relations, and adds a `### Declared order` entry under `## Decisions`.',
34
+ },
35
+ {
36
+ names: ['--rationale-file <path|->'],
37
+ description: 'split rationale prose (`-` reads stdin).',
38
+ },
39
+ {
40
+ names: ['--origin <owner/repo#N>'],
41
+ description: 'backlink when the split originated in another repository.',
42
+ },
43
+ {
44
+ names: ['--before <M>'],
45
+ description:
46
+ 'with `--add`: insert before `#M`, re-pointing what `#M` was waiting on so the chain is never broken.',
47
+ },
48
+ {
49
+ names: ['--after <M>'],
50
+ description:
51
+ 'with `--add`: start after `#M`; branches when `#M` already has a successor, extends when it is a tail.',
52
+ },
53
+ {
54
+ names: ['--order-before <M>', '--order-after <M>'],
55
+ description: 'with `--add`: move the task-list row only; write no `blocked-by` relation.',
56
+ },
57
+ {
58
+ names: ['--decision-file <path|->'],
59
+ description: 'with `--add`: record why the child was placed.',
60
+ },
61
+ {
62
+ names: ['--remove <E> <M> <N> [<N2> …]'],
63
+ description:
64
+ 'delete a declared order from the body and the relations; each consecutive pair is one link.',
65
+ },
66
+ ],
67
+ },
68
+ 'epic:next': {
69
+ examples: [
70
+ { arguments: '858' },
71
+ { arguments: '858 --repo joshuafolkken/kit', note: 'just the next child for one repository' },
72
+ { arguments: '858 --repo joshuafolkken/kit --lanes', note: 'one child per free lane there' },
73
+ ],
74
+ flags: [
75
+ {
76
+ names: [REPO],
77
+ description:
78
+ 'answer for one repository; stdout carries one token (an issue number, or `wait`/`stop`/`complete`), everything else on stderr.',
79
+ },
80
+ {
81
+ names: ['--lanes'],
82
+ description:
83
+ 'print one issue number per free lane (requires `--repo`); `JOSH_LANE_LIMIT` sets the ceiling, default 4. Prints `triage` instead while any candidate carries neither `run:solo` nor `run:lane` (the triage gate in `josh backlog:next`).',
84
+ },
85
+ ],
86
+ },
87
+ 'epic:bundle': { examples: [{ arguments: '874' }] },
88
+ 'epic:audit': { examples: [{ arguments: '858' }] },
89
+ 'epic:check': { examples: [{ arguments: '700' }] },
90
+ 'auto-ok:next': {
91
+ examples: [{ arguments: '' }, { arguments: '--exclude 906', note: JUST_MERGED }],
92
+ flags: [
93
+ {
94
+ names: [EXCLUDE],
95
+ description: 'drop issues from the answer; comma-separated, repeatable.',
96
+ },
97
+ ],
98
+ },
99
+ 'auto-ok:judge': {
100
+ examples: [
101
+ { arguments: '', note: 'the issues that still owe a judgement' },
102
+ { arguments: '--apply 912 --lane', note: 'opt it in, with its run label' },
103
+ { arguments: '--decline 913 --reason "<why>"', note: 'record why it stays out' },
104
+ ],
105
+ flags: [
106
+ {
107
+ names: ['--apply <N> --lane|--solo'],
108
+ description:
109
+ 'checks the exclusions again against the labels as they stand, applies the run label and then `auto-ok`, and notes it on the progress board.',
110
+ },
111
+ { names: ['--decline <N> --reason <text>'], description: 'applies nothing.' },
112
+ ],
113
+ },
114
+ 'backlog:next': {
115
+ examples: [{ arguments: '' }, { arguments: EXCLUDE_1630, note: JUST_MERGED }],
116
+ flags: [
117
+ {
118
+ names: [EXCLUDE],
119
+ description: 'drop issues from every bucket; comma-separated, repeatable.',
120
+ },
121
+ ],
122
+ },
123
+ 'backlog:plan': {
124
+ examples: [
125
+ { arguments: '' },
126
+ { arguments: EXCLUDE_1630, note: 'after #1630 merged' },
127
+ { arguments: '--waves', note: 'the run order, wave by wave' },
128
+ ],
129
+ flags: [
130
+ { names: [EXCLUDE], description: 'same exclusion as `backlog:next`.' },
131
+ {
132
+ names: ['--waves'],
133
+ description:
134
+ 'print the order the run takes, wave by wave, assuming each wave merges before the next. Read-only.',
135
+ },
136
+ ],
137
+ },
138
+ 'backlog:stalled': { examples: [{ arguments: '' }] },
139
+ 'backlog:budget': {
140
+ examples: [
141
+ { arguments: BUDGET },
142
+ { arguments: '--answer exhausted --started "$started" --active "$active" --idle 60' },
143
+ { arguments: `${BUDGET} --merged 3 --running 2 --max 5` },
144
+ ],
145
+ flags: [
146
+ {
147
+ names: ['--answer <candidates|exhausted|blocked|parked|unreadable|untriaged>'],
148
+ description: "`backlog:next`'s answer, mapped.",
149
+ },
150
+ {
151
+ names: ['--started', '--active'],
152
+ description:
153
+ 'when the invocation began / when it last had work (required unless the watch is off).',
154
+ },
155
+ {
156
+ names: ['--idle <minutes>'],
157
+ description:
158
+ 'once nothing can proceed, keep polling this long, counted from `--active` (default 480, 8 hours; `--idle 0` turns the watch off).',
159
+ },
160
+ {
161
+ names: ['--max <count>'],
162
+ description:
163
+ 'issues one invocation may take (default unlimited); `--merged` and `--running` count against it.',
164
+ },
165
+ {
166
+ names: ['--json'],
167
+ description: 'collapse verdict and reason into `{"budget": "<verdict>", "reason": "…"}`.',
168
+ },
169
+ ],
170
+ },
171
+ 'backlog:offer': {
172
+ examples: [{ arguments: '--started "$started" --active "$active" --running 2 --retries 1' }],
173
+ },
174
+ 'backlog:drive': {
175
+ examples: [{ arguments: '--owner "$PPID" [--max <n>] [--idle <minutes>] [--only]' }],
176
+ },
177
+ }
178
+ /* eslint-enable @typescript-eslint/naming-convention */
179
+
180
+ export { BACKLOG_USAGE }
@@ -0,0 +1,230 @@
1
+ import { ports } from '#ports'
2
+ import type { CommandUsage } from './josh-command-types'
3
+
4
+ // The usage of the commands `docs/josh-commands.md` documents, keyed by command name. The page's
5
+ // usage blocks are generated from this table and `josh help <command>` prints it, so an example or a
6
+ // flag is written once, here (#3932).
7
+ // The unseeded ports are read from `ports/index.js`, their one definition (#818).
8
+ const UNSEEDED: Readonly<Record<string, string | undefined>> = {}
9
+ const NARROWED = { arguments: 'scripts/thing.ts', note: 'narrow by the given files instead' }
10
+
11
+ /* eslint-disable @typescript-eslint/naming-convention */
12
+ const DEVELOPER_USAGE: Readonly<Record<string, CommandUsage>> = {
13
+ gate: {
14
+ examples: [
15
+ { arguments: '' },
16
+ { arguments: '--verbose', note: "every check's output, passing ones included" },
17
+ { arguments: '--force', note: 're-run even on a tree already recorded green' },
18
+ { arguments: '--no-unit', note: 'the static checks only (CI only)' },
19
+ ],
20
+ },
21
+ lint: { examples: [{ arguments: '' }] },
22
+ 'lint:related': { examples: [{ arguments: '' }, NARROWED] },
23
+ lines: {
24
+ examples: [{ arguments: 'scripts/hooks/format-edited-file.ts scripts/josh/josh-logic.ts' }],
25
+ },
26
+ bytes: {
27
+ examples: [
28
+ { arguments: 'docs/josh-commands.md', note: 'one document' },
29
+ { arguments: '', note: 'scan: every budgeted document near its ceiling' },
30
+ ],
31
+ },
32
+ metrics: {
33
+ examples: [
34
+ { arguments: '', note: "print the totals and check them against the merge-base's" },
35
+ { arguments: '--accept --reason "<why>"', note: "record this branch's growth and why" },
36
+ ],
37
+ },
38
+ format: { examples: [{ arguments: '' }] },
39
+ 'cspell:dot': { examples: [{ arguments: '', note: 'includes dotfiles' }] },
40
+ behavior: { examples: [{ arguments: '' }] },
41
+ 'exports:unused': { examples: [{ arguments: '' }] },
42
+ 'test:unit': { examples: [{ arguments: '' }] },
43
+ 'test:related': {
44
+ examples: [
45
+ { arguments: '' },
46
+ NARROWED,
47
+ { arguments: '--silent', note: 'flags are forwarded to vitest' },
48
+ ],
49
+ },
50
+ 'test:declared': {
51
+ examples: [
52
+ { arguments: '' },
53
+ { arguments: '--match', note: 'check Step 0 declarations on stdin' },
54
+ { arguments: '--help', note: 'print usage, including the --match stdin form' },
55
+ ],
56
+ },
57
+ 'test:e2e': { examples: [{ arguments: '' }] },
58
+ test: { examples: [{ arguments: '' }] },
59
+ check: { examples: [{ arguments: '' }] },
60
+ port: {
61
+ examples: [
62
+ {
63
+ arguments: 'dev',
64
+ note: `${String(ports.resolve_development_port(UNSEEDED))} with no seed set`,
65
+ },
66
+ {
67
+ arguments: 'preview',
68
+ note: `${String(ports.resolve_preview_port(UNSEEDED))} with no seed set`,
69
+ },
70
+ ],
71
+ },
72
+ profile: { examples: [{ arguments: '' }] },
73
+ init: {
74
+ examples: [
75
+ {
76
+ arguments: '',
77
+ note: 'create/merge config files, install and format (--no-install skips both, --dry-run only prints the plan)',
78
+ },
79
+ ],
80
+ },
81
+ 'registry:migrate': { examples: [{ arguments: '' }] },
82
+ sync: { examples: [{ arguments: '', note: 'overwrite managed files' }] },
83
+ uninstall: {
84
+ examples: [
85
+ { arguments: '', note: 'show the plan, then ask' },
86
+ { arguments: '--yes', note: 'remove without asking' },
87
+ ],
88
+ },
89
+ adopt: {
90
+ examples: [
91
+ { arguments: '' },
92
+ { arguments: '--dry-run', note: 'report the steps without touching anything' },
93
+ ],
94
+ flags: [{ names: ['--dry-run'], description: 'report the plan without writing.' }],
95
+ },
96
+ git: {
97
+ examples: [
98
+ { arguments: '', note: 'interactive' },
99
+ { arguments: '-y', note: 'unattended (no TTY required)' },
100
+ { arguments: '-y "title"', note: 'set commit message prefix' },
101
+ { arguments: '-y "<title> #<N>"', note: 'follow-up commit on the same branch' },
102
+ {
103
+ arguments: '-y --skip-commit --skip-push',
104
+ note: 'open the PR without committing/pushing',
105
+ },
106
+ ],
107
+ flags: [
108
+ {
109
+ names: ['-y', '--yes'],
110
+ description: 'run non-interactively; works without a TTY (agent or CI shell).',
111
+ },
112
+ {
113
+ names: ['--skip-commit', '--skip-push'],
114
+ description: 'recover/open a PR without a new commit or push.',
115
+ },
116
+ ],
117
+ },
118
+ pr: { examples: [{ arguments: '', note: 'open the PR for the current <N>-<slug> branch' }] },
119
+ 'review:findings': { examples: [{ arguments: '' }] },
120
+ 'main:sync': { examples: [{ arguments: '' }] },
121
+ 'main:merge': { examples: [{ arguments: '' }] },
122
+ version: {
123
+ examples: [
124
+ { arguments: '' },
125
+ {
126
+ arguments: '--upgrade',
127
+ note: 'upgrade global + project to latest, then re-run fix-gh-packages',
128
+ },
129
+ ],
130
+ flags: [
131
+ {
132
+ names: ['--upgrade'],
133
+ description:
134
+ 'upgrade both the global install (`pnpm add -g`) and the project devDependency (`pnpm add -D` + `fix-gh-packages`); already-current or not-installed targets are skipped.',
135
+ },
136
+ ],
137
+ },
138
+ ranges: { examples: [{ arguments: '' }] },
139
+ doctor: {
140
+ examples: [
141
+ { arguments: '', note: 'diagnose only' },
142
+ { arguments: '--fix', note: 'reclaim the global josh by removing a stale kit shim' },
143
+ { arguments: '--ports', note: 'also print the per-repository port-seed table' },
144
+ ],
145
+ flags: [
146
+ {
147
+ names: ['--fix'],
148
+ description:
149
+ 'remove a shadowing binary **only if it is a kit shim** (its body references `@joshuafolkken/kit` or the removed `install-bin` script); any other binary is left and reported for manual review. Also the one-shot recovery for an old project that re-created the global shim.',
150
+ },
151
+ { names: ['--ports'], description: 'additionally print the port-seed table (see below).' },
152
+ ],
153
+ },
154
+ audit: { examples: [{ arguments: '' }] },
155
+ overrides: {
156
+ examples: [
157
+ { arguments: '', note: 'verify overrides unchanged' },
158
+ { arguments: '--save', note: 'snapshot current merged overrides' },
159
+ ],
160
+ flags: [
161
+ {
162
+ names: ['--save'],
163
+ description:
164
+ 'write the current merged overrides to `.overrides-snapshot.json` (gitignored); later runs compare against it and exit non-zero on any add, removal, or change.',
165
+ },
166
+ ],
167
+ },
168
+ backlogrun: {
169
+ examples: [
170
+ { arguments: '', note: 'start in Claude, then show the board' },
171
+ { arguments: '3437 --only', note: 'the arguments go to backlogrun as typed' },
172
+ { arguments: '--agent codex', note: 'start in Codex' },
173
+ { arguments: '--stop', note: 'stop the run in this repository' },
174
+ ],
175
+ },
176
+ 'lane:limit': {
177
+ examples: [
178
+ { arguments: '8', note: "raise or lower the live run's limit to 8" },
179
+ { arguments: '', note: 'print the limit, the lanes in use and the free lanes' },
180
+ { arguments: '--reset', note: 'clear the override; JOSH_LANE_LIMIT applies again' },
181
+ ],
182
+ },
183
+ 'lane:withdraw': {
184
+ examples: [{ arguments: '3769 --reason "folded into a broader issue"' }],
185
+ },
186
+ 'test:red': { examples: [{ arguments: '', note: 'red, green, no-test or test-only' }] },
187
+ start: {
188
+ examples: [
189
+ { arguments: '', note: 'asks for the profile and the repository' },
190
+ {
191
+ arguments: '--yes --github --profile basic',
192
+ note: 'unattended, including the GitHub repository',
193
+ },
194
+ ],
195
+ flags: [
196
+ { names: ['--profile basic|full'], description: 'the profile, without asking.' },
197
+ { names: ['--yes'], description: 'take the defaults — not consent to write to GitHub.' },
198
+ { names: ['--github'], description: 'create the GitHub repository and push `main`.' },
199
+ { names: ['--public'], description: 'create the repository public instead of private.' },
200
+ {
201
+ names: ['--init-command "<command>"'],
202
+ description: 'run this setup command in place of `josh init`.',
203
+ },
204
+ {
205
+ names: ['--push-preflight-command "<command>"'],
206
+ description:
207
+ 'a check run before the first step when the plan pushes; a failure stops the run before it writes anything.',
208
+ },
209
+ { names: ['--dry-run'], description: 'print the plan and change nothing.' },
210
+ ],
211
+ },
212
+ latest: { examples: [{ arguments: '', note: 'full update (update + audit + pnpm)' }] },
213
+ 'latest:corepack': { examples: [{ arguments: '', note: 'update pnpm only' }] },
214
+ 'latest:update': { examples: [{ arguments: '', note: 'update dependencies only' }] },
215
+ 'lane:restart': {
216
+ examples: [{ arguments: '3769', note: "prints the fresh child's pid" }],
217
+ },
218
+ 'rule:value': {
219
+ examples: [
220
+ { arguments: '' },
221
+ {
222
+ arguments: '--refresh',
223
+ note: 'write the reading to the loop-head cache instead of stdout',
224
+ },
225
+ ],
226
+ },
227
+ }
228
+ /* eslint-enable @typescript-eslint/naming-convention */
229
+
230
+ export { DEVELOPER_USAGE }
@@ -0,0 +1,38 @@
1
+ import type { CommandUsage } from './josh-command-types'
2
+
3
+ // The usage of the Claude Code and Codex hook commands `docs/josh-commands-automation.md` documents
4
+ // under "Development", keyed by command name. A hook is fed its payload as JSON on stdin, so each
5
+ // example names the event that runs it rather than an argument. The page's usage blocks are generated
6
+ // from this table and `josh help <command>` prints it, so an example is written once, here (#3981).
7
+ const PRE_TOOL_USE = 'run by the PreToolUse hook, the pending tool call as JSON on stdin'
8
+ const IN_PRETOOL_GUARD = 'run inside pretool:guard, not wired on its own'
9
+
10
+ /* eslint-disable @typescript-eslint/naming-convention */
11
+ const HOOK_USAGE: Readonly<Record<string, CommandUsage>> = {
12
+ 'format:edited': {
13
+ examples: [
14
+ { arguments: '', note: 'run by the PostToolUse hook, the tool call as JSON on stdin' },
15
+ ],
16
+ },
17
+ 'batch:guard': { examples: [{ arguments: '', note: IN_PRETOOL_GUARD }] },
18
+ 'investigation:guard': { examples: [{ arguments: '', note: PRE_TOOL_USE }] },
19
+ 'duplicate-read:guard': { examples: [{ arguments: '', note: IN_PRETOOL_GUARD }] },
20
+ 'rule:guard': { examples: [{ arguments: '', note: PRE_TOOL_USE }] },
21
+ 'rule:list': { examples: [{ arguments: '', note: 'print every trigger-delivered rule' }] },
22
+ 'pretool:guard': { examples: [{ arguments: '', note: PRE_TOOL_USE }] },
23
+ 'codex:hook-adapter': {
24
+ examples: [
25
+ { arguments: 'pretool', note: 'a Codex PreToolUse payload on stdin' },
26
+ { arguments: 'posttool', note: 'a Codex PostToolUse payload on stdin' },
27
+ ],
28
+ },
29
+ 'stop:guard': {
30
+ examples: [{ arguments: '', note: 'run by the Stop hook, the stop payload as JSON on stdin' }],
31
+ },
32
+ 'session:lang': {
33
+ examples: [{ arguments: '', note: 'run by the UserPromptSubmit hook; `ja` prints nothing' }],
34
+ },
35
+ }
36
+ /* eslint-enable @typescript-eslint/naming-convention */
37
+
38
+ export { HOOK_USAGE }