pr-shepherd 0.56.1 → 0.56.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +7 -4
  3. package/bin/api.d.mts +11 -1
  4. package/bin/api.mjs +25 -0
  5. package/bin/checks/classify.d.mts +5 -6
  6. package/bin/checks/classify.mjs +5 -7
  7. package/bin/checks/superseded.d.mts +4 -17
  8. package/bin/checks/superseded.mjs +67 -43
  9. package/bin/cli/args.mjs +3 -0
  10. package/bin/cli/fix-formatter.mjs +3 -0
  11. package/bin/cli/help-command-pages.d.mts +17 -2
  12. package/bin/cli/help-command-pages.mjs +16 -1
  13. package/bin/cli/help-iterate-poll-pages.d.mts +1 -1
  14. package/bin/cli/help-iterate-poll-pages.mjs +1 -1
  15. package/bin/cli/help-top-page.d.mts +1 -1
  16. package/bin/cli/help-top-page.mjs +2 -0
  17. package/bin/cli/help.d.mts +18 -3
  18. package/bin/cli/help.mjs +2 -0
  19. package/bin/cli/iterate-instructions.mjs +4 -1
  20. package/bin/cli/iterate-lean.mjs +3 -0
  21. package/bin/cli/iterate-merge-formatter.mjs +2 -0
  22. package/bin/cli/queue-removal-handler.d.mts +2 -0
  23. package/bin/cli/queue-removal-handler.mjs +86 -0
  24. package/bin/cli-parser.mjs +4 -0
  25. package/bin/commands/apply-queue-removal.d.mts +18 -0
  26. package/bin/commands/apply-queue-removal.mjs +44 -0
  27. package/bin/commands/check-fingerprint.mjs +2 -0
  28. package/bin/commands/check.mjs +13 -1
  29. package/bin/commands/iterate/check-evidence.d.mts +4 -0
  30. package/bin/commands/iterate/check-evidence.mjs +8 -0
  31. package/bin/commands/iterate/fix-code.mjs +20 -4
  32. package/bin/commands/iterate/index.mjs +15 -1
  33. package/bin/commands/iterate/merge-state.mjs +4 -1
  34. package/bin/commands/iterate/merge.d.mts +7 -1
  35. package/bin/commands/iterate/merge.mjs +59 -1
  36. package/bin/github/gql/poll-summary-check-contexts.gql +2 -0
  37. package/bin/github/poll-summary-checks.mjs +22 -18
  38. package/bin/github/poll-summary-fingerprint.mjs +7 -0
  39. package/bin/github/poll-summary-raw.d.mts +2 -0
  40. package/bin/github/poll-summary-readiness.mjs +11 -1
  41. package/bin/mcp/server.mjs +18 -0
  42. package/bin/state/queue-removal-ack.d.mts +19 -0
  43. package/bin/state/queue-removal-ack.mjs +66 -0
  44. package/bin/types/iterate.d.mts +4 -0
  45. package/bin/types/merge-queue.d.mts +2 -0
  46. package/package.json +2 -2
  47. package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
  48. package/plugins/pr-shepherd/.codex.mcp.json +1 -1
  49. package/plugins/pr-shepherd/.mcp.json +1 -1
  50. package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +3 -2
  51. package/plugins/pr-shepherd/skills/pr-shepherd/references/ci-failure-triage.md +1 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
3
  "description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
4
- "version": "0.56.1",
4
+ "version": "0.56.3",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
7
7
  "email": "jonathanrichardong@gmail.com"
package/README.md CHANGED
@@ -35,7 +35,7 @@ Each tick returns exactly one action:
35
35
  - `MARK_READY` — the CLI converted an eligible draft PR to ready; continue polling.
36
36
  - `FIX_CODE` — agent work is required; complete it, push when needed, then continue polling. Push access to the PR head branch is a usage precondition.
37
37
  - `MERGE` — run the emitted head-pinned auto-merge or queue command. Ordinary merges include a plain-merge fallback; queue merges include a GraphQL enqueue fallback. GitHub is authoritative for the result and reports any authorization failure.
38
- - `CANCEL` — stop polling because the PR merged, closed, or completed its ready-delay.
38
+ - `CANCEL` — stop polling this pull request because it merged, closed, or completed its ready-delay. Continue any remaining pull requests or issues from the original request.
39
39
  - `ESCALATE` — stop polling until a human provides direction. Native stacks reach this only after their autonomous one-PR sessions are exhausted.
40
40
 
41
41
  Native-stack summaries additionally use stack-level `SHEPHERD`: run the listed one-PR sessions,
@@ -122,7 +122,7 @@ Grok:
122
122
  /pr-shepherd 42
123
123
  ```
124
124
 
125
- MCP clients call `iterate` once per tick, then use `apply` for review/file/journal mutations and `build_suggestion_patches` for anchored suggestions. To read journal entries, call `extract_journal` with a body already in hand or `get_journal` with a repository-qualified PR reference. `iterate` returns the same structured action data as the CLI, including its review mutation arguments. The client owns recurrence, so this works consistently in Codex, Claude Code, Grok, and any other stdio MCP client.
125
+ MCP clients call `iterate` once per tick, then use `apply` for review/file/journal mutations and validated queue-removal acknowledgments and `build_suggestion_patches` for anchored suggestions. To read journal entries, call `extract_journal` with a body already in hand or `get_journal` with a repository-qualified PR reference. `iterate` returns the same structured action data as the CLI, including its review mutation arguments. The client owns recurrence, so this works consistently in Codex, Claude Code, Grok, and any other stdio MCP client.
126
126
 
127
127
  The CLI remains useful for shell workflows. Its canonical polling form is:
128
128
 
@@ -141,6 +141,9 @@ pr-shepherd 42 43 44 # summarize an explicit same-repository s
141
141
  pr-shepherd --stack 43 # summarize every PR in a native GitHub stack
142
142
  ```
143
143
 
144
+ A user-supplied `--merge` authorizes the agent to run the emitted merge/enqueue commands for the
145
+ selected PRs or stack without another conversational confirmation. Host permission checks still apply.
146
+
144
147
  Multi-PR and `--stack` polling use compact, read-only GraphQL summaries. They return when work is
145
148
  needed, every selected PR is complete, the bounded timeout expires, or `--until-terminal` crosses a
146
149
  configured GraphQL quota-warning band. Explicit PR sets give each actionable row an exact single-PR
@@ -161,7 +164,7 @@ receipts, and whose bottom open layer GitHub has retargeted onto the stack base,
161
164
  with `gh stack merge <that PR number> --yes` and the allowed method flag (`--squash` unless config or the repository selects another). That lands the named layer and every
162
165
  unmerged layer below it. When the base uses a merge queue, the same command queues the prefix
163
166
  together and GitHub evaluates each layer from the bottom; a failure ejects that layer and those
164
- above it. Layers above the prefix keep their one-PR sessions. After the merge, GitHub retargets
167
+ above it. If the evidence shows an unrelated failure and no source changes or other blockers remain, the one-PR session emits a head-, queue-commit-, and timestamp-pinned local acknowledgment command. Fresh source checks and a new READY receipt then let the aggregate selector recover the eligible prefix. Manual or stale removals cannot use this path. Layers above the prefix keep their one-PR sessions. After the merge, GitHub retargets
165
168
  the next layer, so the rerun continues until the stack returns `CANCEL`. API and MCP aggregate
166
169
  calls perform one summary tick and leave recurrence to the caller.
167
170
 
@@ -169,7 +172,7 @@ Polling defaults can be set under `poll` in `.pr-shepherdrc.yml`: `intervalSecon
169
172
 
170
173
  ### Apply Review And Journal Changes, Or Select Files
171
174
 
172
- Use `apply` with ordered operations to reply/resolve/minimize/dismiss review items, mark selected changed files as viewed, or append an idempotent Shepherd Journal item. Explicit operations are attempted and surface GitHub's per-operation results; generated iterate guidance remains capability-filtered. Use `build_suggestion_patches` to turn ordered review suggestions into checked patches and commit metadata; it never changes the worktree or git history.
175
+ Use `apply` with ordered operations to reply/resolve/minimize/dismiss review items, mark selected changed files as viewed, append an idempotent Shepherd Journal item, or record a validated native-stack CI queue-removal acknowledgment. Explicit operations are attempted and surface GitHub's per-operation results; generated iterate guidance remains capability-filtered. Use `build_suggestion_patches` to turn ordered review suggestions into checked patches and commit metadata; it never changes the worktree or git history.
173
176
 
174
177
  ### Extract Shepherd Journal Entries
175
178
 
package/bin/api.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type JournalResult } from "./commands/journal/index.mts";
2
2
  import { type MarkFilesAsViewedResult } from "./commands/mark-files-as-viewed.mts";
3
+ import { type ApplyQueueRemovalResult } from "./commands/apply-queue-removal.mts";
3
4
  import type { ResolveResult } from "./comments/resolve.mts";
4
5
  import type { BuildSuggestionPatchesResult, CommitSuggestionResult, IterateCommandOptions, IterateResult, PollSummaryResult } from "./types.mts";
5
6
  import { type ShepherdJournalExtraction } from "./journal/index.mts";
@@ -47,8 +48,14 @@ export interface AppendJournalOperation {
47
48
  item: string;
48
49
  dryRun?: boolean;
49
50
  }
51
+ export interface AcknowledgeQueueRemovalOperation {
52
+ type: "acknowledge_queue_removal";
53
+ requireSha: string;
54
+ queueCommitOid: string;
55
+ removedAtUnix: number;
56
+ }
50
57
  /** Operations run in this exact list order after validation. */
51
- export type ApplyOperation = ReviewMutationsOperation | MarkFilesViewedOperation | AppendJournalOperation;
58
+ export type ApplyOperation = ReviewMutationsOperation | MarkFilesViewedOperation | AppendJournalOperation | AcknowledgeQueueRemovalOperation;
52
59
  export interface ApplyInput {
53
60
  /** PR shared by every operation in this ordered apply request. */
54
61
  pr?: PrReference;
@@ -63,6 +70,9 @@ export type ApplyOperationResult = {
63
70
  } | {
64
71
  type: "append_journal";
65
72
  result: JournalResult;
73
+ } | {
74
+ type: "acknowledge_queue_removal";
75
+ result: ApplyQueueRemovalResult;
66
76
  };
67
77
  export interface ApplyResult {
68
78
  operations: ApplyOperationResult[];
package/bin/api.mjs CHANGED
@@ -8,6 +8,7 @@ import { runJournal } from "./commands/journal/index.mjs";
8
8
  import { validateJournalItem } from "./commands/journal/transform.mjs";
9
9
  import { runMarkFilesAsViewed, } from "./commands/mark-files-as-viewed.mjs";
10
10
  import { runResolveMutate } from "./commands/resolve-mutate.mjs";
11
+ import { applyQueueRemovalAck, } from "./commands/apply-queue-removal.mjs";
11
12
  import { runWithExecutionCwd } from "./execution-context.mjs";
12
13
  import { parsePrReference, normalizeRepositoryIdentity, resolveParsedPrTarget, } from "./pr-reference.mjs";
13
14
  import { getPullRequestBody, getRepoInfo } from "./github/client.mjs";
@@ -104,6 +105,17 @@ export function createPrShepherd(options = {}) {
104
105
  results.push({ type: operation.type, result });
105
106
  break;
106
107
  }
108
+ case "acknowledge_queue_removal": {
109
+ const result = await applyQueueRemovalAck({
110
+ prNumber,
111
+ targetRepository,
112
+ headSha: operation.requireSha,
113
+ queueCommitOid: operation.queueCommitOid,
114
+ removedAtUnix: operation.removedAtUnix,
115
+ });
116
+ results.push({ type: operation.type, result });
117
+ break;
118
+ }
107
119
  }
108
120
  }
109
121
  catch (error) {
@@ -206,6 +218,19 @@ function validateOperation(operation) {
206
218
  throw new PrShepherdValidationError(validation.error);
207
219
  }
208
220
  return;
221
+ case "acknowledge_queue_removal":
222
+ if (typeof operation.requireSha !== "string" ||
223
+ !/^[0-9a-f]{40}$/.test(operation.requireSha)) {
224
+ throw new PrShepherdValidationError("acknowledge_queue_removal.requireSha must be a full 40-character lowercase hex SHA");
225
+ }
226
+ if (typeof operation.queueCommitOid !== "string" ||
227
+ !/^[0-9a-f]{40}$/.test(operation.queueCommitOid)) {
228
+ throw new PrShepherdValidationError("acknowledge_queue_removal.queueCommitOid must be a full 40-character lowercase hex SHA");
229
+ }
230
+ if (!Number.isSafeInteger(operation.removedAtUnix) || operation.removedAtUnix <= 0) {
231
+ throw new PrShepherdValidationError("acknowledge_queue_removal.removedAtUnix must be a positive Unix timestamp in seconds");
232
+ }
233
+ return;
209
234
  default:
210
235
  throw new PrShepherdValidationError(`Unsupported apply operation: ${JSON.stringify(operation.type)}`);
211
236
  }
@@ -7,11 +7,10 @@
7
7
  * to PR readiness.
8
8
  * 2. Drop checks with `conclusion == SKIPPED` or `conclusion == NEUTRAL` from the
9
9
  * pass/fail tally. Report them as "skipped" for transparency but don't block on them.
10
- * 3. Reclassify `CANCELLED` checks as "superseded" (non-blocking) when a newer run of
11
- * the same workflow exists on the same commit — this is GitHub's concurrency-group
12
- * eviction behavior, not a real failure. GitHub branch protection itself resolves
13
- * required status checks by latest-run-per-name and merges past these; mirroring
14
- * that here keeps shepherd's verdict aligned with what GitHub will actually allow.
10
+ * 3. Reclassify `CANCELLED` checks as "superseded" (non-blocking) when a newer
11
+ * run of the same workflow exists on the same commit and event, or when an
12
+ * exact matching check from a lower-ID run started and succeeded later.
13
+ * GitHub can start jobs out of workflow-run creation order.
15
14
  */
16
15
  import type { CheckRun, ClassifiedCheck } from "../types.mts";
17
16
  /**
@@ -36,7 +35,7 @@ export interface CiVerdict {
36
35
  filteredNames: string[];
37
36
  /** Names of checks suppressed by the user's ignoreChecks config. */
38
37
  ignoredNames: string[];
39
- /** Names of CANCELLED checks superseded by a newer run of the same workflow (concurrency-group eviction). */
38
+ /** Names of CANCELLED checks covered by another run of the same workflow and event. */
40
39
  supersededNames: string[];
41
40
  }
42
41
  /** Compute a high-level CI verdict from a list of classified checks. */
@@ -7,11 +7,10 @@
7
7
  * to PR readiness.
8
8
  * 2. Drop checks with `conclusion == SKIPPED` or `conclusion == NEUTRAL` from the
9
9
  * pass/fail tally. Report them as "skipped" for transparency but don't block on them.
10
- * 3. Reclassify `CANCELLED` checks as "superseded" (non-blocking) when a newer run of
11
- * the same workflow exists on the same commit — this is GitHub's concurrency-group
12
- * eviction behavior, not a real failure. GitHub branch protection itself resolves
13
- * required status checks by latest-run-per-name and merges past these; mirroring
14
- * that here keeps shepherd's verdict aligned with what GitHub will actually allow.
10
+ * 3. Reclassify `CANCELLED` checks as "superseded" (non-blocking) when a newer
11
+ * run of the same workflow exists on the same commit and event, or when an
12
+ * exact matching check from a lower-ID run started and succeeded later.
13
+ * GitHub can start jobs out of workflow-run creation order.
15
14
  */
16
15
  import { loadConfig } from "../config/load.mjs";
17
16
  import { buildSupersededIndices } from "./superseded.mjs";
@@ -37,8 +36,7 @@ export function classifyChecks(checks, opts = {}) {
37
36
  return { ...c, category: "ignored" };
38
37
  }
39
38
  const classified = classify(c, relevantEvents);
40
- // Only ever override a "failing" verdict (i.e. conclusion === CANCELLED, guaranteed by
41
- // buildSupersededIndices below) — never touch filtered/skipped/passed classifications.
39
+ // Only override a failing CANCELLED check, never filtered/skipped/passed classifications.
42
40
  if (classified.category === "failing" && supersededIndices.has(index)) {
43
41
  return { ...classified, category: "superseded" };
44
42
  }
@@ -1,21 +1,8 @@
1
- /**
2
- * Detects check runs that are `CANCELLED` because a newer run of the *same workflow*
3
- * superseded them on the same commit (concurrency-group eviction), rather than a genuine
4
- * cancellation. Split out of classify.mts to stay under the file-length cap.
5
- */
1
+ /** Identify cancelled checks covered by another run on the same commit and event. */
6
2
  import type { CheckRun } from "../types.mts";
7
3
  /**
8
- * Grouping key is `workflowId ?? workflowName` — the numeric GitHub Actions workflow database
9
- * ID when available, falling back to the display name. Checks with neither a workflow identity
10
- * nor a numeric `runId` (status contexts, startup-failure synthetics) never participate: they
11
- * can neither be marked superseded nor count as evidence of a newer run.
12
- *
13
- * A check is superseded iff its own conclusion is `CANCELLED` and some other check sharing its
14
- * workflow key has a strictly greater `runId`. The newest run for a workflow is therefore never
15
- * superseded, even if it is itself cancelled — that case stays "failing" so the agent can decide
16
- * whether to rerun it.
17
- *
18
- * @returns Indices into `checks` (not object identities, since check-run objects are not
19
- * deduplicated by reference elsewhere) that should be reclassified as "superseded".
4
+ * A later-created run supersedes an older cancellation as before. GitHub can start
5
+ * check jobs out of run-ID order, so a lower-ID run can also cover a cancellation
6
+ * when its matching successful job actually started and completed later.
20
7
  */
21
8
  export declare function buildSupersededIndices(checks: CheckRun[]): Set<number>;
@@ -1,59 +1,83 @@
1
- /**
2
- * Detects check runs that are `CANCELLED` because a newer run of the *same workflow*
3
- * superseded them on the same commit (concurrency-group eviction), rather than a genuine
4
- * cancellation. Split out of classify.mts to stay under the file-length cap.
5
- */
6
- /** Grouping key for a check's workflow: numeric `workflowId`, falling back to `workflowName`. */
1
+ /** Identify cancelled checks covered by another run on the same commit and event. */
2
+ /** Prefer the stable workflow ID; retain the name fallback for the older-run rule. */
7
3
  function workflowKeyOf(check) {
8
- return check.workflowId ?? check.workflowName;
4
+ if (check.workflowId)
5
+ return `id:${check.workflowId}`;
6
+ return check.workflowName ? `name:${check.workflowName}` : undefined;
7
+ }
8
+ function groupKeyOf(check) {
9
+ const workflow = workflowKeyOf(check);
10
+ if (workflow === undefined)
11
+ return undefined;
12
+ return JSON.stringify([workflow, check.event, check.scope ?? null, check.commitOid ?? null]);
13
+ }
14
+ function numericRunId(check) {
15
+ if (check.runId === null || !/^[1-9]\d*$/.test(check.runId))
16
+ return undefined;
17
+ const id = Number(check.runId);
18
+ return Number.isSafeInteger(id) ? id : undefined;
19
+ }
20
+ function validTimes(check) {
21
+ const { startedAtUnix: start, completedAtUnix: completion } = check;
22
+ return (typeof start === "number" &&
23
+ Number.isFinite(start) &&
24
+ start > 0 &&
25
+ typeof completion === "number" &&
26
+ Number.isFinite(completion) &&
27
+ completion > 0 &&
28
+ completion >= start);
9
29
  }
10
30
  /**
11
- * Grouping key is `workflowId ?? workflowName` — the numeric GitHub Actions workflow database
12
- * ID when available, falling back to the display name. Checks with neither a workflow identity
13
- * nor a numeric `runId` (status contexts, startup-failure synthetics) never participate: they
14
- * can neither be marked superseded nor count as evidence of a newer run.
15
- *
16
- * A check is superseded iff its own conclusion is `CANCELLED` and some other check sharing its
17
- * workflow key has a strictly greater `runId`. The newest run for a workflow is therefore never
18
- * superseded, even if it is itself cancelled — that case stays "failing" so the agent can decide
19
- * whether to rerun it.
20
- *
21
- * @returns Indices into `checks` (not object identities, since check-run objects are not
22
- * deduplicated by reference elsewhere) that should be reclassified as "superseded".
31
+ * A later-created run supersedes an older cancellation as before. GitHub can start
32
+ * check jobs out of run-ID order, so a lower-ID run can also cover a cancellation
33
+ * when its matching successful job actually started and completed later.
23
34
  */
24
35
  export function buildSupersededIndices(checks) {
25
- const runIdByIndex = new Map();
26
- const maxRunIdByWorkflow = new Map();
36
+ const maxRunIdByGroup = new Map();
37
+ const runIds = checks.map(numericRunId);
27
38
  checks.forEach((check, index) => {
28
- const workflowKey = workflowKeyOf(check);
29
- if (workflowKey === undefined || check.runId === null)
30
- return;
31
- const runIdNum = Number(check.runId);
32
- if (!Number.isFinite(runIdNum))
39
+ const group = groupKeyOf(check);
40
+ const runId = runIds[index];
41
+ if (group === undefined || runId === undefined)
33
42
  return;
34
- runIdByIndex.set(index, runIdNum);
35
- const currentMax = maxRunIdByWorkflow.get(workflowKey);
36
- if (currentMax === undefined || runIdNum > currentMax) {
37
- maxRunIdByWorkflow.set(workflowKey, runIdNum);
38
- }
43
+ const previous = maxRunIdByGroup.get(group);
44
+ if (previous === undefined || runId > previous)
45
+ maxRunIdByGroup.set(group, runId);
39
46
  });
40
47
  const superseded = new Set();
41
- checks.forEach((check, index) => {
42
- if (check.conclusion !== "CANCELLED")
48
+ checks.forEach((cancelled, index) => {
49
+ if (cancelled.conclusion !== "CANCELLED")
43
50
  return;
44
- const runIdNum = runIdByIndex.get(index);
45
- if (runIdNum === undefined)
51
+ const group = groupKeyOf(cancelled);
52
+ const runId = runIds[index];
53
+ if (group === undefined || runId === undefined)
46
54
  return;
47
- // workflowKeyOf(check) is guaranteed defined here, with a corresponding entry in
48
- // maxRunIdByWorkflow: runIdByIndex is only ever populated in the loop above alongside a
49
- // maxRunIdByWorkflow entry for that same workflow key (at minimum, this check's own
50
- // runIdNum) — the two maps are always updated together for a given index. A defensive
51
- // undefined-check here would therefore guard a branch no input can ever exercise, which
52
- // would silently fail this repo's 100%-coverage requirement instead of catching a real bug.
53
- const maxRunId = maxRunIdByWorkflow.get(workflowKeyOf(check));
54
- if (maxRunId > runIdNum) {
55
+ if (maxRunIdByGroup.get(group) > runId) {
55
56
  superseded.add(index);
57
+ return;
56
58
  }
59
+ if (cancelled.status !== "COMPLETED" ||
60
+ !cancelled.workflowId ||
61
+ cancelled.event === null ||
62
+ !validTimes(cancelled))
63
+ return;
64
+ const covered = checks.some((success, candidateIndex) => {
65
+ const candidateRunId = runIds[candidateIndex];
66
+ return (candidateRunId !== undefined &&
67
+ candidateRunId < runId &&
68
+ success.status === "COMPLETED" &&
69
+ success.conclusion === "SUCCESS" &&
70
+ success.workflowId === cancelled.workflowId &&
71
+ success.event === cancelled.event &&
72
+ success.scope === cancelled.scope &&
73
+ success.commitOid === cancelled.commitOid &&
74
+ success.name === cancelled.name &&
75
+ validTimes(success) &&
76
+ success.startedAtUnix > cancelled.startedAtUnix &&
77
+ success.completedAtUnix > cancelled.completedAtUnix);
78
+ });
79
+ if (covered)
80
+ superseded.add(index);
57
81
  });
58
82
  return superseded;
59
83
  }
package/bin/cli/args.mjs CHANGED
@@ -23,6 +23,9 @@ const FLAGS_WITH_VALUES = new Set([
23
23
  "--match",
24
24
  "--check",
25
25
  "--blocked-by",
26
+ "--require-sha",
27
+ "--queue-commit",
28
+ "--removed-at",
26
29
  ]);
27
30
  // Boolean flags that do NOT consume the next argument. Any --flag not in this
28
31
  // set and not in FLAGS_WITH_VALUES is treated conservatively as value-taking
@@ -191,6 +191,9 @@ export function formatFixCodeResult(header, result, opts = {}) {
191
191
  postFixLines.push(`- requeue API fallback: ${inlineCode(renderMergeCommand(result.fix.requeue.queueApiFallbackCommand))}`);
192
192
  }
193
193
  }
194
+ if (result.fix.queueRemovalAcknowledgment) {
195
+ postFixLines.push(`- acknowledge queue removal: ${inlineCode(renderMergeCommand(result.fix.queueRemovalAcknowledgment))}`);
196
+ }
194
197
  sections.push(postFixLines.join("\n"));
195
198
  sections.push("## Instructions");
196
199
  sections.push(numberInstructions(result.fix.instructions));
@@ -11,8 +11,9 @@ Usage:
11
11
  pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
12
12
  pr-shepherd apply check-blocker [PR] --check <name> --blocked-by <ref>
13
13
  pr-shepherd apply check-blocker [PR] --check <name> --clear
14
+ pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>
14
15
 
15
- Run 'pr-shepherd apply <review|files|journal|check-blocker> --help' for command-specific details.
16
+ Run 'pr-shepherd apply <review|files|journal|check-blocker|queue-removal> --help' for command-specific details.
16
17
  --help, -h Print this help and exit before GitHub I/O.`;
17
18
  readonly "apply review": `pr-shepherd apply review
18
19
 
@@ -80,6 +81,20 @@ Usage:
80
81
 
81
82
  \`--clear\` removes that check's record and leaves other checks alone.
82
83
  --help, -h Print this help and exit before any I/O.`;
84
+ readonly "apply queue-removal": `pr-shepherd apply queue-removal
85
+
86
+ Acknowledge one current CI-driven merge-queue removal for a native-stack PR.
87
+ This writes local state only after a fresh GitHub read confirms the supplied head,
88
+ queue commit, and removal timestamp still identify the current removal.
89
+
90
+ Usage:
91
+ pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>
92
+
93
+ --require-sha <sha> Full 40-character lowercase PR head SHA observed with the failure.
94
+ --queue-commit <sha> Full 40-character lowercase synthetic merge-group commit SHA.
95
+ --removed-at <unix> Removal time in Unix seconds.
96
+ --format text|json Output format. Default: text.
97
+ --help, -h Print this help and exit before any I/O.`;
83
98
  readonly "build-suggestion-patches": `pr-shepherd build-suggestion-patches
84
99
 
85
100
  Build an ordered list of patches and commit instructions from GitHub review suggestions.
@@ -212,7 +227,7 @@ Flags:
212
227
 
213
228
  PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
214
229
  Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
215
- 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 Do not convert draft PRs to ready for review.\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 --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: merged/closed or ready-delay elapsed.\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 or ready-delay elapsed)\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).";
230
+ 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 Do not convert draft PRs to ready for review.\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 --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 or ready-delay elapsed. 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 or ready-delay elapsed)\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).";
216
231
  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 Do not convert draft PRs to ready for review.\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 --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 or ready-delay elapsed)\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).";
217
232
  readonly clean: `pr-shepherd clean
218
233
 
@@ -14,8 +14,9 @@ Usage:
14
14
  pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
15
15
  pr-shepherd apply check-blocker [PR] --check <name> --blocked-by <ref>
16
16
  pr-shepherd apply check-blocker [PR] --check <name> --clear
17
+ pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>
17
18
 
18
- Run 'pr-shepherd apply <review|files|journal|check-blocker> --help' for command-specific details.
19
+ Run 'pr-shepherd apply <review|files|journal|check-blocker|queue-removal> --help' for command-specific details.
19
20
  --help, -h Print this help and exit before GitHub I/O.`,
20
21
  "apply review": `pr-shepherd apply review
21
22
 
@@ -83,6 +84,20 @@ Usage:
83
84
 
84
85
  \`--clear\` removes that check's record and leaves other checks alone.
85
86
  --help, -h Print this help and exit before any I/O.`,
87
+ "apply queue-removal": `pr-shepherd apply queue-removal
88
+
89
+ Acknowledge one current CI-driven merge-queue removal for a native-stack PR.
90
+ This writes local state only after a fresh GitHub read confirms the supplied head,
91
+ queue commit, and removal timestamp still identify the current removal.
92
+
93
+ Usage:
94
+ pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>
95
+
96
+ --require-sha <sha> Full 40-character lowercase PR head SHA observed with the failure.
97
+ --queue-commit <sha> Full 40-character lowercase synthetic merge-group commit SHA.
98
+ --removed-at <unix> Removal time in Unix seconds.
99
+ --format text|json Output format. Default: text.
100
+ --help, -h Print this help and exit before any I/O.`,
86
101
  "build-suggestion-patches": `pr-shepherd build-suggestion-patches
87
102
 
88
103
  Build an ordered list of patches and commit instructions from GitHub review suggestions.
@@ -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 Do not convert draft PRs to ready for review.\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 --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: merged/closed or ready-delay elapsed.\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 or ready-delay elapsed)\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).";
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 Do not convert draft PRs to ready for review.\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 --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 or ready-delay elapsed. 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 or ready-delay elapsed)\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
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 Do not convert draft PRs to ready for review.\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 --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 or ready-delay elapsed)\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;
@@ -23,7 +23,7 @@ Actions:
23
23
  MARK_READY Draft PR was marked ready; continue with the next poll.
24
24
  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.
25
25
  FIX_CODE Agent action is required; follow the instructions, then continue polling.
26
- CANCEL Stop polling: merged/closed or ready-delay elapsed.
26
+ CANCEL Stop polling this pull request: merged/closed or ready-delay elapsed. Continue remaining work from the original request.
27
27
  ESCALATE Stop polling until a human provides direction.
28
28
  MERGE Run the emitted merge/queue command, then continue monitoring.
29
29
 
@@ -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 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 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 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 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 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 --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 Do not convert draft PRs to ready for review.\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\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 or ready-delay elapsed)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
1
+ export declare const TOP_USAGE = "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\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 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 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 --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 Do not convert draft PRs to ready for review.\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\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 or ready-delay elapsed)\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.";
@@ -12,6 +12,7 @@ Usage:
12
12
  pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
13
13
  pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
14
14
  pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)
15
+ pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>
15
16
  pr-shepherd journal extract --body-file <path>
16
17
  pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]
17
18
  pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
@@ -24,6 +25,7 @@ Commands:
24
25
  apply files Mark selected changed files as viewed.
25
26
  apply journal Append a list item to the Shepherd Journal details block of a PR body.
26
27
  apply check-blocker Record that a failing check is blocked on an external PR or issue.
28
+ apply queue-removal Acknowledge one current CI-driven native-stack queue removal.
27
29
  journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.
28
30
  build-suggestion-patches
29
31
  Convert ordered GitHub suggestion threads into patches and commit instructions.