pr-shepherd 0.45.0 → 0.46.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 +20 -9
- package/bin/api.d.mts +2 -2
- package/bin/checks/conclusions.d.mts +0 -16
- package/bin/checks/conclusions.mjs +0 -27
- package/bin/cli/fix-formatter.mjs +10 -4
- package/bin/cli/help-command-pages.d.mts +16 -5
- package/bin/cli/help-command-pages.mjs +16 -5
- package/bin/cli/help-top-page.d.mts +1 -1
- package/bin/cli/help-top-page.mjs +3 -1
- package/bin/cli/help.d.mts +17 -6
- package/bin/cli/help.mjs +2 -0
- package/bin/cli/iterate-checks-formatter.d.mts +2 -0
- package/bin/cli/iterate-checks-formatter.mjs +55 -0
- package/bin/cli/iterate-formatter.mjs +7 -2
- package/bin/cli/iterate-lean.mjs +4 -0
- package/bin/cli/journal-extract-handler.d.mts +2 -0
- package/bin/cli/journal-extract-handler.mjs +48 -0
- package/bin/cli/mark-files-as-viewed-formatter.mjs +7 -6
- package/bin/cli/safe-body-file.d.mts +14 -0
- package/bin/cli/safe-body-file.mjs +42 -0
- package/bin/cli-parser.mjs +7 -0
- package/bin/commands/check-status.mjs +4 -4
- package/bin/commands/check.mjs +25 -5
- package/bin/commands/iterate/api-usage.mjs +1 -8
- package/bin/commands/iterate/check-instructions.d.mts +2 -2
- package/bin/commands/iterate/check-instructions.mjs +8 -32
- package/bin/commands/iterate/classify.mjs +2 -1
- package/bin/commands/iterate/escalate.mjs +63 -9
- package/bin/commands/iterate/fix-code.mjs +83 -80
- package/bin/commands/iterate/index.mjs +2 -2
- package/bin/commands/iterate/merge-state.mjs +8 -37
- package/bin/commands/iterate/merge.mjs +1 -0
- package/bin/commands/iterate/render.d.mts +1 -1
- package/bin/commands/iterate/render.mjs +16 -13
- package/bin/commands/journal/index.d.mts +1 -0
- package/bin/commands/journal/index.mjs +1 -10
- package/bin/commands/mark-files-as-viewed.d.mts +2 -1
- package/bin/commands/mark-files-as-viewed.mjs +116 -4
- package/bin/commands/poll.mjs +1 -4
- package/bin/commands/resolve-mutate.mjs +17 -40
- package/bin/comments/resolve.d.mts +4 -0
- package/bin/comments/resolve.mjs +10 -4
- package/bin/comments/review-visibility.d.mts +1 -1
- package/bin/comments/review-visibility.mjs +3 -2
- package/bin/comments/thread-visibility.d.mts +1 -1
- package/bin/comments/thread-visibility.mjs +9 -3
- package/bin/github/client.d.mts +1 -2
- package/bin/github/client.mjs +1 -4
- package/bin/github/gql/get-pr-body.gql +0 -1
- package/bin/mcp/server.mjs +2 -2
- package/bin/pr-reference.d.mts +1 -1
- package/bin/pr-reference.mjs +1 -1
- package/bin/types/escalate.d.mts +5 -3
- package/bin/types/report.d.mts +1 -1
- 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/mark-files-as-viewed/SKILL.md +2 -2
- package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +21 -15
package/bin/pr-reference.mjs
CHANGED
|
@@ -47,7 +47,7 @@ export function resolveParsedPrTarget(parsed) {
|
|
|
47
47
|
targetRepository: { owner, name },
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
-
/** Canonical collision-safe PR reference for generated commands and
|
|
50
|
+
/** Canonical collision-safe PR reference for generated commands and escalation messages. */
|
|
51
51
|
export function formatPrUrl(repository, prNumber) {
|
|
52
52
|
return `https://github.com/${repository}/pull/${prNumber}`;
|
|
53
53
|
}
|
package/bin/types/escalate.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AgentComment, AgentThread } from "./report.mts";
|
|
1
|
+
import type { AgentCheck, AgentComment, AgentThread } from "./report.mts";
|
|
2
2
|
import type { CheckStatus, Review } from "./github.mts";
|
|
3
3
|
import type { MergeQueueRemovalStatus } from "./merge-requirements.mts";
|
|
4
|
-
export type EscalateTrigger = "fix-thrash" | "base-branch-unknown" | "stall-timeout" | "
|
|
4
|
+
export type EscalateTrigger = "fix-thrash" | "base-branch-unknown" | "stall-timeout" | "check-follow-up-unavailable" | "authorization-required" | "bot-cr-not-dismissed" | "merge-queue-removed";
|
|
5
5
|
export interface AgentStalledCheck {
|
|
6
6
|
name: string;
|
|
7
7
|
status: CheckStatus;
|
|
@@ -19,6 +19,8 @@ export interface EscalateDetails {
|
|
|
19
19
|
unresolvedThreads: AgentThread[];
|
|
20
20
|
ambiguousComments: AgentComment[];
|
|
21
21
|
changesRequestedReviews: Review[];
|
|
22
|
+
/** Failing checks whose next step requires human attention. */
|
|
23
|
+
checks?: AgentCheck[];
|
|
22
24
|
stalledChecks?: AgentStalledCheck[];
|
|
23
25
|
thrashHistory?: Array<{
|
|
24
26
|
threadId: string;
|
|
@@ -28,7 +30,7 @@ export interface EscalateDetails {
|
|
|
28
30
|
humanMessage: string;
|
|
29
31
|
mergeQueueRemoval?: MergeQueueRemovalStatus;
|
|
30
32
|
authorization?: Array<{
|
|
31
|
-
action: "
|
|
33
|
+
action: "mark-ready" | "merge-or-enqueue";
|
|
32
34
|
targetIds: string[];
|
|
33
35
|
reason: "denied-or-unverifiable";
|
|
34
36
|
}>;
|
package/bin/types/report.d.mts
CHANGED
|
@@ -119,7 +119,7 @@ export interface AgentComment {
|
|
|
119
119
|
url: string;
|
|
120
120
|
edited?: boolean;
|
|
121
121
|
}
|
|
122
|
-
/** Check shape emitted to the iterate agent under `fix_code
|
|
122
|
+
/** Check shape emitted to the iterate agent under `fix_code` or check escalation. */
|
|
123
123
|
export interface AgentCheck {
|
|
124
124
|
name: string;
|
|
125
125
|
runId: string | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pr-shepherd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.46.1",
|
|
4
4
|
"description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"automation",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@vitest/coverage-v8": "^4.1.4",
|
|
87
87
|
"husky": "^9.1.7",
|
|
88
88
|
"knip": "^6.14.1",
|
|
89
|
-
"oxfmt": "^0.
|
|
89
|
+
"oxfmt": "^0.64.0",
|
|
90
90
|
"oxlint": "^1.60.0",
|
|
91
91
|
"typescript": "^7.0.2",
|
|
92
92
|
"vitest": "^4.1.4"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: mark-files-as-viewed
|
|
3
|
-
description: "
|
|
3
|
+
description: "Mark selected changed pull-request files as viewed with pr-shepherd (MCP or CLI)."
|
|
4
4
|
user-invocable: true
|
|
5
5
|
argument-hint: "[PR number or URL] [files|tests|--tests|--match REGEX]"
|
|
6
6
|
allowed-tools: ["MCP", "Bash", "Read", "Grep", "Glob"]
|
|
@@ -8,7 +8,7 @@ allowed-tools: ["MCP", "Bash", "Read", "Grep", "Glob"]
|
|
|
8
8
|
|
|
9
9
|
# mark-files-as-viewed
|
|
10
10
|
|
|
11
|
-
Thin dispatcher for
|
|
11
|
+
Thin dispatcher for explicit file-view mutations. The operation attempts `markFileAsViewed` for selected files and surfaces GitHub's per-file results. Use the MCP server when it is available; otherwise use the CLI.
|
|
12
12
|
|
|
13
13
|
## Arguments: $ARGUMENTS
|
|
14
14
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pr-shepherd
|
|
3
|
-
description: '
|
|
3
|
+
description: 'Create or iterate a GitHub pull request with pr-shepherd (MCP or CLI). Use for requests like "make a PR and use pr-shepherd", "iterate PR #123", or "run pr-shepherd until this PR is ready".'
|
|
4
4
|
user-invocable: true
|
|
5
5
|
argument-hint: "[PR number or URL] [--merge]"
|
|
6
6
|
allowed-tools: ["MCP", "Bash", "Read", "Grep", "Glob", "Edit", "Write"]
|
|
@@ -8,7 +8,13 @@ allowed-tools: ["MCP", "Bash", "Read", "Grep", "Glob", "Edit", "Write"]
|
|
|
8
8
|
|
|
9
9
|
# pr-shepherd
|
|
10
10
|
|
|
11
|
-
Thin dispatcher for iterating a PR. Poll with the CLI; use MCP `iterate` only when the CLI is unavailable.
|
|
11
|
+
Thin dispatcher for creating or iterating a PR. Poll with the CLI; use MCP `iterate` only when the CLI is unavailable.
|
|
12
|
+
|
|
13
|
+
## PR creation authorization
|
|
14
|
+
|
|
15
|
+
When the user asks to make, create, or open a PR and invokes this skill, proceed with the ordinary non-force push of the reviewed, in-scope commits to the current repository's configured push remote and creation of the requested PR. Do not ask for a separate conversational confirmation merely because the push publishes those changes; request runtime escalation directly when the host requires it. A skill cannot grant or bypass host permissions, so unattended approval must come from a trusted command rule or equivalent host policy. Force-pushes, remote or credential changes, unrelated changes, and ambiguous repositories or PR targets remain outside this workflow.
|
|
16
|
+
|
|
17
|
+
If the requested PR does not exist yet, review and commit the in-scope changes, verify the configured push remote and base branch, push a fresh branch, create the PR, and use its qualified URL for the dispatcher below.
|
|
12
18
|
|
|
13
19
|
## Arguments: $ARGUMENTS
|
|
14
20
|
|
|
@@ -18,7 +24,7 @@ Thin dispatcher for iterating a PR. Poll with the CLI; use MCP `iterate` only wh
|
|
|
18
24
|
|
|
19
25
|
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_patches` with the same qualified PR reference; do not run a shell `pr-shepherd apply` command.
|
|
20
26
|
|
|
21
|
-
4. After completing the returned instructions, repeat step 2 unless the action is `[CANCEL]` or `[ESCALATE]`, the
|
|
27
|
+
4. After completing the returned instructions, repeat step 2 unless the action is `[CANCEL]` or `[ESCALATE]`, or the human directs you to stop. `[FIX_CODE]` is always non-terminal: complete its instructions and rerun the same canonical command without asking whether to continue. Only `[ESCALATE]` hands work to a human.
|
|
22
28
|
|
|
23
29
|
## Playbooks
|
|
24
30
|
|
|
@@ -28,7 +34,7 @@ mechanics every tick. Apply the referenced playbook in full whenever a step poin
|
|
|
28
34
|
### Suggestion patches
|
|
29
35
|
|
|
30
36
|
- Run one plural `build-suggestion-patches` command with a repeated `--thread-id … --message … [--description …]` group for every marked thread in displayed order.
|
|
31
|
-
- The CLI only builds patches. Apply, stage, and commit the returned patches in order
|
|
37
|
+
- The CLI only builds patches. Apply, stage, and commit the returned patches in order, then follow the `iterate`/`fix_code` output's commit, push, review-mutation, and continuation instructions. Push access to the PR head branch is a usage precondition.
|
|
32
38
|
- The command builds from the fetched PR head and accepts a clean local descendant only when the complete ordered patch stream passes `git apply --check`.
|
|
33
39
|
- If the command refuses because a suggestion is unsafe or no longer applies, inspect the current source, the displayed replacement block, and reviewer intent before editing manually. Do not apply a stale numeric range blindly or retry unchanged input.
|
|
34
40
|
- A returned patch was checked against the then-current worktree. If it later fails, re-inspect the worktree because it changed after validation.
|
|
@@ -40,25 +46,25 @@ Match each failure's `[conclusion: …]` tag under `## Failing checks` to a rule
|
|
|
40
46
|
|
|
41
47
|
More specific rows win over the general "GitHub Actions failure" row — check conclusion first.
|
|
42
48
|
|
|
43
|
-
A `[rerun authorized]` tag with a `rerun:` command means the viewer's repository role grants GitHub's Actions rerun capability (WRITE+) — Shepherd verified this from `repositoryPermission`.
|
|
49
|
+
A `[rerun authorized]` tag with a `rerun:` command means the viewer's repository role grants GitHub's Actions rerun capability (WRITE+) — Shepherd verified this from `repositoryPermission`. Run the printed command at most once. A run still in progress, an `ACTION_REQUIRED` run (paused pending manual workflow approval — a rerun cannot grant that approval), or a check whose runId does not resolve to a GitHub Actions workflow never gets `[rerun authorized]`, regardless of role. When a check has no autonomous follow-up and no other agent work remains, Shepherd returns `[ESCALATE]`; do not invent a handoff from a `[FIX_CODE]` result.
|
|
44
50
|
|
|
45
51
|
When several bullets share one runId (matrix jobs from the same run), the `rerun:` command is printed once, on the first bullet; every bullet for that runId still carries `[rerun authorized]` and is covered by that single command — do not run it more than once.
|
|
46
52
|
|
|
47
|
-
| Tag / kind | Do
|
|
48
|
-
| ------------------------------------------------------------------------ |
|
|
49
|
-
| GitHub Actions failure (has a run ID, not `CANCELLED`/`STARTUP_FAILURE`) | Read the included log excerpt
|
|
50
|
-
| Transient infrastructure failure | Run the `rerun:` command
|
|
51
|
-
| Real test or build failure | Apply a code fix — do not rerun, even if `[rerun authorized]` is shown.
|
|
52
|
-
| `[conclusion: CANCELLED]` | No log excerpt is rendered. Run the `rerun:` command
|
|
53
|
-
| `[conclusion: STARTUP_FAILURE]` | No log excerpt is rendered. Run the `rerun:` command
|
|
54
|
-
| `[conclusion: ACTION_REQUIRED]` |
|
|
55
|
-
| `external` (no run ID, has a URL) |
|
|
53
|
+
| Tag / kind | Do |
|
|
54
|
+
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
55
|
+
| GitHub Actions failure (has a run ID, not `CANCELLED`/`STARTUP_FAILURE`) | Read the included log excerpt. Apply a warranted code fix, or run the printed `rerun:` command when the evidence indicates a transient failure, then iterate again. Missing autonomous follow-up becomes `[ESCALATE]` when no other work remains. |
|
|
56
|
+
| Transient infrastructure failure | Run the `rerun:` command when present, then iterate again once it completes. If no command is present, complete any other surfaced work and iterate; Shepherd owns any later `[ESCALATE]`. |
|
|
57
|
+
| Real test or build failure | Apply a code fix — do not rerun, even if `[rerun authorized]` is shown. |
|
|
58
|
+
| `[conclusion: CANCELLED]` | No log excerpt is rendered. Run the printed `rerun:` command, then iterate again once it completes. Without a command, complete any other work and iterate; Shepherd escalates when this remains the only blocker. |
|
|
59
|
+
| `[conclusion: STARTUP_FAILURE]` | No log excerpt is rendered. Run the printed `rerun:` command, then iterate again once it completes. Without a command, complete any other work and iterate; Shepherd escalates when this remains the only blocker. |
|
|
60
|
+
| `[conclusion: ACTION_REQUIRED]` | This appears in `[FIX_CODE]` only alongside other autonomous work. Complete that work and iterate; Shepherd returns `[ESCALATE]` if manual workflow approval remains necessary. |
|
|
61
|
+
| `external` (no run ID, has a URL) | Treat the URL as an autonomous investigation path: inspect the provider or reproduce the failure locally, apply any warranted fix, and iterate. A non-empty external URL does not trigger `[ESCALATE]` by itself. |
|
|
56
62
|
|
|
57
63
|
### Review-mutation mechanics
|
|
58
64
|
|
|
59
65
|
Applies to every `apply review:` / `resolve-only:` command the CLI prints. Covers only what stays safe if you run the printed command **unmodified** — `$HEAD_SHA`/`$DISMISS_MESSAGE` substitution remains a separate CLI-printed step because the command is unsafe by default without those placeholders.
|
|
60
66
|
|
|
61
|
-
The CLI only includes IDs whose per-object GitHub viewer capability
|
|
67
|
+
The CLI only includes IDs whose per-object GitHub viewer capability and semantic routing authorize the corresponding generated action. Direct `apply review` honors those emitted IDs without a second authorization preflight and surfaces GitHub's per-operation result. Do not reconstruct omitted review reply, thread resolution, or bot-review dismissal IDs and do not hand them off: denied or unverifiable generated mutations are one-look skips that Shepherd suppresses until the item is edited. Threads without a path or line follow the same skip rule.
|
|
62
68
|
|
|
63
69
|
- Run every generated `apply review:` / `resolve-only:` command even when no code change is warranted. The command records the agent's disposition of the included review items; skipping it leaves bot threads active and can eventually trigger `fix-thrash`.
|
|
64
70
|
- Never add first-look-only or check-annotation IDs to `--reply-thread-ids`, `--resolve-thread-ids`, `--dismiss-review-ids`, or `--minimize-comment-ids` — those flags are pre-populated by the CLI.
|