pr-shepherd 0.59.0 → 0.59.2
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/.claude-plugin/plugin.json +1 -1
- package/README.md +38 -45
- 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 +5 -5
- package/bin/cli/help-top-page.d.mts +1 -1
- package/bin/cli/help-top-page.mjs +2 -2
- package/bin/cli/help.d.mts +3 -3
- package/bin/cli/iterate-instructions.mjs +1 -31
- package/bin/cli/iterate-lean.mjs +0 -1
- package/bin/commands/event-mode.mjs +3 -7
- package/bin/commands/iterate/index.mjs +23 -10
- package/bin/commands/next-check.d.mts +0 -2
- package/bin/commands/next-check.mjs +1 -1
- package/bin/commands/poll-summary-explicit-instructions.d.mts +2 -0
- package/bin/commands/poll-summary-explicit-instructions.mjs +18 -2
- package/bin/commands/poll-summary-instructions.mjs +33 -11
- package/bin/commands/stack-drain.mjs +1 -2
- package/bin/commands/stack-work.d.mts +8 -21
- package/bin/commands/stack-work.mjs +14 -38
- package/bin/exit-codes.d.mts +1 -1
- package/bin/exit-codes.mjs +2 -1
- package/bin/github/poll-summary-projector.mjs +3 -1
- package/bin/github/poll-summary-route.mjs +6 -7
- package/bin/journal/journal-container.d.mts +6 -0
- package/bin/journal/journal-container.mjs +33 -0
- package/bin/journal/markdown-details.d.mts +15 -0
- package/bin/journal/markdown-details.mjs +92 -0
- package/bin/journal/markdown-line.d.mts +2 -0
- package/bin/journal/markdown-line.mjs +3 -3
- package/bin/journal/reconcile.mjs +14 -31
- package/bin/types/iterate.d.mts +2 -3
- package/bin/types/merge-requirements.d.mts +0 -7
- 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/.codex.mcp.json +1 -1
- package/plugins/pr-shepherd/.mcp.json +1 -1
- package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +8 -6
- package/plugins/pr-shepherd/skills/pr-shepherd/references/cloud-event-loop.md +1 -1
- package/plugins/pr-shepherd/skills/pr-shepherd/references/draft-handoff.md +38 -0
- package/bin/commands/iterate/parent-first.d.mts +0 -8
- package/bin/commands/iterate/parent-first.mjs +0 -13
package/README.md
CHANGED
|
@@ -4,6 +4,43 @@ Drive a pull request to merge-ready with a coding agent. It works with Claude Co
|
|
|
4
4
|
|
|
5
5
|
**Estimated per PR session: −42% cost and −19% turns vs. `gh`, −77% cost vs. the GitHub MCP server. While waiting on CI: ~60 GraphQL points an hour vs. ~360 for `gh pr checks --watch`.**
|
|
6
6
|
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
- Gathers the PR's review items, CI failures, and merge requirements in one call.
|
|
10
|
+
- Returns one action with numbered instructions and exact commands. `CANCEL` ends the loop and carries none.
|
|
11
|
+
- Never mutates git. The agent edits, commits, pushes, and decides what each comment deserves.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
$ pr-shepherd 123
|
|
15
|
+
|
|
16
|
+
# PR #123 [FIX_CODE]
|
|
17
|
+
|
|
18
|
+
**status** `UNRESOLVED_COMMENTS` · **repo** `owner/repo`
|
|
19
|
+
**summary** 3 passing
|
|
20
|
+
|
|
21
|
+
## Review threads
|
|
22
|
+
|
|
23
|
+
### `threadId=PRRT_kwDOSGizTs58XB1L` — `src/commands/iterate/index.mts:42` (@alice · MEMBER)
|
|
24
|
+
|
|
25
|
+
> The variable name is misleading.
|
|
26
|
+
|
|
27
|
+
## Failing checks
|
|
28
|
+
|
|
29
|
+
- `24697658766` — `CI › lint / typecheck / test (22.x)` [conclusion: FAILURE]
|
|
30
|
+
> oxfmt
|
|
31
|
+
|
|
32
|
+
## Instructions
|
|
33
|
+
|
|
34
|
+
1. Fix each warranted item.
|
|
35
|
+
2. Triage `## Failing checks`. Playbook: "CI failure triage".
|
|
36
|
+
3. Commit and push any changes.
|
|
37
|
+
4. Journal key decisions or rejections with URLs or IDs: `pr-shepherd apply journal 123 '- <decision>'`
|
|
38
|
+
5. `$DISMISS_MESSAGE`: one sentence on what changed. Run even if no code changed: `pr-shepherd apply review 123 --reply-thread-ids PRRT_kwDOSGizTs58XB1L --message "$DISMISS_MESSAGE" --require-sha HEAD`
|
|
39
|
+
6. Rerun Shepherd now.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
More features are in [docs/features.md](docs/features.md).
|
|
43
|
+
|
|
7
44
|
## Outcomes
|
|
8
45
|
|
|
9
46
|
| Outcome | Headline | Evidence |
|
|
@@ -17,23 +54,6 @@ Drive a pull request to merge-ready with a coding agent. It works with Claude Co
|
|
|
17
54
|
|
|
18
55
|
**[jongleberry.com/pr-shepherd](https://jongleberry.com/pr-shepherd/)** covers the why and the design principles.
|
|
19
56
|
|
|
20
|
-
## What it does
|
|
21
|
-
|
|
22
|
-
- Gathers the PR's review items, CI failures, and merge requirements in one call.
|
|
23
|
-
- Returns one action with numbered instructions and exact commands. `CANCEL` ends the loop and carries none.
|
|
24
|
-
- Never mutates git. The agent edits, commits, pushes, and decides what each comment deserves.
|
|
25
|
-
|
|
26
|
-
```mermaid
|
|
27
|
-
flowchart LR
|
|
28
|
-
A[Agent] -->|iterate PR| S[pr-shepherd]
|
|
29
|
-
S -->|batched, conditional reads| G[(GitHub)]
|
|
30
|
-
G --> S
|
|
31
|
-
S -->|one action + numbered instructions| A
|
|
32
|
-
A -->|fix, push, run the printed commands| G
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Without Shepherd, an agent fans out across `gh`, the GitHub MCP server, and GraphQL to rebuild PR state, then guesses the next step. Details for each outcome follow; more features are in [docs/features.md](docs/features.md).
|
|
36
|
-
|
|
37
57
|
## Outcome details
|
|
38
58
|
|
|
39
59
|
### Context and correctness
|
|
@@ -179,34 +199,7 @@ Requirements:
|
|
|
179
199
|
pr-shepherd 42 # shell: poll for work (270s cap; --until-terminal removes it)
|
|
180
200
|
```
|
|
181
201
|
|
|
182
|
-
Leave out the PR number to use the current branch.
|
|
183
|
-
|
|
184
|
-
```text
|
|
185
|
-
# PR #123 [FIX_CODE]
|
|
186
|
-
|
|
187
|
-
**status** `UNRESOLVED_COMMENTS` · **repo** `owner/repo`
|
|
188
|
-
**summary** 3 passing
|
|
189
|
-
|
|
190
|
-
## Review threads
|
|
191
|
-
|
|
192
|
-
### `threadId=PRRT_kwDOSGizTs58XB1L` — `src/commands/iterate/index.mts:42` (@alice · MEMBER)
|
|
193
|
-
|
|
194
|
-
> The variable name is misleading.
|
|
195
|
-
|
|
196
|
-
## Failing checks
|
|
197
|
-
|
|
198
|
-
- `24697658766` — `CI › lint / typecheck / test (22.x)` [conclusion: FAILURE]
|
|
199
|
-
> oxfmt
|
|
200
|
-
|
|
201
|
-
## Instructions
|
|
202
|
-
|
|
203
|
-
1. Fix each warranted item.
|
|
204
|
-
2. Triage `## Failing checks`. Playbook: "CI failure triage".
|
|
205
|
-
3. Commit and push any changes.
|
|
206
|
-
4. Journal key decisions or rejections with URLs or IDs: `pr-shepherd apply journal 123 '- <decision>'`
|
|
207
|
-
5. `$DISMISS_MESSAGE`: one sentence on what changed. Run even if no code changed: `pr-shepherd apply review 123 --reply-thread-ids PRRT_kwDOSGizTs58XB1L --message "$DISMISS_MESSAGE" --require-sha HEAD`
|
|
208
|
-
6. Rerun Shepherd now.
|
|
209
|
-
```
|
|
202
|
+
Leave out the PR number to use the current branch.
|
|
210
203
|
|
|
211
204
|
## Documentation
|
|
212
205
|
|
|
@@ -253,8 +253,8 @@ Flags:
|
|
|
253
253
|
|
|
254
254
|
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
255
255
|
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
256
|
-
readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready
|
|
257
|
-
readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready
|
|
256
|
+
readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed, ready-delay elapsed, or a clean draft left in draft because auto mark-ready is disabled. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
257
|
+
readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, FIX_CODE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
258
258
|
readonly clean: `pr-shepherd clean
|
|
259
259
|
|
|
260
260
|
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const ITERATE_USAGE = "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready
|
|
2
|
-
export declare const POLL_USAGE = "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready
|
|
1
|
+
export declare const ITERATE_USAGE = "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed, ready-delay elapsed, or a clean draft left in draft because auto mark-ready is disabled. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
2
|
+
export declare const POLL_USAGE = "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, FIX_CODE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
3
3
|
/** Public help page for the default PR polling invocation. */
|
|
4
4
|
export declare const DEFAULT_USAGE: string;
|
|
@@ -9,7 +9,7 @@ Usage:
|
|
|
9
9
|
Iterate flags:
|
|
10
10
|
--ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.
|
|
11
11
|
--stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
|
|
12
|
-
--no-auto-mark-ready
|
|
12
|
+
--no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.
|
|
13
13
|
--no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
|
|
14
14
|
--merge Shepherd through readiness, then emit a merge or merge-queue command.
|
|
15
15
|
--instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
|
|
@@ -26,12 +26,12 @@ Actions:
|
|
|
26
26
|
MARK_READY Draft PR was marked ready; continue with the next poll.
|
|
27
27
|
READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.
|
|
28
28
|
FIX_CODE Agent action is required; follow the instructions, then continue polling.
|
|
29
|
-
CANCEL Stop polling this pull request: merged/closed
|
|
29
|
+
CANCEL Stop polling this pull request: merged/closed, ready-delay elapsed, or a clean draft left in draft because auto mark-ready is disabled. Continue remaining work from the original request.
|
|
30
30
|
ESCALATE Stop polling until a human provides direction.
|
|
31
31
|
MERGE Run the emitted merge/queue command, then continue monitoring.
|
|
32
32
|
|
|
33
33
|
Exit codes:
|
|
34
|
-
0 CANCEL (merged
|
|
34
|
+
0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)
|
|
35
35
|
10 WAIT or READY
|
|
36
36
|
11 MARK_READY
|
|
37
37
|
12 FIX_CODE
|
|
@@ -65,7 +65,7 @@ Poll flags:
|
|
|
65
65
|
Forwarded iterate flags:
|
|
66
66
|
--ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.
|
|
67
67
|
--stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
|
|
68
|
-
--no-auto-mark-ready
|
|
68
|
+
--no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.
|
|
69
69
|
--no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
|
|
70
70
|
--merge Shepherd through readiness, then emit a merge or merge-queue command.
|
|
71
71
|
--instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
|
|
@@ -83,7 +83,7 @@ FIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not
|
|
|
83
83
|
With --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, FIX_CODE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.
|
|
84
84
|
|
|
85
85
|
Exit codes: same as iterate (the final tick's action/reason decides the code).
|
|
86
|
-
0 CANCEL (merged
|
|
86
|
+
0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)
|
|
87
87
|
10 WAIT or READY (including a WAIT returned by --timeout)
|
|
88
88
|
11 MARK_READY
|
|
89
89
|
12 FIX_CODE
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const TOP_USAGE = "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready
|
|
1
|
+
export declare const TOP_USAGE = "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n\nPolling flags:\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
|
|
@@ -49,7 +49,7 @@ Common flags:
|
|
|
49
49
|
Iterate flags:
|
|
50
50
|
--ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.
|
|
51
51
|
--stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
|
|
52
|
-
--no-auto-mark-ready
|
|
52
|
+
--no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.
|
|
53
53
|
--no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
|
|
54
54
|
--merge Shepherd through readiness, then emit a merge or merge-queue command.
|
|
55
55
|
--instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
|
|
@@ -70,7 +70,7 @@ Clean variants:
|
|
|
70
70
|
all Remove all pr-shepherd state.
|
|
71
71
|
|
|
72
72
|
Exit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).
|
|
73
|
-
0 CANCEL (merged
|
|
73
|
+
0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)
|
|
74
74
|
10 WAIT or READY
|
|
75
75
|
11 MARK_READY
|
|
76
76
|
12 FIX_CODE
|
package/bin/cli/help.d.mts
CHANGED
|
@@ -253,8 +253,8 @@ Flags:
|
|
|
253
253
|
|
|
254
254
|
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
255
255
|
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
256
|
-
readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready
|
|
257
|
-
readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready
|
|
256
|
+
readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed, ready-delay elapsed, or a clean draft left in draft because auto mark-ready is disabled. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
257
|
+
readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, FIX_CODE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
258
258
|
readonly clean: `pr-shepherd clean
|
|
259
259
|
|
|
260
260
|
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
@@ -336,7 +336,7 @@ The name is case-insensitive; spaces and hyphens are equivalent ("Fix-code loop"
|
|
|
336
336
|
Unknown names exit 64 and list the available playbooks.
|
|
337
337
|
--help, -h Print this help and exit before any I/O.`;
|
|
338
338
|
readonly "log-file": "pr-shepherd log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd log-file [--format text|json] [--poll-mode auto|poll|event]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --poll-mode auto|poll|event\n Report the log for that poll mode; event mode keeps it in durable\n state under the git common directory. Default: poll.mode (auto).\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
|
|
339
|
-
readonly top: "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready
|
|
339
|
+
readonly top: "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n\nPolling flags:\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
|
|
340
340
|
};
|
|
341
341
|
/** Resolve help keys for nested public commands before any command I/O. */
|
|
342
342
|
export declare function helpKeyForArgs(args: string[]): keyof typeof USAGE;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { inlineCode } from "../util/markdown.mjs";
|
|
2
2
|
import { buildQuotaAwareContinuation } from "../quota-warning.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { AUTO_MARK_READY_DISABLED_HOLD } from "../commands/stack-work.mjs";
|
|
5
|
-
import { buildPrShepherdCommand, renderShellCommand } from "./runner.mjs";
|
|
3
|
+
import { renderShellCommand } from "./runner.mjs";
|
|
6
4
|
import { eventWaitSteps } from "../commands/event-instructions.mjs";
|
|
7
|
-
import { playbookPointer } from "../commands/playbook-pointer.mjs";
|
|
8
5
|
export function buildSimpleIterateInstructions(result) {
|
|
9
6
|
switch (result.action) {
|
|
10
7
|
case "ready": {
|
|
@@ -20,8 +17,6 @@ export function buildSimpleIterateInstructions(result) {
|
|
|
20
17
|
];
|
|
21
18
|
}
|
|
22
19
|
case "wait":
|
|
23
|
-
if (result.stackDraftHold)
|
|
24
|
-
return buildStackDraftHoldInstructions(result, result.stackDraftHold);
|
|
25
20
|
if (result.nextCheck) {
|
|
26
21
|
return ["Non-terminal — no action needed this tick.", ...eventWaitSteps(result.nextCheck)];
|
|
27
22
|
}
|
|
@@ -85,31 +80,6 @@ export function buildSimpleIterateInstructions(result) {
|
|
|
85
80
|
}
|
|
86
81
|
}
|
|
87
82
|
}
|
|
88
|
-
/**
|
|
89
|
-
* A held stack draft cannot advance by repeating its one-PR session, so hand control back
|
|
90
|
-
* to the stack selector instead of asking for another immediate iteration.
|
|
91
|
-
*/
|
|
92
|
-
function buildStackDraftHoldInstructions(result, hold) {
|
|
93
|
-
const event = result.pollMode === "event";
|
|
94
|
-
const stackCommand = buildPrShepherdCommand([
|
|
95
|
-
"--stack",
|
|
96
|
-
formatPrUrl(result.repo, result.pr),
|
|
97
|
-
"--until-terminal",
|
|
98
|
-
...(event ? ["--poll-mode", "event"] : []),
|
|
99
|
-
]).text;
|
|
100
|
-
const handoff = `a \`--stack\` selector listed this session, finish that selector's remaining steps and rerun it with its original flags; otherwise run ${inlineCode(stackCommand)}, adding \`--merge\` when merging was requested.`;
|
|
101
|
-
const reason = hold.kind === "auto-mark-ready-disabled" ? AUTO_MARK_READY_DISABLED_HOLD : hold.kind;
|
|
102
|
-
const instruction = `PR #${result.pr} stays in draft because ${reason}, so repeating this one-PR session cannot advance it. If ${handoff}`;
|
|
103
|
-
const step = result.quotaWarning
|
|
104
|
-
? buildQuotaAwareContinuation(result.quotaWarning, instruction)
|
|
105
|
-
: instruction;
|
|
106
|
-
if (!event)
|
|
107
|
-
return [step];
|
|
108
|
-
return [
|
|
109
|
-
step,
|
|
110
|
-
`Event mode: do not rerun this one-PR session and keep no wake-up for it. After the handoff, follow only the stack selector's output; it ends the turn and schedules the next tick through its own \`nextCheck\`. ${playbookPointer("Cloud event loop")}`,
|
|
111
|
-
];
|
|
112
|
-
}
|
|
113
83
|
export function adaptIterateLog(log) {
|
|
114
84
|
return log.replace(/\s+—\s+\d+s until auto-cancel/g, "");
|
|
115
85
|
}
|
package/bin/cli/iterate-lean.mjs
CHANGED
|
@@ -119,7 +119,6 @@ export function projectIterateLean(result, opts) {
|
|
|
119
119
|
...(result.deferredWork && {
|
|
120
120
|
deferredWork: Object.fromEntries(Object.entries(result.deferredWork).filter(([, n]) => n > 0)),
|
|
121
121
|
}),
|
|
122
|
-
...(result.stackDraftHold && { stackDraftHold: result.stackDraftHold }),
|
|
123
122
|
log: adaptIterateLog(result.log),
|
|
124
123
|
instructions: simpleInstructions(result),
|
|
125
124
|
};
|
|
@@ -4,7 +4,7 @@ import { runWithDurableState } from "../state/durable-state.mjs";
|
|
|
4
4
|
import { eventAggregateStep, eventFixContinuation } from "./event-instructions.mjs";
|
|
5
5
|
import { earliestNextCheck, MERGE_QUEUE_RECHECK_SECONDS, nextCheckCandidates, SAFETY_NET_SECONDS, } from "./next-check.mjs";
|
|
6
6
|
import { isFixCodeContinuation } from "./iterate/check-instructions.mjs";
|
|
7
|
-
import { isHandedOffSelection } from "./poll-summary-explicit-instructions.mjs";
|
|
7
|
+
import { isHandedOffSelection, onlyDraftVerificationSelection, } from "./poll-summary-explicit-instructions.mjs";
|
|
8
8
|
import { runIterate } from "./iterate/index.mjs";
|
|
9
9
|
import { resolvePollMode } from "./poll-mode.mjs";
|
|
10
10
|
import { readStackStallDeadline } from "./stack-stall.mjs";
|
|
@@ -56,7 +56,6 @@ async function runIterateEvent(opts) {
|
|
|
56
56
|
remainingSeconds: result.remainingSeconds,
|
|
57
57
|
queued: result.mergeQueue?.inQueue === true,
|
|
58
58
|
restMerge: result.action === "merge" && result.merge.mode === "rest",
|
|
59
|
-
stackDraftHold: result.action === "wait" && result.stackDraftHold !== undefined,
|
|
60
59
|
stallDeadlineSeconds,
|
|
61
60
|
}, nowMs), nowMs);
|
|
62
61
|
const tagged = { ...result, pollMode: "event", ...(nextCheck && { nextCheck }) };
|
|
@@ -102,11 +101,7 @@ async function withAggregateNextCheck(result, opts) {
|
|
|
102
101
|
],
|
|
103
102
|
};
|
|
104
103
|
}
|
|
105
|
-
/**
|
|
106
|
-
* Event mode replaces polling: the appended event step owns the next wake-up, so a stack
|
|
107
|
-
* step's "recheck at the configured polling cadence" would contradict it. A pending stack
|
|
108
|
-
* merge resumes on that wake-up instead.
|
|
109
|
-
*/
|
|
104
|
+
/** The appended event step owns timing, including pending stack merges. */
|
|
110
105
|
function withoutPollingCadence(step) {
|
|
111
106
|
return step
|
|
112
107
|
.replace(/ Recheck(?: them)? at the configured polling cadence\./g, "")
|
|
@@ -114,6 +109,7 @@ function withoutPollingCadence(step) {
|
|
|
114
109
|
}
|
|
115
110
|
function aggregateNextCheck(result, stallDeadlineSeconds) {
|
|
116
111
|
if (isHandedOffSelection(result) ||
|
|
112
|
+
(onlyDraftVerificationSelection(result) && result.nextAction !== "merge") ||
|
|
117
113
|
result.reason === "all_terminal" ||
|
|
118
114
|
result.nextAction === "cancel" ||
|
|
119
115
|
result.nextAction === "escalate") {
|
|
@@ -9,7 +9,7 @@ import { classifyReviewSummaries } from "./classify.mjs";
|
|
|
9
9
|
import { applyStallGuard } from "./stall.mjs";
|
|
10
10
|
import { clearStallState } from "../../state/iterate-stall.mjs";
|
|
11
11
|
import { handleFixCode } from "./fix-code.mjs";
|
|
12
|
-
import { normalizeBotUsernames } from "../../comments/authors.mjs";
|
|
12
|
+
import { isConfiguredBotAuthor, normalizeBotUsernames } from "../../comments/authors.mjs";
|
|
13
13
|
import { autoMinimizeComments } from "../../comments/resolve.mjs";
|
|
14
14
|
import { hasCheckDrivenActionableWork } from "../check-annotations.mjs";
|
|
15
15
|
import { buildReadyMergeOutcome, handleActiveMergeState } from "./merge-state.mjs";
|
|
@@ -23,7 +23,6 @@ import { fingerprintRawSummaryPr } from "../../github/poll-summary-fingerprint.m
|
|
|
23
23
|
import { currentQueueRemovalEvent } from "../../github/poll-summary-queue-removal.mjs";
|
|
24
24
|
import { isCurrentSummaryReady } from "../../github/poll-summary-readiness.mjs";
|
|
25
25
|
import { clearReadyReceipt, isReadyReceiptCurrent, readReadyReceipt, writeReadyReceipt, } from "../../state/ready-receipts.mjs";
|
|
26
|
-
import { stackDraftHold } from "./parent-first.mjs";
|
|
27
26
|
import { findStaleNativeStackAncestry } from "./stale-ancestry.mjs";
|
|
28
27
|
import { annotateBlockedWait, resolveCheckBlockerGate } from "./check-blocker-gate.mjs";
|
|
29
28
|
import { buildUnreportedFixResult, planUnreportedRequired } from "./unreported-required.mjs";
|
|
@@ -96,14 +95,19 @@ async function runIterateCore(opts) {
|
|
|
96
95
|
reviewSummaryIds = [...reviewSummaryIds, ...unminimized];
|
|
97
96
|
}
|
|
98
97
|
// A first look at an already-minimized comment is only an acknowledgment.
|
|
99
|
-
//
|
|
100
|
-
// it must restart the ready delay and void an existing READY receipt.
|
|
98
|
+
// A non-bot edit that no longer matches a noise rule may carry new feedback;
|
|
99
|
+
// it must restart the ready delay and void an existing READY receipt. Bots
|
|
100
|
+
// regenerate minimized summaries on their own, so their edits surface for
|
|
101
|
+
// acknowledgment without restarting the countdown.
|
|
102
|
+
const editedMinimizedFeedback = report.comments.firstLook.some((comment) => comment.isMinimized === true &&
|
|
103
|
+
comment.edited === true &&
|
|
104
|
+
!isConfiguredBotAuthor(comment, botUsernames));
|
|
101
105
|
const hasReadinessWork = report.threads.actionable.length > 0 ||
|
|
102
106
|
report.threads.resolutionOnly.length > 0 ||
|
|
103
107
|
report.threads.firstLook.length > 0 ||
|
|
104
108
|
(report.threads.ruleAutoResolveIds?.length ?? 0) > 0 ||
|
|
105
109
|
report.comments.actionable.length > 0 ||
|
|
106
|
-
|
|
110
|
+
editedMinimizedFeedback ||
|
|
107
111
|
(report.comments.minimizeIds?.length ?? 0) > 0 ||
|
|
108
112
|
report.changesRequestedReviews.length > 0 ||
|
|
109
113
|
hasCheckDrivenActionableWork(reportForWork.checks, report.mergeStatus.status) ||
|
|
@@ -124,7 +128,7 @@ async function runIterateCore(opts) {
|
|
|
124
128
|
!hasReadinessWork &&
|
|
125
129
|
!activeMerge &&
|
|
126
130
|
staleAncestry === null;
|
|
127
|
-
const receiptCurrent = await revalidateReadyReceipt(receiptKey, report, hasReadinessWork, checkContext);
|
|
131
|
+
const receiptCurrent = await revalidateReadyReceipt(receiptKey, report, hasReadinessWork, editedMinimizedFeedback, checkContext);
|
|
128
132
|
const headSha = report.headSha ?? "unknown";
|
|
129
133
|
// The elapsed marker survives a hidden-comment acknowledgement tick and is
|
|
130
134
|
// consumed only when this tick cancels or merges. A receipt that is still
|
|
@@ -256,6 +260,18 @@ async function runIterateCore(opts) {
|
|
|
256
260
|
};
|
|
257
261
|
}
|
|
258
262
|
const autoMarkReady = !opts.noAutoMarkReady && config.actions.autoMarkReady;
|
|
263
|
+
if (canMarkReady && !autoMarkReady) {
|
|
264
|
+
await clearReadyDelay(report.pr, repoOwner, repoName);
|
|
265
|
+
await clearStallState(stallKey);
|
|
266
|
+
return {
|
|
267
|
+
...base,
|
|
268
|
+
action: "cancel",
|
|
269
|
+
reason: "auto-mark-ready-disabled",
|
|
270
|
+
shouldCancel: false,
|
|
271
|
+
remainingSeconds: 0,
|
|
272
|
+
log: `CANCEL: PR #${base.pr} stays in draft because automatic mark-ready is disabled — stopping`,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
259
275
|
const markReadyResult = await markReadyIfAuthorized(canMarkReady && autoMarkReady, base, report);
|
|
260
276
|
if (markReadyResult)
|
|
261
277
|
return markReadyResult;
|
|
@@ -305,12 +321,10 @@ async function runIterateCore(opts) {
|
|
|
305
321
|
log: `READY: PR #${base.pr} is ready — ${readyState.remainingSeconds}s of ready-delay remaining — ${buildWaitLog(base).slice("WAIT: ".length)}`,
|
|
306
322
|
};
|
|
307
323
|
}
|
|
308
|
-
const hold = stackDraftHold(report, autoMarkReady);
|
|
309
324
|
const wait = {
|
|
310
325
|
...base,
|
|
311
326
|
action: "wait",
|
|
312
327
|
log: buildWaitLog(base),
|
|
313
|
-
...(hold && { stackDraftHold: hold }),
|
|
314
328
|
};
|
|
315
329
|
return annotateBlockedWait(await applyStallGuard(stallKey, stallTimeoutSeconds, headSha, base, prNumber, wait, reportForWork, reviewSummaryIds, opts.stallDeadlineSink), blockerGate);
|
|
316
330
|
}
|
|
@@ -386,7 +400,7 @@ async function recordReadyReceipt(key, report, context) {
|
|
|
386
400
|
}
|
|
387
401
|
}
|
|
388
402
|
/** Clear a stale READY receipt; return whether a current receipt remains. */
|
|
389
|
-
async function revalidateReadyReceipt(key, report, hasReadinessWork, context) {
|
|
403
|
+
async function revalidateReadyReceipt(key, report, hasReadinessWork, editedMinimizedFeedback, context) {
|
|
390
404
|
const receipt = await readReadyReceipt(key);
|
|
391
405
|
if (!receipt)
|
|
392
406
|
return false;
|
|
@@ -394,7 +408,6 @@ async function revalidateReadyReceipt(key, report, hasReadinessWork, context) {
|
|
|
394
408
|
report.mergeStatus.state === "OPEN" &&
|
|
395
409
|
!report.mergeStatus.isDraft &&
|
|
396
410
|
Boolean(report.headSha && report.baseRefOid);
|
|
397
|
-
const editedMinimizedFeedback = report.comments.firstLook.some((comment) => comment.isMinimized && comment.edited === true);
|
|
398
411
|
if (report.mergeStatus.state !== "OPEN" ||
|
|
399
412
|
report.mergeStatus.isDraft ||
|
|
400
413
|
!report.headSha ||
|
|
@@ -17,8 +17,6 @@ interface NextCheckFacts {
|
|
|
17
17
|
queued?: boolean;
|
|
18
18
|
/** A `merge` tick whose printed command is a REST merge request, which can stay `pending`. */
|
|
19
19
|
restMerge?: boolean;
|
|
20
|
-
/** A native-stack draft hold: repeating this one-PR session cannot advance it. */
|
|
21
|
-
stackDraftHold?: boolean;
|
|
22
20
|
/** Unix seconds when an unchanged state would trip the stall timeout. */
|
|
23
21
|
stallDeadlineSeconds?: number;
|
|
24
22
|
}
|
|
@@ -24,7 +24,7 @@ export function nextCheckCandidates(facts, nowMs) {
|
|
|
24
24
|
return [{ reason: "merge-pending", seconds: MERGE_QUEUE_RECHECK_SECONDS }];
|
|
25
25
|
}
|
|
26
26
|
const terminal = ["cancel", "escalate", "merge", "mark_ready"].includes(facts.action);
|
|
27
|
-
if (terminal
|
|
27
|
+
if (terminal)
|
|
28
28
|
return [];
|
|
29
29
|
const candidates = [];
|
|
30
30
|
if (facts.action === "ready" && (facts.remainingSeconds ?? 0) > 0) {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { PollSummaryResult } from "../types.mts";
|
|
2
2
|
/** Every selected row already returned `CANCEL` or `ESCALATE`: no autonomous work remains. */
|
|
3
3
|
export declare function isHandedOffSelection(result: PollSummaryResult): boolean;
|
|
4
|
+
/** A final full-review probe can finish this selection without another aggregate read. */
|
|
5
|
+
export declare function onlyDraftVerificationSelection(result: PollSummaryResult): boolean;
|
|
4
6
|
export declare function explicitInstructions(result: PollSummaryResult): string[];
|