pr-shepherd 2.2.9 → 2.2.11
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.
- package/.agents/plugins/marketplace.json +2 -2
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.grok-plugin/marketplace.json +2 -2
- package/README.md +1 -1
- package/bin/checks/classify.mjs +4 -2
- package/bin/cli/help-command-pages.d.mts +2 -2
- package/bin/cli/help-iterate-poll-pages.d.mts +2 -2
- package/bin/cli/help-iterate-poll-pages.mjs +7 -0
- package/bin/cli/help-top-page.d.mts +1 -1
- package/bin/cli/help-top-page.mjs +1 -0
- package/bin/cli/help.d.mts +3 -3
- package/bin/cli/iterate-instructions.mjs +7 -4
- package/bin/cli/poll-handler.mjs +49 -67
- package/bin/cli/poll-loop-options.d.mts +25 -0
- package/bin/cli/poll-loop-options.mjs +58 -0
- package/bin/cli/poll-watch.d.mts +27 -0
- package/bin/cli/poll-watch.mjs +48 -0
- package/bin/cli/watch-report.d.mts +17 -0
- package/bin/cli/watch-report.mjs +33 -0
- package/bin/commands/iterate/api-usage.mjs +16 -1
- package/bin/commands/iterate/gh-cache.d.mts +12 -0
- package/bin/commands/iterate/gh-cache.mjs +98 -0
- package/bin/commands/iterate/index.mjs +77 -55
- package/bin/commands/iterate/merge-plan.d.mts +1 -1
- package/bin/commands/poll-options.d.mts +3 -0
- package/bin/commands/poll-summary.d.mts +3 -0
- package/bin/commands/poll-summary.mjs +5 -1
- package/bin/commands/poll-watch-verify.d.mts +6 -0
- package/bin/commands/poll-watch-verify.mjs +16 -0
- package/bin/commands/poll.mjs +3 -3
- package/bin/exit-codes.d.mts +2 -0
- package/bin/exit-codes.mjs +2 -0
- package/bin/github/batch-parser-helpers.mjs +4 -1
- package/bin/state/process-start.d.mts +14 -0
- package/bin/state/process-start.mjs +35 -0
- package/bin/state/watch-lock.d.mts +29 -0
- package/bin/state/watch-lock.mjs +145 -0
- package/bin/state/watch-set.d.mts +23 -0
- package/bin/state/watch-set.mjs +58 -0
- package/bin/types/merge-action.d.mts +8 -0
- package/package.json +1 -1
- package/plugins/pr-shepherd/.claude-plugin/plugin.json +1 -1
- package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
- package/plugins/pr-shepherd/hooks/pipe-guard-parse.d.mts +4 -0
- package/plugins/pr-shepherd/hooks/pipe-guard-parse.mjs +142 -0
- package/plugins/pr-shepherd/hooks/poll-guard.d.mts +1 -0
- package/plugins/pr-shepherd/hooks/poll-guard.mjs +23 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
|
|
3
|
-
"name": "
|
|
4
|
-
"description": "
|
|
3
|
+
"name": "pr-shepherd",
|
|
4
|
+
"description": "Autonomous PR CI monitor and review-comment resolver",
|
|
5
5
|
"owner": {
|
|
6
6
|
"name": "Jonathan Ong",
|
|
7
7
|
"email": "jonathanrichardong@gmail.com"
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Take pull requests from scratch to merge-ready with a coding agent, as a [Code M
|
|
|
4
4
|
|
|
5
5
|
## Benefits
|
|
6
6
|
|
|
7
|
-
- **Better decisions:** across
|
|
7
|
+
- **Better decisions:** across 59 PR states, it scores 0.94 with the plugin vs. 0.46 with `gh` + the GitHub MCP server ([outcome evals](evals/README.md), 2026-11-19).
|
|
8
8
|
- **Lower cost:** modeled cost per PR session is about 36% lower than `gh` and 76% lower than the GitHub MCP server, with 20% / 69% fewer turns ([token bench](evals/tokens/README.md); assumes a warm prompt cache).
|
|
9
9
|
- **More PRs on one GitHub quota:** 65% fewer GraphQL points than `gh` per PR session. While CI runs, a 5,000-point hourly budget covers about 80 waiting PRs, vs. about 13 with `gh pr checks --watch` ([GitHub API](docs/github-api.md), [GraphQL usage](docs/graphql-usage.md)). A [GitHub App](docs/github-app.md) and [webhook events](docs/hook-harness.md) cut it more.
|
|
10
10
|
- **72 GitHub edge cases handled:** outdated or resolved threads are still shown once, edited comments come back, and conflicts that GraphQL reports as `CLEAN` are caught ([handled cases](docs/handled-cases.md)).
|
package/bin/checks/classify.mjs
CHANGED
|
@@ -76,8 +76,10 @@ function classify(check, relevantEvents) {
|
|
|
76
76
|
return { ...check, category: "filtered" };
|
|
77
77
|
}
|
|
78
78
|
const { status, conclusion } = check;
|
|
79
|
-
// Not yet finished.
|
|
80
|
-
|
|
79
|
+
// Not yet finished. A recorded conclusion means finished whatever `status` says, so a check can
|
|
80
|
+
// never be both non-completed and carry a SUCCESS conclusion (which would hide it from the
|
|
81
|
+
// failing list while still counting as failing).
|
|
82
|
+
if (status !== "COMPLETED" && conclusion == null) {
|
|
81
83
|
// The enclosing suite finished while this run did not: nothing will update it again, so
|
|
82
84
|
// waiting would only end in the stall timeout. Surface it as failing work (rerun the
|
|
83
85
|
// workflow) with the raw status and suite status shown.
|
|
@@ -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 --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).";
|
|
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.\nOnly one live process polls a PR at a time. A PR another process already watches is skipped and\nreported; when every requested PR is watched, the command exits 17 without polling. The report names the\nholder's PID and flags.\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 17 WATCHED (every requested PR is already watched by another live pr-shepherd)\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.
|
|
@@ -163,7 +163,7 @@ When CLAUDE_CODE_REMOTE=true, state is the durable copy under the git common dir
|
|
|
163
163
|
--help, -h Print this help and exit before any cleanup.`;
|
|
164
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.";
|
|
165
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
|
+
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.\nOnly one live process polls a PR at a time (not with --once). A layer another process already\nwatches exits 17 and reports the holder's PID and flags.\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 17 WATCHED (a layer is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
167
167
|
readonly "journal extract": `pr-shepherd journal extract
|
|
168
168
|
|
|
169
169
|
Extract one visible, structurally valid Shepherd Journal from a local PR-body file.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
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 --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
|
+
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.\nOnly one live process polls a PR at a time. A PR another process already watches is skipped and\nreported; when every requested PR is watched, the command exits 17 without polling. The report names the\nholder's PID and flags.\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 17 WATCHED (every requested PR is already watched by another live pr-shepherd)\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 [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).";
|
|
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.\nOnly one live process polls a PR at a time (not with --once). A layer another process already\nwatches exits 17 and reports the holder's PID and flags.\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 17 WATCHED (a layer is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
@@ -51,6 +51,9 @@ returns the last WAIT result. TRIAGE starts a --debounce settle window (default:
|
|
|
51
51
|
poll.debounce-seconds; built-in 1m): poll keeps
|
|
52
52
|
iterating at --interval, then runs one more tick after the window and returns that result.
|
|
53
53
|
With --until-terminal or --merge, poll also continues through MARK_READY.
|
|
54
|
+
Only one live process polls a PR at a time. A PR another process already watches is skipped and
|
|
55
|
+
reported; when every requested PR is watched, the command exits 17 without polling. The report names the
|
|
56
|
+
holder's PID and flags.
|
|
54
57
|
|
|
55
58
|
Usage:
|
|
56
59
|
pr-shepherd [PR ...] [poll-flags] [iterate-flags]
|
|
@@ -93,6 +96,7 @@ Exit codes: same as iterate (the final tick's action/reason decides the code).
|
|
|
93
96
|
13 ESCALATE
|
|
94
97
|
14 CANCEL (closed without merging)
|
|
95
98
|
15 MERGE
|
|
99
|
+
17 WATCHED (every requested PR is already watched by another live pr-shepherd)
|
|
96
100
|
A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).`;
|
|
97
101
|
/** Public help page for `pr-shepherd stack`. */
|
|
98
102
|
export const STACK_USAGE = `pr-shepherd stack
|
|
@@ -101,6 +105,8 @@ Shepherd every open PR in one PR's native GitHub stack, bottom to top. Each poll
|
|
|
101
105
|
per-layer summaries and returns when a layer needs work, every layer is terminal, or timeout.
|
|
102
106
|
SHEPHERD lists one-PR sessions to run before rerunning this command.
|
|
103
107
|
--once, or CLAUDE_CODE_REMOTE=true, runs one aggregate tick and prints nextCheck instead of sleeping.
|
|
108
|
+
Only one live process polls a PR at a time (not with --once). A layer another process already
|
|
109
|
+
watches exits 17 and reports the holder's PID and flags.
|
|
104
110
|
|
|
105
111
|
Usage:
|
|
106
112
|
pr-shepherd stack PR [PR ...] [--once] [poll-flags] [iterate-flags]
|
|
@@ -144,4 +150,5 @@ Exit codes:
|
|
|
144
150
|
14 CANCEL (a layer closed without merging)
|
|
145
151
|
15 MERGE
|
|
146
152
|
16 SHEPHERD (run the listed one-PR sessions, then rerun this stack command)
|
|
153
|
+
17 WATCHED (a layer is already watched by another live pr-shepherd)
|
|
147
154
|
A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).`;
|
|
@@ -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 [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.";
|
|
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)\n 17 WATCHED (polling commands only: another live pr-shepherd already watches every requested PR)\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.";
|
|
@@ -77,6 +77,7 @@ Exit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).
|
|
|
77
77
|
14 CANCEL (closed without merging)
|
|
78
78
|
15 MERGE
|
|
79
79
|
16 SHEPHERD (stack only: run the listed one-PR sessions, then rerun the stack command)
|
|
80
|
+
17 WATCHED (polling commands only: another live pr-shepherd already watches every requested PR)
|
|
80
81
|
See docs/exit-codes.md for the full sysexits.h error-code table.
|
|
81
82
|
|
|
82
83
|
Duration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).
|
package/bin/cli/help.d.mts
CHANGED
|
@@ -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 --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).";
|
|
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.\nOnly one live process polls a PR at a time. A PR another process already watches is skipped and\nreported; when every requested PR is watched, the command exits 17 without polling. The report names the\nholder's PID and flags.\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 17 WATCHED (every requested PR is already watched by another live pr-shepherd)\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.
|
|
@@ -163,7 +163,7 @@ When CLAUDE_CODE_REMOTE=true, state is the durable copy under the git common dir
|
|
|
163
163
|
--help, -h Print this help and exit before any cleanup.`;
|
|
164
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.";
|
|
165
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
|
+
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.\nOnly one live process polls a PR at a time (not with --once). A layer another process already\nwatches exits 17 and reports the holder's PID and flags.\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 17 WATCHED (a layer is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
167
167
|
readonly "journal extract": `pr-shepherd journal extract
|
|
168
168
|
|
|
169
169
|
Extract one visible, structurally valid Shepherd Journal from a local PR-body file.
|
|
@@ -192,7 +192,7 @@ Flags:
|
|
|
192
192
|
The name is case-insensitive; spaces and hyphens are equivalent ("Triage loop" and triage-loop match).
|
|
193
193
|
Unknown names exit 64 and list the available playbooks.
|
|
194
194
|
--help, -h Print this help and exit before any I/O.`;
|
|
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
|
+
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)\n 17 WATCHED (polling commands only: another live pr-shepherd already watches every requested PR)\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.";
|
|
196
196
|
};
|
|
197
197
|
/** Resolve help keys for nested public commands before any command I/O. */
|
|
198
198
|
export declare function helpKeyForArgs(args: string[]): keyof typeof USAGE;
|
|
@@ -50,9 +50,12 @@ export function buildSimpleIterateInstructions(result) {
|
|
|
50
50
|
`Run the REST merge command exactly as printed: ${command}. If its status is \`pending\`, rerun that same command at the configured polling cadence to resume the recorded request; \`enqueued\` is not merged.`,
|
|
51
51
|
"Then iterate with the same options until GitHub confirms the PR merged or needs work.",
|
|
52
52
|
];
|
|
53
|
-
const instructions = [
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const instructions = [];
|
|
54
|
+
const stale = result.merge.ghCacheStaleRateLimit;
|
|
55
|
+
if (stale) {
|
|
56
|
+
instructions.push(`gh's HTTP cache holds a stale GraphQL rate-limit response that makes \`gh pr merge\` fail until ${stale.expiresAt}, although the live quota is healthy. Delete it with ${inlineCode(renderShellCommand(["rm", ...stale.paths]))}, then run the merge command below.`);
|
|
57
|
+
}
|
|
58
|
+
instructions.push(`Run the ${result.merge.mode === "queue" ? "merge queue" : "auto-merge"} command exactly as printed: ${command}.`);
|
|
56
59
|
if (result.merge.mode === "queue" && result.merge.queueApiFallbackCommand) {
|
|
57
60
|
instructions.push(`If gh says auto-merge is disabled instead of adding the PR to the queue, run the queue API fallback: ${inlineCode(renderShellCommand(result.merge.queueApiFallbackCommand.argv))}.`);
|
|
58
61
|
}
|
|
@@ -60,7 +63,7 @@ export function buildSimpleIterateInstructions(result) {
|
|
|
60
63
|
instructions.push(`Only if GitHub reports that auto-merge is unavailable, run the plain merge fallback: ${inlineCode(renderShellCommand(result.merge.fallbackCommand.argv))}.`);
|
|
61
64
|
}
|
|
62
65
|
if (result.merge.restFallbackCommand) {
|
|
63
|
-
instructions.push(`If GraphQL
|
|
66
|
+
instructions.push(`If \`gh\` reports a GraphQL rate limit, run: ${inlineCode(renderShellCommand(result.merge.restFallbackCommand.argv))}.`);
|
|
64
67
|
}
|
|
65
68
|
instructions.push(result.quotaWarning
|
|
66
69
|
? buildQuotaAwareContinuation(result.quotaWarning, "After running the merge command.")
|
package/bin/cli/poll-handler.mjs
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { runAggregatePollCommand, runPollCommand, runPollSummaryTick } from "../commands/tick.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { parseCommonArgs, getFlag, hasFlag } from "./args.mjs";
|
|
4
|
-
import { parseDurationToSeconds } from "./duration.mjs";
|
|
5
|
-
import { validateSecondsDurationFlag } from "./duration-flag.mjs";
|
|
6
|
-
import { hasInvalidIterateFlags, parseIterateFlags } from "./iterate-flags.mjs";
|
|
2
|
+
import { parseCommonArgs, hasFlag } from "./args.mjs";
|
|
7
3
|
import { emitIterateResult } from "./iterate-emitter.mjs";
|
|
8
4
|
import { EXIT } from "../exit-codes.mjs";
|
|
9
5
|
import { emitPollSummaryResult } from "./poll-summary-emitter.mjs";
|
|
@@ -15,6 +11,10 @@ import { validateDefaultArgs } from "./validate-default-args.mjs";
|
|
|
15
11
|
import { rejectRemovedFlags } from "./removed-flags.mjs";
|
|
16
12
|
import { rejectUnknownFlags } from "./unknown-flags.mjs";
|
|
17
13
|
import { maybePrintHelp, USAGE } from "./help.mjs";
|
|
14
|
+
import { parseLoopOptions } from "./poll-loop-options.mjs";
|
|
15
|
+
import { lostWatchGuard, watchFlagsOf, withWatchLock } from "./poll-watch.mjs";
|
|
16
|
+
import { runsSingleTick } from "../commands/single-tick.mjs";
|
|
17
|
+
import { getCurrentPrNumber } from "../github/client.mjs";
|
|
18
18
|
/** The default command: one PR, or several PRs from one repository. */
|
|
19
19
|
export async function handlePoll(args) {
|
|
20
20
|
const parsedTargets = parsePollTargets(args);
|
|
@@ -26,19 +26,44 @@ export async function handlePoll(args) {
|
|
|
26
26
|
const shared = parseLoopOptions(parsedTargets.extra, parsedTargets.global, true);
|
|
27
27
|
if (!shared)
|
|
28
28
|
return;
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
await withWatchLock({
|
|
30
|
+
repo: resolvedTargets.targetRepository,
|
|
31
|
+
prs: resolvedTargets.prNumbers,
|
|
32
|
+
flags: watchFlagsOf(shared.options),
|
|
33
|
+
format: parsedTargets.global.format,
|
|
34
|
+
}, async (watch, prNumbers) => {
|
|
35
|
+
const result = await runAggregatePollCommand({
|
|
36
|
+
...shared.options,
|
|
37
|
+
...resolvedTargets,
|
|
38
|
+
prNumbers,
|
|
39
|
+
...(watch && { watch }),
|
|
40
|
+
});
|
|
41
|
+
emitPollSummaryResult(result, { format: parsedTargets.global.format });
|
|
42
|
+
});
|
|
31
43
|
return;
|
|
32
44
|
}
|
|
33
45
|
const { prNumber, global: globalOpts, extra } = parseCommonArgs(args);
|
|
34
46
|
const shared = parseLoopOptions(extra, globalOpts, false);
|
|
35
47
|
if (!shared)
|
|
36
48
|
return;
|
|
37
|
-
const
|
|
38
|
-
|
|
49
|
+
const pr = prNumber ?? (runsSingleTick() ? undefined : ((await getCurrentPrNumber()) ?? undefined));
|
|
50
|
+
await withWatchLock({
|
|
51
|
+
repo: globalOpts.targetRepository,
|
|
52
|
+
prs: pr === undefined ? [] : [pr],
|
|
53
|
+
flags: watchFlagsOf(shared.options),
|
|
39
54
|
format: globalOpts.format,
|
|
40
|
-
|
|
41
|
-
|
|
55
|
+
}, async (watch) => {
|
|
56
|
+
const beforeTick = watch && (() => lostWatchGuard(watch));
|
|
57
|
+
const result = await runPollCommand({
|
|
58
|
+
...shared.options,
|
|
59
|
+
prNumber: pr,
|
|
60
|
+
...(beforeTick && { beforeTick }),
|
|
61
|
+
});
|
|
62
|
+
emitIterateResult(result, {
|
|
63
|
+
format: globalOpts.format,
|
|
64
|
+
verbose: globalOpts.verbose ?? false,
|
|
65
|
+
readyDelaySuffix: shared.readyDelaySuffix,
|
|
66
|
+
});
|
|
42
67
|
});
|
|
43
68
|
}
|
|
44
69
|
/** `pr-shepherd stack <ref> [<ref> ...]`: the native stack that a stack number or PRs select. */
|
|
@@ -76,10 +101,19 @@ export async function handleStack(args) {
|
|
|
76
101
|
...(target.owned && { stackOwned: target.owned }),
|
|
77
102
|
targetRepository: target.targetRepository,
|
|
78
103
|
};
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
:
|
|
82
|
-
|
|
104
|
+
const once = hasFlag(parsedTargets.extra, "--once");
|
|
105
|
+
await withWatchLock({
|
|
106
|
+
repo: target.targetRepository,
|
|
107
|
+
prs: [],
|
|
108
|
+
growing: !once,
|
|
109
|
+
flags: watchFlagsOf(options),
|
|
110
|
+
format: parsedTargets.global.format,
|
|
111
|
+
}, async (watch) => {
|
|
112
|
+
const result = once
|
|
113
|
+
? await runPollSummaryTick(options)
|
|
114
|
+
: await runAggregatePollCommand({ ...options, ...(watch && { watch }) });
|
|
115
|
+
emitPollSummaryResult(result, { format: parsedTargets.global.format });
|
|
116
|
+
});
|
|
83
117
|
}
|
|
84
118
|
// `--layers` is for the one-PR commands a stack prints; `stack` itself has no use for it.
|
|
85
119
|
const STACK_FLAGS_WITH_VALUES = new Set([
|
|
@@ -88,58 +122,6 @@ const STACK_FLAGS_WITH_VALUES = new Set([
|
|
|
88
122
|
]);
|
|
89
123
|
const STACK_BOOLEAN_FLAGS = new Set([...DEFAULT_POLL_BOOLEAN_FLAGS, "--once", "--merge-ready"]);
|
|
90
124
|
const STACK_FLAGS = [...STACK_FLAGS_WITH_VALUES, ...STACK_BOOLEAN_FLAGS];
|
|
91
|
-
function parseLoopOptions(extra, globalOpts, isAggregate) {
|
|
92
|
-
const cfg = loadConfig();
|
|
93
|
-
const flags = parseIterateFlags(extra, cfg);
|
|
94
|
-
if (hasInvalidIterateFlags(flags))
|
|
95
|
-
return null;
|
|
96
|
-
const intervalStr = getFlag(extra, "--interval");
|
|
97
|
-
const intervalSuffix = validateSecondsDurationFlag("pr-shepherd", "--interval", intervalStr, hasFlag(extra, "--interval"));
|
|
98
|
-
if (intervalSuffix === null)
|
|
99
|
-
return null;
|
|
100
|
-
let intervalSeconds = parseDurationToSeconds(intervalSuffix ?? "", cfg.poll["interval-seconds"]);
|
|
101
|
-
// `--interval` is the invocation interval. Only an omitted flag is scaled, and only for aggregates.
|
|
102
|
-
if (isAggregate && intervalSuffix === undefined) {
|
|
103
|
-
intervalSeconds *= cfg.poll["stack-interval-factor"];
|
|
104
|
-
}
|
|
105
|
-
const timeoutStr = getFlag(extra, "--timeout");
|
|
106
|
-
const timeoutSuffix = validateSecondsDurationFlag("pr-shepherd", "--timeout", timeoutStr, hasFlag(extra, "--timeout"));
|
|
107
|
-
if (timeoutSuffix === null)
|
|
108
|
-
return null;
|
|
109
|
-
const timeoutSeconds = parseDurationToSeconds(timeoutSuffix ?? "", cfg.poll["timeout-seconds"]);
|
|
110
|
-
const debounceStr = getFlag(extra, "--debounce");
|
|
111
|
-
const debounceSuffix = validateSecondsDurationFlag("pr-shepherd", "--debounce", debounceStr, hasFlag(extra, "--debounce"), { allowZero: true });
|
|
112
|
-
if (debounceSuffix === null)
|
|
113
|
-
return null;
|
|
114
|
-
const debounceSeconds = parseDurationToSeconds(debounceSuffix ?? "", cfg.poll["debounce-seconds"], {
|
|
115
|
-
allowZero: true,
|
|
116
|
-
});
|
|
117
|
-
const quietStatusFlag = hasFlag(extra, "--quiet-status");
|
|
118
|
-
const noQuietStatusFlag = hasFlag(extra, "--no-quiet-status");
|
|
119
|
-
if (quietStatusFlag && noQuietStatusFlag) {
|
|
120
|
-
process.stderr.write("pr-shepherd: --quiet-status and --no-quiet-status cannot be used together\n");
|
|
121
|
-
process.exitCode = EXIT.USAGE;
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
const quietStatus = quietStatusFlag || (!noQuietStatusFlag && cfg.poll["quiet-status"]);
|
|
125
|
-
return {
|
|
126
|
-
readyDelaySuffix: flags.readyDelaySuffix ?? undefined,
|
|
127
|
-
options: {
|
|
128
|
-
...globalOpts,
|
|
129
|
-
readyDelaySeconds: flags.readyDelaySeconds,
|
|
130
|
-
stallTimeoutSeconds: flags.stallTimeoutSeconds,
|
|
131
|
-
noAutoMarkReady: flags.noAutoMarkReady,
|
|
132
|
-
merge: flags.merge,
|
|
133
|
-
instructions: flags.instructions ?? undefined,
|
|
134
|
-
...(flags.stackLayers && { stackLayers: flags.stackLayers }),
|
|
135
|
-
intervalSeconds,
|
|
136
|
-
timeoutSeconds,
|
|
137
|
-
debounceSeconds,
|
|
138
|
-
quietStatus,
|
|
139
|
-
untilTerminal: hasFlag(extra, "--until-terminal"),
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
125
|
function usageArg(arg) {
|
|
144
126
|
usage(`unexpected argument: "${arg}"`);
|
|
145
127
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { parseCommonArgs } from "./args.mts";
|
|
2
|
+
export declare function parseLoopOptions(extra: string[], globalOpts: ReturnType<typeof parseCommonArgs>["global"], isAggregate: boolean): {
|
|
3
|
+
readyDelaySuffix: string | undefined;
|
|
4
|
+
options: {
|
|
5
|
+
transport?: import("../api.mts").GithubTransport;
|
|
6
|
+
prNumber?: number;
|
|
7
|
+
targetRepository?: {
|
|
8
|
+
owner: string;
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
format: "text" | "json";
|
|
12
|
+
verbose?: boolean;
|
|
13
|
+
readyDelaySeconds: number;
|
|
14
|
+
stallTimeoutSeconds: number;
|
|
15
|
+
noAutoMarkReady: boolean;
|
|
16
|
+
merge: boolean;
|
|
17
|
+
instructions: "inline" | "playbook" | undefined;
|
|
18
|
+
stackLayers?: import("../types.mts").StackLayerOwnership[] | undefined;
|
|
19
|
+
intervalSeconds: number;
|
|
20
|
+
timeoutSeconds: number;
|
|
21
|
+
debounceSeconds: number;
|
|
22
|
+
quietStatus: boolean;
|
|
23
|
+
untilTerminal: boolean;
|
|
24
|
+
};
|
|
25
|
+
} | null;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { loadConfig } from "../config/load.mjs";
|
|
2
|
+
import { parseCommonArgs, getFlag, hasFlag } from "./args.mjs";
|
|
3
|
+
import { parseDurationToSeconds } from "./duration.mjs";
|
|
4
|
+
import { validateSecondsDurationFlag } from "./duration-flag.mjs";
|
|
5
|
+
import { hasInvalidIterateFlags, parseIterateFlags } from "./iterate-flags.mjs";
|
|
6
|
+
import { EXIT } from "../exit-codes.mjs";
|
|
7
|
+
export function parseLoopOptions(extra, globalOpts, isAggregate) {
|
|
8
|
+
const cfg = loadConfig();
|
|
9
|
+
const flags = parseIterateFlags(extra, cfg);
|
|
10
|
+
if (hasInvalidIterateFlags(flags))
|
|
11
|
+
return null;
|
|
12
|
+
const intervalStr = getFlag(extra, "--interval");
|
|
13
|
+
const intervalSuffix = validateSecondsDurationFlag("pr-shepherd", "--interval", intervalStr, hasFlag(extra, "--interval"));
|
|
14
|
+
if (intervalSuffix === null)
|
|
15
|
+
return null;
|
|
16
|
+
let intervalSeconds = parseDurationToSeconds(intervalSuffix ?? "", cfg.poll["interval-seconds"]);
|
|
17
|
+
// `--interval` is the invocation interval. Only an omitted flag is scaled, and only for aggregates.
|
|
18
|
+
if (isAggregate && intervalSuffix === undefined) {
|
|
19
|
+
intervalSeconds *= cfg.poll["stack-interval-factor"];
|
|
20
|
+
}
|
|
21
|
+
const timeoutStr = getFlag(extra, "--timeout");
|
|
22
|
+
const timeoutSuffix = validateSecondsDurationFlag("pr-shepherd", "--timeout", timeoutStr, hasFlag(extra, "--timeout"));
|
|
23
|
+
if (timeoutSuffix === null)
|
|
24
|
+
return null;
|
|
25
|
+
const timeoutSeconds = parseDurationToSeconds(timeoutSuffix ?? "", cfg.poll["timeout-seconds"]);
|
|
26
|
+
const debounceStr = getFlag(extra, "--debounce");
|
|
27
|
+
const debounceSuffix = validateSecondsDurationFlag("pr-shepherd", "--debounce", debounceStr, hasFlag(extra, "--debounce"), { allowZero: true });
|
|
28
|
+
if (debounceSuffix === null)
|
|
29
|
+
return null;
|
|
30
|
+
const debounceSeconds = parseDurationToSeconds(debounceSuffix ?? "", cfg.poll["debounce-seconds"], {
|
|
31
|
+
allowZero: true,
|
|
32
|
+
});
|
|
33
|
+
const quietStatusFlag = hasFlag(extra, "--quiet-status");
|
|
34
|
+
const noQuietStatusFlag = hasFlag(extra, "--no-quiet-status");
|
|
35
|
+
if (quietStatusFlag && noQuietStatusFlag) {
|
|
36
|
+
process.stderr.write("pr-shepherd: --quiet-status and --no-quiet-status cannot be used together\n");
|
|
37
|
+
process.exitCode = EXIT.USAGE;
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const quietStatus = quietStatusFlag || (!noQuietStatusFlag && cfg.poll["quiet-status"]);
|
|
41
|
+
return {
|
|
42
|
+
readyDelaySuffix: flags.readyDelaySuffix ?? undefined,
|
|
43
|
+
options: {
|
|
44
|
+
...globalOpts,
|
|
45
|
+
readyDelaySeconds: flags.readyDelaySeconds,
|
|
46
|
+
stallTimeoutSeconds: flags.stallTimeoutSeconds,
|
|
47
|
+
noAutoMarkReady: flags.noAutoMarkReady,
|
|
48
|
+
merge: flags.merge,
|
|
49
|
+
instructions: flags.instructions ?? undefined,
|
|
50
|
+
...(flags.stackLayers && { stackLayers: flags.stackLayers }),
|
|
51
|
+
intervalSeconds,
|
|
52
|
+
timeoutSeconds,
|
|
53
|
+
debounceSeconds,
|
|
54
|
+
quietStatus,
|
|
55
|
+
untilTerminal: hasFlag(extra, "--until-terminal"),
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|