pr-shepherd 0.37.0 → 0.37.1

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
3
  "description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
4
- "version": "0.37.0",
4
+ "version": "0.37.1",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
7
7
  "email": "jonathanrichardong@gmail.com"
package/README.md CHANGED
@@ -29,11 +29,11 @@ The MCP server exposes three tools: `iterate`, `apply`, and `build_suggestion_pa
29
29
 
30
30
  Each tick returns exactly one action:
31
31
 
32
- - `WAIT` — no immediate action; poll can recheck until timeout.
33
- - `MARK_READY` — the CLI already converted an eligible draft PR to ready for review.
34
- - `FIX_CODE` — review items, failing CI, conflicts, or minimization work need agent action.
35
- - `CANCEL` — terminal success for merged/closed PRs or elapsed ready-delay.
36
- - `ESCALATE` — manual direction is needed.
32
+ - `WAIT` — no immediate action; continue with the next poll.
33
+ - `MARK_READY` — the CLI converted an eligible draft PR to ready; continue polling.
34
+ - `FIX_CODE` — agent work is required; complete it, then continue polling.
35
+ - `CANCEL` — stop polling because the PR merged, closed, or completed its ready-delay.
36
+ - `ESCALATE` — stop polling until a human provides direction.
37
37
 
38
38
  Example shape:
39
39
 
@@ -65,10 +65,12 @@ Conversations Resolved: No [Not Required]
65
65
 
66
66
  ## Instructions
67
67
 
68
- 1. Decide for each item under `## Review threads` and `## Failing checks` whether a code change is warranted. If code changes are needed, apply edits, commit, push, then run the `apply review:` command.
69
- 2. For each failing check under `## Failing checks`: fetch logs when needed and decide whether to rerun or fix.
70
- 3. Run the `apply review:` command shown above, substituting `$HEAD_SHA` and `$DISMISS_MESSAGE`.
71
- 4. Stop this iteration.
68
+ 1. Review each item under `## Review threads` and `## Failing checks` and decide whether it needs a code change.
69
+ 2. Apply every warranted review fix in each file referenced above.
70
+ 3. Read the included CI log excerpt; fetch the full log if needed, then rerun transient failures or fix real failures.
71
+ 4. If you changed code, commit any remaining changes and push before review mutations. Otherwise, do not commit or push.
72
+ 5. Replace `$HEAD_SHA` and `$DISMISS_MESSAGE`, then run the `apply review:` command shown above.
73
+ 6. `[FIX_CODE]` is non-terminal. Continue with the next poll using the same CLI mode and flags, or call MCP `iterate` again.
72
74
  ```
73
75
 
74
76
  See [docs/actions.md](docs/actions.md) for the complete output contract. Iterate/poll PR outcomes use exit codes `0` and `10`–`14`; command and GitHub failures use `sysexits.h` codes — [docs/exit-codes.md](docs/exit-codes.md).
@@ -176,7 +176,7 @@ Flags:
176
176
 
177
177
  PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
178
178
  Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
179
- readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\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 code action; run another iterate tick later.\n MARK_READY Draft PR was marked ready for review.\n FIX_CODE Apply fixes, commit, push, and run the printed apply command.\n CANCEL Terminal state: merged/closed or ready-delay elapsed.\n ESCALATE Terminal state requiring human direction.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
179
+ readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\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 FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling: merged/closed or ready-delay elapsed.\n ESCALATE Stop polling until a human provides direction.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
180
180
  readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for WAIT ticks and during the FIX_CODE debounce window. Print only the\nfinal tick to stdout.\nPoll exits as soon as iterate returns MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR] [poll-flags] [iterate-flags]\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: 60s.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: 4.5m.\n --debounce <duration> Settle window after first FIX_CODE before returning. Bare number = seconds. Default: 60s. 0 disables.\n --quiet-status During WAIT polling, print only changed status snapshots.\n --until-terminal Continue through WAIT/MARK_READY until FIX_CODE/CANCEL/ESCALATE.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\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 single dot to stderr by default; --quiet-status prints only changed WAIT snapshots, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until FIX_CODE, CANCEL, or ESCALATE.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
181
181
  readonly clean: `pr-shepherd clean
182
182
 
@@ -1,4 +1,4 @@
1
- export declare const ITERATE_USAGE = "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\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 code action; run another iterate tick later.\n MARK_READY Draft PR was marked ready for review.\n FIX_CODE Apply fixes, commit, push, and run the printed apply command.\n CANCEL Terminal state: merged/closed or ready-delay elapsed.\n ESCALATE Terminal state requiring human direction.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
1
+ export declare const ITERATE_USAGE = "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\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 FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling: merged/closed or ready-delay elapsed.\n ESCALATE Stop polling until a human provides direction.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
2
2
  export declare const POLL_USAGE = "pr-shepherd poll\n\nRun iterate repeatedly for WAIT ticks and during the FIX_CODE debounce window. Print only the\nfinal tick to stdout.\nPoll exits as soon as iterate returns MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR] [poll-flags] [iterate-flags]\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: 60s.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: 4.5m.\n --debounce <duration> Settle window after first FIX_CODE before returning. Bare number = seconds. Default: 60s. 0 disables.\n --quiet-status During WAIT polling, print only changed status snapshots.\n --until-terminal Continue through WAIT/MARK_READY until FIX_CODE/CANCEL/ESCALATE.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\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 single dot to stderr by default; --quiet-status prints only changed WAIT snapshots, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until FIX_CODE, CANCEL, or ESCALATE.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
3
3
  /** Public help page for the default PR polling invocation. */
4
4
  export declare const DEFAULT_USAGE: string;
@@ -18,11 +18,11 @@ Iterate flags:
18
18
  Durations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).
19
19
 
20
20
  Actions:
21
- WAIT No immediate code action; run another iterate tick later.
22
- MARK_READY Draft PR was marked ready for review.
23
- FIX_CODE Apply fixes, commit, push, and run the printed apply command.
24
- CANCEL Terminal state: merged/closed or ready-delay elapsed.
25
- ESCALATE Terminal state requiring human direction.
21
+ WAIT No immediate action; continue with the next poll.
22
+ MARK_READY Draft PR was marked ready; continue with the next poll.
23
+ FIX_CODE Agent action is required; follow the instructions, then continue polling.
24
+ CANCEL Stop polling: merged/closed or ready-delay elapsed.
25
+ ESCALATE Stop polling until a human provides direction.
26
26
 
27
27
  Exit codes:
28
28
  0 CANCEL (merged or ready-delay elapsed)
@@ -176,7 +176,7 @@ Flags:
176
176
 
177
177
  PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
178
178
  Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
179
- readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\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 code action; run another iterate tick later.\n MARK_READY Draft PR was marked ready for review.\n FIX_CODE Apply fixes, commit, push, and run the printed apply command.\n CANCEL Terminal state: merged/closed or ready-delay elapsed.\n ESCALATE Terminal state requiring human direction.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
179
+ readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\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 FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling: merged/closed or ready-delay elapsed.\n ESCALATE Stop polling until a human provides direction.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
180
180
  readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for WAIT ticks and during the FIX_CODE debounce window. Print only the\nfinal tick to stdout.\nPoll exits as soon as iterate returns MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR] [poll-flags] [iterate-flags]\n\nPoll flags:\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: 60s.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: 4.5m.\n --debounce <duration> Settle window after first FIX_CODE before returning. Bare number = seconds. Default: 60s. 0 disables.\n --quiet-status During WAIT polling, print only changed status snapshots.\n --until-terminal Continue through WAIT/MARK_READY until FIX_CODE/CANCEL/ESCALATE.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Do not cancel in-progress runs before actionable fixes.\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 single dot to stderr by default; --quiet-status prints only changed WAIT snapshots, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until FIX_CODE, CANCEL, or ESCALATE.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
181
181
  readonly clean: `pr-shepherd clean
182
182
 
@@ -1,17 +1,17 @@
1
1
  export function buildSimpleIterateInstructions(result) {
2
2
  switch (result.action) {
3
3
  case "wait":
4
- return ["No action this tick — the poll loop reruns automatically."];
4
+ return [
5
+ "No action is needed this tick. Continue with the next poll using the same interface and mode: rerun the current `pr-shepherd` CLI invocation with its flags, or call MCP `iterate` again.",
6
+ ];
5
7
  case "mark_ready":
6
8
  return [
7
- "The CLI already marked the PR ready for review. No further action this tick the poll loop reruns automatically.",
9
+ "The CLI marked the PR ready for review. Continue with the next poll using the same interface and mode: rerun the current `pr-shepherd` CLI invocation with its flags, or call MCP `iterate` again.",
8
10
  ];
9
11
  case "cancel":
10
- return ["Stop — the active goal is complete."];
12
+ return ["Stop — the PR loop is complete. No further polling is needed."];
11
13
  case "escalate":
12
- return [
13
- "Stop — the PR needs human direction before iterating can resume. This is a manual handoff; do not continue automated fix attempts.",
14
- ];
14
+ return ["Stop — human direction is required before automated polling can resume."];
15
15
  }
16
16
  }
17
17
  export function adaptIterateLog(log) {
@@ -5,4 +5,4 @@
5
5
  * e.g. `"## Review threads"`.
6
6
  * @param includeDriftHint - Whether to add the trailing note about drift on failed apply.
7
7
  */
8
- export declare function buildCommitSuggestionInstruction(prNumber: number, sectionName: string, includeDriftHint: boolean): string;
8
+ export declare function buildCommitSuggestionInstruction(prNumber: number, sectionName: string, includeDriftHint: boolean): string[];
@@ -17,7 +17,12 @@ export function buildCommitSuggestionInstruction(prNumber, sectionName, includeD
17
17
  "--format=json",
18
18
  ]).text;
19
19
  const driftHint = includeDriftHint
20
- ? " If the patch fails to apply (drift since the suggestion was written), fall through to the manual fix step."
21
- : " If the patch fails to apply, fall through to the manual-edit step.";
22
- return `For each thread marked \`[suggestion]\` under \`${sectionName}\`: run \`${command}\` to retrieve the patch and suggested commit. The CLI does not mutate the working tree — apply the patch yourself (run \`git apply\` with the diff shown, or edit the file directly using the line range), then stage the listed file and run the suggested \`git commit\` from the \`## Instructions\` section. Human-authored thread IDs are replied to by the apply command below; Shepherd does not auto-resolve them.${driftHint} Do not retry the same command.`;
20
+ ? "If the patch does not apply because the suggestion drifted, use the manual-fix step below. Do not retry the command."
21
+ : "If the patch does not apply, use the manual-edit step below. Do not retry the command.";
22
+ return [
23
+ `For each thread marked \`[suggestion]\` under \`${sectionName}\`, run \`${command}\` to retrieve its patch and suggested commit.`,
24
+ "The CLI only builds the patch. Apply it, stage the listed file, and follow the returned commit instructions.",
25
+ driftHint,
26
+ "Keep human-authored thread IDs in `apply review:` so Shepherd replies instead of resolving them.",
27
+ ];
23
28
  }
@@ -14,3 +14,4 @@ export declare function buildBehindBaseHintInstruction(baseBranch: string, hint:
14
14
  /** Build the `Run the apply review: command` instruction, including its optional substitution hint. */
15
15
  export declare function buildResolveCommandInstruction(resolveCommand: ResolveCommand): string[];
16
16
  export declare function buildFailingCheckInstructions(checks: AgentCheck[]): string[];
17
+ export declare function buildFixCompletionInstruction(checks: AgentCheck[]): string;
@@ -1,12 +1,9 @@
1
1
  /** Build the stale-CR clause appended to the `## Changes-requested reviews` instruction. */
2
2
  export function buildCrStaleClause(reviews) {
3
- const bot = reviews.some((r) => r.staleBotCr)
4
- ? " `[pending dismissal — already surfaced]` bullets are bot CRs from a prior tick."
5
- : "";
6
3
  const human = reviews.some((r) => r.staleReview && !r.staleBotCr)
7
- ? " `[stale]` bullets are human CRs on an old commit; ask reviewer to re-review."
4
+ ? " `[stale]` bullets are human CRs on an old commit. Ask the reviewer to re-review."
8
5
  : "";
9
- return bot + human;
6
+ return human;
10
7
  }
11
8
  /**
12
9
  * Build the optional behind-base push hint. Empty unless the branch is actually behind its base
@@ -21,7 +18,7 @@ export function buildBehindBaseHintInstruction(baseBranch, hint, isBehind) {
21
18
  const trimmedHint = typeof hint === "string" ? hint.trim() : "";
22
19
  if (!isBehind || trimmedHint === "")
23
20
  return [];
24
- return [`The branch is behind \`origin/${baseBranch}\` ${trimmedHint} before pushing.`];
21
+ return [`The branch is behind \`origin/${baseBranch}\`. ${trimmedHint} before pushing.`];
25
22
  }
26
23
  /** Build the `Run the apply review: command` instruction, including its optional substitution hint. */
27
24
  export function buildResolveCommandInstruction(resolveCommand) {
@@ -29,17 +26,15 @@ export function buildResolveCommandInstruction(resolveCommand) {
29
26
  return [];
30
27
  const instructions = [];
31
28
  if ((resolveCommand.replyThreadIds?.length ?? 0) > 0) {
32
- instructions.push(`Before running the \`apply review:\` command, remove any thread from \`--reply-thread-ids\` if the latest visible comment in that thread is your own prior Shepherd reply. Do not reply to your own comments.`);
29
+ instructions.push("Before `apply review:`, remove any `--reply-thread-ids` entry whose latest visible comment is your own Shepherd reply. Do not reply to yourself.");
33
30
  }
34
- const substituteParts = [];
35
31
  if (resolveCommand.requiresHeadSha) {
36
- substituteParts.push(`\`$HEAD_SHA\` with the pushed commit SHA (or \`$(git rev-parse HEAD)\` if you did not push)`);
32
+ instructions.push("Replace `$HEAD_SHA` with the pushed commit SHA, or `$(git rev-parse HEAD)` if you did not push.");
37
33
  }
38
34
  if (resolveCommand.requiresDismissMessage) {
39
- substituteParts.push(`\`$DISMISS_MESSAGE\` with a one-sentence reply/description of what you changed`);
35
+ instructions.push("Replace `$DISMISS_MESSAGE` with one sentence describing what changed.");
40
36
  }
41
- const substituteHint = substituteParts.length > 0 ? `, substituting ${substituteParts.join(" and ")}` : "";
42
- instructions.push(`Run the \`apply review:\` command shown above${substituteHint}.`);
37
+ instructions.push("Run the `apply review:` command shown above.");
43
38
  return instructions;
44
39
  }
45
40
  export function buildFailingCheckInstructions(checks) {
@@ -50,21 +45,28 @@ export function buildFailingCheckInstructions(checks) {
50
45
  const hasStartupFailure = checks.some((c) => c.runId && c.conclusion === "STARTUP_FAILURE");
51
46
  const hasExternal = checks.some((c) => !c.runId && c.detailsUrl);
52
47
  const hasBare = checks.some((c) => !c.runId && !c.detailsUrl);
53
- const parts = [];
48
+ const instructions = [];
54
49
  if (hasRunId) {
55
- parts.push("read any included log excerpt first; fetch the full log with `gh run view <runId> --log-failed` if insufficient; rerun with `gh run rerun <runId> --failed` for transient infra failures, or apply a code fix for real test/build failures; if API/log output lacks detail, open the run URL in the GitHub UI");
50
+ instructions.push("For each GitHub Actions failure under `## Failing checks`, read the included log excerpt first.", "If the excerpt is insufficient, run `gh run view <runId> --log-failed`. Open the run URL only if the API still lacks detail.", "Rerun transient infrastructure failures with `gh run rerun <runId> --failed`. Apply a code fix for real test or build failures.");
56
51
  }
57
52
  if (hasCancelled) {
58
- parts.push("for `[conclusion: CANCELLED]` entries (not concurrency-superseded — see `**superseded**`): rerun with `gh run rerun <runId>` unless already pushing new commits this tick, in which case the fresh run supersedes it; don't treat as resolved — distinct from `## Cancelled runs`");
53
+ instructions.push("For each `[conclusion: CANCELLED]` failure, run `gh run rerun <runId>` unless this tick will push new commits.", "Do not treat a cancelled failure as resolved. `## Cancelled runs` is a different section.");
59
54
  }
60
55
  if (hasStartupFailure) {
61
- parts.push("for `[conclusion: STARTUP_FAILURE]` entries: inspect with `gh run view <runId>`, rerun with `gh run rerun <runId>` if warranted");
56
+ instructions.push("For each `[conclusion: STARTUP_FAILURE]` failure, inspect it with `gh run view <runId>` and rerun it with `gh run rerun <runId>` if warranted.");
62
57
  }
63
58
  if (hasExternal) {
64
- parts.push("for `external` entries: open the URL to inspect the failure");
59
+ instructions.push("For each `external` failure, open its URL and inspect it.");
65
60
  }
66
61
  if (hasBare) {
67
- parts.push("for `(no runId)` entries: no log or URL available — escalate to a human");
62
+ instructions.push("For each `(no runId)` failure, escalate to a human because no log or URL is available.");
63
+ }
64
+ return instructions;
65
+ }
66
+ export function buildFixCompletionInstruction(checks) {
67
+ const requiresHumanHandoff = checks.some((check) => !check.runId && !check.detailsUrl);
68
+ if (requiresHumanHandoff) {
69
+ return "`[FIX_CODE]` requires a human handoff for an uninspectable failing check. Stop polling after escalating, and resume only after human direction.";
68
70
  }
69
- return [`For each failing check under \`## Failing checks\`: ${parts.join("; ")}.`];
71
+ return "`[FIX_CODE]` is non-terminal. After completing these steps, continue with the next poll using the same interface and mode: rerun the current `pr-shepherd` CLI invocation with its flags, or call MCP `iterate` again.";
70
72
  }
@@ -1,9 +1,8 @@
1
1
  import { renderShellCommand } from "../../cli/runner.mjs";
2
- import { buildFailingCheckInstructions, buildCrStaleClause, buildBehindBaseHintInstruction, buildResolveCommandInstruction, } from "./check-instructions.mjs";
2
+ import { buildFailingCheckInstructions, buildCrStaleClause, buildBehindBaseHintInstruction, buildResolveCommandInstruction, buildFixCompletionInstruction, } from "./check-instructions.mjs";
3
3
  import { SHEPHERD_JOURNAL_FIRST_LOOK_GUIDANCE, SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS, buildShepherdJournalInstruction, } from "../shepherd-journal.mjs";
4
4
  import { isFailingAgentCheck } from "../../checks/conclusions.mjs";
5
5
  import { buildCommitSuggestionInstruction } from "../commit-suggestion-instruction.mjs";
6
- const FIX_INSTRUCTION_STOP = "Stop this iteration — if you pushed new commits, CI needs time before the next tick; otherwise stop before the next tick.";
7
6
  /** Render a resolve command as a shell snippet. Appends `--require-sha "$HEAD_SHA"` when set. */
8
7
  export function renderResolveCommand(rc) {
9
8
  const parts = [...rc.argv];
@@ -21,7 +20,7 @@ isBehind = false) {
21
20
  hasAnnotations ||
22
21
  changesRequestedReviews.length > 0 ||
23
22
  actionableComments.length > 0;
24
- // Leading decision or mandatory instruction depending on what actionable items exist.
23
+ // Start with interpretation. The agent decides what raw feedback warrants a code change.
25
24
  if (hasNonConflictHints) {
26
25
  const actionableSections = [];
27
26
  if (threads.length > 0)
@@ -36,74 +35,74 @@ isBehind = false) {
36
35
  if (changesRequestedReviews.length > 0)
37
36
  actionableSections.push("`## Changes-requested reviews`");
38
37
  const sectionRef = actionableSections.length > 0 ? `under ${actionableSections.join(", ")}` : "above";
39
- const resolveClause = resolveCommand.hasMutations
40
- ? ", then run the `apply review:` command"
41
- : "";
42
- if (hasConflicts) {
43
- // Conflicts make push mandatory regardless of whether code edits are needed.
44
- instructions.push(`The branch has merge conflicts that must be resolved before merging (see \`**branch**\` above). Apply any code edits for items ${sectionRef}, then commit and push${resolveClause}.`);
45
- }
46
- else {
47
- const skipClause = resolveCommand.hasMutations
48
- ? "skip the commit/push and run the `apply review:` command"
49
- : "no push is needed";
50
- instructions.push(`Decide for each item ${sectionRef} whether a code change is warranted. **If any code changes are needed:** apply edits, commit, push${resolveClause}. **If no code changes are needed:** ${skipClause}.`);
51
- }
38
+ instructions.push(`Review each item ${sectionRef} and decide whether it needs a code change.`);
52
39
  }
53
- else if (hasConflicts) {
54
- instructions.push(`The branch has merge conflicts that must be resolved before merging (see \`**branch**\` above). Resolve them and push.`);
40
+ if (hasConflicts) {
41
+ instructions.push("The branch has merge conflicts (see `**branch**` above). Resolve them before committing and pushing.");
42
+ }
43
+ const firstLookTotal = firstLookThreads.length + firstLookComments.length;
44
+ if (firstLookTotal > 0) {
45
+ instructions.push("Review every item under `## First-look items` before acting.", "If a first-look thread also appears under `## Review threads to resolve`, its ID is already in `apply review:`. Do not add first-look-only IDs to mutation flags.");
46
+ }
47
+ if (firstLookSummaries.length > 0)
48
+ instructions.push(SHEPHERD_JOURNAL_FIRST_LOOK_GUIDANCE);
49
+ const editedTotal = editedSummaries.length +
50
+ actionableComments.filter((c) => c.edited).length +
51
+ firstLookThreads.filter((t) => t.edited).length +
52
+ firstLookComments.filter((c) => c.edited).length;
53
+ if (editedTotal > 0) {
54
+ instructions.push("Read every item marked `[edited since first look]`, including edited summaries and edited first-look bullets, before deciding whether to resolve a matching thread.");
55
55
  }
56
- instructions.push(...buildBehindBaseHintInstruction(baseBranch, behindBaseHint, isBehind));
57
56
  if (inProgressRunIds.length > 0) {
58
- instructions.push(`If you decide to push new commits: cancel each in-progress run listed under \`## In-progress runs\` before applying code fixes (e.g. \`gh run cancel <id>\`). Runs may complete between the tick and your action; treat cancellation errors on already-finished runs as non-fatal. Skip this step if you are only resolving threads without pushing — the existing runs remain relevant.`);
57
+ instructions.push("If you will push, first cancel every ID under `## In-progress runs` with `gh run cancel <id>`.", "Ignore cancellation errors for runs that already finished.", "If you will not push, leave the in-progress runs alone.");
58
+ }
59
+ if (cancelledCount > 0) {
60
+ instructions.push("Do not cancel the IDs under `## Cancelled runs` again. The CLI already cancelled them.");
59
61
  }
60
62
  const hasSuggestions = threads.some((t) => t.suggestion);
61
63
  if (hasSuggestions)
62
- instructions.push(buildCommitSuggestionInstruction(prNumber, "## Review threads", false));
64
+ instructions.push(...buildCommitSuggestionInstruction(prNumber, "## Review threads", false));
63
65
  if (threads.length > 0 || actionableComments.length > 0) {
64
66
  // Actionable comments carry no file/line location (unlike threads), so "referenced above"
65
67
  // is only accurate when threads are present.
66
68
  const filesRef = threads.length > 0 ? "each file referenced above" : "the relevant files";
67
- const suggestionFallback = hasSuggestions
68
- ? ` When applying a \`[suggestion]\` thread manually (e.g. after a failed \`build-suggestion-patch\` run), replace the exact line range shown in the heading (\`path:startLine-endLine\`) with the replacement shown in its \`Replaces lines …\` block verbatim — an empty replacement deletes those lines, a single blank line replaces the range with one blank line.`
69
- : "";
70
- instructions.push(`Apply code fixes: read and edit ${filesRef}.${suggestionFallback}`);
69
+ instructions.push(`Apply every warranted review fix in ${filesRef}.`);
70
+ if (hasSuggestions) {
71
+ instructions.push("For a manual `[suggestion]` fix, replace the heading's exact `path:startLine-endLine` range with the `Replaces lines …` block verbatim. An empty replacement deletes the range. One blank line replaces it with one blank line.");
72
+ }
71
73
  }
72
74
  if (resolutionOnlyThreads.length > 0) {
73
- instructions.push(`Review the threads under \`## Review threads to resolve\`. Human-authored threads are replied to by the \`apply review:\` command shown below; Shepherd does not resolve them. Bot/non-human threads are included in \`--resolve-thread-ids\`.`);
75
+ instructions.push("Review the threads under `## Review threads to resolve` before running mutations.", "Use the generated commands as shown. Human-authored IDs use `--reply-thread-ids`. Bot and non-human IDs use `--resolve-thread-ids`. Shepherd does not resolve human-authored threads.");
74
76
  }
75
77
  instructions.push(...buildFailingCheckInstructions(failingChecks));
76
78
  if (hasAnnotations) {
77
- instructions.push(`For each item under \`## Check annotations\`: inspect the referenced file range and decide whether the annotation requires a code change. These annotations are surfaced once per PR and do not need any resolve/minimize mutation.`);
79
+ instructions.push("Inspect every referenced range under `## Check annotations` and apply any warranted change.", "Do not add annotation IDs to resolve or minimize mutations.");
78
80
  }
79
81
  if (changesRequestedReviews.length > 0) {
80
82
  const staleClause = buildCrStaleClause(changesRequestedReviews);
81
- instructions.push(`For each bullet under \`## Changes-requested reviews\` above: read the review body and apply the requested changes.${staleClause}`);
83
+ instructions.push(`Read every body under \`## Changes-requested reviews\` and apply any warranted change.${staleClause}`);
82
84
  if ((resolveCommand.dismissReviewIds?.length ?? 0) > 0)
83
- instructions.push(`Pass every ID listed in \`--dismiss-review-ids\` to the \`apply review:\` command verbatim these are bot/non-human CR reviews that the agent (not the author) must dismiss. Dropping an ID leaves the PR in \`CHANGES_REQUESTED\` state; the next tick re-surfaces it as \`[pending dismissal]\` and an unattended bot CR escalates after \`iterate.stallTimeoutMinutes\`.`);
85
+ instructions.push("Keep every existing `--dismiss-review-ids` ID in `apply review:`. Each is a bot or non-human review that must be dismissed. Omitting one leaves the PR in `CHANGES_REQUESTED`.");
84
86
  }
85
- if (resolveOnlyCommand?.hasMutations)
86
- instructions.push(`Run the \`resolve-only:\` command shown above no substitutions needed.`);
87
- instructions.push(...buildResolveCommandInstruction(resolveCommand));
88
- if (cancelledCount > 0) {
89
- instructions.push(`Do not re-run \`gh run cancel\` on the IDs listed under \`## Cancelled runs\` — those runs were already cancelled by the CLI before this turn.`);
90
- }
91
- const firstLookTotal = firstLookThreads.length + firstLookComments.length;
92
- if (firstLookTotal > 0) {
93
- instructions.push(`Items in \`## First-look items\` are shown so you can acknowledge their current status before acting. If a first-look thread also appears under \`## Review threads to resolve\`, its ID is already included in the \`apply review:\` command; otherwise do not pass first-look-only IDs to mutation flags.`);
87
+ instructions.push(...buildBehindBaseHintInstruction(baseBranch, behindBaseHint, isBehind));
88
+ const hasReviewMutations = resolveCommand.hasMutations || resolveOnlyCommand?.hasMutations === true;
89
+ const mutationSuffix = hasReviewMutations ? " before review mutations" : "";
90
+ if (hasConflicts) {
91
+ instructions.push(`Commit any remaining changes and push the conflict resolution${mutationSuffix}.`);
94
92
  }
95
- if (firstLookSummaries.length > 0)
96
- instructions.push(SHEPHERD_JOURNAL_FIRST_LOOK_GUIDANCE);
97
- const editedTotal = editedSummaries.length +
98
- actionableComments.filter((c) => c.edited).length +
99
- firstLookThreads.filter((t) => t.edited).length +
100
- firstLookComments.filter((c) => c.edited).length;
101
- if (editedTotal > 0) {
102
- instructions.push(`Items marked \`[edited since first look]\`, items under \`## Review summaries (edited since first look)\`, and any first-look bullet tagged \`, edited\` were updated by their author after you previously acknowledged them. Read the updated body before deciding whether any matching \`## Review threads to resolve\` item should be resolved.`);
93
+ else if (hasNonConflictHints) {
94
+ instructions.push(`If you changed code, commit any remaining changes and push${mutationSuffix}. Otherwise, do not commit or push.`);
103
95
  }
104
- if (resolveCommand.hasMutations || hasNonConflictHints || firstLookTotal > 0) {
105
- instructions.push(buildShepherdJournalInstruction(prNumber, SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS));
96
+ if (hasReviewMutations ||
97
+ hasNonConflictHints ||
98
+ firstLookTotal > 0 ||
99
+ firstLookSummaries.length > 0 ||
100
+ editedTotal > 0) {
101
+ instructions.push(...buildShepherdJournalInstruction(prNumber, SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS));
106
102
  }
107
- instructions.push(FIX_INSTRUCTION_STOP);
103
+ if (resolveOnlyCommand?.hasMutations)
104
+ instructions.push("Run the `resolve-only:` command shown above.");
105
+ instructions.push(...buildResolveCommandInstruction(resolveCommand));
106
+ instructions.push(buildFixCompletionInstruction(failingChecks));
108
107
  return instructions;
109
108
  }
@@ -1,7 +1,7 @@
1
1
  export declare const SHEPHERD_JOURNAL_SECTION = "## Shepherd Journal";
2
2
  export declare const SHEPHERD_JOURNAL_SECTION_PATTERN: RegExp;
3
3
  export declare const SHEPHERD_JOURNAL_APPEND_HINT = "If this section already exists, append your entries under it instead of creating a duplicate heading.";
4
- export declare const SHEPHERD_JOURNAL_FIRST_LOOK_GUIDANCE = "Review the bodies shown under `## Review summaries (first look)` \u2014 you are seeing these for the first time. Eligible non-human IDs, when present, are already included in `--minimize-comment-ids` in the `apply review:` or `resolve-only:` command above; if any warrants a Shepherd Journal note, append it before applying review mutations.";
5
- export declare function buildShepherdJournalInstruction(prNumber: number, itemReferenceGuidance: string): string;
6
- export declare const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS = "For threads and comments, use the markdown link shown in its heading above; for reviews, reference the review ID.";
7
- export declare const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEMS = "For threads and comments, use the markdown link shown in each item's bullet above; for reviews, reference the review ID.";
4
+ export declare const SHEPHERD_JOURNAL_FIRST_LOOK_GUIDANCE = "Review each body under `## Review summaries (first look)`. Eligible non-human IDs are already in `--minimize-comment-ids`. Record any warranted Shepherd Journal note before review mutations.";
5
+ export declare function buildShepherdJournalInstruction(prNumber: number, itemReferenceGuidance: string): string[];
6
+ export declare const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS = "Link threads and comments from their headings. Cite reviews by ID.";
7
+ export declare const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEMS = "Link threads and comments from their item bullets. Cite reviews by ID.";
@@ -1,13 +1,12 @@
1
1
  export const SHEPHERD_JOURNAL_SECTION = "## Shepherd Journal";
2
2
  export const SHEPHERD_JOURNAL_SECTION_PATTERN = /^##\s+Shepherd\s+Journal$/;
3
3
  export const SHEPHERD_JOURNAL_APPEND_HINT = "If this section already exists, append your entries under it instead of creating a duplicate heading.";
4
- export const SHEPHERD_JOURNAL_FIRST_LOOK_GUIDANCE = "Review the bodies shown under `## Review summaries (first look)` — you are seeing these for the first time. Eligible non-human IDs, when present, are already included in `--minimize-comment-ids` in the `apply review:` or `resolve-only:` command above; if any warrants a Shepherd Journal note, append it before applying review mutations.";
4
+ export const SHEPHERD_JOURNAL_FIRST_LOOK_GUIDANCE = "Review each body under `## Review summaries (first look)`. Eligible non-human IDs are already in `--minimize-comment-ids`. Record any warranted Shepherd Journal note before review mutations.";
5
5
  export function buildShepherdJournalInstruction(prNumber, itemReferenceGuidance) {
6
6
  return [
7
- `For any large decisions or rejections you made this iteration, run \`pr-shepherd apply journal ${prNumber} '- <decision>'\` to append an entry to the \`${SHEPHERD_JOURNAL_SECTION}\` section.`,
7
+ `For any substantial decision or rejection, append \`- <decision>\` to \`${SHEPHERD_JOURNAL_SECTION}\` with \`pr-shepherd apply journal ${prNumber} '- <decision>'\`.`,
8
8
  itemReferenceGuidance,
9
- `The command is idempotent — re-running with the same text is a no-op.`,
10
- ].join(" ");
9
+ ];
11
10
  }
12
- export const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS = "For threads and comments, use the markdown link shown in its heading above; for reviews, reference the review ID.";
13
- export const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEMS = "For threads and comments, use the markdown link shown in each item's bullet above; for reviews, reference the review ID.";
11
+ export const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS = "Link threads and comments from their headings. Cite reviews by ID.";
12
+ export const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEMS = "Link threads and comments from their item bullets. Cite reviews by ID.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
5
5
  "keywords": [
6
6
  "automation",
@@ -82,7 +82,7 @@
82
82
  "@vitest/coverage-v8": "^4.1.4",
83
83
  "husky": "^9.1.7",
84
84
  "knip": "^6.14.1",
85
- "oxfmt": "^0.62.0",
85
+ "oxfmt": "^0.63.0",
86
86
  "oxlint": "^1.60.0",
87
87
  "typescript": "^7.0.2",
88
88
  "vitest": "^4.1.4"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.37.0",
3
+ "version": "0.37.1",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for Codex.",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
@@ -2,7 +2,7 @@
2
2
  "mcpServers": {
3
3
  "pr-shepherd": {
4
4
  "command": "npx",
5
- "args": ["--yes", "--package", "pr-shepherd@0.37.0", "pr-shepherd-mcp"]
5
+ "args": ["--yes", "--package", "pr-shepherd@0.37.1", "pr-shepherd-mcp"]
6
6
  }
7
7
  }
8
8
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "pr-shepherd": {
3
3
  "command": "npx",
4
- "args": ["--yes", "--package", "pr-shepherd@0.37.0", "pr-shepherd-mcp"]
4
+ "args": ["--yes", "--package", "pr-shepherd@0.37.1", "pr-shepherd-mcp"]
5
5
  }
6
6
  }
@@ -16,4 +16,6 @@ Thin dispatcher for iterating a PR. Poll with the CLI; use MCP `iterate` only wh
16
16
 
17
17
  2. Run the poll command `pr-shepherd` with the optional PR argument and print its full result. Do not run `pr-shepherd iterate`. If the CLI is unavailable and the `iterate` MCP tool is available, call `iterate` and print its full result.
18
18
 
19
- 3. Follow the returned instructions exactly. If this tick used MCP `iterate`, use MCP `apply` and `build_suggestion_patch` for the returned review mutations and suggestion patches — do not run a `pr-shepherd apply` shell command. If this tick used the CLI poll, run the printed apply command. After completing an action, run `pr-shepherd` again (or call `iterate` if only MCP is available) until a terminal action or the human directs you to stop.
19
+ 3. Print the full result and follow every returned `## Instructions` step exactly. For CLI output, run each printed mutation command when instructed. For MCP output, use MCP `apply` and `build_suggestion_patch`; do not run a shell `pr-shepherd apply` command.
20
+
21
+ 4. After completing the returned instructions, repeat step 2 unless the action is `[CANCEL]` or `[ESCALATE]`, the instructions require a human handoff, or the human directs you to stop.