pr-shepherd 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +28 -22
  3. package/bin/api.d.mts +10 -2
  4. package/bin/api.mjs +30 -6
  5. package/bin/checks/pending-deployments.d.mts +10 -0
  6. package/bin/checks/pending-deployments.mjs +66 -0
  7. package/bin/checks/run-workflow-paths.d.mts +7 -0
  8. package/bin/checks/run-workflow-paths.mjs +19 -0
  9. package/bin/checks/triage.mjs +3 -2
  10. package/bin/checks/unreported-required.d.mts +11 -1
  11. package/bin/checks/unreported-required.mjs +8 -3
  12. package/bin/checks/workflow-concurrency.d.mts +9 -0
  13. package/bin/checks/workflow-concurrency.mjs +84 -0
  14. package/bin/checks/workflow-path.d.mts +2 -0
  15. package/bin/checks/workflow-path.mjs +4 -0
  16. package/bin/cli/arg-flags.mjs +3 -0
  17. package/bin/cli/clean-handler.mjs +1 -1
  18. package/bin/cli/default-poll.mjs +1 -0
  19. package/bin/cli/handlers.mjs +2 -0
  20. package/bin/cli/help-command-pages.d.mts +5 -4
  21. package/bin/cli/help-command-pages.mjs +2 -1
  22. package/bin/cli/help-iterate-poll-pages.d.mts +3 -3
  23. package/bin/cli/help-iterate-poll-pages.mjs +10 -2
  24. package/bin/cli/help-top-page.d.mts +1 -1
  25. package/bin/cli/help-top-page.mjs +2 -2
  26. package/bin/cli/help.d.mts +6 -5
  27. package/bin/cli/in-progress-run-format.d.mts +3 -0
  28. package/bin/cli/in-progress-run-format.mjs +14 -0
  29. package/bin/cli/iterate-activity-formatter.d.mts +2 -0
  30. package/bin/cli/iterate-activity-formatter.mjs +11 -0
  31. package/bin/cli/iterate-flags.d.mts +3 -0
  32. package/bin/cli/iterate-flags.mjs +18 -1
  33. package/bin/cli/iterate-formatter.mjs +2 -1
  34. package/bin/cli/iterate-lean.mjs +2 -0
  35. package/bin/cli/pending-deployments-format.d.mts +5 -0
  36. package/bin/cli/pending-deployments-format.mjs +19 -0
  37. package/bin/cli/poll-handler.d.mts +1 -1
  38. package/bin/cli/poll-handler.mjs +33 -10
  39. package/bin/cli/poll-targets.mjs +2 -0
  40. package/bin/cli/stack-merge-args.d.mts +10 -0
  41. package/bin/cli/stack-merge-args.mjs +27 -0
  42. package/bin/cli/stack-overview.d.mts +1 -0
  43. package/bin/cli/stack-overview.mjs +5 -1
  44. package/bin/cli/stalled-check-format.d.mts +3 -0
  45. package/bin/cli/stalled-check-format.mjs +23 -0
  46. package/bin/cli/suggestion-renderer.mjs +6 -0
  47. package/bin/cli/triage-formatter.mjs +14 -0
  48. package/bin/commands/check.mjs +7 -2
  49. package/bin/commands/clean.d.mts +1 -1
  50. package/bin/commands/clean.mjs +7 -0
  51. package/bin/commands/iterate/check-follow-up.d.mts +9 -0
  52. package/bin/commands/iterate/check-follow-up.mjs +34 -0
  53. package/bin/commands/iterate/ci-start-stall.d.mts +23 -0
  54. package/bin/commands/iterate/ci-start-stall.mjs +33 -0
  55. package/bin/commands/iterate/duration-approx.d.mts +2 -0
  56. package/bin/commands/iterate/duration-approx.mjs +8 -0
  57. package/bin/commands/iterate/escalate.d.mts +8 -17
  58. package/bin/commands/iterate/escalate.mjs +19 -48
  59. package/bin/commands/iterate/helpers.mjs +1 -0
  60. package/bin/commands/iterate/in-progress-runs.d.mts +10 -0
  61. package/bin/commands/iterate/in-progress-runs.mjs +120 -0
  62. package/bin/commands/iterate/index.mjs +12 -6
  63. package/bin/commands/iterate/merge-plan.d.mts +2 -0
  64. package/bin/commands/iterate/merge-plan.mjs +2 -1
  65. package/bin/commands/iterate/merge-state.d.mts +2 -0
  66. package/bin/commands/iterate/merge-state.mjs +8 -21
  67. package/bin/commands/iterate/native-stack-rebase.d.mts +3 -2
  68. package/bin/commands/iterate/native-stack-rebase.mjs +32 -11
  69. package/bin/commands/iterate/queue-removal.d.mts +19 -0
  70. package/bin/commands/iterate/queue-removal.mjs +64 -0
  71. package/bin/commands/iterate/render.d.mts +2 -1
  72. package/bin/commands/iterate/render.mjs +4 -1
  73. package/bin/commands/iterate/stack-boundary.d.mts +17 -0
  74. package/bin/commands/iterate/stack-boundary.mjs +95 -0
  75. package/bin/commands/iterate/stall-repair.d.mts +17 -0
  76. package/bin/commands/iterate/stall-repair.mjs +25 -0
  77. package/bin/commands/iterate/stall.d.mts +1 -1
  78. package/bin/commands/iterate/stall.mjs +27 -18
  79. package/bin/commands/iterate/state-unavailable.d.mts +8 -0
  80. package/bin/commands/iterate/state-unavailable.mjs +23 -0
  81. package/bin/commands/iterate/triage-loop-instruction.mjs +1 -1
  82. package/bin/commands/iterate/triage.mjs +41 -74
  83. package/bin/commands/iterate/unreported-required.d.mts +5 -2
  84. package/bin/commands/iterate/unreported-required.mjs +13 -8
  85. package/bin/commands/iterate/workflow-files.d.mts +27 -0
  86. package/bin/commands/iterate/workflow-files.mjs +85 -0
  87. package/bin/commands/poll-summary-explicit-instructions.mjs +15 -1
  88. package/bin/commands/poll-summary-instructions.d.mts +4 -3
  89. package/bin/commands/poll-summary-instructions.mjs +60 -22
  90. package/bin/commands/poll-summary.mjs +38 -10
  91. package/bin/commands/poll.mjs +4 -2
  92. package/bin/commands/stack-drain.d.mts +4 -4
  93. package/bin/commands/stack-drain.mjs +19 -113
  94. package/bin/commands/stack-handoffs.d.mts +3 -3
  95. package/bin/commands/stack-handoffs.mjs +8 -8
  96. package/bin/commands/stack-lower-ready-note.d.mts +6 -0
  97. package/bin/commands/stack-lower-ready-note.mjs +35 -0
  98. package/bin/commands/stack-merge-escalations.d.mts +17 -0
  99. package/bin/commands/stack-merge-escalations.mjs +57 -0
  100. package/bin/commands/stack-merge-plan.d.mts +10 -0
  101. package/bin/commands/stack-merge-plan.mjs +132 -0
  102. package/bin/commands/stack-merge-scope.d.mts +42 -0
  103. package/bin/commands/stack-merge-scope.mjs +113 -0
  104. package/bin/commands/stack-ownership.d.mts +25 -0
  105. package/bin/commands/stack-ownership.mjs +85 -0
  106. package/bin/commands/stack-stall.d.mts +2 -0
  107. package/bin/commands/stack-stall.mjs +25 -3
  108. package/bin/commands/stack-targets-error.d.mts +16 -0
  109. package/bin/commands/stack-targets-error.mjs +44 -0
  110. package/bin/commands/stack-targets.d.mts +30 -0
  111. package/bin/commands/stack-targets.mjs +121 -0
  112. package/bin/commands/stack-work.d.mts +4 -3
  113. package/bin/commands/stack-work.mjs +7 -4
  114. package/bin/commands/tick.mjs +14 -2
  115. package/bin/config/renames.mjs +1 -1
  116. package/bin/config/schema.d.mts +4 -0
  117. package/bin/config/schema.mjs +2 -0
  118. package/bin/github/batch-parse-suites.d.mts +4 -1
  119. package/bin/github/batch-parse-suites.mjs +15 -3
  120. package/bin/github/batch-raw-types.d.mts +6 -0
  121. package/bin/github/gql/commit-check-suites.gql +6 -0
  122. package/bin/github/gql/poll-summary-fragment.gql +6 -0
  123. package/bin/github/poll-summary-command.d.mts +15 -1
  124. package/bin/github/poll-summary-command.mjs +39 -3
  125. package/bin/github/poll-summary-projector.d.mts +1 -1
  126. package/bin/github/poll-summary-projector.mjs +1 -4
  127. package/bin/github/poll-summary-raw.d.mts +6 -0
  128. package/bin/github/poll-summary-route.mjs +4 -1
  129. package/bin/github/poll-summary.mjs +10 -3
  130. package/bin/github/rest-batch-read.mjs +17 -6
  131. package/bin/github/rest-batch-snapshot.d.mts +2 -2
  132. package/bin/github/rest-batch-snapshot.mjs +3 -0
  133. package/bin/github/rest-check-read.d.mts +1 -18
  134. package/bin/github/rest-check-read.mjs +1 -2
  135. package/bin/github/rest-stack-read.d.mts +9 -0
  136. package/bin/github/rest-stack-read.mjs +40 -0
  137. package/bin/github/rest-suite-types.d.mts +23 -0
  138. package/bin/github/rest-suite-types.mjs +1 -0
  139. package/bin/github/rest-summary-read.mjs +2 -0
  140. package/bin/mcp/server.mjs +29 -3
  141. package/bin/pr-reference.d.mts +2 -0
  142. package/bin/pr-reference.mjs +1 -1
  143. package/bin/reporters/agent.mjs +3 -0
  144. package/bin/state/check-follow-up.d.mts +30 -0
  145. package/bin/state/check-follow-up.mjs +51 -0
  146. package/bin/state/ci-start-follow-up.d.mts +14 -0
  147. package/bin/state/ci-start-follow-up.mjs +21 -0
  148. package/bin/state/queue-removal-follow-up.d.mts +20 -0
  149. package/bin/state/queue-removal-follow-up.mjs +23 -0
  150. package/bin/state/signature-marker.d.mts +10 -0
  151. package/bin/state/signature-marker.mjs +28 -0
  152. package/bin/state/stack-merge-approval.d.mts +26 -0
  153. package/bin/state/stack-merge-approval.mjs +39 -0
  154. package/bin/state/stall-repair.d.mts +16 -0
  155. package/bin/state/stall-repair.mjs +47 -0
  156. package/bin/types/activity.d.mts +2 -1
  157. package/bin/types/escalate.d.mts +9 -2
  158. package/bin/types/github.d.mts +18 -0
  159. package/bin/types/in-progress-run.d.mts +20 -0
  160. package/bin/types/in-progress-run.mjs +1 -0
  161. package/bin/types/iterate.d.mts +22 -1
  162. package/bin/types/poll-summary.d.mts +18 -1
  163. package/bin/types/report.d.mts +5 -1
  164. package/bin/types.d.mts +1 -0
  165. package/bin/types.mjs +1 -0
  166. package/package.json +2 -2
  167. package/plugins/pr-shepherd/.claude-plugin/plugin.json +1 -1
  168. package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
  169. package/plugins/pr-shepherd/.codex.mcp.json +1 -1
  170. package/plugins/pr-shepherd/.mcp.json +1 -1
  171. package/plugins/pr-shepherd/package-lock.json +4 -4
  172. package/plugins/pr-shepherd/package.json +1 -1
  173. package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +8 -7
  174. package/plugins/pr-shepherd/skills/pr-shepherd/references/check-follow-up.md +14 -0
  175. package/plugins/pr-shepherd/skills/pr-shepherd/references/ci-failure-triage.md +6 -5
  176. package/plugins/pr-shepherd/skills/pr-shepherd/references/ci-start-stall.md +15 -0
  177. package/plugins/pr-shepherd/skills/pr-shepherd/references/create-a-pr.md +4 -1
  178. package/plugins/pr-shepherd/skills/pr-shepherd/references/mcp-fallback.md +1 -1
  179. package/plugins/pr-shepherd/skills/pr-shepherd/references/merge-queue-ejection.md +6 -5
  180. package/plugins/pr-shepherd/skills/pr-shepherd/references/required-checks-unreported.md +16 -0
  181. package/pr-shepherd.schema.json +11 -0
@@ -1,5 +1,5 @@
1
1
  export declare const COMMAND_USAGE: {
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, for foreground waits).\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 For background runs that wake the caller on exit; foreground waits use the bounded default.\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).";
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, for foreground waits).\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 For background runs that wake the caller on exit; foreground waits use the bounded default.\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 --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\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.
@@ -140,7 +140,7 @@ every generated patch is dry-run in order with git apply --check before output.
140
140
  Administrative state and diagnostics commands.
141
141
 
142
142
  Usage:
143
- pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
143
+ pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]
144
144
  pr-shepherd admin log-file [--format text|json]
145
145
 
146
146
  Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
@@ -151,6 +151,7 @@ Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
151
151
 
152
152
  Usage:
153
153
  pr-shepherd admin clean pr [number] [--dry-run] [--format text|json]
154
+ pr-shepherd admin clean stack <number> [--dry-run] [--format text|json]
154
155
  pr-shepherd admin clean branch [name] [--dry-run] [--format text|json]
155
156
  pr-shepherd admin clean current [--dry-run] [--format text|json]
156
157
  pr-shepherd admin clean repo [--dry-run] [--format text|json]
@@ -161,8 +162,8 @@ Use --dry-run to preview paths without removing them.
161
162
  When CLAUDE_CODE_REMOTE=true, state is the durable copy under the git common directory.
162
163
  --help, -h Print this help and exit before any cleanup.`;
163
164
  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, for foreground waits).\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).";
165
+ 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 --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\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).";
166
+ 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 [PR ...] [--once] [poll-flags] [iterate-flags]\n\nThe PRs you list are the layers you own (one PR owns only itself); a stack number (owner/repo#N) owns every\nlayer. A merge that would also land unlisted layers escalates instead. A bare number is a PR first, then a\nstack number. Refs that span several stacks fail with one command per stack.\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, for foreground waits).\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 one merge that lands every owned layer.\n --merge-ready Merge the highest contiguous ready, owned prefix as layers become ready.\n --merge-through <PR> Merge up to and including this PR of the stack; layers above stay open.\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).";
166
167
  readonly "journal extract": `pr-shepherd journal extract
167
168
 
168
169
  Extract one visible, structurally valid Shepherd Journal from a local PR-body file.
@@ -143,7 +143,7 @@ every generated patch is dry-run in order with git apply --check before output.
143
143
  Administrative state and diagnostics commands.
144
144
 
145
145
  Usage:
146
- pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
146
+ pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]
147
147
  pr-shepherd admin log-file [--format text|json]
148
148
 
149
149
  Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
@@ -154,6 +154,7 @@ Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
154
154
 
155
155
  Usage:
156
156
  pr-shepherd admin clean pr [number] [--dry-run] [--format text|json]
157
+ pr-shepherd admin clean stack <number> [--dry-run] [--format text|json]
157
158
  pr-shepherd admin clean branch [name] [--dry-run] [--format text|json]
158
159
  pr-shepherd admin clean current [--dry-run] [--format text|json]
159
160
  pr-shepherd admin clean repo [--dry-run] [--format text|json]
@@ -1,5 +1,5 @@
1
- export declare const ITERATE_USAGE = "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).";
1
+ export declare const ITERATE_USAGE = "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 --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\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).";
2
2
  /** Public help page for the default PR polling invocation. */
3
- export declare const DEFAULT_USAGE = "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, for foreground waits).\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 For background runs that wake the caller on exit; foreground waits use the bounded default.\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
+ export declare const DEFAULT_USAGE = "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, for foreground waits).\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 For background runs that wake the caller on exit; foreground waits use the bounded default.\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 --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\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).";
4
4
  /** Public help page for `pr-shepherd stack`. */
5
- export declare const STACK_USAGE = "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, for foreground waits).\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).";
5
+ export declare const STACK_USAGE = "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 [PR ...] [--once] [poll-flags] [iterate-flags]\n\nThe PRs you list are the layers you own (one PR owns only itself); a stack number (owner/repo#N) owns every\nlayer. A merge that would also land unlisted layers escalates instead. A bare number is a PR first, then a\nstack number. Refs that span several stacks fail with one command per stack.\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, for foreground waits).\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 one merge that lands every owned layer.\n --merge-ready Merge the highest contiguous ready, owned prefix as layers become ready.\n --merge-through <PR> Merge up to and including this PR of the stack; layers above stay open.\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).";
@@ -14,6 +14,7 @@ Iterate flags:
14
14
  --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.
15
15
  --merge Shepherd through readiness, then emit a merge or merge-queue command.
16
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
+ --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.
17
18
  --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).
18
19
  --format text|json Output Markdown text or JSON. Default: text.
19
20
  --verbose Include verbose iterate fields.
@@ -71,6 +72,7 @@ Forwarded iterate flags:
71
72
  --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.
72
73
  --merge Shepherd through readiness, then emit a merge or merge-queue command.
73
74
  --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
75
+ --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.
74
76
  --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).
75
77
  --format text|json Output Markdown text or JSON. Default: text.
76
78
  --verbose Include verbose iterate fields and detailed per-tick lines.
@@ -101,7 +103,11 @@ SHEPHERD lists one-PR sessions to run before rerunning this command.
101
103
  --once, or CLAUDE_CODE_REMOTE=true, runs one aggregate tick and prints nextCheck instead of sleeping.
102
104
 
103
105
  Usage:
104
- pr-shepherd stack PR [--once] [poll-flags] [iterate-flags]
106
+ pr-shepherd stack PR [PR ...] [--once] [poll-flags] [iterate-flags]
107
+
108
+ The PRs you list are the layers you own (one PR owns only itself); a stack number (owner/repo#N) owns every
109
+ layer. A merge that would also land unlisted layers escalates instead. A bare number is a PR first, then a
110
+ stack number. Refs that span several stacks fail with one command per stack.
105
111
 
106
112
  Stack flags:
107
113
  --once Run one aggregate tick without sleeping; poll flags are ignored.
@@ -118,7 +124,9 @@ Forwarded iterate flags:
118
124
  --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.
119
125
  --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
120
126
  --no-auto-mark-ready Do not convert draft PRs to ready for review.
121
- --merge Shepherd through readiness, then emit the stack merge commands.
127
+ --merge Shepherd through readiness, then emit one merge that lands every owned layer.
128
+ --merge-ready Merge the highest contiguous ready, owned prefix as layers become ready.
129
+ --merge-through <PR> Merge up to and including this PR of the stack; layers above stay open.
122
130
  --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
123
131
  --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).
124
132
  --format text|json Output Markdown text or JSON. Default: text.
@@ -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 [--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.";
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 [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|stack|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,7 +6,7 @@ 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 [--once] [poll-flags] [iterate-flags]
9
+ pr-shepherd stack PR [PR ...] [--once] [poll-flags] [iterate-flags]
10
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]
@@ -16,7 +16,7 @@ Usage:
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
18
  pr-shepherd suggest [PR] --thread-id ID --message MSG [groups...]
19
- pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
19
+ pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]
20
20
  pr-shepherd admin log-file [--format text|json]
21
21
 
22
22
  Commands:
@@ -1,5 +1,5 @@
1
1
  export declare const USAGE: {
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, for foreground waits).\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 For background runs that wake the caller on exit; foreground waits use the bounded default.\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).";
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, for foreground waits).\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 For background runs that wake the caller on exit; foreground waits use the bounded default.\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 --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\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.
@@ -140,7 +140,7 @@ every generated patch is dry-run in order with git apply --check before output.
140
140
  Administrative state and diagnostics commands.
141
141
 
142
142
  Usage:
143
- pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
143
+ pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]
144
144
  pr-shepherd admin log-file [--format text|json]
145
145
 
146
146
  Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
@@ -151,6 +151,7 @@ Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
151
151
 
152
152
  Usage:
153
153
  pr-shepherd admin clean pr [number] [--dry-run] [--format text|json]
154
+ pr-shepherd admin clean stack <number> [--dry-run] [--format text|json]
154
155
  pr-shepherd admin clean branch [name] [--dry-run] [--format text|json]
155
156
  pr-shepherd admin clean current [--dry-run] [--format text|json]
156
157
  pr-shepherd admin clean repo [--dry-run] [--format text|json]
@@ -161,8 +162,8 @@ Use --dry-run to preview paths without removing them.
161
162
  When CLAUDE_CODE_REMOTE=true, state is the durable copy under the git common directory.
162
163
  --help, -h Print this help and exit before any cleanup.`;
163
164
  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, for foreground waits).\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).";
165
+ 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 --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\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).";
166
+ 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 [PR ...] [--once] [poll-flags] [iterate-flags]\n\nThe PRs you list are the layers you own (one PR owns only itself); a stack number (owner/repo#N) owns every\nlayer. A merge that would also land unlisted layers escalates instead. A bare number is a PR first, then a\nstack number. Refs that span several stacks fail with one command per stack.\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, for foreground waits).\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 one merge that lands every owned layer.\n --merge-ready Merge the highest contiguous ready, owned prefix as layers become ready.\n --merge-through <PR> Merge up to and including this PR of the stack; layers above stay open.\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).";
166
167
  readonly "journal extract": `pr-shepherd journal extract
167
168
 
168
169
  Extract one visible, structurally valid Shepherd Journal from a local PR-body file.
@@ -191,7 +192,7 @@ Flags:
191
192
  The name is case-insensitive; spaces and hyphens are equivalent ("Triage loop" and triage-loop match).
192
193
  Unknown names exit 64 and list the available playbooks.
193
194
  --help, -h Print this help and exit before any I/O.`;
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.";
195
+ 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 [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|stack|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.";
195
196
  };
196
197
  /** Resolve help keys for nested public commands before any command I/O. */
197
198
  export declare function helpKeyForArgs(args: string[]): keyof typeof USAGE;
@@ -0,0 +1,3 @@
1
+ import type { InProgressRun } from "../types.mts";
2
+ /** One `## In-progress runs` bullet: the run, its raw `concurrency`, and the cancel command if any. */
3
+ export declare function renderInProgressRun(run: InProgressRun): string;
@@ -0,0 +1,14 @@
1
+ /** One `## In-progress runs` bullet: the run, its raw `concurrency`, and the cancel command if any. */
2
+ export function renderInProgressRun(run) {
3
+ const siblings = run.failed && run.running
4
+ ? ` failed: ${run.failed.join(", ")} · running: ${run.running.join(", ")}`
5
+ : "";
6
+ const protectedTag = run.neverCancel ? ` [never-cancel: ${run.neverCancel}]` : "";
7
+ const lines = [
8
+ `- \`${run.runId}\` — \`${run.workflowName}\` [status: ${run.status}]${protectedTag}${siblings}`,
9
+ ` concurrency: ${run.concurrency}`,
10
+ ];
11
+ if (run.cancelCommand)
12
+ lines.push(` cancel: \`${run.cancelCommand}\``);
13
+ return lines.join("\n");
14
+ }
@@ -1,2 +1,4 @@
1
1
  import type { IterateResult } from "../types.mts";
2
+ /** Environment approvals blocking active (waiting) checks, one line per environment. */
3
+ export declare function formatPendingDeploymentLines(result: IterateResult): string[];
2
4
  export declare function formatActivityLine(result: IterateResult, verbose?: boolean): string | null;
@@ -1,4 +1,15 @@
1
1
  import { formatNameList } from "./iterate-check-names.mjs";
2
+ import { formatPendingDeployment } from "./pending-deployments-format.mjs";
3
+ /** Environment approvals blocking active (waiting) checks, one line per environment. */
4
+ export function formatPendingDeploymentLines(result) {
5
+ // A stall escalation lists the stalled checks with their pending deployments under its items.
6
+ if (result.action === "escalate" && (result.escalate.stalledChecks?.length ?? 0) > 0)
7
+ return [];
8
+ return (result.inProgressChecks ?? []).flatMap((check) => (check.pendingDeployments ?? []).map((deployment) => {
9
+ const run = check.runId ? ` (run \`${check.runId}\`)` : "";
10
+ return `**pending deployment** \`${check.name}\`${run} — ${formatPendingDeployment(deployment)}`;
11
+ }));
12
+ }
2
13
  export function formatActivityLine(result, verbose = false) {
3
14
  const activity = result.activity ?? {
4
15
  commitCount: 0,
@@ -1,5 +1,6 @@
1
1
  import type { loadConfig } from "../config/load.mts";
2
2
  import { type InstructionStyle } from "../config/resolve.mts";
3
+ import type { StackLayerOwnership } from "../types.mts";
3
4
  interface IterateFlags {
4
5
  readyDelaySuffix: string | undefined | null;
5
6
  readyDelaySeconds: number;
@@ -9,6 +10,8 @@ interface IterateFlags {
9
10
  merge: boolean;
10
11
  /** `null` when `--instructions` was invalid (an error was already printed). */
11
12
  instructions: InstructionStyle | null | undefined;
13
+ /** `null` when `--layers` was invalid (an error was already printed). */
14
+ stackLayers: StackLayerOwnership[] | null | undefined;
12
15
  }
13
16
  /** True when any flag failed validation; the usage error is already printed. */
14
17
  export declare function hasInvalidIterateFlags(flags: IterateFlags): boolean;
@@ -1,4 +1,5 @@
1
1
  import { INSTRUCTION_STYLES, isInstructionStyle, } from "../config/resolve.mjs";
2
+ import { parseStackLayers } from "../commands/iterate/stack-boundary.mjs";
2
3
  import { EXIT } from "../exit-codes.mjs";
3
4
  import { getFlag, hasFlag } from "./args.mjs";
4
5
  import { parseDurationToSeconds } from "./duration.mjs";
@@ -10,7 +11,8 @@ const MINUTE_FLAG_OPTS = { defaultUnit: "m", allowZero: true };
10
11
  export function hasInvalidIterateFlags(flags) {
11
12
  return (flags.readyDelaySuffix === null ||
12
13
  flags.stallTimeoutSuffix === null ||
13
- flags.instructions === null);
14
+ flags.instructions === null ||
15
+ flags.stackLayers === null);
14
16
  }
15
17
  export function parseIterateFlags(extra, cfg) {
16
18
  const readyDelayStr = getFlag(extra, "--ready-delay");
@@ -22,8 +24,10 @@ export function parseIterateFlags(extra, cfg) {
22
24
  const stallTimeoutSuffix = validateSecondsDurationFlag("pr-shepherd", "--stall-timeout", stallTimeoutStr, hasFlag(extra, "--stall-timeout"), MINUTE_FLAG_OPTS);
23
25
  const stallTimeoutSeconds = parseDurationToSeconds(stallTimeoutSuffix ?? "", cfg.iterate["stall-timeout-minutes"] * 60, MINUTE_FLAG_OPTS);
24
26
  const instructions = parseInstructionsFlag(extra);
27
+ const stackLayers = parseStackLayersFlag(extra);
25
28
  return {
26
29
  instructions,
30
+ stackLayers,
27
31
  readyDelaySuffix,
28
32
  readyDelaySeconds,
29
33
  stallTimeoutSuffix,
@@ -46,3 +50,16 @@ function parseInstructionsFlag(extra) {
46
50
  function hasInstructionsFlag(extra) {
47
51
  return extra.some((arg) => arg === "--instructions" || arg.startsWith("--instructions="));
48
52
  }
53
+ /** Validate `--layers`. Returns `undefined` when absent, `null` after printing a usage error. */
54
+ function parseStackLayersFlag(extra) {
55
+ const value = getFlag(extra, "--layers");
56
+ if (!extra.some((arg) => arg === "--layers" || arg.startsWith("--layers="))) {
57
+ return undefined;
58
+ }
59
+ const layers = value === null ? null : parseStackLayers(value);
60
+ if (layers)
61
+ return layers;
62
+ process.stderr.write(`pr-shepherd: --layers must be comma-separated pr:position:o|u:branch entries (branch percent-encoded), got ${JSON.stringify(value ?? "")}\n`);
63
+ process.exitCode = EXIT.USAGE;
64
+ return null;
65
+ }
@@ -7,7 +7,7 @@ import { adaptIterateLog, buildSimpleIterateInstructions, numberInstructions, }
7
7
  import { formatMergeRequirementLines } from "../merge-status/requirements-format.mjs";
8
8
  import { appendMergeQueueHeader, formatDeferredWorkLine, formatMergeAction, } from "./iterate-merge-formatter.mjs";
9
9
  import { formatApiUsage, formatQuotaWarning } from "./api-usage-formatter.mjs";
10
- import { formatActivityLine } from "./iterate-activity-formatter.mjs";
10
+ import { formatActivityLine, formatPendingDeploymentLines } from "./iterate-activity-formatter.mjs";
11
11
  import { formatSuppressedNameLines } from "./iterate-check-names.mjs";
12
12
  import { branchStateSegment } from "./iterate-branch-segment.mjs";
13
13
  import { insertRuleAutoResolveSection } from "../commands/rule-auto-resolve-format.mjs";
@@ -125,6 +125,7 @@ export function formatIterateResult(result, opts) {
125
125
  const activityLine = formatActivityLine(result, verbose);
126
126
  if (activityLine)
127
127
  headerLines.push(activityLine);
128
+ headerLines.push(...formatPendingDeploymentLines(result));
128
129
  headerLines.push(...formatNextCheckLines(result.nextCheck));
129
130
  const header = headerLines.join("\n");
130
131
  const quotaWarning = formatQuotaWarning(result.quotaWarning);
@@ -175,6 +175,8 @@ export function projectIterateLean(result, opts) {
175
175
  queueRemovalAcknowledgment: result.triage.queueRemovalAcknowledgment,
176
176
  }),
177
177
  ...(result.triage.checks.length > 0 && { checks: result.triage.checks }),
178
+ ...(result.triage.stalledChecks && { stalledChecks: result.triage.stalledChecks }),
179
+ ...(result.triage.inProgressRuns && { inProgressRuns: result.triage.inProgressRuns }),
178
180
  ...(result.triage.changesRequestedReviews.length > 0 && {
179
181
  changesRequestedReviews: result.triage.changesRequestedReviews,
180
182
  }),
@@ -0,0 +1,5 @@
1
+ import type { PendingDeployment } from "../types.mts";
2
+ /** One environment approval, as raw fields: name, required reviewers, viewer capability, timer. */
3
+ export declare function formatPendingDeployment(deployment: PendingDeployment): string;
4
+ /** Shared text rendering of environment approvals under a check bullet. */
5
+ export declare function renderPendingDeploymentLines(deployments: PendingDeployment[] | undefined, indent?: string): string[];
@@ -0,0 +1,19 @@
1
+ function renderReviewer(reviewer) {
2
+ return reviewer.type === "Team" ? `team \`${reviewer.name}\`` : `\`@${reviewer.name}\``;
3
+ }
4
+ /** One environment approval, as raw fields: name, required reviewers, viewer capability, timer. */
5
+ export function formatPendingDeployment(deployment) {
6
+ const parts = [`environment \`${deployment.environment}\``];
7
+ if (deployment.reviewers) {
8
+ parts.push(`required reviewers ${deployment.reviewers.map(renderReviewer).join(", ")}`);
9
+ }
10
+ parts.push(`viewer can approve: ${deployment.currentUserCanApprove ? "yes" : "no"}`);
11
+ if (deployment.waitTimerMinutes !== undefined) {
12
+ parts.push(`wait timer ${deployment.waitTimerMinutes} min`);
13
+ }
14
+ return parts.join(", ");
15
+ }
16
+ /** Shared text rendering of environment approvals under a check bullet. */
17
+ export function renderPendingDeploymentLines(deployments, indent = " ") {
18
+ return (deployments ?? []).map((d) => `${indent}pending deployment: ${formatPendingDeployment(d)}`);
19
+ }
@@ -1,4 +1,4 @@
1
1
  /** The default command: one PR, or several PRs from one repository. */
2
2
  export declare function handlePoll(args: string[]): Promise<void>;
3
- /** `pr-shepherd stack <PR>`: the native stack containing one PR. */
3
+ /** `pr-shepherd stack <ref> [<ref> ...]`: the native stack that a stack number or PRs select. */
4
4
  export declare function handleStack(args: string[]): Promise<void>;
@@ -8,6 +8,8 @@ import { emitIterateResult } from "./iterate-emitter.mjs";
8
8
  import { EXIT } from "../exit-codes.mjs";
9
9
  import { emitPollSummaryResult } from "./poll-summary-emitter.mjs";
10
10
  import { parsePollTargets, resolvePollTargets } from "./poll-targets.mjs";
11
+ import { parseStackMerge } from "./stack-merge-args.mjs";
12
+ import { resolveStackTarget, stackMergeScope } from "../commands/stack-targets.mjs";
11
13
  import { DEFAULT_POLL_BOOLEAN_FLAGS, DEFAULT_POLL_FLAGS_WITH_VALUES } from "./default-poll.mjs";
12
14
  import { validateDefaultArgs } from "./validate-default-args.mjs";
13
15
  import { rejectRemovedFlags } from "./removed-flags.mjs";
@@ -39,33 +41,53 @@ export async function handlePoll(args) {
39
41
  readyDelaySuffix: shared.readyDelaySuffix,
40
42
  });
41
43
  }
42
- /** `pr-shepherd stack <PR>`: the native stack containing one PR. */
44
+ /** `pr-shepherd stack <ref> [<ref> ...]`: the native stack that a stack number or PRs select. */
43
45
  export async function handleStack(args) {
44
46
  if (maybePrintHelp(args, "stack"))
45
47
  return;
46
48
  if (rejectRemovedFlags(args) || rejectUnknownFlags(args, "stack", STACK_FLAGS))
47
49
  return;
48
- if (!validateDefaultArgs(args, DEFAULT_POLL_FLAGS_WITH_VALUES, STACK_BOOLEAN_FLAGS, usageArg))
50
+ if (!validateDefaultArgs(args, STACK_FLAGS_WITH_VALUES, STACK_BOOLEAN_FLAGS, usageArg))
49
51
  return;
50
52
  const parsedTargets = parsePollTargets(args);
51
53
  if (!parsedTargets)
52
54
  return;
53
- if (parsedTargets.refs.length !== 1) {
54
- usage("stack requires exactly one PR reference.");
55
+ if (parsedTargets.refs.length === 0) {
56
+ usage("stack requires a PR or stack reference.");
55
57
  return;
56
58
  }
57
- const { prNumbers, targetRepository } = await resolvePollTargets(parsedTargets);
59
+ const merge = parseStackMerge(parsedTargets.extra);
60
+ if (!merge)
61
+ return;
58
62
  const shared = parseLoopOptions(parsedTargets.extra, parsedTargets.global, true);
59
63
  if (!shared)
60
64
  return;
61
- const target = { stackPrNumber: prNumbers[0], targetRepository };
65
+ const target = await resolveStackTarget({
66
+ refs: parsedTargets.refs,
67
+ ...(merge.through && { through: merge.through }),
68
+ ...(merge.flag && { merge: merge.flag }),
69
+ });
70
+ const scope = stackMergeScope(merge.flag, target.through);
71
+ const options = {
72
+ ...shared.options,
73
+ merge: scope !== undefined,
74
+ ...(scope && { stackMerge: scope }),
75
+ stackPrNumber: target.anchor,
76
+ ...(target.owned && { stackOwned: target.owned }),
77
+ targetRepository: target.targetRepository,
78
+ };
62
79
  const result = hasFlag(parsedTargets.extra, "--once")
63
- ? await runPollSummaryTick({ ...shared.options, ...target })
64
- : await runAggregatePollCommand({ ...shared.options, ...target });
80
+ ? await runPollSummaryTick(options)
81
+ : await runAggregatePollCommand(options);
65
82
  emitPollSummaryResult(result, { format: parsedTargets.global.format });
66
83
  }
67
- const STACK_BOOLEAN_FLAGS = new Set([...DEFAULT_POLL_BOOLEAN_FLAGS, "--once"]);
68
- const STACK_FLAGS = [...DEFAULT_POLL_FLAGS_WITH_VALUES, ...STACK_BOOLEAN_FLAGS];
84
+ // `--layers` is for the one-PR commands a stack prints; `stack` itself has no use for it.
85
+ const STACK_FLAGS_WITH_VALUES = new Set([
86
+ ...[...DEFAULT_POLL_FLAGS_WITH_VALUES].filter((flag) => flag !== "--layers"),
87
+ "--merge-through",
88
+ ]);
89
+ const STACK_BOOLEAN_FLAGS = new Set([...DEFAULT_POLL_BOOLEAN_FLAGS, "--once", "--merge-ready"]);
90
+ const STACK_FLAGS = [...STACK_FLAGS_WITH_VALUES, ...STACK_BOOLEAN_FLAGS];
69
91
  function parseLoopOptions(extra, globalOpts, isAggregate) {
70
92
  const cfg = loadConfig();
71
93
  const flags = parseIterateFlags(extra, cfg);
@@ -109,6 +131,7 @@ function parseLoopOptions(extra, globalOpts, isAggregate) {
109
131
  noAutoMarkReady: flags.noAutoMarkReady,
110
132
  merge: flags.merge,
111
133
  instructions: flags.instructions ?? undefined,
134
+ ...(flags.stackLayers && { stackLayers: flags.stackLayers }),
112
135
  intervalSeconds,
113
136
  timeoutSeconds,
114
137
  debounceSeconds,