pr-shepherd 0.60.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (245) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +7 -5
  3. package/bin/api.d.mts +35 -24
  4. package/bin/api.mjs +68 -48
  5. package/bin/checks/classify.d.mts +1 -1
  6. package/bin/checks/classify.mjs +4 -4
  7. package/bin/checks/log-excerpt.mjs +1 -1
  8. package/bin/cli/arg-flags.mjs +0 -3
  9. package/bin/cli/clean-handler.d.mts +1 -1
  10. package/bin/cli/clean-handler.mjs +5 -15
  11. package/bin/cli/default-poll.d.mts +2 -0
  12. package/bin/cli/default-poll.mjs +9 -6
  13. package/bin/cli/formatters.d.mts +2 -3
  14. package/bin/cli/formatters.mjs +0 -26
  15. package/bin/cli/handlers.d.mts +3 -3
  16. package/bin/cli/handlers.mjs +45 -35
  17. package/bin/cli/help-command-pages.d.mts +13 -158
  18. package/bin/cli/help-command-pages.mjs +12 -157
  19. package/bin/cli/help-iterate-poll-pages.d.mts +4 -3
  20. package/bin/cli/help-iterate-poll-pages.mjs +76 -36
  21. package/bin/cli/help-log-file-page.d.mts +1 -1
  22. package/bin/cli/help-log-file-page.mjs +3 -5
  23. package/bin/cli/help-top-page.d.mts +1 -1
  24. package/bin/cli/help-top-page.mjs +19 -20
  25. package/bin/cli/help.d.mts +14 -159
  26. package/bin/cli/iterate-checks-formatter.mjs +1 -1
  27. package/bin/cli/iterate-flags.d.mts +2 -4
  28. package/bin/cli/iterate-flags.mjs +4 -20
  29. package/bin/cli/iterate-formatter.d.mts +1 -1
  30. package/bin/cli/iterate-formatter.mjs +6 -6
  31. package/bin/cli/iterate-instructions.d.mts +1 -1
  32. package/bin/cli/iterate-instructions.mjs +5 -6
  33. package/bin/cli/iterate-lean.mjs +32 -40
  34. package/bin/cli/iterate-verbose.mjs +1 -1
  35. package/bin/cli/journal-formatter.mjs +0 -3
  36. package/bin/cli/journal-handler.d.mts +1 -1
  37. package/bin/cli/journal-handler.mjs +2 -1
  38. package/bin/cli/mutate-formatter.mjs +0 -9
  39. package/bin/cli/next-check-format.d.mts +0 -4
  40. package/bin/cli/next-check-format.mjs +0 -4
  41. package/bin/cli/poll-handler.d.mts +3 -0
  42. package/bin/cli/poll-handler.mjs +88 -47
  43. package/bin/cli/poll-summary-emitter.mjs +2 -2
  44. package/bin/cli/poll-summary-formatter.mjs +5 -2
  45. package/bin/cli/poll-targets.d.mts +2 -2
  46. package/bin/cli/poll-targets.mjs +15 -35
  47. package/bin/cli/removed-flags.d.mts +3 -0
  48. package/bin/cli/removed-flags.mjs +24 -0
  49. package/bin/cli/rule-auto-resolve-lines.d.mts +3 -0
  50. package/bin/cli/rule-auto-resolve-lines.mjs +12 -0
  51. package/bin/cli/runner.d.mts +1 -1
  52. package/bin/cli/runner.mjs +2 -2
  53. package/bin/cli/stack-layer-view.d.mts +2 -1
  54. package/bin/cli/stack-overview.d.mts +0 -1
  55. package/bin/cli/stack-overview.mjs +4 -2
  56. package/bin/cli/{fix-formatter-extra.d.mts → triage-formatter-extra.d.mts} +1 -2
  57. package/bin/cli/{fix-formatter-extra.mjs → triage-formatter-extra.mjs} +0 -6
  58. package/bin/cli/triage-formatter.d.mts +4 -0
  59. package/bin/cli/{fix-formatter.mjs → triage-formatter.mjs} +31 -42
  60. package/bin/cli/unknown-flags.d.mts +6 -0
  61. package/bin/cli/unknown-flags.mjs +29 -0
  62. package/bin/cli-parser.mjs +41 -62
  63. package/bin/commands/check-activity.d.mts +8 -0
  64. package/bin/commands/check-activity.mjs +26 -0
  65. package/bin/commands/check-annotations.d.mts +1 -1
  66. package/bin/commands/check-annotations.mjs +3 -2
  67. package/bin/commands/check-review-budget.d.mts +1 -1
  68. package/bin/commands/check-review-budget.mjs +1 -1
  69. package/bin/commands/check-wait-detectors.d.mts +1 -1
  70. package/bin/commands/check-wait-detectors.mjs +12 -1
  71. package/bin/commands/check.d.mts +1 -1
  72. package/bin/commands/check.mjs +13 -8
  73. package/bin/commands/commit-suggestion-instruction.d.mts +2 -2
  74. package/bin/commands/commit-suggestion-instruction.mjs +3 -3
  75. package/bin/commands/iterate/api-usage.mjs +8 -8
  76. package/bin/commands/iterate/check-instructions.d.mts +4 -4
  77. package/bin/commands/iterate/check-instructions.mjs +8 -8
  78. package/bin/commands/iterate/classify.mjs +2 -2
  79. package/bin/commands/iterate/escalate.mjs +6 -6
  80. package/bin/commands/iterate/index.mjs +20 -23
  81. package/bin/commands/iterate/merge-plan.mjs +3 -3
  82. package/bin/commands/iterate/merge-state.mjs +4 -7
  83. package/bin/commands/iterate/native-stack-rebase.mjs +1 -1
  84. package/bin/commands/iterate/render.d.mts +1 -1
  85. package/bin/commands/iterate/render.mjs +2 -2
  86. package/bin/commands/iterate/stall.mjs +11 -9
  87. package/bin/commands/iterate/{fix-loop-instruction.mjs → triage-loop-instruction.mjs} +7 -3
  88. package/bin/commands/iterate/{fix-code.d.mts → triage.d.mts} +2 -2
  89. package/bin/commands/iterate/{fix-code.mjs → triage.mjs} +14 -23
  90. package/bin/commands/iterate/unreported-required.mjs +2 -5
  91. package/bin/commands/journal/index.d.mts +1 -3
  92. package/bin/commands/journal/index.mjs +1 -1
  93. package/bin/commands/mark-files-as-viewed.d.mts +1 -3
  94. package/bin/commands/mark-files-as-viewed.mjs +1 -1
  95. package/bin/commands/next-check.d.mts +2 -2
  96. package/bin/commands/next-check.mjs +4 -2
  97. package/bin/commands/poll-progress.mjs +1 -1
  98. package/bin/commands/poll-summary-explicit-instructions.mjs +1 -1
  99. package/bin/commands/poll-summary-instructions.mjs +7 -7
  100. package/bin/commands/poll-summary-signature.d.mts +6 -0
  101. package/bin/commands/poll-summary-signature.mjs +19 -2
  102. package/bin/commands/poll-summary.mjs +11 -4
  103. package/bin/commands/poll.d.mts +1 -1
  104. package/bin/commands/poll.mjs +4 -4
  105. package/bin/commands/ready-delay.d.mts +1 -0
  106. package/bin/commands/ready-delay.mjs +8 -3
  107. package/bin/commands/resolve-mutate.d.mts +1 -1
  108. package/bin/commands/resolve-mutate.mjs +1 -1
  109. package/bin/commands/rest-stack-merge-readiness.mjs +1 -1
  110. package/bin/commands/rule-auto-resolve-format.d.mts +7 -0
  111. package/bin/commands/rule-auto-resolve-format.mjs +11 -4
  112. package/bin/commands/rule-auto-resolve.d.mts +14 -2
  113. package/bin/commands/single-tick.d.mts +5 -0
  114. package/bin/commands/single-tick.mjs +7 -0
  115. package/bin/commands/stack-drain.mjs +1 -1
  116. package/bin/commands/stack-merge-flag.mjs +1 -1
  117. package/bin/commands/stack-stall.d.mts +2 -2
  118. package/bin/commands/stack-stall.mjs +2 -2
  119. package/bin/commands/stack-work.d.mts +2 -2
  120. package/bin/commands/stack-work.mjs +2 -2
  121. package/bin/commands/suggestion-patch-item.d.mts +0 -1
  122. package/bin/commands/suggestion-patch-item.mjs +0 -12
  123. package/bin/commands/suggestion-patches.d.mts +2 -2
  124. package/bin/commands/suggestion-patches.mjs +1 -1
  125. package/bin/commands/tick-instructions.d.mts +9 -0
  126. package/bin/commands/tick-instructions.mjs +23 -0
  127. package/bin/commands/tick.d.mts +15 -0
  128. package/bin/commands/{event-mode.mjs → tick.mjs} +39 -55
  129. package/bin/comments/minimize-policy.mjs +1 -3
  130. package/bin/comments/resolve.d.mts +0 -23
  131. package/bin/comments/resolve.mjs +0 -4
  132. package/bin/comments/review-output-budget.d.mts +1 -1
  133. package/bin/comments/review-output-budget.mjs +1 -1
  134. package/bin/comments/sha-poll.mjs +3 -1
  135. package/bin/comments/thread-visibility.d.mts +6 -0
  136. package/bin/comments/thread-visibility.mjs +30 -15
  137. package/bin/config/default-bot-usernames.d.mts +2 -0
  138. package/bin/config/default-bot-usernames.mjs +15 -0
  139. package/bin/config/load.d.mts +4 -138
  140. package/bin/config/load.mjs +88 -443
  141. package/bin/config/merge-command-args.mjs +2 -2
  142. package/bin/config/merge-method.d.mts +1 -2
  143. package/bin/config/merge-method.mjs +1 -8
  144. package/bin/config/renames.d.mts +8 -0
  145. package/bin/config/renames.mjs +87 -0
  146. package/bin/config/resolve.d.mts +31 -0
  147. package/bin/config/resolve.mjs +89 -0
  148. package/bin/config/schema.d.mts +161 -0
  149. package/bin/config/schema.mjs +168 -0
  150. package/bin/exit-codes.d.mts +1 -1
  151. package/bin/exit-codes.mjs +3 -3
  152. package/bin/github/batch-parse-suites.d.mts +14 -0
  153. package/bin/github/batch-parse-suites.mjs +4 -1
  154. package/bin/github/batch-parser-helpers.mjs +3 -0
  155. package/bin/github/check-annotation-cache.d.mts +5 -0
  156. package/bin/github/check-annotation-cache.mjs +6 -3
  157. package/bin/github/fingerprint.mjs +4 -0
  158. package/bin/github/poll-summary-annotation-probe.d.mts +5 -0
  159. package/bin/github/poll-summary-annotation-probe.mjs +17 -3
  160. package/bin/github/poll-summary-annotations.d.mts +14 -0
  161. package/bin/github/poll-summary-annotations.mjs +75 -0
  162. package/bin/github/poll-summary-blocking-reviewer.d.mts +2 -0
  163. package/bin/github/poll-summary-blocking-reviewer.mjs +9 -0
  164. package/bin/github/poll-summary-check-blockers.mjs +1 -1
  165. package/bin/github/poll-summary-checks.d.mts +1 -0
  166. package/bin/github/poll-summary-checks.mjs +20 -2
  167. package/bin/github/poll-summary-command.mjs +8 -6
  168. package/bin/github/poll-summary-fingerprint.d.mts +7 -0
  169. package/bin/github/poll-summary-fingerprint.mjs +7 -0
  170. package/bin/github/poll-summary-projector.d.mts +3 -1
  171. package/bin/github/poll-summary-projector.mjs +14 -25
  172. package/bin/github/poll-summary-queue-removal.d.mts +2 -0
  173. package/bin/github/poll-summary-queue-removal.mjs +11 -0
  174. package/bin/github/poll-summary-readiness.mjs +1 -0
  175. package/bin/github/poll-summary-review-parity.d.mts +24 -0
  176. package/bin/github/poll-summary-review-parity.mjs +82 -0
  177. package/bin/github/poll-summary-review.d.mts +11 -2
  178. package/bin/github/poll-summary-review.mjs +88 -60
  179. package/bin/github/poll-summary-route.mjs +9 -9
  180. package/bin/github/poll-summary-row-error.d.mts +16 -0
  181. package/bin/github/poll-summary-row-error.mjs +74 -0
  182. package/bin/github/poll-summary-rule-auto-resolve.d.mts +32 -0
  183. package/bin/github/poll-summary-rule-auto-resolve.mjs +119 -0
  184. package/bin/github/poll-summary-rule-handoff.d.mts +7 -0
  185. package/bin/github/poll-summary-rule-handoff.mjs +20 -0
  186. package/bin/github/poll-summary-rule-items.d.mts +20 -0
  187. package/bin/github/poll-summary-rule-items.mjs +28 -0
  188. package/bin/github/poll-summary-unreported.mjs +1 -1
  189. package/bin/github/poll-summary.mjs +16 -8
  190. package/bin/github/queries.d.mts +1 -1
  191. package/bin/github/queries.mjs +1 -1
  192. package/bin/github/rest-reader-core.mjs +13 -2
  193. package/bin/github/rest-summary-read.mjs +12 -1
  194. package/bin/mcp/server.mjs +48 -54
  195. package/bin/merge-status/derive.mjs +1 -1
  196. package/bin/state/durable-state.d.mts +1 -3
  197. package/bin/state/durable-state.mjs +2 -8
  198. package/bin/state/fix-attempts.d.mts +2 -2
  199. package/bin/state/fix-attempts.mjs +1 -1
  200. package/bin/state/merge-request.mjs +1 -1
  201. package/bin/state/pr-fingerprint.mjs +4 -11
  202. package/bin/state/seen-comments.d.mts +4 -5
  203. package/bin/state/seen-comments.mjs +8 -14
  204. package/bin/state/stack-stall.d.mts +1 -1
  205. package/bin/state/stack-stall.mjs +1 -1
  206. package/bin/state/stall-state-store.d.mts +1 -1
  207. package/bin/state/stall-state-store.mjs +1 -1
  208. package/bin/types/escalate.d.mts +2 -2
  209. package/bin/types/github.d.mts +2 -0
  210. package/bin/types/iterate.d.mts +12 -26
  211. package/bin/types/merge-queue.d.mts +2 -2
  212. package/bin/types/next-check.d.mts +1 -1
  213. package/bin/types/poll-summary.d.mts +26 -6
  214. package/bin/types/report.d.mts +2 -2
  215. package/bin/types/suggestion-patch.d.mts +1 -8
  216. package/package.json +3 -2
  217. package/plugins/pr-shepherd/.claude-plugin/plugin.json +1 -1
  218. package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
  219. package/plugins/pr-shepherd/.codex.mcp.json +1 -1
  220. package/plugins/pr-shepherd/.mcp.json +1 -1
  221. package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +6 -6
  222. package/plugins/pr-shepherd/skills/pr-shepherd/references/ci-failure-triage.md +1 -1
  223. package/plugins/pr-shepherd/skills/pr-shepherd/references/{cloud-event-loop.md → event-loop.md} +5 -5
  224. package/plugins/pr-shepherd/skills/pr-shepherd/references/mcp-fallback.md +3 -3
  225. package/plugins/pr-shepherd/skills/pr-shepherd/references/merge-queue-ejection.md +1 -1
  226. package/plugins/pr-shepherd/skills/pr-shepherd/references/suggestion-patches.md +1 -1
  227. package/plugins/pr-shepherd/skills/pr-shepherd/references/{fix-code-loop.md → triage-loop.md} +3 -3
  228. package/plugins/pr-shepherd/skills/reduce-pr-noise/SKILL.md +1 -1
  229. package/plugins/pr-shepherd/skills/reduce-pr-noise/references/classifiers.md +2 -2
  230. package/plugins/pr-shepherd/skills/reduce-pr-noise/references/settings.md +11 -11
  231. package/pr-shepherd.schema.json +361 -0
  232. package/bin/cli/event-state-scope.d.mts +0 -19
  233. package/bin/cli/event-state-scope.mjs +0 -60
  234. package/bin/cli/fix-formatter.d.mts +0 -4
  235. package/bin/commands/commit-suggestion.d.mts +0 -8
  236. package/bin/commands/commit-suggestion.mjs +0 -26
  237. package/bin/commands/event-instructions.d.mts +0 -11
  238. package/bin/commands/event-instructions.mjs +0 -27
  239. package/bin/commands/event-mode.d.mts +0 -14
  240. package/bin/commands/poll-mode.d.mts +0 -8
  241. package/bin/commands/poll-mode.mjs +0 -14
  242. package/bin/config.json +0 -68
  243. package/bin/types/protected-run.d.mts +0 -6
  244. package/bin/types/protected-run.mjs +0 -1
  245. /package/bin/commands/iterate/{fix-loop-instruction.d.mts → triage-loop-instruction.d.mts} +0 -0
@@ -1,19 +1,19 @@
1
1
  export const ITERATE_USAGE = `pr-shepherd iterate
2
2
 
3
- Run one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.
4
- The output contains one action and an action-specific ## Instructions section.
3
+ Run one tick and return without sleeping. The no-subcommand form polls; use this subcommand when the
4
+ caller owns the next wake-up. One PR prints one action and an action-specific ## Instructions section.
5
+ Several same-repository PRs print one aggregate summary. Unless nothing remains to wait for, the output
6
+ carries nextCheck: when to rerun if no GitHub event arrives first.
5
7
 
6
8
  Usage:
7
- pr-shepherd iterate [PR] [iterate-flags]
9
+ pr-shepherd iterate [PR ...] [iterate-flags]
8
10
 
9
11
  Iterate flags:
10
- --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.
12
+ --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.
11
13
  --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
12
14
  --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.
13
- --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
14
15
  --merge Shepherd through readiness, then emit a merge or merge-queue command.
15
- --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
16
- --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).
16
+ --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
17
17
  --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).
18
18
  --format text|json Output Markdown text or JSON. Default: text.
19
19
  --verbose Include verbose iterate fields.
@@ -25,7 +25,7 @@ Actions:
25
25
  WAIT No immediate action; continue with the next poll.
26
26
  MARK_READY Draft PR was marked ready; continue with the next poll.
27
27
  READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.
28
- FIX_CODE Agent action is required; follow the instructions, then continue polling.
28
+ TRIAGE Agent action is required; follow the instructions, then continue polling.
29
29
  CANCEL Stop polling this pull request: merged/closed, ready-delay elapsed, or a clean draft left in draft because auto mark-ready is disabled. Continue remaining work from the original request.
30
30
  ESCALATE Stop polling until a human provides direction.
31
31
  MERGE Run the emitted merge/queue command, then continue monitoring.
@@ -34,42 +34,42 @@ Exit codes:
34
34
  0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)
35
35
  10 WAIT or READY
36
36
  11 MARK_READY
37
- 12 FIX_CODE
37
+ 12 TRIAGE
38
38
  13 ESCALATE
39
39
  14 CANCEL (closed without merging)
40
40
  15 MERGE
41
41
  A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).`;
42
- export const POLL_USAGE = `pr-shepherd poll
42
+ /** Public help page for the default PR polling invocation. */
43
+ export const DEFAULT_USAGE = `pr-shepherd [PR]
43
44
 
44
- Run iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native
45
- GitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.
45
+ Run iterate repeatedly for one PR, or read compact summaries for an explicit same-repository PR set.
46
+ Aggregate mode returns when any row needs work, every row is terminal, or timeout.
47
+ When CLAUDE_CODE_REMOTE=true, the command runs one tick like iterate and prints nextCheck instead.
46
48
  Poll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout
47
- returns the last WAIT result. FIX_CODE starts a --debounce settle window (default:
48
- poll.debounceSeconds; built-in 1m): poll keeps
49
+ returns the last WAIT result. TRIAGE starts a --debounce settle window (default:
50
+ poll.debounce-seconds; built-in 1m): poll keeps
49
51
  iterating at --interval, then runs one more tick after the window and returns that result.
50
52
  With --until-terminal or --merge, poll also continues through MARK_READY.
51
53
 
52
54
  Usage:
53
- pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]
54
- pr-shepherd poll --stack PR [poll-flags] [iterate-flags]
55
+ pr-shepherd [PR ...] [poll-flags] [iterate-flags]
56
+
57
+ Use 'pr-shepherd stack PR' for a native GitHub stack.
55
58
 
56
59
  Poll flags:
57
- --stack PR Select all entries in PR's native GitHub stack, bottom to top.
58
- --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.
59
- --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).
60
- --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.
61
- --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.
62
- --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.
63
- --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.
60
+ --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.
61
+ --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).
62
+ --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.
63
+ --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.
64
+ --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.
65
+ --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.
64
66
 
65
67
  Forwarded iterate flags:
66
- --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.
68
+ --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.
67
69
  --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
68
70
  --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.
69
- --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
70
71
  --merge Shepherd through readiness, then emit a merge or merge-queue command.
71
- --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
72
- --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).
72
+ --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
73
73
  --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).
74
74
  --format text|json Output Markdown text or JSON. Default: text.
75
75
  --verbose Include verbose iterate fields and detailed per-tick lines.
@@ -78,21 +78,61 @@ Forwarded iterate flags:
78
78
  Durations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds
79
79
  for --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with
80
80
  an explicit unit (4.5m).
81
- Each WAIT tick writes a stderr line naming what it is waiting on by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.
82
- FIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.
83
- With --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, FIX_CODE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.
81
+ Each WAIT tick writes a stderr line naming what it is waiting on by default; poll.quiet-status can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.
82
+ TRIAGE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.
83
+ With --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, TRIAGE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.
84
84
 
85
85
  Exit codes: same as iterate (the final tick's action/reason decides the code).
86
86
  0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)
87
87
  10 WAIT or READY (including a WAIT returned by --timeout)
88
88
  11 MARK_READY
89
- 12 FIX_CODE
89
+ 12 TRIAGE
90
90
  13 ESCALATE
91
91
  14 CANCEL (closed without merging)
92
92
  15 MERGE
93
- 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)
94
93
  A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).`;
95
- /** Public help page for the default PR polling invocation. */
96
- export const DEFAULT_USAGE = POLL_USAGE.replace(/^pr-shepherd poll$/m, "pr-shepherd [PR]")
97
- .replace(/^ {2}pr-shepherd poll \[PR \.\.\.\]/m, " pr-shepherd [PR ...]")
98
- .replace(/^ {2}pr-shepherd poll --stack/m, " pr-shepherd --stack");
94
+ /** Public help page for `pr-shepherd stack`. */
95
+ export const STACK_USAGE = `pr-shepherd stack
96
+
97
+ Shepherd every open PR in one PR's native GitHub stack, bottom to top. Each poll reads compact
98
+ per-layer summaries and returns when a layer needs work, every layer is terminal, or timeout.
99
+ SHEPHERD lists one-PR sessions to run before rerunning this command.
100
+ --once, or CLAUDE_CODE_REMOTE=true, runs one aggregate tick and prints nextCheck instead of sleeping.
101
+
102
+ Usage:
103
+ pr-shepherd stack PR [--once] [poll-flags] [iterate-flags]
104
+
105
+ Stack flags:
106
+ --once Run one aggregate tick without sleeping; poll flags are ignored.
107
+
108
+ Poll flags:
109
+ --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s) multiplied by poll.stack-interval-factor (built-in 2) unless this flag is set.
110
+ --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).
111
+ --debounce <duration> Settle window after the first SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.
112
+ --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.
113
+ --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.
114
+ --until-terminal Continue through WAIT until SHEPHERD, MERGE, CANCEL, or ESCALATE.
115
+
116
+ Forwarded iterate flags:
117
+ --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.
118
+ --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
119
+ --no-auto-mark-ready Do not convert draft PRs to ready for review.
120
+ --merge Shepherd through readiness, then emit the stack merge commands.
121
+ --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
122
+ --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).
123
+ --format text|json Output Markdown text or JSON. Default: text.
124
+ --verbose Include detailed per-tick lines.
125
+ --help, -h Print this help and exit before GitHub, git, config, or log I/O.
126
+
127
+ Durations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds
128
+ for --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with
129
+ an explicit unit (4.5m).
130
+
131
+ Exit codes:
132
+ 0 CANCEL (every layer merged)
133
+ 10 WAIT
134
+ 13 ESCALATE
135
+ 14 CANCEL (a layer closed without merging)
136
+ 15 MERGE
137
+ 16 SHEPHERD (run the listed one-PR sessions, then rerun this stack command)
138
+ A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).`;
@@ -1 +1 @@
1
- export declare const LOG_FILE_USAGE = "pr-shepherd log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd log-file [--format text|json] [--poll-mode auto|poll|event]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --poll-mode auto|poll|event\n Report the log for that poll mode; event mode keeps it in durable\n state under the git common directory. Default: poll.mode (auto).\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
1
+ export declare const LOG_FILE_USAGE = "pr-shepherd admin log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd admin log-file [--format text|json]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n CLAUDE_CODE_REMOTE=true reports the durable log under the git common directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
@@ -1,20 +1,18 @@
1
- export const LOG_FILE_USAGE = `pr-shepherd log-file
1
+ export const LOG_FILE_USAGE = `pr-shepherd admin log-file
2
2
 
3
3
  Print the per-worktree append-only debug log path for the current repository.
4
4
  The log is created by the first non-help pr-shepherd command that initializes logging.
5
5
 
6
6
  Usage:
7
- pr-shepherd log-file [--format text|json] [--poll-mode auto|poll|event]
7
+ pr-shepherd admin log-file [--format text|json]
8
8
 
9
9
  Flags:
10
10
  --format text|json Print a raw path or {"path": "..."} JSON. Default: text.
11
- --poll-mode auto|poll|event
12
- Report the log for that poll mode; event mode keeps it in durable
13
- state under the git common directory. Default: poll.mode (auto).
14
11
  --help, -h Print this help and exit before logging setup.
15
12
 
16
13
  Environment:
17
14
  PR_SHEPHERD_LOG_DISABLED=1 disables logging.
18
15
  PR_SHEPHERD_STATE_DIR overrides the base state directory.
16
+ CLAUDE_CODE_REMOTE=true reports the durable log under the git common directory.
19
17
 
20
18
  Exit code: 0 on success; 1 if repository identity cannot be resolved.`;
@@ -1 +1 @@
1
- export declare const TOP_USAGE = "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n\nPolling flags:\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
1
+ export declare const TOP_USAGE = "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd stack PR [--once] [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR ...] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd suggest [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR or an explicit same-repository set.\n stack Poll every open PR in one PR's native GitHub stack.\n iterate Run one tick for one PR or a same-repository set, and print nextCheck.\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n suggest Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n\nPolling flags (looping commands; in a Claude Code cloud session, CLAUDE_CODE_REMOTE=true, they run one tick like iterate):\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (stack only: run the listed one-PR sessions, then rerun the stack command)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
@@ -6,8 +6,8 @@ Usage:
6
6
  pr-shepherd --version | -v
7
7
  pr-shepherd --help | -h
8
8
  pr-shepherd [PR ...] [poll-flags] [iterate-flags]
9
- pr-shepherd --stack PR [poll-flags] [iterate-flags]
10
- pr-shepherd iterate [PR] [iterate-flags]
9
+ pr-shepherd stack PR [--once] [poll-flags] [iterate-flags]
10
+ pr-shepherd iterate [PR ...] [iterate-flags]
11
11
  pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest
12
12
  pr-shepherd apply review [PR] [review-flags]
13
13
  pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
@@ -15,13 +15,14 @@ Usage:
15
15
  pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)
16
16
  pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>
17
17
  pr-shepherd journal extract --body-file <path>
18
- pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]
18
+ pr-shepherd suggest [PR] --thread-id ID --message MSG [groups...]
19
19
  pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
20
20
  pr-shepherd admin log-file [--format text|json]
21
21
 
22
22
  Commands:
23
- [PR ...] Poll one PR, an explicit same-repository set, or a native stack.
24
- iterate Run one iterate tick (single-tick alias).
23
+ [PR ...] Poll one PR or an explicit same-repository set.
24
+ stack Poll every open PR in one PR's native GitHub stack.
25
+ iterate Run one tick for one PR or a same-repository set, and print nextCheck.
25
26
  apply merge Submit or resume a guarded asynchronous merge or enqueue request.
26
27
  apply review Apply review-state mutations after fixes.
27
28
  apply files Mark selected changed files as viewed.
@@ -29,15 +30,14 @@ Commands:
29
30
  apply check-blocker Record that a failing check is blocked on an external PR or issue.
30
31
  apply queue-removal Acknowledge one current CI-driven native-stack queue removal.
31
32
  journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.
32
- build-suggestion-patches
33
- Convert ordered GitHub suggestion threads into patches and commit instructions.
33
+ suggest Convert ordered GitHub suggestion threads into patches and commit instructions.
34
34
  playbook Print a playbook named by an instruction pointer.
35
35
  admin clean Remove pr-shepherd state files.
36
36
  admin log-file Print the per-worktree debug log path.
37
37
 
38
38
  PR argument:
39
39
  PR may be a number, owner/repo#number, or a GitHub pull request URL.
40
- Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.
40
+ Multiple PRs must name one repository.
41
41
  When omitted, pr-shepherd infers the current branch's pull request.
42
42
 
43
43
  Common flags:
@@ -47,20 +47,19 @@ Common flags:
47
47
  --help, -h Print help and exit before any GitHub, git, config, or log I/O.
48
48
 
49
49
  Iterate flags:
50
- --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.
50
+ --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.
51
51
  --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
52
52
  --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.
53
- --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
54
53
  --merge Shepherd through readiness, then emit a merge or merge-queue command.
55
- --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
54
+ --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
56
55
 
57
- Polling flags:
58
- --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.
59
- --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).
60
- --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.
61
- --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.
62
- --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.
63
- --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.
56
+ Polling flags (looping commands; in a Claude Code cloud session, CLAUDE_CODE_REMOTE=true, they run one tick like iterate):
57
+ --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.
58
+ --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).
59
+ --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.
60
+ --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.
61
+ --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.
62
+ --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.
64
63
 
65
64
  Clean variants:
66
65
  pr [number] Remove state for one PR. Defaults to current branch PR.
@@ -73,11 +72,11 @@ Exit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).
73
72
  0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)
74
73
  10 WAIT or READY
75
74
  11 MARK_READY
76
- 12 FIX_CODE
75
+ 12 TRIAGE
77
76
  13 ESCALATE
78
77
  14 CANCEL (closed without merging)
79
78
  15 MERGE
80
- 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)
79
+ 16 SHEPHERD (stack only: run the listed one-PR sessions, then rerun the stack command)
81
80
  See docs/exit-codes.md for the full sysexits.h error-code table.
82
81
 
83
82
  Duration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).
@@ -1,5 +1,5 @@
1
1
  export declare const USAGE: {
2
- readonly default: string;
2
+ readonly default: "pr-shepherd [PR]\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit same-repository PR set.\nAggregate mode returns when any row needs work, every row is terminal, or timeout.\nWhen CLAUDE_CODE_REMOTE=true, the command runs one tick like iterate and prints nextCheck instead.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. TRIAGE starts a --debounce settle window (default:\npoll.debounce-seconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n\nUse 'pr-shepherd stack PR' for a native GitHub stack.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quiet-status can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nTRIAGE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, TRIAGE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
3
3
  readonly "apply merge": `pr-shepherd apply merge
4
4
 
5
5
  Submit one SHA-guarded asynchronous merge or enqueue request with REST.
@@ -118,13 +118,13 @@ Usage:
118
118
  --removed-at <unix> Removal time in Unix seconds.
119
119
  --format text|json Output format. Default: text.
120
120
  --help, -h Print this help and exit before any I/O.`;
121
- readonly "build-suggestion-patches": `pr-shepherd build-suggestion-patches
121
+ readonly suggest: `pr-shepherd suggest
122
122
 
123
123
  Build an ordered list of patches and commit instructions from GitHub review suggestions.
124
124
  The command does not edit files or mutate git history.
125
125
 
126
126
  Usage:
127
- pr-shepherd build-suggestion-patches [PR]
127
+ pr-shepherd suggest [PR]
128
128
  --thread-id ID --message MSG [--description DESC]
129
129
  [--thread-id ID --message MSG [--description DESC] ...]
130
130
  [--format text|json]
@@ -134,22 +134,6 @@ belong to that suggestion. Groups are validated and returned in command-line ord
134
134
 
135
135
  The current branch must match the PR head ref. Local HEAD may equal or descend from the PR head;
136
136
  every generated patch is dry-run in order with git apply --check before output.
137
- --help, -h Print this help and exit before GitHub, git, config, or log I/O.`;
138
- readonly "build-suggestion-patch": `pr-shepherd build-suggestion-patch
139
-
140
- Deprecated one-suggestion adapter. Use build-suggestion-patches.
141
-
142
- Usage:
143
- pr-shepherd build-suggestion-patch [PR] --thread-id ID --message MSG
144
- [--description DESC] [--format text|json]
145
-
146
- Flags:
147
- --thread-id <id> Review thread containing exactly one suggestion block. Required.
148
- --message <text> Suggested commit subject. Required and non-empty.
149
- --description <text> Optional longer commit body.
150
- --format text|json Output format. Default: text.
151
-
152
- The current branch must match the PR head ref. Local HEAD may equal or descend from the PR head.
153
137
  --help, -h Print this help and exit before GitHub, git, config, or log I/O.`;
154
138
  readonly admin: `pr-shepherd admin
155
139
 
@@ -166,147 +150,19 @@ Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
166
150
  Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
167
151
 
168
152
  Usage:
169
- pr-shepherd admin clean pr [number] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
170
- pr-shepherd admin clean branch [name] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
171
- pr-shepherd admin clean current [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
172
- pr-shepherd admin clean repo [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
173
- pr-shepherd admin clean all [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
153
+ pr-shepherd admin clean pr [number] [--dry-run] [--format text|json]
154
+ pr-shepherd admin clean branch [name] [--dry-run] [--format text|json]
155
+ pr-shepherd admin clean current [--dry-run] [--format text|json]
156
+ pr-shepherd admin clean repo [--dry-run] [--format text|json]
157
+ pr-shepherd admin clean all [--dry-run] [--format text|json]
174
158
 
175
159
  Variants remove state for one PR, branch, current branch, repository, or all repositories.
176
160
  Use --dry-run to preview paths without removing them.
177
- --poll-mode auto|poll|event Clean the state for that poll mode; event mode keeps it in durable
178
- state under the git common directory. Default: poll.mode (auto).
161
+ When CLAUDE_CODE_REMOTE=true, state is the durable copy under the git common directory.
179
162
  --help, -h Print this help and exit before any cleanup.`;
180
- readonly "admin log-file": string;
181
- readonly resolve: `pr-shepherd resolve
182
-
183
- Deprecated compatibility alias for user-directed GitHub review-state mutations. Supplied IDs are forwarded to GitHub;
184
- GitHub accepts or rejects each mutation.
185
-
186
- Usage:
187
- pr-shepherd resolve [PR] --reply-thread-ids A,B --message MSG
188
- pr-shepherd resolve [PR] --resolve-thread-ids A,B [--minimize-comment-ids X,Y]
189
- [--dismiss-review-ids Q] [--message MSG]
190
- [--require-sha SHA] [--format text|json]
191
-
192
- Flags:
193
- --resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
194
- Note: comment IDs (PRRC_*) from gh api are not thread IDs and will fail.
195
- --reply-thread-ids <ids> Comma-separated review thread IDs to reply to.
196
- --minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
197
- --dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
198
- --message <text> Reply/dismiss message. Required with --reply-thread-ids
199
- or --dismiss-review-ids.
200
- --require-sha <sha> Wait until GitHub reports this PR head SHA (or HEAD) before mutating.
201
- Must be a full 40-character lowercase hex SHA, or HEAD for this
202
- checkout's commit. Local HEAD is valid only when it equals the
203
- current remote PR head.
204
- --format text|json Output format. Default: text.
205
- --help, -h Print this help and exit before GitHub I/O.
206
-
207
- At least one non-empty action flag is required:
208
- --reply-thread-ids, --resolve-thread-ids, --minimize-comment-ids, or --dismiss-review-ids.
209
-
210
- PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
211
- Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
212
- readonly "commit-suggestion": `pr-shepherd commit-suggestion
213
-
214
- Build a patch and commit instructions for one GitHub review thread containing a suggestion block.
215
- The command does not edit files or mutate git history.
216
-
217
- Usage:
218
- pr-shepherd commit-suggestion [PR] --thread-id ID --message MSG
219
- [--description DESC] [--format text|json]
220
-
221
- Flags:
222
- --thread-id <id> Review thread ID containing exactly one suggestion to apply. Required.
223
- --message <text> Suggested commit subject. Required and must be non-empty.
224
- --description <text> Optional longer commit body.
225
- --format text|json Output format. Default: text.
226
- --help, -h Print this help and exit before GitHub, git, config, or log I/O.
227
-
228
- Preconditions:
229
- The current branch must match the PR head ref. Local HEAD may equal or descend from the PR head.
230
-
231
- Exit codes:
232
- 0 suggestion patch and instructions produced
233
- 64 usage error (missing/invalid flag)
234
- 69 precondition unmet (thread ineligible, branch/SHA mismatch, no open PR)
235
- See docs/exit-codes.md for the full sysexits.h table.`;
236
- readonly "mark-files-as-viewed": `pr-shepherd mark-files-as-viewed
237
-
238
- Deprecated compatibility alias for marking selected PR files as viewed.
239
-
240
- Usage:
241
- pr-shepherd mark-files-as-viewed [PR] [files...] [--tests] [--match REGEX]
242
- [--format text|json]
243
-
244
- Selectors:
245
- files... Exact changed-file paths from the PR diff.
246
- --tests Select changed test files.
247
- --match <regex> Select changed files whose paths match a case-insensitive JavaScript regex.
248
- May be repeated.
249
-
250
- Flags:
251
- --format text|json Output format. Default: text.
252
- --help, -h Print this help and exit before GitHub I/O.
253
-
254
- PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
255
- Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
256
- readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed, ready-delay elapsed, or a clean draft left in draft because auto mark-ready is disabled. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
257
- readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, FIX_CODE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
258
- readonly clean: `pr-shepherd clean
259
-
260
- Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
261
-
262
- Usage:
263
- pr-shepherd clean pr [number] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
264
- pr-shepherd clean branch [name] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
265
- pr-shepherd clean current [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
266
- pr-shepherd clean repo [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
267
- pr-shepherd clean all [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
268
-
269
- Variants:
270
- pr [number] Remove state for one PR. Defaults to current branch PR.
271
- branch [name] Resolve a branch to its open PR, then remove that PR's state.
272
- Defaults to current branch.
273
- current Alias for branch against the current branch.
274
- repo Remove all state for the current repository, including worktree logs.
275
- all Remove all pr-shepherd state.
276
-
277
- Flags:
278
- --dry-run Preview paths without removing them.
279
- --format text|json Output format. Default: text.
280
- --poll-mode auto|poll|event
281
- Clean the state for that poll mode; event mode keeps it in durable
282
- state under the git common directory. Default: poll.mode (auto).
283
- --help, -h Print this help and exit before any cleanup.
284
-
285
- Exit code: 0 on success (including a no-op --dry-run on a nonexistent target); nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
286
- readonly journal: `pr-shepherd journal
287
-
288
- Append a list item to the Shepherd Journal details block of a PR body.
289
- Creates the section at the end if absent. Idempotent — duplicate items are skipped.
290
-
291
- Usage:
292
- pr-shepherd journal [PR] <item> [--dry-run] [--format text|json]
293
- pr-shepherd journal [PR] --file <path> [--dry-run] [--format text|json]
294
- pr-shepherd journal [PR] --file - [--dry-run] [--format text|json]
295
-
296
- PR PR number or GitHub pull request URL. Defaults to current branch PR.
297
- item Markdown list item: must start with "- " followed by non-whitespace text.
298
- Example: '- Rejected suggestion: kept existing pattern for consistency.'
299
- Provide it as a positional argument, or via --file to avoid shell-escaping
300
- backticks and multi-line Markdown. Exactly one of the two is required.
301
-
302
- Flags:
303
- --file <path> Read the entry from a file instead of a positional argument.
304
- Pass --file - to read from stdin.
305
- --dry-run Preview the new PR body without writing it to GitHub.
306
- --format text|json Output format. Default: text.
307
- --help, -h Print this help and exit before any GitHub I/O.
308
-
309
- Exit code: 0 on success (including no-change no-op); nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
163
+ readonly "admin log-file": "pr-shepherd admin log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd admin log-file [--format text|json]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n CLAUDE_CODE_REMOTE=true reports the durable log under the git common directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
164
+ readonly iterate: "pr-shepherd iterate\n\nRun one tick and return without sleeping. The no-subcommand form polls; use this subcommand when the\ncaller owns the next wake-up. One PR prints one action and an action-specific ## Instructions section.\nSeveral same-repository PRs print one aggregate summary. Unless nothing remains to wait for, the output\ncarries nextCheck: when to rerun if no GitHub event arrives first.\n\nUsage:\n pr-shepherd iterate [PR ...] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n TRIAGE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed, ready-delay elapsed, or a clean draft left in draft because auto mark-ready is disabled. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
165
+ readonly stack: "pr-shepherd stack\n\nShepherd every open PR in one PR's native GitHub stack, bottom to top. Each poll reads compact\nper-layer summaries and returns when a layer needs work, every layer is terminal, or timeout.\nSHEPHERD lists one-PR sessions to run before rerunning this command.\n--once, or CLAUDE_CODE_REMOTE=true, runs one aggregate tick and prints nextCheck instead of sleeping.\n\nUsage:\n pr-shepherd stack PR [--once] [poll-flags] [iterate-flags]\n\nStack flags:\n --once Run one aggregate tick without sleeping; poll flags are ignored.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s) multiplied by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).\n --debounce <duration> Settle window after the first SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT until SHEPHERD, MERGE, CANCEL, or ESCALATE.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --merge Shepherd through readiness, then emit the stack merge commands.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\n\nExit codes:\n 0 CANCEL (every layer merged)\n 10 WAIT\n 13 ESCALATE\n 14 CANCEL (a layer closed without merging)\n 15 MERGE\n 16 SHEPHERD (run the listed one-PR sessions, then rerun this stack command)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
310
166
  readonly "journal extract": `pr-shepherd journal extract
311
167
 
312
168
  Extract one visible, structurally valid Shepherd Journal from a local PR-body file.
@@ -332,11 +188,10 @@ Usage:
332
188
  Flags:
333
189
  --format text|json Markdown text (default) or one JSON line: {"name","content"} or {"playbooks":[...]}.
334
190
 
335
- The name is case-insensitive; spaces and hyphens are equivalent ("Fix-code loop" and fix-code-loop match).
191
+ The name is case-insensitive; spaces and hyphens are equivalent ("Triage loop" and triage-loop match).
336
192
  Unknown names exit 64 and list the available playbooks.
337
193
  --help, -h Print this help and exit before any I/O.`;
338
- readonly "log-file": "pr-shepherd log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd log-file [--format text|json] [--poll-mode auto|poll|event]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --poll-mode auto|poll|event\n Report the log for that poll mode; event mode keeps it in durable\n state under the git common directory. Default: poll.mode (auto).\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
339
- readonly top: "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n\nPolling flags:\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
194
+ readonly top: "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd stack PR [--once] [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR ...] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd suggest [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR or an explicit same-repository set.\n stack Poll every open PR in one PR's native GitHub stack.\n iterate Run one tick for one PR or a same-repository set, and print nextCheck.\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n suggest Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n\nPolling flags (looping commands; in a Claude Code cloud session, CLAUDE_CODE_REMOTE=true, they run one tick like iterate):\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (stack only: run the listed one-PR sessions, then rerun the stack command)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
340
195
  };
341
196
  /** Resolve help keys for nested public commands before any command I/O. */
342
197
  export declare function helpKeyForArgs(args: string[]): keyof typeof USAGE;
@@ -1,5 +1,5 @@
1
1
  import { renderRelatedJobLines } from "./related-jobs-format.mjs";
2
- import { renderCheckAnnotation } from "./fix-formatter-extra.mjs";
2
+ import { renderCheckAnnotation } from "./triage-formatter-extra.mjs";
3
3
  export function formatRelevantChecks(checks) {
4
4
  if (checks.length === 0)
5
5
  return null;