pr-shepherd 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/bin/classify/standard/coderabbit-walkthrough.d.mts +10 -0
  3. package/bin/classify/standard/coderabbit-walkthrough.mjs +21 -0
  4. package/bin/classify/standard/devin-no-issues.d.mts +7 -0
  5. package/bin/classify/standard/devin-no-issues.mjs +18 -0
  6. package/bin/classify/standard/index.d.mts +2 -1
  7. package/bin/classify/standard/index.mjs +6 -1
  8. package/bin/cli/apply-merge-handler.mjs +2 -0
  9. package/bin/cli/body-truncate.d.mts +7 -0
  10. package/bin/cli/body-truncate.mjs +8 -4
  11. package/bin/cli/help-command-pages.d.mts +4 -2
  12. package/bin/cli/help-command-pages.mjs +4 -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 +3 -1
  17. package/bin/cli/help-watch-status-page.d.mts +1 -0
  18. package/bin/cli/help-watch-status-page.mjs +21 -0
  19. package/bin/cli/help.d.mts +5 -3
  20. package/bin/cli/help.mjs +2 -0
  21. package/bin/cli/iterate-lean.d.mts +0 -5
  22. package/bin/cli/iterate-lean.mjs +9 -2
  23. package/bin/cli/poll-summary-formatter.mjs +2 -1
  24. package/bin/cli/review-body-cap.d.mts +10 -0
  25. package/bin/cli/review-body-cap.mjs +84 -0
  26. package/bin/cli/stack-layer-view.d.mts +2 -0
  27. package/bin/cli/stack-layer-view.mjs +8 -0
  28. package/bin/cli/stack-overview.mjs +4 -5
  29. package/bin/cli/triage-formatter.mjs +4 -1
  30. package/bin/cli/watch-status-handler.d.mts +2 -0
  31. package/bin/cli/watch-status-handler.mjs +56 -0
  32. package/bin/cli-parser.mjs +7 -0
  33. package/bin/commands/apply-merge-default-route.d.mts +56 -0
  34. package/bin/commands/apply-merge-default-route.mjs +149 -0
  35. package/bin/commands/apply-merge-output.d.mts +2 -0
  36. package/bin/commands/apply-merge-output.mjs +8 -0
  37. package/bin/commands/apply-merge-pull.d.mts +3 -0
  38. package/bin/commands/apply-merge-resume.d.mts +2 -3
  39. package/bin/commands/apply-merge-resume.mjs +74 -32
  40. package/bin/commands/apply-merge-stack-membership.d.mts +27 -0
  41. package/bin/commands/apply-merge-stack-membership.mjs +85 -0
  42. package/bin/commands/apply-merge-submit.d.mts +20 -0
  43. package/bin/commands/apply-merge-submit.mjs +47 -0
  44. package/bin/commands/apply-merge-supersede.d.mts +17 -0
  45. package/bin/commands/apply-merge-supersede.mjs +30 -0
  46. package/bin/commands/apply-merge-sync-fallback.d.mts +16 -0
  47. package/bin/commands/apply-merge-sync-fallback.mjs +55 -0
  48. package/bin/commands/apply-merge.d.mts +2 -0
  49. package/bin/commands/apply-merge.mjs +65 -41
  50. package/bin/commands/check-review-budget.mjs +12 -1
  51. package/bin/commands/check.d.mts +2 -0
  52. package/bin/commands/check.mjs +9 -1
  53. package/bin/commands/iterate/escalate.mjs +5 -0
  54. package/bin/commands/iterate/index.mjs +34 -4
  55. package/bin/commands/iterate/merge-plan.d.mts +2 -0
  56. package/bin/commands/iterate/merge-plan.mjs +1 -1
  57. package/bin/commands/iterate/merge.mjs +7 -3
  58. package/bin/commands/iterate/stack-boundary.mjs +6 -6
  59. package/bin/commands/iterate/stale-ancestry.mjs +8 -3
  60. package/bin/commands/iterate/triage.mjs +19 -6
  61. package/bin/commands/poll-events.d.mts +1 -1
  62. package/bin/commands/poll-events.mjs +8 -3
  63. package/bin/commands/poll-seen-options.d.mts +7 -0
  64. package/bin/commands/poll-seen-options.mjs +9 -0
  65. package/bin/commands/poll-summary-instructions.d.mts +1 -0
  66. package/bin/commands/poll-summary-instructions.mjs +17 -7
  67. package/bin/commands/poll-summary.mjs +8 -4
  68. package/bin/commands/poll.mjs +2 -2
  69. package/bin/commands/rest-stack-merge-readiness.d.mts +6 -2
  70. package/bin/commands/rest-stack-merge-readiness.mjs +59 -7
  71. package/bin/commands/stack-drain.d.mts +7 -1
  72. package/bin/commands/stack-drain.mjs +30 -6
  73. package/bin/commands/stack-lower-heads.d.mts +32 -0
  74. package/bin/commands/stack-lower-heads.mjs +53 -0
  75. package/bin/commands/stack-merge-escalations.d.mts +2 -1
  76. package/bin/commands/stack-merge-plan.mjs +35 -41
  77. package/bin/commands/stack-merge-trunk-check.d.mts +0 -2
  78. package/bin/commands/stack-merge-trunk-check.mjs +0 -2
  79. package/bin/commands/stack-ownership.mjs +3 -3
  80. package/bin/commands/stack-stall.d.mts +1 -0
  81. package/bin/commands/stack-stall.mjs +6 -2
  82. package/bin/commands/stack-trunk-behind.d.mts +1 -1
  83. package/bin/commands/stack-trunk-behind.mjs +1 -1
  84. package/bin/commands/stack-work.mjs +1 -1
  85. package/bin/config/merge-command-args.d.mts +2 -0
  86. package/bin/config/merge-command-args.mjs +13 -0
  87. package/bin/config/merge-method.d.mts +0 -5
  88. package/bin/config/merge-method.mjs +0 -6
  89. package/bin/config/schema.d.mts +2 -0
  90. package/bin/config/schema.mjs +2 -13
  91. package/bin/github/batch-parser-helpers.d.mts +5 -0
  92. package/bin/github/batch-parser-helpers.mjs +7 -2
  93. package/bin/github/batch-parsers.mjs +6 -2
  94. package/bin/github/errors.d.mts +2 -0
  95. package/bin/github/errors.mjs +1 -1
  96. package/bin/github/poll-summary-annotation-probe.d.mts +1 -1
  97. package/bin/github/poll-summary-annotation-probe.mjs +2 -2
  98. package/bin/github/poll-summary-command.d.mts +3 -2
  99. package/bin/github/poll-summary-command.mjs +6 -4
  100. package/bin/github/poll-summary-projector.mjs +16 -14
  101. package/bin/github/poll-summary-readiness.d.mts +4 -0
  102. package/bin/github/poll-summary-readiness.mjs +22 -0
  103. package/bin/github/poll-summary-rest-queue.d.mts +13 -0
  104. package/bin/github/poll-summary-rest-queue.mjs +21 -0
  105. package/bin/github/poll-summary-review-helpers.mjs +8 -4
  106. package/bin/state/merge-method-cache.d.mts +19 -0
  107. package/bin/state/merge-method-cache.mjs +27 -0
  108. package/bin/state/merge-request-claim.d.mts +23 -0
  109. package/bin/state/merge-request-claim.mjs +44 -0
  110. package/bin/state/merge-request-clear.d.mts +24 -0
  111. package/bin/state/merge-request-clear.mjs +36 -0
  112. package/bin/state/merge-request-lock.d.mts +13 -0
  113. package/bin/state/merge-request-lock.mjs +136 -0
  114. package/bin/state/merge-request-stack-heads.d.mts +2 -0
  115. package/bin/state/merge-request-stack-heads.mjs +8 -0
  116. package/bin/state/merge-request.d.mts +23 -6
  117. package/bin/state/merge-request.mjs +29 -29
  118. package/bin/state/ready-receipts.d.mts +11 -0
  119. package/bin/state/ready-receipts.mjs +7 -0
  120. package/bin/state/watch-lock.d.mts +10 -0
  121. package/bin/state/watch-lock.mjs +38 -3
  122. package/bin/types/poll-summary.d.mts +2 -0
  123. package/package.json +12 -5
  124. package/plugins/pr-shepherd/.claude-plugin/plugin.json +1 -1
  125. package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
  126. package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +1 -1
  127. package/plugins/pr-shepherd/skills/pr-shepherd/references/create-a-pr.md +2 -2
  128. package/plugins/pr-shepherd/skills/pr-shepherd/references/waiting.md +1 -1
  129. package/plugins/pr-shepherd/skills/setup-pr-shepherd/references/classifiers.md +1 -1
  130. package/pr-shepherd.schema.json +8 -0
  131. package/bin/commands/stack-merge-flag.d.mts +0 -7
  132. package/bin/commands/stack-merge-flag.mjs +0 -6
@@ -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": "2.6.0",
4
+ "version": "2.7.0",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
7
7
  "email": "jonathanrichardong@gmail.com"
@@ -0,0 +1,10 @@
1
+ import type { ClassifyRule } from "../types.mts";
2
+ /**
3
+ * CodeRabbit's per-PR summary ("walkthrough") conversation comment, whatever sections it holds:
4
+ * the walkthrough, change type, merge and security risk, approval status, review info, usage
5
+ * receipts, tool warnings, and the finishing-touch and Autofix checkboxes. CodeRabbit posts its
6
+ * findings as review threads and review summaries, which stay on the normal review path. A summary
7
+ * comment that `coderabbit-notices` matches is left to that rule.
8
+ */
9
+ declare const rule: ClassifyRule;
10
+ export default rule;
@@ -0,0 +1,21 @@
1
+ import { isBotItem } from "./author.mjs";
2
+ import coderabbitNotices from "./coderabbit-notices.mjs";
3
+ /** CodeRabbit marks its one per-PR summary comment with this header, after an optional version marker. */
4
+ const SUMMARY_MARKER = /^(?:<!-- coderabbit-ai-generated:\S* -->\s*)?<!-- This is an auto-generated comment: summarize by coderabbit\.ai -->/;
5
+ /**
6
+ * CodeRabbit's per-PR summary ("walkthrough") conversation comment, whatever sections it holds:
7
+ * the walkthrough, change type, merge and security risk, approval status, review info, usage
8
+ * receipts, tool warnings, and the finishing-touch and Autofix checkboxes. CodeRabbit posts its
9
+ * findings as review threads and review summaries, which stay on the normal review path. A summary
10
+ * comment that `coderabbit-notices` matches is left to that rule.
11
+ */
12
+ const rule = (item) => {
13
+ if (!isBotItem(item, ["coderabbitai"], ["pr-comment"]))
14
+ return null;
15
+ if (!SUMMARY_MARKER.test(item.body.replace(/\r\n/g, "\n").trim()))
16
+ return null;
17
+ if (coderabbitNotices(item) != null)
18
+ return null;
19
+ return { autoResolve: true, suppress: true, reason: "CodeRabbit walkthrough summary comment" };
20
+ };
21
+ export default rule;
@@ -0,0 +1,7 @@
1
+ import type { ClassifyRule } from "../types.mts";
2
+ /**
3
+ * Devin Review's no-issues report, posted as a review or a conversation comment. It states that
4
+ * the review found nothing, so it has no inline comments to leave open when it is minimized.
5
+ */
6
+ declare const rule: ClassifyRule;
7
+ export default rule;
@@ -0,0 +1,18 @@
1
+ import { isBotItem } from "./author.mjs";
2
+ /**
3
+ * The whole "No Issues Found" report: heading, one fixed sentence, the review badge, and an
4
+ * optional summary marker. A report that found issues, or any added text, does not match.
5
+ */
6
+ const NO_ISSUES = /^## ✅ Devin Review: No Issues Found\n\nDevin Review analyzed this PR and found no bugs or issues to report\.\n\n<!-- devin-review-badge-begin -->\n<a href="https:\/\/app\.devin\.ai\/review\/[^"\s]+" target="_blank"><picture>(?:<source [^>\n]*>)*<img [^>\n]*><\/picture><\/a>\n<!-- devin-review-badge-end -->(?:\n\n<!-- devin-review-summary -->)?$/;
7
+ /**
8
+ * Devin Review's no-issues report, posted as a review or a conversation comment. It states that
9
+ * the review found nothing, so it has no inline comments to leave open when it is minimized.
10
+ */
11
+ const rule = (item) => {
12
+ if (!isBotItem(item, ["devin-ai-integration"], ["review-summary", "pr-comment"]))
13
+ return null;
14
+ if (!NO_ISSUES.test(item.body.replace(/\r\n/g, "\n").trim()))
15
+ return null;
16
+ return { autoResolve: true, suppress: true, reason: "Devin Review no-issues report" };
17
+ };
18
+ export default rule;
@@ -2,7 +2,8 @@ import type { ClassifyRule } from "../types.mts";
2
2
  /**
3
3
  * Bundled classification rules that `classify.standard` can enable by name.
4
4
  * Rules match conversation comments (`pr-comment`) only, except `coderabbit-notices` also
5
- * suppresses CodeRabbit's chat rate-limit notice on review-thread replies (`review-thread-reply`).
5
+ * suppresses CodeRabbit's chat rate-limit notice on review-thread replies (`review-thread-reply`),
6
+ * and `devin-no-issues` also matches Devin's no-issues review (`review-summary`).
6
7
  */
7
8
  export declare const STANDARD_RULES: Readonly<Record<string, ClassifyRule>>;
8
9
  export declare const STANDARD_RULE_NAMES: readonly string[];
@@ -1,9 +1,11 @@
1
1
  import claudeNotices from "./claude-notices.mjs";
2
2
  import coderabbitNotices from "./coderabbit-notices.mjs";
3
+ import coderabbitWalkthrough from "./coderabbit-walkthrough.mjs";
3
4
  import codecovReport from "./codecov-report.mjs";
4
5
  import codexNotices from "./codex-notices.mjs";
5
6
  import dependabotNotices from "./dependabot-notices.mjs";
6
7
  import dependencyReviewNoIssues from "./dependency-review-no-issues.mjs";
8
+ import devinNoIssues from "./devin-no-issues.mjs";
7
9
  import geminiNotices from "./gemini-notices.mjs";
8
10
  import kiloNoIssues from "./kilo-no-issues.mjs";
9
11
  import snykNoIssues from "./snyk-no-issues.mjs";
@@ -14,15 +16,18 @@ import sourceryReviewGuide from "./sourcery-review-guide.mjs";
14
16
  /**
15
17
  * Bundled classification rules that `classify.standard` can enable by name.
16
18
  * Rules match conversation comments (`pr-comment`) only, except `coderabbit-notices` also
17
- * suppresses CodeRabbit's chat rate-limit notice on review-thread replies (`review-thread-reply`).
19
+ * suppresses CodeRabbit's chat rate-limit notice on review-thread replies (`review-thread-reply`),
20
+ * and `devin-no-issues` also matches Devin's no-issues review (`review-summary`).
18
21
  */
19
22
  export const STANDARD_RULES = {
20
23
  "claude-notices": claudeNotices,
21
24
  "coderabbit-notices": coderabbitNotices,
25
+ "coderabbit-walkthrough": coderabbitWalkthrough,
22
26
  "codecov-report": codecovReport,
23
27
  "codex-notices": codexNotices,
24
28
  "dependabot-notices": dependabotNotices,
25
29
  "dependency-review-no-issues": dependencyReviewNoIssues,
30
+ "devin-no-issues": devinNoIssues,
26
31
  "gemini-notices": geminiNotices,
27
32
  "kilo-no-issues": kiloNoIssues,
28
33
  "snyk-no-issues": snykNoIssues,
@@ -65,6 +65,8 @@ export function formatApplyMergeResult(result) {
65
65
  lines.push("uncertain: true");
66
66
  if (result.note)
67
67
  lines.push(`note: ${result.note}`);
68
+ if (result.merge_route)
69
+ lines.push(`merge_route: ${result.merge_route}`);
68
70
  for (const [name, value] of Object.entries(result.details)) {
69
71
  if (value !== undefined)
70
72
  lines.push(`- ${name}: ${typeof value === "string" ? value : JSON.stringify(value)}`);
@@ -1,5 +1,12 @@
1
+ export declare const HEAD_FRACTION = 0.7;
1
2
  export declare const BODY_TRUNCATE_MAX_CHARS = 1200;
2
3
  export declare const NESTED_BODY_TRUNCATE_MAX_CHARS = 600;
4
+ export interface FenceOpener {
5
+ char: string;
6
+ len: number;
7
+ }
8
+ export declare function fenceOpener(trimmed: string): FenceOpener | null;
9
+ export declare function isFenceCloser(trimmed: string, fence: FenceOpener): boolean;
3
10
  /**
4
11
  * Truncates `body` to roughly `maxChars`, keeping a head and tail portion so an
5
12
  * opening question and a trailing summary both survive. Never cuts inside a
@@ -1,7 +1,7 @@
1
- const HEAD_FRACTION = 0.7;
1
+ export const HEAD_FRACTION = 0.7;
2
2
  export const BODY_TRUNCATE_MAX_CHARS = 1200;
3
3
  export const NESTED_BODY_TRUNCATE_MAX_CHARS = 600;
4
- function fenceOpener(trimmed) {
4
+ export function fenceOpener(trimmed) {
5
5
  const char = trimmed[0];
6
6
  if (char !== "`" && char !== "~")
7
7
  return null;
@@ -10,7 +10,7 @@ function fenceOpener(trimmed) {
10
10
  len++;
11
11
  return len >= 3 ? { char, len } : null;
12
12
  }
13
- function isFenceCloser(trimmed, fence) {
13
+ export function isFenceCloser(trimmed, fence) {
14
14
  return trimmed.length >= fence.len && [...trimmed].every((c) => c === fence.char);
15
15
  }
16
16
  // Backtick and tilde fences close only against their own kind — a run of one
@@ -99,6 +99,10 @@ function elisionMarker(charCount, url) {
99
99
  * character-level slice of that line rather than dropping it entirely.
100
100
  */
101
101
  export function truncateBody(body, maxChars, url) {
102
+ return truncateBodyWith(body, maxChars, (elided) => elisionMarker(elided, url));
103
+ }
104
+ /** {@link truncateBody} with a caller-built marker for the elided middle. */
105
+ function truncateBodyWith(body, maxChars, marker) {
102
106
  if (body.length <= maxChars)
103
107
  return body;
104
108
  const lines = body.split("\n");
@@ -119,5 +123,5 @@ export function truncateBody(body, maxChars, url) {
119
123
  const elidedChars = body.length - head.length - tail.length;
120
124
  if (elidedChars <= 0)
121
125
  return body;
122
- return [head, elisionMarker(elidedChars, url), tail].join("\n\n");
126
+ return [head, marker(elidedChars), tail].join("\n\n");
123
127
  }
@@ -1,5 +1,5 @@
1
1
  export declare const COMMAND_USAGE: {
2
- readonly default: "pr-shepherd [PR]\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit same-repository PR set.\nAggregate mode returns when any row needs work, every row is terminal, or timeout.\nWhen CLAUDE_CODE_REMOTE=true, the command runs one tick like iterate and prints nextCheck instead.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. TRIAGE starts a --debounce settle window (default:\npoll.debounce-seconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\nOnly one live process polls a PR at a time. A PR another process already watches is skipped and\nreported; when every requested PR is watched, the command exits 17 without polling. The report names the\nholder's PID and flags.\n\nUsage:\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n\nUse 'pr-shepherd stack PR' for a native GitHub stack.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m, for foreground waits).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n For background runs that wake the caller on exit; foreground waits use the bounded default.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quiet-status can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nTRIAGE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, TRIAGE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 17 WATCHED (every requested PR is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
2
+ readonly default: "pr-shepherd [PR]\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit same-repository PR set.\nAggregate mode returns when any row needs work, every row is terminal, or timeout.\nWhen CLAUDE_CODE_REMOTE=true, the command runs one tick like iterate and prints nextCheck instead.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. TRIAGE starts a --debounce settle window (default:\npoll.debounce-seconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\nOnly one live process polls a PR at a time. A PR another process already watches is skipped and\nreported; when every requested PR is watched, the command exits 17 without polling. The report names the\nholder's PID and flags.\n\nUsage:\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n\nUse 'pr-shepherd stack PR' for a native GitHub stack.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m, for foreground waits).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n For background runs that wake the caller on exit; foreground waits use the bounded default.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quiet-status can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nTRIAGE debounce writes a remaining-seconds line to stderr. --timeout covers the debounce: the window ends at the poll deadline, and one last tick then returns the action it finds (TRIAGE while the work is still there).\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, TRIAGE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 17 WATCHED (every requested PR is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
3
3
  readonly "apply merge": `pr-shepherd apply merge
4
4
 
5
5
  Submit one SHA-guarded asynchronous merge or enqueue request with REST.
@@ -142,8 +142,9 @@ Administrative state and diagnostics commands.
142
142
  Usage:
143
143
  pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]
144
144
  pr-shepherd admin log-file [--format text|json]
145
+ pr-shepherd admin watch-status <PR> [--format text|json]
145
146
 
146
- Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
147
+ Run 'pr-shepherd admin <clean|log-file|watch-status> --help' for command-specific details.
147
148
  --help, -h Print this help and exit before any I/O.`;
148
149
  readonly "admin clean": `pr-shepherd admin clean
149
150
 
@@ -162,6 +163,7 @@ Use --dry-run to preview paths without removing them.
162
163
  When CLAUDE_CODE_REMOTE=true, state is the durable copy under the git common directory.
163
164
  --help, -h Print this help and exit before any cleanup.`;
164
165
  readonly "admin log-file": "pr-shepherd admin log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd admin log-file [--format text|json]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n CLAUDE_CODE_REMOTE=true reports the durable log under the git common directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
166
+ readonly "admin watch-status": "pr-shepherd admin watch-status\n\nReport whether a live pr-shepherd process watches a pull request. Read-only: it reads the\nwatcher lock only, starts no watcher, takes no lock, polls nothing, and makes no GitHub call.\n\nUsage:\n pr-shepherd admin watch-status <PR> [--format text|json]\n\nArguments:\n PR A number, owner/repo#number, or a GitHub pull request URL. Required;\n the current branch's pull request is not inferred.\n\nFlags:\n --format text|json Output Markdown text or JSON. Default: text.\n --help, -h Print this help and exit before any I/O.\n\nExit code: 17 when a live pr-shepherd watches the PR, 0 when none does, 65 when the lock file\nexists but is unreadable or not a valid lock (whether a watcher is live is then unknown; JSON\nprints \"unreadable\": true and no \"watched\"), 64 on a usage error.\nA lock whose process is gone counts as no watcher. Single-tick commands (iterate, apply, MCP)\nand cloud sessions take no lock, so they never show as watching.";
165
167
  readonly iterate: "pr-shepherd iterate\n\nRun one tick and return without sleeping. The no-subcommand form polls; use this subcommand when the\ncaller owns the next wake-up. One PR prints one action and an action-specific ## Instructions section.\nSeveral same-repository PRs print one aggregate summary. Unless nothing remains to wait for, the output\ncarries nextCheck: when to rerun if no GitHub event arrives first.\n\nUsage:\n pr-shepherd iterate [PR ...] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n TRIAGE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed, ready-delay elapsed, or a clean draft left in draft because auto mark-ready is disabled. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
166
168
  readonly stack: "pr-shepherd stack\n\nShepherd every open PR in one PR's native GitHub stack, bottom to top. Each poll reads compact\nper-layer summaries and returns when a layer needs work, every layer is terminal, or timeout.\nSHEPHERD lists one-PR sessions to run before rerunning this command.\n--once, or CLAUDE_CODE_REMOTE=true, runs one aggregate tick and prints nextCheck instead of sleeping.\nOnly one live process polls a PR at a time (not with --once). A layer another process already\nwatches exits 17 and reports the holder's PID and flags.\n\nUsage:\n pr-shepherd stack PR [PR ...] [--once] [poll-flags] [iterate-flags]\n\nThe PRs you list are the layers you own (one PR owns only itself); a stack number (owner/repo#N) owns every\nlayer. A merge that would also land unlisted layers escalates instead. A bare number is a PR first, then a\nstack number. Refs that span several stacks fail with one command per stack.\n\nStack flags:\n --once Run one aggregate tick without sleeping; poll flags are ignored.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s) multiplied by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m, for foreground waits).\n --debounce <duration> Settle window after the first SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT until SHEPHERD, MERGE, CANCEL, or ESCALATE.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --merge Shepherd through readiness, then emit one merge that lands every owned layer.\n --merge-ready Merge the highest contiguous ready, owned prefix as layers become ready.\n --merge-through <PR> Merge up to and including this PR of the stack; layers above stay open.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\n\nExit codes:\n 0 CANCEL (every layer merged)\n 10 WAIT\n 13 ESCALATE\n 14 CANCEL (a layer closed without merging)\n 15 MERGE\n 16 SHEPHERD (run the listed one-PR sessions, then rerun this stack command)\n 17 WATCHED (a layer is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
167
169
  readonly "journal extract": `pr-shepherd journal extract
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable max-lines */
2
2
  import { LOG_FILE_USAGE } from "./help-log-file-page.mjs";
3
+ import { WATCH_STATUS_USAGE } from "./help-watch-status-page.mjs";
3
4
  import { DEFAULT_USAGE, ITERATE_USAGE, STACK_USAGE } from "./help-iterate-poll-pages.mjs";
4
5
  export const COMMAND_USAGE = {
5
6
  default: DEFAULT_USAGE,
@@ -145,8 +146,9 @@ Administrative state and diagnostics commands.
145
146
  Usage:
146
147
  pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]
147
148
  pr-shepherd admin log-file [--format text|json]
149
+ pr-shepherd admin watch-status <PR> [--format text|json]
148
150
 
149
- Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
151
+ Run 'pr-shepherd admin <clean|log-file|watch-status> --help' for command-specific details.
150
152
  --help, -h Print this help and exit before any I/O.`,
151
153
  "admin clean": `pr-shepherd admin clean
152
154
 
@@ -165,6 +167,7 @@ Use --dry-run to preview paths without removing them.
165
167
  When CLAUDE_CODE_REMOTE=true, state is the durable copy under the git common directory.
166
168
  --help, -h Print this help and exit before any cleanup.`,
167
169
  "admin log-file": LOG_FILE_USAGE,
170
+ "admin watch-status": WATCH_STATUS_USAGE,
168
171
  iterate: ITERATE_USAGE,
169
172
  stack: STACK_USAGE,
170
173
  "journal extract": `pr-shepherd journal extract
@@ -1,5 +1,5 @@
1
1
  export declare const ITERATE_USAGE = "pr-shepherd iterate\n\nRun one tick and return without sleeping. The no-subcommand form polls; use this subcommand when the\ncaller owns the next wake-up. One PR prints one action and an action-specific ## Instructions section.\nSeveral same-repository PRs print one aggregate summary. Unless nothing remains to wait for, the output\ncarries nextCheck: when to rerun if no GitHub event arrives first.\n\nUsage:\n pr-shepherd iterate [PR ...] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n TRIAGE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed, ready-delay elapsed, or a clean draft left in draft because auto mark-ready is disabled. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
2
2
  /** Public help page for the default PR polling invocation. */
3
- export declare const DEFAULT_USAGE = "pr-shepherd [PR]\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit same-repository PR set.\nAggregate mode returns when any row needs work, every row is terminal, or timeout.\nWhen CLAUDE_CODE_REMOTE=true, the command runs one tick like iterate and prints nextCheck instead.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. TRIAGE starts a --debounce settle window (default:\npoll.debounce-seconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\nOnly one live process polls a PR at a time. A PR another process already watches is skipped and\nreported; when every requested PR is watched, the command exits 17 without polling. The report names the\nholder's PID and flags.\n\nUsage:\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n\nUse 'pr-shepherd stack PR' for a native GitHub stack.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m, for foreground waits).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n For background runs that wake the caller on exit; foreground waits use the bounded default.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quiet-status can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nTRIAGE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, TRIAGE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 17 WATCHED (every requested PR is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
3
+ export declare const DEFAULT_USAGE = "pr-shepherd [PR]\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit same-repository PR set.\nAggregate mode returns when any row needs work, every row is terminal, or timeout.\nWhen CLAUDE_CODE_REMOTE=true, the command runs one tick like iterate and prints nextCheck instead.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. TRIAGE starts a --debounce settle window (default:\npoll.debounce-seconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\nOnly one live process polls a PR at a time. A PR another process already watches is skipped and\nreported; when every requested PR is watched, the command exits 17 without polling. The report names the\nholder's PID and flags.\n\nUsage:\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n\nUse 'pr-shepherd stack PR' for a native GitHub stack.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m, for foreground waits).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n For background runs that wake the caller on exit; foreground waits use the bounded default.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quiet-status can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nTRIAGE debounce writes a remaining-seconds line to stderr. --timeout covers the debounce: the window ends at the poll deadline, and one last tick then returns the action it finds (TRIAGE while the work is still there).\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, TRIAGE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 17 WATCHED (every requested PR is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
4
4
  /** Public help page for `pr-shepherd stack`. */
5
5
  export declare const STACK_USAGE = "pr-shepherd stack\n\nShepherd every open PR in one PR's native GitHub stack, bottom to top. Each poll reads compact\nper-layer summaries and returns when a layer needs work, every layer is terminal, or timeout.\nSHEPHERD lists one-PR sessions to run before rerunning this command.\n--once, or CLAUDE_CODE_REMOTE=true, runs one aggregate tick and prints nextCheck instead of sleeping.\nOnly one live process polls a PR at a time (not with --once). A layer another process already\nwatches exits 17 and reports the holder's PID and flags.\n\nUsage:\n pr-shepherd stack PR [PR ...] [--once] [poll-flags] [iterate-flags]\n\nThe PRs you list are the layers you own (one PR owns only itself); a stack number (owner/repo#N) owns every\nlayer. A merge that would also land unlisted layers escalates instead. A bare number is a PR first, then a\nstack number. Refs that span several stacks fail with one command per stack.\n\nStack flags:\n --once Run one aggregate tick without sleeping; poll flags are ignored.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s) multiplied by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m, for foreground waits).\n --debounce <duration> Settle window after the first SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT until SHEPHERD, MERGE, CANCEL, or ESCALATE.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --merge Shepherd through readiness, then emit one merge that lands every owned layer.\n --merge-ready Merge the highest contiguous ready, owned prefix as layers become ready.\n --merge-through <PR> Merge up to and including this PR of the stack; layers above stay open.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\n\nExit codes:\n 0 CANCEL (every layer merged)\n 10 WAIT\n 13 ESCALATE\n 14 CANCEL (a layer closed without merging)\n 15 MERGE\n 16 SHEPHERD (run the listed one-PR sessions, then rerun this stack command)\n 17 WATCHED (a layer is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
@@ -85,7 +85,7 @@ Durations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's d
85
85
  for --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with
86
86
  an explicit unit (4.5m).
87
87
  Each WAIT tick writes a stderr line naming what it is waiting on by default; poll.quiet-status can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.
88
- TRIAGE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.
88
+ TRIAGE debounce writes a remaining-seconds line to stderr. --timeout covers the debounce: the window ends at the poll deadline, and one last tick then returns the action it finds (TRIAGE while the work is still there).
89
89
  With --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, TRIAGE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.
90
90
 
91
91
  Exit codes: same as iterate (the final tick's action/reason decides the 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 [PR ...] [--once] [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR ...] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd suggest [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR or an explicit same-repository set.\n stack Poll every open PR in one PR's native GitHub stack.\n iterate Run one tick for one PR or a same-repository set, and print nextCheck.\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n suggest Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n\nPolling flags (looping commands; in a Claude Code cloud session, CLAUDE_CODE_REMOTE=true, they run one tick like iterate):\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (stack only: run the listed one-PR sessions, then rerun the stack command)\n 17 WATCHED (polling commands only: another live pr-shepherd already watches every requested PR)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
1
+ export declare const TOP_USAGE = "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd stack PR [PR ...] [--once] [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR ...] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd suggest [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n pr-shepherd admin watch-status <PR> [--format text|json]\n\nCommands:\n [PR ...] Poll one PR or an explicit same-repository set.\n stack Poll every open PR in one PR's native GitHub stack.\n iterate Run one tick for one PR or a same-repository set, and print nextCheck.\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n suggest Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n admin watch-status Report, read-only, whether a live pr-shepherd watches a PR (exit 17 if so).\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n\nPolling flags (looping commands; in a Claude Code cloud session, CLAUDE_CODE_REMOTE=true, they run one tick like iterate):\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (stack only: run the listed one-PR sessions, then rerun the stack command)\n 17 WATCHED (polling commands: another live pr-shepherd already watches every requested PR; admin watch-status: a live pr-shepherd watches the PR, 0 when none does, 65 when its lock is unreadable)\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.";
@@ -18,6 +18,7 @@ Usage:
18
18
  pr-shepherd suggest [PR] --thread-id ID --message MSG [groups...]
19
19
  pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]
20
20
  pr-shepherd admin log-file [--format text|json]
21
+ pr-shepherd admin watch-status <PR> [--format text|json]
21
22
 
22
23
  Commands:
23
24
  [PR ...] Poll one PR or an explicit same-repository set.
@@ -34,6 +35,7 @@ Commands:
34
35
  playbook Print a playbook named by an instruction pointer.
35
36
  admin clean Remove pr-shepherd state files.
36
37
  admin log-file Print the per-worktree debug log path.
38
+ admin watch-status Report, read-only, whether a live pr-shepherd watches a PR (exit 17 if so).
37
39
 
38
40
  PR argument:
39
41
  PR may be a number, owner/repo#number, or a GitHub pull request URL.
@@ -77,7 +79,7 @@ Exit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).
77
79
  14 CANCEL (closed without merging)
78
80
  15 MERGE
79
81
  16 SHEPHERD (stack only: run the listed one-PR sessions, then rerun the stack command)
80
- 17 WATCHED (polling commands only: another live pr-shepherd already watches every requested PR)
82
+ 17 WATCHED (polling commands: another live pr-shepherd already watches every requested PR; admin watch-status: a live pr-shepherd watches the PR, 0 when none does, 65 when its lock is unreadable)
81
83
  See docs/exit-codes.md for the full sysexits.h error-code table.
82
84
 
83
85
  Duration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).
@@ -0,0 +1 @@
1
+ export declare const WATCH_STATUS_USAGE = "pr-shepherd admin watch-status\n\nReport whether a live pr-shepherd process watches a pull request. Read-only: it reads the\nwatcher lock only, starts no watcher, takes no lock, polls nothing, and makes no GitHub call.\n\nUsage:\n pr-shepherd admin watch-status <PR> [--format text|json]\n\nArguments:\n PR A number, owner/repo#number, or a GitHub pull request URL. Required;\n the current branch's pull request is not inferred.\n\nFlags:\n --format text|json Output Markdown text or JSON. Default: text.\n --help, -h Print this help and exit before any I/O.\n\nExit code: 17 when a live pr-shepherd watches the PR, 0 when none does, 65 when the lock file\nexists but is unreadable or not a valid lock (whether a watcher is live is then unknown; JSON\nprints \"unreadable\": true and no \"watched\"), 64 on a usage error.\nA lock whose process is gone counts as no watcher. Single-tick commands (iterate, apply, MCP)\nand cloud sessions take no lock, so they never show as watching.";
@@ -0,0 +1,21 @@
1
+ export const WATCH_STATUS_USAGE = `pr-shepherd admin watch-status
2
+
3
+ Report whether a live pr-shepherd process watches a pull request. Read-only: it reads the
4
+ watcher lock only, starts no watcher, takes no lock, polls nothing, and makes no GitHub call.
5
+
6
+ Usage:
7
+ pr-shepherd admin watch-status <PR> [--format text|json]
8
+
9
+ Arguments:
10
+ PR A number, owner/repo#number, or a GitHub pull request URL. Required;
11
+ the current branch's pull request is not inferred.
12
+
13
+ Flags:
14
+ --format text|json Output Markdown text or JSON. Default: text.
15
+ --help, -h Print this help and exit before any I/O.
16
+
17
+ Exit code: 17 when a live pr-shepherd watches the PR, 0 when none does, 65 when the lock file
18
+ exists but is unreadable or not a valid lock (whether a watcher is live is then unknown; JSON
19
+ prints "unreadable": true and no "watched"), 64 on a usage error.
20
+ A lock whose process is gone counts as no watcher. Single-tick commands (iterate, apply, MCP)
21
+ and cloud sessions take no lock, so they never show as watching.`;
@@ -1,5 +1,5 @@
1
1
  export declare const USAGE: {
2
- readonly default: "pr-shepherd [PR]\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit same-repository PR set.\nAggregate mode returns when any row needs work, every row is terminal, or timeout.\nWhen CLAUDE_CODE_REMOTE=true, the command runs one tick like iterate and prints nextCheck instead.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. TRIAGE starts a --debounce settle window (default:\npoll.debounce-seconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\nOnly one live process polls a PR at a time. A PR another process already watches is skipped and\nreported; when every requested PR is watched, the command exits 17 without polling. The report names the\nholder's PID and flags.\n\nUsage:\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n\nUse 'pr-shepherd stack PR' for a native GitHub stack.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m, for foreground waits).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n For background runs that wake the caller on exit; foreground waits use the bounded default.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quiet-status can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nTRIAGE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, TRIAGE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 17 WATCHED (every requested PR is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
2
+ readonly default: "pr-shepherd [PR]\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit same-repository PR set.\nAggregate mode returns when any row needs work, every row is terminal, or timeout.\nWhen CLAUDE_CODE_REMOTE=true, the command runs one tick like iterate and prints nextCheck instead.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. TRIAGE starts a --debounce settle window (default:\npoll.debounce-seconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\nOnly one live process polls a PR at a time. A PR another process already watches is skipped and\nreported; when every requested PR is watched, the command exits 17 without polling. The report names the\nholder's PID and flags.\n\nUsage:\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n\nUse 'pr-shepherd stack PR' for a native GitHub stack.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m, for foreground waits).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n For background runs that wake the caller on exit; foreground waits use the bounded default.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quiet-status can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nTRIAGE debounce writes a remaining-seconds line to stderr. --timeout covers the debounce: the window ends at the poll deadline, and one last tick then returns the action it finds (TRIAGE while the work is still there).\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, TRIAGE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 17 WATCHED (every requested PR is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
3
3
  readonly "apply merge": `pr-shepherd apply merge
4
4
 
5
5
  Submit one SHA-guarded asynchronous merge or enqueue request with REST.
@@ -142,8 +142,9 @@ Administrative state and diagnostics commands.
142
142
  Usage:
143
143
  pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]
144
144
  pr-shepherd admin log-file [--format text|json]
145
+ pr-shepherd admin watch-status <PR> [--format text|json]
145
146
 
146
- Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
147
+ Run 'pr-shepherd admin <clean|log-file|watch-status> --help' for command-specific details.
147
148
  --help, -h Print this help and exit before any I/O.`;
148
149
  readonly "admin clean": `pr-shepherd admin clean
149
150
 
@@ -162,6 +163,7 @@ Use --dry-run to preview paths without removing them.
162
163
  When CLAUDE_CODE_REMOTE=true, state is the durable copy under the git common directory.
163
164
  --help, -h Print this help and exit before any cleanup.`;
164
165
  readonly "admin log-file": "pr-shepherd admin log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd admin log-file [--format text|json]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n CLAUDE_CODE_REMOTE=true reports the durable log under the git common directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
166
+ readonly "admin watch-status": "pr-shepherd admin watch-status\n\nReport whether a live pr-shepherd process watches a pull request. Read-only: it reads the\nwatcher lock only, starts no watcher, takes no lock, polls nothing, and makes no GitHub call.\n\nUsage:\n pr-shepherd admin watch-status <PR> [--format text|json]\n\nArguments:\n PR A number, owner/repo#number, or a GitHub pull request URL. Required;\n the current branch's pull request is not inferred.\n\nFlags:\n --format text|json Output Markdown text or JSON. Default: text.\n --help, -h Print this help and exit before any I/O.\n\nExit code: 17 when a live pr-shepherd watches the PR, 0 when none does, 65 when the lock file\nexists but is unreadable or not a valid lock (whether a watcher is live is then unknown; JSON\nprints \"unreadable\": true and no \"watched\"), 64 on a usage error.\nA lock whose process is gone counts as no watcher. Single-tick commands (iterate, apply, MCP)\nand cloud sessions take no lock, so they never show as watching.";
165
167
  readonly iterate: "pr-shepherd iterate\n\nRun one tick and return without sleeping. The no-subcommand form polls; use this subcommand when the\ncaller owns the next wake-up. One PR prints one action and an action-specific ## Instructions section.\nSeveral same-repository PRs print one aggregate summary. Unless nothing remains to wait for, the output\ncarries nextCheck: when to rerun if no GitHub event arrives first.\n\nUsage:\n pr-shepherd iterate [PR ...] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --layers <list> Set by the commands a partly owned stack prints. Open layers as pr:position:o|u:branch (branch percent-encoded); a one-PR session then never prints a whole-stack rebase or push.\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n TRIAGE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed, ready-delay elapsed, or a clean draft left in draft because auto mark-ready is disabled. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
166
168
  readonly stack: "pr-shepherd stack\n\nShepherd every open PR in one PR's native GitHub stack, bottom to top. Each poll reads compact\nper-layer summaries and returns when a layer needs work, every layer is terminal, or timeout.\nSHEPHERD lists one-PR sessions to run before rerunning this command.\n--once, or CLAUDE_CODE_REMOTE=true, runs one aggregate tick and prints nextCheck instead of sleeping.\nOnly one live process polls a PR at a time (not with --once). A layer another process already\nwatches exits 17 and reports the holder's PID and flags.\n\nUsage:\n pr-shepherd stack PR [PR ...] [--once] [poll-flags] [iterate-flags]\n\nThe PRs you list are the layers you own (one PR owns only itself); a stack number (owner/repo#N) owns every\nlayer. A merge that would also land unlisted layers escalates instead. A bare number is a PR first, then a\nstack number. Refs that span several stacks fail with one command per stack.\n\nStack flags:\n --once Run one aggregate tick without sleeping; poll flags are ignored.\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s) multiplied by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m, for foreground waits).\n --debounce <duration> Settle window after the first SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT until SHEPHERD, MERGE, CANCEL, or ESCALATE.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --merge Shepherd through readiness, then emit one merge that lands every owned layer.\n --merge-ready Merge the highest contiguous ready, owned prefix as layers become ready.\n --merge-through <PR> Merge up to and including this PR of the stack; layers above stay open.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\n\nExit codes:\n 0 CANCEL (every layer merged)\n 10 WAIT\n 13 ESCALATE\n 14 CANCEL (a layer closed without merging)\n 15 MERGE\n 16 SHEPHERD (run the listed one-PR sessions, then rerun this stack command)\n 17 WATCHED (a layer is already watched by another live pr-shepherd)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
167
169
  readonly "journal extract": `pr-shepherd journal extract
@@ -192,7 +194,7 @@ Flags:
192
194
  The name is case-insensitive; spaces and hyphens are equivalent ("Triage loop" and triage-loop match).
193
195
  Unknown names exit 64 and list the available playbooks.
194
196
  --help, -h Print this help and exit before any I/O.`;
195
- readonly top: "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd stack PR [PR ...] [--once] [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR ...] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd suggest [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR or an explicit same-repository set.\n stack Poll every open PR in one PR's native GitHub stack.\n iterate Run one tick for one PR or a same-repository set, and print nextCheck.\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n suggest Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n\nPolling flags (looping commands; in a Claude Code cloud session, CLAUDE_CODE_REMOTE=true, they run one tick like iterate):\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (stack only: run the listed one-PR sessions, then rerun the stack command)\n 17 WATCHED (polling commands only: another live pr-shepherd already watches every requested PR)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
197
+ readonly top: "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd stack PR [PR ...] [--once] [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR ...] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd suggest [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|stack|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n pr-shepherd admin watch-status <PR> [--format text|json]\n\nCommands:\n [PR ...] Poll one PR or an explicit same-repository set.\n stack Poll every open PR in one PR's native GitHub stack.\n iterate Run one tick for one PR or a same-repository set, and print nextCheck.\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n suggest Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n admin watch-status Report, read-only, whether a live pr-shepherd watches a PR (exit 17 if so).\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Default: iterate.ready-delay-minutes (built-in 0). Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Leave draft PRs in draft; stop when otherwise ready.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render triage steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n\nPolling flags (looping commands; in a Claude Code cloud session, CLAUDE_CODE_REMOTE=true, they run one tick like iterate):\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.interval-seconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stack-interval-factor (built-in 2) unless this flag is set.\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeout-seconds (built-in 4.5m).\n --debounce <duration> Settle window after first TRIAGE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounce-seconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quiet-status.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quiet-status.\n --until-terminal Continue through WAIT/MARK_READY until READY/TRIAGE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged, ready-delay elapsed, or clean draft left in draft by disabled auto mark-ready)\n 10 WAIT or READY\n 11 MARK_READY\n 12 TRIAGE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (stack only: run the listed one-PR sessions, then rerun the stack command)\n 17 WATCHED (polling commands: another live pr-shepherd already watches every requested PR; admin watch-status: a live pr-shepherd watches the PR, 0 when none does, 65 when its lock is unreadable)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
196
198
  };
197
199
  /** Resolve help keys for nested public commands before any command I/O. */
198
200
  export declare function helpKeyForArgs(args: string[]): keyof typeof USAGE;
package/bin/cli/help.mjs CHANGED
@@ -25,6 +25,8 @@ export function helpKeyForArgs(args) {
25
25
  return "admin clean";
26
26
  if (args[0] === "admin" && args[1] === "log-file")
27
27
  return "admin log-file";
28
+ if (args[0] === "admin" && args[1] === "watch-status")
29
+ return "admin watch-status";
28
30
  if (args[0] != null && args[0] in USAGE) {
29
31
  return args[0];
30
32
  }
@@ -2,10 +2,5 @@ import type { IterateResult } from "../types.mts";
2
2
  interface IterateProjectionOptions {
3
3
  readyDelaySuffix?: string;
4
4
  }
5
- /**
6
- * Project an IterateResult to a lean JSON shape for the default (non-verbose) output.
7
- * Omits fields that are the trivial default (false, 0, empty) or state-gated fields
8
- * outside the state where they are meaningful.
9
- */
10
5
  export declare function projectIterateLean(result: IterateResult, opts?: IterateProjectionOptions): unknown;
11
6
  export { projectIterateVerbose } from "./iterate-verbose.mts";
@@ -10,6 +10,13 @@ import { capList } from "../util/cap-list.mjs";
10
10
  * Omits fields that are the trivial default (false, 0, empty) or state-gated fields
11
11
  * outside the state where they are meaningful.
12
12
  */
13
+ /** A re-surfaced review showed its body on an earlier tick, so it carries none. */
14
+ function leanChangesRequestedReview(review) {
15
+ if (review.staleBotCr !== true)
16
+ return review;
17
+ const { body: _body, ...rest } = review;
18
+ return rest;
19
+ }
13
20
  export function projectIterateLean(result, opts) {
14
21
  const readyDelaySuffix = opts?.readyDelaySuffix;
15
22
  const simpleInstructions = (r) => buildSimpleIterateInstructions(r);
@@ -179,7 +186,7 @@ export function projectIterateLean(result, opts) {
179
186
  ...(result.triage.stalledChecks && { stalledChecks: result.triage.stalledChecks }),
180
187
  ...(result.triage.inProgressRuns && { inProgressRuns: result.triage.inProgressRuns }),
181
188
  ...(result.triage.changesRequestedReviews.length > 0 && {
182
- changesRequestedReviews: result.triage.changesRequestedReviews,
189
+ changesRequestedReviews: result.triage.changesRequestedReviews.map(leanChangesRequestedReview),
183
190
  }),
184
191
  resolveCommand: result.triage.resolveCommand,
185
192
  ...(result.triage.resolveOnlyCommand && {
@@ -209,7 +216,7 @@ export function projectIterateLean(result, opts) {
209
216
  ambiguousComments: result.escalate.ambiguousComments,
210
217
  }),
211
218
  ...(result.escalate.changesRequestedReviews.length > 0 && {
212
- changesRequestedReviews: result.escalate.changesRequestedReviews,
219
+ changesRequestedReviews: result.escalate.changesRequestedReviews.map(leanChangesRequestedReview),
213
220
  }),
214
221
  ...(result.escalate.firstLookSummaries &&
215
222
  result.escalate.firstLookSummaries.length > 0 && {
@@ -52,11 +52,12 @@ function formatItem(item) {
52
52
  const queuePolicy = item.requiresMergeQueue !== undefined
53
53
  ? ` · merge queue ${item.requiresMergeQueue ? "required" : "not required"}`
54
54
  : "";
55
+ const linearHistory = item.requiresLinearHistory ? " · linear history required" : "";
55
56
  const checks = item.checks;
56
57
  const review = item.review;
57
58
  return [
58
59
  `- [PR #${item.pr}: ${escapeMarkdownText(item.title)}](${item.url}) [${item.action.toUpperCase()}]`,
59
- ` - state \`${item.state}\` · mergeable \`${item.mergeable}\` · merge \`${item.mergeStateStatus}\`${reviewDecision}${stateFlags}${blockingReviewer}${readyDelay}${readyReceipt}${queuePolicy}${stack}`,
60
+ ` - state \`${item.state}\` · mergeable \`${item.mergeable}\` · merge \`${item.mergeStateStatus}\`${reviewDecision}${stateFlags}${blockingReviewer}${readyDelay}${readyReceipt}${queuePolicy}${linearHistory}${stack}`,
60
61
  ` - head \`${item.headRefName}\` at \`${item.headRefOid}\` · base \`${item.baseRefName}\``,
61
62
  ...(checks
62
63
  ? [` - checks: ${formatCounts(checks, checks.incomplete ? ", incomplete" : "")}`]
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Caps a review body at `maxChars` of GitHub-visible text (`0` disables the cap). An over-cap body
3
+ * keeps a head and a tail around a notice that names the review ID and the cap, and gives the
4
+ * command that prints the full text. A body within the cap is returned unchanged.
5
+ */
6
+ export declare function capReviewBody<T extends {
7
+ id: string;
8
+ body: string;
9
+ url?: string;
10
+ }>(review: T, maxChars: number): T;