pr-shepherd 0.36.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.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +11 -9
- package/bin/checks/conclusions.d.mts +6 -0
- package/bin/checks/conclusions.mjs +9 -0
- package/bin/cli/fix-formatter.mjs +4 -2
- package/bin/cli/help-command-pages.d.mts +1 -1
- package/bin/cli/help-iterate-poll-pages.d.mts +1 -1
- package/bin/cli/help-iterate-poll-pages.mjs +5 -5
- package/bin/cli/help.d.mts +1 -1
- package/bin/cli/iterate-instructions.mjs +6 -6
- package/bin/commands/check-annotations.d.mts +16 -3
- package/bin/commands/check-annotations.mjs +37 -1
- package/bin/commands/check.mjs +9 -6
- package/bin/commands/commit-suggestion-instruction.d.mts +1 -1
- package/bin/commands/commit-suggestion-instruction.mjs +8 -3
- package/bin/commands/iterate/check-instructions.d.mts +1 -0
- package/bin/commands/iterate/check-instructions.mjs +21 -19
- package/bin/commands/iterate/fix-code.mjs +12 -5
- package/bin/commands/iterate/index.mjs +2 -0
- package/bin/commands/iterate/render.mjs +57 -54
- package/bin/commands/iterate/stall.mjs +5 -0
- package/bin/commands/shepherd-journal.d.mts +4 -4
- package/bin/commands/shepherd-journal.mjs +5 -6
- package/bin/github/batch-parser-helpers.mjs +1 -0
- package/bin/github/batch-raw-types.d.mts +5 -0
- package/bin/github/gql/batch-pr-page.gql +5 -0
- package/bin/github/gql/batch-pr.gql +5 -0
- package/bin/reporters/agent.mjs +0 -3
- package/bin/types/check-classification.d.mts +2 -2
- package/bin/types/github.d.mts +2 -0
- package/bin/types/report.d.mts +5 -5
- package/package.json +2 -2
- package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
- package/plugins/pr-shepherd/.codex.mcp.json +1 -1
- package/plugins/pr-shepherd/.mcp.json +1 -1
- package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +3 -1
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;
|
|
33
|
-
- `MARK_READY` — the CLI
|
|
34
|
-
- `FIX_CODE` —
|
|
35
|
-
- `CANCEL` —
|
|
36
|
-
- `ESCALATE` —
|
|
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.
|
|
69
|
-
2.
|
|
70
|
-
3.
|
|
71
|
-
4.
|
|
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).
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CheckConclusion } from "../types.mts";
|
|
2
|
+
/** Failing-check rows for formatter/instructions — excludes annotation-only carriers. */
|
|
3
|
+
export declare function isFailingAgentCheck(check: {
|
|
4
|
+
conclusion: CheckConclusion;
|
|
5
|
+
annotationOnly?: boolean;
|
|
6
|
+
}): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const NON_FAILING_CONCLUSIONS = new Set(["SUCCESS", "SKIPPED", "NEUTRAL"]);
|
|
2
|
+
/** True for conclusions that belong under `## Failing checks` (not success/skipped/neutral). */
|
|
3
|
+
function isFailingCheckConclusion(conclusion) {
|
|
4
|
+
return conclusion == null || !NON_FAILING_CONCLUSIONS.has(conclusion);
|
|
5
|
+
}
|
|
6
|
+
/** Failing-check rows for formatter/instructions — excludes annotation-only carriers. */
|
|
7
|
+
export function isFailingAgentCheck(check) {
|
|
8
|
+
return !check.annotationOnly && isFailingCheckConclusion(check.conclusion);
|
|
9
|
+
}
|
|
@@ -4,6 +4,7 @@ import { renderSuggestionBlock, renderLineRange } from "./suggestion-renderer.mj
|
|
|
4
4
|
import { renderThreadBullet, renderReviewBullet, renderThreadResolutionStatusTag, renderAuthor, buildFirstLookBullets, renderThreadConversation, blockquote, } from "./list-formatters.mjs";
|
|
5
5
|
import { numberInstructions } from "./iterate-instructions.mjs";
|
|
6
6
|
import { renderCheckAnnotation, renderProtectedRun } from "./fix-formatter-extra.mjs";
|
|
7
|
+
import { isFailingAgentCheck } from "../checks/conclusions.mjs";
|
|
7
8
|
export function formatFixCodeResult(header, result) {
|
|
8
9
|
const sections = [header];
|
|
9
10
|
if (result.fix.threads.length > 0) {
|
|
@@ -37,9 +38,10 @@ export function formatFixCodeResult(header, result) {
|
|
|
37
38
|
sections.push(blockquote(c.body));
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
+
const failingChecks = result.fix.checks.filter((ch) => isFailingAgentCheck(ch));
|
|
42
|
+
if (failingChecks.length > 0) {
|
|
41
43
|
sections.push("## Failing checks");
|
|
42
|
-
const bullets =
|
|
44
|
+
const bullets = failingChecks.map((ch) => {
|
|
43
45
|
const workflowPrefix = ch.workflowName ? `${ch.workflowName} › ` : "";
|
|
44
46
|
const jobLabel = ch.jobName ? ch.jobName : ch.name;
|
|
45
47
|
const locator = ch.runId
|
|
@@ -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
|
|
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
|
|
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
|
|
22
|
-
MARK_READY Draft PR was marked ready
|
|
23
|
-
FIX_CODE
|
|
24
|
-
CANCEL
|
|
25
|
-
ESCALATE
|
|
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)
|
package/bin/cli/help.d.mts
CHANGED
|
@@ -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
|
|
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 [
|
|
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
|
|
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
|
|
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) {
|
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
import type { CheckAnnotation, TriagedCheck } from "../types.mts";
|
|
2
|
-
export declare function
|
|
1
|
+
import type { CheckAnnotation, ClassifiedCheck, ShepherdReport, TriagedCheck } from "../types.mts";
|
|
2
|
+
export declare function checksWithUnseenAnnotations(report: ShepherdReport): TriagedCheck[];
|
|
3
|
+
export declare function attachAndMergeCheckAnnotations(buckets: {
|
|
4
|
+
passing: ClassifiedCheck[];
|
|
5
|
+
failing: TriagedCheck[];
|
|
6
|
+
skipped: ClassifiedCheck[];
|
|
7
|
+
filtered: ClassifiedCheck[];
|
|
8
|
+
ignored: ClassifiedCheck[];
|
|
9
|
+
}, seenMap: Map<string, {
|
|
3
10
|
seenAt: number;
|
|
4
|
-
}>, prNumber: number): Promise<
|
|
11
|
+
}>, prNumber: number): Promise<{
|
|
12
|
+
passing: ClassifiedCheck[];
|
|
13
|
+
failing: TriagedCheck[];
|
|
14
|
+
skipped: ClassifiedCheck[];
|
|
15
|
+
filtered: ClassifiedCheck[];
|
|
16
|
+
ignored: ClassifiedCheck[];
|
|
17
|
+
}>;
|
|
5
18
|
export declare function annotationMarkerBody(a: CheckAnnotation): string;
|
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
import { fetchCheckRunAnnotations } from "../github/check-annotations.mjs";
|
|
2
|
-
|
|
2
|
+
function shouldFetchCheckAnnotations(check) {
|
|
3
|
+
return check.id != null && check.status === "COMPLETED" && check.hasAnnotations === true;
|
|
4
|
+
}
|
|
5
|
+
export function checksWithUnseenAnnotations(report) {
|
|
6
|
+
return [
|
|
7
|
+
...report.checks.failing,
|
|
8
|
+
...report.checks.passing,
|
|
9
|
+
...report.checks.skipped,
|
|
10
|
+
...report.checks.filtered,
|
|
11
|
+
...(report.checks.ignored ?? []),
|
|
12
|
+
].filter((c) => (c.annotations?.length ?? 0) > 0);
|
|
13
|
+
}
|
|
14
|
+
export async function attachAndMergeCheckAnnotations(buckets, seenMap, prNumber) {
|
|
15
|
+
const candidates = [
|
|
16
|
+
...buckets.failing,
|
|
17
|
+
...buckets.passing,
|
|
18
|
+
...buckets.skipped,
|
|
19
|
+
...buckets.filtered,
|
|
20
|
+
...buckets.ignored,
|
|
21
|
+
].filter(shouldFetchCheckAnnotations);
|
|
22
|
+
const annotated = await attachUnseenCheckAnnotations(candidates, seenMap, prNumber);
|
|
23
|
+
const byId = new Map(annotated.flatMap((c) => (c.id != null ? [[c.id, c]] : [])));
|
|
24
|
+
const apply = (list) => list.map((c) => {
|
|
25
|
+
if (c.id == null)
|
|
26
|
+
return c;
|
|
27
|
+
const next = byId.get(c.id);
|
|
28
|
+
return next !== undefined ? next : c;
|
|
29
|
+
});
|
|
30
|
+
return {
|
|
31
|
+
passing: apply(buckets.passing),
|
|
32
|
+
failing: apply(buckets.failing),
|
|
33
|
+
skipped: apply(buckets.skipped),
|
|
34
|
+
filtered: apply(buckets.filtered),
|
|
35
|
+
ignored: apply(buckets.ignored),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async function attachUnseenCheckAnnotations(checks, seenMap, prNumber) {
|
|
3
39
|
const checksWithAnnotations = [];
|
|
4
40
|
for (const check of checks) {
|
|
5
41
|
// eslint-disable-next-line no-await-in-loop
|
package/bin/commands/check.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { deriveMergeStatus } from "../merge-status/derive.mjs";
|
|
|
7
7
|
import { loadConfig } from "../config/load.mjs";
|
|
8
8
|
import { classifyVisibleComments } from "../comments/visible-comments.mjs";
|
|
9
9
|
import { computeStatus } from "./check-status.mjs";
|
|
10
|
-
import {
|
|
10
|
+
import { attachAndMergeCheckAnnotations } from "./check-annotations.mjs";
|
|
11
11
|
import { buildTerminalReport } from "./check-terminal-report.mjs";
|
|
12
12
|
import { isBlockedByFilteredCheck, refreshReadyMergeability, refreshUnknownMergeability, } from "./ready-mergeability.mjs";
|
|
13
13
|
import { loadSeenMap, markSeen, classifyItem } from "../state/seen-comments.mjs";
|
|
@@ -49,6 +49,7 @@ export async function runCheck(opts) {
|
|
|
49
49
|
const inProgress = classifiedChecks.filter((c) => c.category === "in_progress");
|
|
50
50
|
const skipped = classifiedChecks.filter((c) => c.category === "skipped");
|
|
51
51
|
const filtered = classifiedChecks.filter((c) => c.category === "filtered");
|
|
52
|
+
const ignored = classifiedChecks.filter((c) => c.category === "ignored");
|
|
52
53
|
const triagedBase = failing.length > 0 && !opts.skipTriage ? await triageFailingChecks(failing, repo) : failing;
|
|
53
54
|
const stateKey = { owner: repo.owner, repo: repo.name, pr: prNumber };
|
|
54
55
|
const seenMap = await loadSeenMap(stateKey);
|
|
@@ -56,7 +57,8 @@ export async function runCheck(opts) {
|
|
|
56
57
|
const ruleSet = await loadRules(discoverRuleFiles(getEffectiveCwd()));
|
|
57
58
|
const classifyIndex = buildClassifyIndex(ruleSet, batchData);
|
|
58
59
|
const partition = partitionBatch(classifyIndex, batchData);
|
|
59
|
-
const
|
|
60
|
+
const merged = await attachAndMergeCheckAnnotations({ passing, failing: triagedBase, skipped, filtered, ignored }, seenMap, prNumber);
|
|
61
|
+
const ignoredAnnotated = merged.ignored.filter((c) => (c.annotations?.length ?? 0) > 0);
|
|
60
62
|
const minimizedCommentCandidates = batchData.comments.filter((c) => c.isMinimized && !partition.suppressedCommentIds.has(c.id));
|
|
61
63
|
const visibleCommentClassification = classifyVisibleComments(batchData.comments.filter((c) => !partition.suppressedCommentIds.has(c.id)), seenMap, config.iterate.minimizeComments, botUsernames);
|
|
62
64
|
const threadVisibility = classifyThreadVisibility(batchData.reviewThreads.filter((t) => !partition.suppressedThreadIds.has(t.id)), seenMap, botUsernames);
|
|
@@ -125,11 +127,12 @@ export async function runCheck(opts) {
|
|
|
125
127
|
baseBranch: batchData.baseRefName,
|
|
126
128
|
mergeStatus,
|
|
127
129
|
checks: {
|
|
128
|
-
passing,
|
|
129
|
-
failing:
|
|
130
|
+
passing: merged.passing,
|
|
131
|
+
failing: merged.failing,
|
|
130
132
|
inProgress: inProgress,
|
|
131
|
-
skipped,
|
|
132
|
-
filtered,
|
|
133
|
+
skipped: merged.skipped,
|
|
134
|
+
filtered: merged.filtered,
|
|
135
|
+
...(ignoredAnnotated.length > 0 && { ignored: ignoredAnnotated }),
|
|
133
136
|
filteredNames: verdict.filteredNames,
|
|
134
137
|
blockedByFilteredCheck,
|
|
135
138
|
...(verdict.ignoredNames.length > 0 && { ignoredNames: verdict.ignoredNames }),
|
|
@@ -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
|
-
? "
|
|
21
|
-
: "
|
|
22
|
-
return
|
|
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
|
|
4
|
+
? " `[stale]` bullets are human CRs on an old commit. Ask the reviewer to re-review."
|
|
8
5
|
: "";
|
|
9
|
-
return
|
|
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}
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
35
|
+
instructions.push("Replace `$DISMISS_MESSAGE` with one sentence describing what changed.");
|
|
40
36
|
}
|
|
41
|
-
|
|
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
|
|
48
|
+
const instructions = [];
|
|
54
49
|
if (hasRunId) {
|
|
55
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
59
|
+
instructions.push("For each `external` failure, open its URL and inspect it.");
|
|
65
60
|
}
|
|
66
61
|
if (hasBare) {
|
|
67
|
-
|
|
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 [`
|
|
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
|
}
|
|
@@ -8,7 +8,7 @@ import { buildResolveCommand } from "./classify.mjs";
|
|
|
8
8
|
import { buildFixInstructions } from "./render.mjs";
|
|
9
9
|
import { applyStallGuard } from "./stall.mjs";
|
|
10
10
|
import { tryCancelRun, buildAutoCancelRunIdsWithOptions, buildInProgressRunIds, buildRunProtection, } from "./helpers.mjs";
|
|
11
|
-
import { annotationMarkerBody } from "../check-annotations.mjs";
|
|
11
|
+
import { annotationMarkerBody, checksWithUnseenAnnotations } from "../check-annotations.mjs";
|
|
12
12
|
import { threadTranscriptBody } from "../../threads/transcript.mjs";
|
|
13
13
|
import { isHumanAuthor, isConfiguredBotAuthor } from "../../comments/authors.mjs";
|
|
14
14
|
import { loadConfig } from "../../config/load.mjs";
|
|
@@ -30,6 +30,7 @@ function nextFixAttempts(stored, headSha, threads) {
|
|
|
30
30
|
export async function handleFixCode(ctx) {
|
|
31
31
|
const { base, report, opts, headSha, stallKey, prNumber, stallTimeoutSeconds, repoOwner, repoName, reviewSummaryIds, firstLookSummaries, editedSummaries, surfacedApprovals, botUsernames, ruleAutoResolveThreadIds, } = ctx;
|
|
32
32
|
const failingChecks = report.checks.failing;
|
|
33
|
+
const annotatedExtra = checksWithUnseenAnnotations(report).filter((c) => c.category !== "failing");
|
|
33
34
|
const { protectedRunIds, protectedRuns } = buildRunProtection([...failingChecks, ...report.checks.inProgress], opts.neverCancelRuns);
|
|
34
35
|
const stored = await readFixAttempts({ owner: repoOwner, repo: repoName, pr: prNumber });
|
|
35
36
|
const { threadAttempts, threadBodyHashes } = nextFixAttempts(stored, headSha, report.threads.actionable);
|
|
@@ -89,7 +90,11 @@ export async function handleFixCode(ctx) {
|
|
|
89
90
|
const threads = report.threads.actionable.map(toAgentThread);
|
|
90
91
|
const resolutionOnlyThreads = report.threads.resolutionOnly;
|
|
91
92
|
const actionableComments = report.comments.actionable.map(toAgentComment);
|
|
92
|
-
const
|
|
93
|
+
const failingAgentChecks = toAgentChecks(failingChecks);
|
|
94
|
+
const checks = [
|
|
95
|
+
...failingAgentChecks,
|
|
96
|
+
...toAgentChecks(annotatedExtra).map((c) => ({ ...c, annotationOnly: true })),
|
|
97
|
+
];
|
|
93
98
|
const { changesRequestedReviews } = report;
|
|
94
99
|
const hasConflicts = report.mergeStatus.status === "CONFLICTS";
|
|
95
100
|
const isBehind = report.mergeStatus.status === "BEHIND";
|
|
@@ -98,7 +103,8 @@ export async function handleFixCode(ctx) {
|
|
|
98
103
|
// summary-only iterations have no path to a push, so listing runs would prompt
|
|
99
104
|
// unnecessary cancellation.
|
|
100
105
|
const pushLikely = threads.length > 0 ||
|
|
101
|
-
|
|
106
|
+
failingAgentChecks.length > 0 ||
|
|
107
|
+
annotatedExtra.length > 0 ||
|
|
102
108
|
hasConflicts ||
|
|
103
109
|
changesRequestedReviews.length > 0 ||
|
|
104
110
|
actionableComments.length > 0;
|
|
@@ -110,13 +116,14 @@ export async function handleFixCode(ctx) {
|
|
|
110
116
|
: [];
|
|
111
117
|
const commentMinimizeIds = report.comments.minimizeIds ?? actionableComments.map((c) => c.id);
|
|
112
118
|
const allCommentIds = [...commentMinimizeIds, ...reviewSummaryIds];
|
|
113
|
-
const { resolveCommand, resolveOnlyCommand } = buildResolveCommand(threads, resolutionOnlyThreads, allCommentIds, changesRequestedReviews,
|
|
119
|
+
const { resolveCommand, resolveOnlyCommand } = buildResolveCommand(threads, resolutionOnlyThreads, allCommentIds, changesRequestedReviews, failingAgentChecks, prNumber, botUsernames, ruleAutoResolveThreadIds);
|
|
114
120
|
// Safety: if the base branch is unknown, escalate when a push is plausible — the agent
|
|
115
121
|
// would need the correct base to rebase safely. This is a conservative guard, not a
|
|
116
122
|
// prediction that the agent *will* push. Intentionally broader than `pushLikely` above:
|
|
117
123
|
// resolution-only threads also need a known base in case the agent does push.
|
|
118
124
|
const pushIsPlausible = threads.length > 0 ||
|
|
119
|
-
|
|
125
|
+
failingAgentChecks.length > 0 ||
|
|
126
|
+
annotatedExtra.length > 0 ||
|
|
120
127
|
hasConflicts ||
|
|
121
128
|
changesRequestedReviews.length > 0 ||
|
|
122
129
|
actionableComments.length > 0 ||
|
|
@@ -12,6 +12,7 @@ import { clearStallState } from "../../state/iterate-stall.mjs";
|
|
|
12
12
|
import { handleFixCode } from "./fix-code.mjs";
|
|
13
13
|
import { normalizeBotUsernames } from "../../comments/authors.mjs";
|
|
14
14
|
import { autoMinimizeComments } from "../../comments/resolve.mjs";
|
|
15
|
+
import { checksWithUnseenAnnotations } from "../check-annotations.mjs";
|
|
15
16
|
export async function runIterate(opts) {
|
|
16
17
|
const config = loadConfig();
|
|
17
18
|
const botUsernames = normalizeBotUsernames(config.botUsernames);
|
|
@@ -69,6 +70,7 @@ export async function runIterate(opts) {
|
|
|
69
70
|
report.comments.firstLook.length > 0 ||
|
|
70
71
|
report.changesRequestedReviews.length > 0 ||
|
|
71
72
|
report.checks.failing.length > 0 ||
|
|
73
|
+
checksWithUnseenAnnotations(report).length > 0 ||
|
|
72
74
|
report.mergeStatus.status === "CONFLICTS" ||
|
|
73
75
|
reviewSummaryIds.length > 0 ||
|
|
74
76
|
firstLookSummaries.length > 0 ||
|
|
@@ -1,8 +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
|
+
import { isFailingAgentCheck } from "../../checks/conclusions.mjs";
|
|
4
5
|
import { buildCommitSuggestionInstruction } from "../commit-suggestion-instruction.mjs";
|
|
5
|
-
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.";
|
|
6
6
|
/** Render a resolve command as a shell snippet. Appends `--require-sha "$HEAD_SHA"` when set. */
|
|
7
7
|
export function renderResolveCommand(rc) {
|
|
8
8
|
const parts = [...rc.argv];
|
|
@@ -13,93 +13,96 @@ export function renderResolveCommand(rc) {
|
|
|
13
13
|
export function buildFixInstructions(threads, actionableComments, checks, changesRequestedReviews, baseBranch, resolveCommand, hasConflicts, prNumber, cancelledCount, firstLookThreads = [], firstLookComments = [], firstLookSummaries = [], editedSummaries = [], inProgressRunIds = [], resolutionOnlyThreads = [], resolveOnlyCommand, behindBaseHint = "", // iterate.behindBaseHint — see buildBehindBaseHintInstruction
|
|
14
14
|
isBehind = false) {
|
|
15
15
|
const instructions = [];
|
|
16
|
+
const failingChecks = checks.filter((c) => isFailingAgentCheck(c));
|
|
17
|
+
const hasAnnotations = checks.some((c) => (c.annotations?.length ?? 0) > 0);
|
|
16
18
|
const hasNonConflictHints = threads.length > 0 ||
|
|
17
|
-
|
|
19
|
+
failingChecks.length > 0 ||
|
|
20
|
+
hasAnnotations ||
|
|
18
21
|
changesRequestedReviews.length > 0 ||
|
|
19
22
|
actionableComments.length > 0;
|
|
20
|
-
//
|
|
23
|
+
// Start with interpretation. The agent decides what raw feedback warrants a code change.
|
|
21
24
|
if (hasNonConflictHints) {
|
|
22
25
|
const actionableSections = [];
|
|
23
26
|
if (threads.length > 0)
|
|
24
27
|
actionableSections.push("`## Review threads`");
|
|
25
28
|
if (actionableComments.length > 0)
|
|
26
29
|
actionableSections.push("`## Actionable comments`");
|
|
27
|
-
if (
|
|
30
|
+
if (failingChecks.length > 0)
|
|
28
31
|
actionableSections.push("`## Failing checks`");
|
|
29
|
-
if (
|
|
32
|
+
if (hasAnnotations) {
|
|
30
33
|
actionableSections.push("`## Check annotations`");
|
|
31
34
|
}
|
|
32
35
|
if (changesRequestedReviews.length > 0)
|
|
33
36
|
actionableSections.push("`## Changes-requested reviews`");
|
|
34
37
|
const sectionRef = actionableSections.length > 0 ? `under ${actionableSections.join(", ")}` : "above";
|
|
35
|
-
|
|
36
|
-
? ", then run the `apply review:` command"
|
|
37
|
-
: "";
|
|
38
|
-
if (hasConflicts) {
|
|
39
|
-
// Conflicts make push mandatory regardless of whether code edits are needed.
|
|
40
|
-
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}.`);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
const skipClause = resolveCommand.hasMutations
|
|
44
|
-
? "skip the commit/push and run the `apply review:` command"
|
|
45
|
-
: "no push is needed";
|
|
46
|
-
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}.`);
|
|
47
|
-
}
|
|
38
|
+
instructions.push(`Review each item ${sectionRef} and decide whether it needs a code change.`);
|
|
48
39
|
}
|
|
49
|
-
|
|
50
|
-
instructions.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.");
|
|
51
55
|
}
|
|
52
|
-
instructions.push(...buildBehindBaseHintInstruction(baseBranch, behindBaseHint, isBehind));
|
|
53
56
|
if (inProgressRunIds.length > 0) {
|
|
54
|
-
instructions.push(
|
|
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.");
|
|
55
61
|
}
|
|
56
62
|
const hasSuggestions = threads.some((t) => t.suggestion);
|
|
57
63
|
if (hasSuggestions)
|
|
58
|
-
instructions.push(buildCommitSuggestionInstruction(prNumber, "## Review threads", false));
|
|
64
|
+
instructions.push(...buildCommitSuggestionInstruction(prNumber, "## Review threads", false));
|
|
59
65
|
if (threads.length > 0 || actionableComments.length > 0) {
|
|
60
66
|
// Actionable comments carry no file/line location (unlike threads), so "referenced above"
|
|
61
67
|
// is only accurate when threads are present.
|
|
62
68
|
const filesRef = threads.length > 0 ? "each file referenced above" : "the relevant files";
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
: "
|
|
66
|
-
|
|
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
|
+
}
|
|
67
73
|
}
|
|
68
74
|
if (resolutionOnlyThreads.length > 0) {
|
|
69
|
-
instructions.push(
|
|
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.");
|
|
70
76
|
}
|
|
71
|
-
instructions.push(...buildFailingCheckInstructions(
|
|
72
|
-
if (
|
|
73
|
-
instructions.push(
|
|
77
|
+
instructions.push(...buildFailingCheckInstructions(failingChecks));
|
|
78
|
+
if (hasAnnotations) {
|
|
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.");
|
|
74
80
|
}
|
|
75
81
|
if (changesRequestedReviews.length > 0) {
|
|
76
82
|
const staleClause = buildCrStaleClause(changesRequestedReviews);
|
|
77
|
-
instructions.push(`
|
|
83
|
+
instructions.push(`Read every body under \`## Changes-requested reviews\` and apply any warranted change.${staleClause}`);
|
|
78
84
|
if ((resolveCommand.dismissReviewIds?.length ?? 0) > 0)
|
|
79
|
-
instructions.push(
|
|
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`.");
|
|
80
86
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (
|
|
85
|
-
instructions.push(`
|
|
86
|
-
}
|
|
87
|
-
const firstLookTotal = firstLookThreads.length + firstLookComments.length;
|
|
88
|
-
if (firstLookTotal > 0) {
|
|
89
|
-
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}.`);
|
|
90
92
|
}
|
|
91
|
-
if (
|
|
92
|
-
instructions.push(
|
|
93
|
-
const editedTotal = editedSummaries.length +
|
|
94
|
-
actionableComments.filter((c) => c.edited).length +
|
|
95
|
-
firstLookThreads.filter((t) => t.edited).length +
|
|
96
|
-
firstLookComments.filter((c) => c.edited).length;
|
|
97
|
-
if (editedTotal > 0) {
|
|
98
|
-
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.`);
|
|
99
95
|
}
|
|
100
|
-
if (
|
|
101
|
-
|
|
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));
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
if (resolveOnlyCommand?.hasMutations)
|
|
104
|
+
instructions.push("Run the `resolve-only:` command shown above.");
|
|
105
|
+
instructions.push(...buildResolveCommandInstruction(resolveCommand));
|
|
106
|
+
instructions.push(buildFixCompletionInstruction(failingChecks));
|
|
104
107
|
return instructions;
|
|
105
108
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { readStallState, writeStallState } from "../../state/iterate-stall.mjs";
|
|
2
2
|
import { toAgentThread, toAgentComment, toAgentStalledCheck } from "../../reporters/agent.mjs";
|
|
3
3
|
import { buildEscalateSuggestion, buildEscalateHumanMessage, formatDurationApprox, } from "./escalate.mjs";
|
|
4
|
+
import { checksWithUnseenAnnotations } from "../check-annotations.mjs";
|
|
4
5
|
function computeStallFingerprint(action, headSha, base, report, reviewSummaryIds) {
|
|
5
6
|
const checks = [
|
|
6
7
|
...report.checks.failing.map((f) => `failing:${f.name}:${f.conclusion}`),
|
|
@@ -13,6 +14,9 @@ function computeStallFingerprint(action, headSha, base, report, reviewSummaryIds
|
|
|
13
14
|
const reviews = report.changesRequestedReviews.map((r) => r.id).sort();
|
|
14
15
|
const summaries = [...reviewSummaryIds].sort();
|
|
15
16
|
const ruleAutoResolveSummaries = (report.ruleAutoResolveReviewSummaryIds ?? []).sort((a, b) => a.localeCompare(b));
|
|
17
|
+
const annotations = checksWithUnseenAnnotations(report)
|
|
18
|
+
.flatMap((c) => (c.annotations ?? []).map((a) => a.id))
|
|
19
|
+
.sort((a, b) => a.localeCompare(b));
|
|
16
20
|
return JSON.stringify({
|
|
17
21
|
action,
|
|
18
22
|
headSha,
|
|
@@ -28,6 +32,7 @@ function computeStallFingerprint(action, headSha, base, report, reviewSummaryIds
|
|
|
28
32
|
reviews,
|
|
29
33
|
summaries,
|
|
30
34
|
ruleAutoResolveSummaries,
|
|
35
|
+
annotations,
|
|
31
36
|
});
|
|
32
37
|
}
|
|
33
38
|
export async function applyStallGuard(stallKey, stallTimeoutSeconds, headSha, base, prNumber, prospectiveResult, report, reviewSummaryIds) {
|
|
@@ -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
|
|
5
|
-
export declare function buildShepherdJournalInstruction(prNumber: number, itemReferenceGuidance: string): string;
|
|
6
|
-
export declare const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS = "
|
|
7
|
-
export declare const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEMS = "
|
|
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
|
|
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
|
|
7
|
+
`For any substantial decision or rejection, append \`- <decision>\` to \`${SHEPHERD_JOURNAL_SECTION}\` with \`pr-shepherd apply journal ${prNumber} '- <decision>'\`.`,
|
|
8
8
|
itemReferenceGuidance,
|
|
9
|
-
|
|
10
|
-
].join(" ");
|
|
9
|
+
];
|
|
11
10
|
}
|
|
12
|
-
export const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS = "
|
|
13
|
-
export const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEMS = "
|
|
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.";
|
|
@@ -45,6 +45,7 @@ export function mapCheckRunNode(node) {
|
|
|
45
45
|
...(completedAtUnix !== undefined && { completedAtUnix }),
|
|
46
46
|
...(updatedAtUnix !== undefined && { updatedAtUnix }),
|
|
47
47
|
...(summary !== undefined && { summary }),
|
|
48
|
+
...((node.annotations?.nodes.length ?? 0) > 0 && { hasAnnotations: true }),
|
|
48
49
|
};
|
|
49
50
|
}
|
|
50
51
|
function extractCheckRunSummary(title, summary) {
|
|
@@ -192,6 +192,11 @@ export type RawContextNode = {
|
|
|
192
192
|
startedAt?: string | null;
|
|
193
193
|
title: string | null;
|
|
194
194
|
summary: string | null;
|
|
195
|
+
annotations?: {
|
|
196
|
+
nodes: Array<{
|
|
197
|
+
message: string;
|
|
198
|
+
}>;
|
|
199
|
+
};
|
|
195
200
|
checkSuite: {
|
|
196
201
|
createdAt?: string;
|
|
197
202
|
updatedAt?: string;
|
package/bin/reporters/agent.mjs
CHANGED
|
@@ -50,9 +50,6 @@ export function toAgentComment(c) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
export function toAgentCheck(c) {
|
|
53
|
-
if (c.conclusion === "SKIPPED" || c.conclusion === "NEUTRAL") {
|
|
54
|
-
throw new Error(`Unexpected conclusion ${c.conclusion} in toAgentCheck`);
|
|
55
|
-
}
|
|
56
53
|
return {
|
|
57
54
|
name: c.name,
|
|
58
55
|
runId: c.runId,
|
|
@@ -3,6 +3,8 @@ import type { CheckRun } from "./github.mts";
|
|
|
3
3
|
type CheckCategory = "passed" | "failing" | "in_progress" | "skipped" | "filtered" | "ignored" | "superseded";
|
|
4
4
|
export interface ClassifiedCheck extends CheckRun {
|
|
5
5
|
category: CheckCategory;
|
|
6
|
+
/** Inline annotations attached to this check run, surfaced once per PR. */
|
|
7
|
+
annotations?: CheckAnnotation[];
|
|
6
8
|
}
|
|
7
9
|
export interface TriagedCheck extends ClassifiedCheck {
|
|
8
10
|
/** Workflow display name (e.g. `"CI"`). Populated when available from the jobs API; may be `undefined` on fetch failure or when no matching job is found. */
|
|
@@ -13,7 +15,5 @@ export interface TriagedCheck extends ClassifiedCheck {
|
|
|
13
15
|
failedStep?: string;
|
|
14
16
|
/** Bounded raw excerpt from the matched failed job log, when GitHub exposes one. */
|
|
15
17
|
logExcerpt?: string;
|
|
16
|
-
/** Inline annotations attached to this failing check run, surfaced once per PR. */
|
|
17
|
-
annotations?: CheckAnnotation[];
|
|
18
18
|
}
|
|
19
19
|
export {};
|
package/bin/types/github.d.mts
CHANGED
|
@@ -28,6 +28,8 @@ export interface CheckRun {
|
|
|
28
28
|
/** Workflow display name for GitHub Actions check runs, when GraphQL exposes it. */
|
|
29
29
|
workflowName?: string;
|
|
30
30
|
workflowId?: string;
|
|
31
|
+
/** True when GraphQL reported at least one CheckRun annotation. Omitted when false. */
|
|
32
|
+
hasAnnotations?: boolean;
|
|
31
33
|
}
|
|
32
34
|
export interface ReviewThread {
|
|
33
35
|
id: string;
|
package/bin/types/report.d.mts
CHANGED
|
@@ -32,6 +32,8 @@ export interface ShepherdReport {
|
|
|
32
32
|
skipped: ClassifiedCheck[];
|
|
33
33
|
/** Checks filtered out because they were triggered by a non-PR event (push, schedule, etc.). */
|
|
34
34
|
filtered: ClassifiedCheck[];
|
|
35
|
+
/** Ignored checks with unseen annotations; omitted when empty. */
|
|
36
|
+
ignored?: ClassifiedCheck[];
|
|
35
37
|
filteredNames: string[];
|
|
36
38
|
blockedByFilteredCheck: boolean;
|
|
37
39
|
ignoredNames?: string[];
|
|
@@ -104,16 +106,14 @@ export interface AgentComment {
|
|
|
104
106
|
url: string;
|
|
105
107
|
edited?: boolean;
|
|
106
108
|
}
|
|
107
|
-
/** Check shape emitted to the iterate agent under `fix_code`.
|
|
108
|
-
* should be handled from `name`/`runId`/`detailsUrl`/`conclusion`; optional
|
|
109
|
-
* workflow/job/step metadata may still be present when available. */
|
|
109
|
+
/** Check shape emitted to the iterate agent under `fix_code`. */
|
|
110
110
|
export interface AgentCheck {
|
|
111
111
|
name: string;
|
|
112
112
|
runId: string | null;
|
|
113
113
|
/** Fallback for checks where runId is null (e.g. external status checks). */
|
|
114
114
|
detailsUrl: string | null;
|
|
115
115
|
/** Raw GitHub check conclusion; may be null for some completed checks from upstream data. */
|
|
116
|
-
conclusion:
|
|
116
|
+
conclusion: CheckConclusion;
|
|
117
117
|
/** Workflow display name (e.g. `"CI"`). Populated on a best-effort basis when available from the jobs API. */
|
|
118
118
|
workflowName?: string;
|
|
119
119
|
/** Name of the matched job (e.g. `"tests (ubuntu)"`). Distinct from check name for matrix builds. */
|
|
@@ -123,8 +123,8 @@ export interface AgentCheck {
|
|
|
123
123
|
/** One-line status text shown in the GitHub UI (e.g. "67.68% of diff hit (target 85.00%)"). */
|
|
124
124
|
summary?: string;
|
|
125
125
|
logExcerpt?: string;
|
|
126
|
-
/** Marker-gated inline annotations from this failing check. */
|
|
127
126
|
annotations?: CheckAnnotation[];
|
|
127
|
+
annotationOnly?: true;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* A single CI check that is relevant to PR readiness — triggered by a PR event
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pr-shepherd",
|
|
3
|
-
"version": "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.
|
|
85
|
+
"oxfmt": "^0.63.0",
|
|
86
86
|
"oxlint": "^1.60.0",
|
|
87
87
|
"typescript": "^7.0.2",
|
|
88
88
|
"vitest": "^4.1.4"
|
|
@@ -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.
|
|
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.
|