pr-shepherd 0.54.1 → 0.55.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/bin/checks/unreported-required.d.mts +29 -0
- package/bin/checks/unreported-required.mjs +52 -0
- package/bin/classify/apply.d.mts +2 -0
- package/bin/classify/apply.mjs +31 -31
- package/bin/classify/rule-action.d.mts +8 -0
- package/bin/classify/rule-action.mjs +29 -0
- package/bin/classify/types.d.mts +1 -1
- package/bin/cli/help-command-pages.d.mts +2 -2
- package/bin/cli/help-iterate-poll-pages.d.mts +2 -2
- package/bin/cli/help-iterate-poll-pages.mjs +6 -5
- package/bin/cli/help-top-page.d.mts +1 -1
- package/bin/cli/help-top-page.mjs +2 -2
- package/bin/cli/help.d.mts +3 -3
- package/bin/cli/iterate-formatter.mjs +29 -9
- package/bin/cli/iterate-instructions.mjs +6 -0
- package/bin/cli/iterate-lean.mjs +15 -0
- package/bin/cli/poll-summary-emitter.mjs +4 -1
- package/bin/cli/poll-summary-formatter.mjs +10 -3
- package/bin/cli/stack-overview.d.mts +48 -0
- package/bin/cli/stack-overview.mjs +138 -0
- package/bin/commands/check-fingerprint.mjs +2 -1
- package/bin/commands/check-status.d.mts +1 -1
- package/bin/commands/check-status.mjs +8 -3
- package/bin/commands/check-unreported.d.mts +26 -0
- package/bin/commands/check-unreported.mjs +73 -0
- package/bin/commands/check.mjs +44 -38
- package/bin/commands/iterate/base.mjs +9 -0
- package/bin/commands/iterate/escalate.mjs +4 -0
- package/bin/commands/iterate/index.mjs +69 -3
- package/bin/commands/iterate/merge-state.mjs +12 -12
- package/bin/commands/iterate/merge.d.mts +12 -2
- package/bin/commands/iterate/merge.mjs +32 -2
- package/bin/commands/iterate/unreported-required.d.mts +18 -0
- package/bin/commands/iterate/unreported-required.mjs +122 -0
- package/bin/commands/poll-summary.mjs +1 -0
- package/bin/commands/poll.mjs +9 -2
- package/bin/commands/ready-mergeability.d.mts +1 -1
- package/bin/commands/ready-mergeability.mjs +2 -2
- package/bin/commands/rule-auto-resolve-format.d.mts +22 -0
- package/bin/commands/rule-auto-resolve-format.mjs +151 -0
- package/bin/commands/rule-auto-resolve.d.mts +21 -0
- package/bin/commands/rule-auto-resolve.mjs +113 -0
- package/bin/commands/stack-drain.d.mts +0 -5
- package/bin/commands/stack-drain.mjs +26 -16
- package/bin/commands/stack-merge-flag.d.mts +7 -0
- package/bin/commands/stack-merge-flag.mjs +6 -0
- package/bin/config/load.d.mts +3 -0
- package/bin/config/load.mjs +9 -2
- package/bin/config/merge-method.d.mts +27 -0
- package/bin/config/merge-method.mjs +56 -0
- package/bin/exit-codes.d.mts +1 -1
- package/bin/exit-codes.mjs +2 -1
- package/bin/github/batch-parse-suites.d.mts +3 -0
- package/bin/github/batch-parse-suites.mjs +15 -0
- package/bin/github/batch-parsers.d.mts +1 -1
- package/bin/github/batch-parsers.mjs +7 -0
- package/bin/github/batch-raw-types.d.mts +5 -0
- package/bin/github/batch.d.mts +3 -0
- package/bin/github/batch.mjs +9 -1
- package/bin/github/errors.d.mts +6 -0
- package/bin/github/errors.mjs +23 -5
- package/bin/github/fingerprint-fields.d.mts +1 -0
- package/bin/github/fingerprint-fields.mjs +1 -1
- package/bin/github/gql/batch-pr-page.gql +2 -0
- package/bin/github/gql/batch-pr.gql +5 -0
- package/bin/github/gql/commit-check-suites.gql +1 -0
- package/bin/github/gql/poll-stack-summary.gql +6 -0
- package/bin/github/gql/poll-summary-annotation-probe.gql +32 -0
- package/bin/github/gql/poll-summary-check-contexts.gql +2 -3
- package/bin/github/gql/poll-summary-fragment.gql +16 -0
- package/bin/github/gql/pr-merge-policy.gql +1 -44
- package/bin/github/gql/ref-rules-query.gql +18 -0
- package/bin/github/gql/ref-rules.gql +46 -0
- package/bin/github/graphql-internal-retry.d.mts +1 -1
- package/bin/github/graphql-internal-retry.mjs +4 -3
- package/bin/github/merge-queue-checks.mjs +7 -3
- package/bin/github/merge-target-rules.d.mts +20 -0
- package/bin/github/merge-target-rules.mjs +54 -0
- package/bin/github/poll-summary-annotation-probe.d.mts +19 -0
- package/bin/github/poll-summary-annotation-probe.mjs +88 -0
- package/bin/github/poll-summary-fingerprint.mjs +1 -1
- package/bin/github/poll-summary-projector.d.mts +1 -1
- package/bin/github/poll-summary-projector.mjs +19 -12
- package/bin/github/poll-summary-queue-removal.mjs +7 -3
- package/bin/github/poll-summary-raw.d.mts +16 -0
- package/bin/github/poll-summary-readiness.mjs +1 -0
- package/bin/github/poll-summary-route.mjs +5 -0
- package/bin/github/poll-summary-unreported.d.mts +6 -0
- package/bin/github/poll-summary-unreported.mjs +51 -0
- package/bin/github/poll-summary.d.mts +1 -0
- package/bin/github/poll-summary.mjs +28 -3
- package/bin/github/queries.d.mts +7 -0
- package/bin/github/queries.mjs +9 -2
- package/bin/github/queue-removal-freshness.d.mts +20 -5
- package/bin/github/queue-removal-freshness.mjs +37 -10
- package/bin/github/stack-read.d.mts +4 -0
- package/bin/github/stack-read.mjs +13 -1
- package/bin/mcp/server.mjs +6 -1
- package/bin/state/ci-retrigger.d.mts +25 -0
- package/bin/state/ci-retrigger.mjs +48 -0
- package/bin/types/escalate.d.mts +1 -1
- package/bin/types/github.d.mts +11 -0
- package/bin/types/iterate.d.mts +14 -3
- package/bin/types/poll-summary.d.mts +13 -0
- package/bin/types/report.d.mts +32 -1
- package/package.json +1 -1
- 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 +2 -2
- package/plugins/pr-shepherd/skills/reduce-pr-noise/references/classifiers.md +1 -1
- package/src/classify/types.mts +1 -1
package/bin/types/report.d.mts
CHANGED
|
@@ -4,6 +4,21 @@ import type { AgentThreadComment } from "./agent-thread.mts";
|
|
|
4
4
|
import type { CheckAnnotation } from "./check-annotations.mts";
|
|
5
5
|
import type { PrActivitySummary } from "./activity.mts";
|
|
6
6
|
import type { MergeQueueReport } from "./merge-queue.mts";
|
|
7
|
+
export interface AutoMinimizedItem {
|
|
8
|
+
id: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
kind: "pr-comment" | "review-summary";
|
|
11
|
+
ruleReason?: string;
|
|
12
|
+
}
|
|
13
|
+
export type AutoResolvedThread = ReviewThread & {
|
|
14
|
+
ruleReason?: string;
|
|
15
|
+
};
|
|
16
|
+
export interface RuleAutoResolveReport {
|
|
17
|
+
summary: string;
|
|
18
|
+
threads?: AutoResolvedThread[];
|
|
19
|
+
minimized?: AutoMinimizedItem[];
|
|
20
|
+
errors?: string[];
|
|
21
|
+
}
|
|
7
22
|
export interface FirstLookThread extends ReviewThread {
|
|
8
23
|
firstLookStatus: "outdated" | "resolved" | "minimized";
|
|
9
24
|
autoResolved?: boolean;
|
|
@@ -23,6 +38,8 @@ export interface ShepherdReport {
|
|
|
23
38
|
nodeId: string;
|
|
24
39
|
/** GitHub PR head OID from the same batch used to decide the action. */
|
|
25
40
|
headSha?: string;
|
|
41
|
+
/** PR head branch name. Used to compare a native stack against its trunk. */
|
|
42
|
+
headRefName?: string;
|
|
26
43
|
/** Internal. True when this report was reused from the fingerprint cache. */
|
|
27
44
|
fingerprintReused?: true;
|
|
28
45
|
repo: string;
|
|
@@ -54,8 +71,10 @@ export interface ShepherdReport {
|
|
|
54
71
|
actionable: ReviewThread[];
|
|
55
72
|
/** Unresolved threads that need a GitHub resolve mutation but do not require code edits. */
|
|
56
73
|
resolutionOnly: ReviewThread[];
|
|
57
|
-
autoResolved:
|
|
74
|
+
autoResolved: AutoResolvedThread[];
|
|
58
75
|
autoResolveErrors: string[];
|
|
76
|
+
/** Rule reasons for this fetch's auto-resolve errors. Omitted when empty. */
|
|
77
|
+
autoResolveErrorReasons?: string[];
|
|
59
78
|
/** First-look items — outdated/resolved/minimized threads not yet seen by the agent. */
|
|
60
79
|
firstLook: FirstLookThread[];
|
|
61
80
|
/** Thread IDs matched by user classification rules with autoResolve:true — routed to resolveThreadIds. */
|
|
@@ -67,6 +86,8 @@ export interface ShepherdReport {
|
|
|
67
86
|
minimizeIds?: string[];
|
|
68
87
|
/** First-look items — minimized comments not yet seen by the agent. */
|
|
69
88
|
firstLook: FirstLookComment[];
|
|
89
|
+
/** PR comments and review summaries minimized by a suppress+autoResolve rule this fetch. */
|
|
90
|
+
autoMinimized?: AutoMinimizedItem[];
|
|
70
91
|
};
|
|
71
92
|
changesRequestedReviews: Review[];
|
|
72
93
|
/** COMMENTED reviews already seen — eligible for `--minimize-comment-ids` without re-rendering. */
|
|
@@ -81,8 +102,18 @@ export interface ShepherdReport {
|
|
|
81
102
|
ruleAutoResolveReviewSummaryIds?: string[];
|
|
82
103
|
/** Branch protection rule for the PR's base branch. Null when no rule exists or the base ref is unavailable. */
|
|
83
104
|
branchProtection: import("./github.mts").BranchProtection | null;
|
|
105
|
+
/** Repository merge methods from the same batch. Omitted when that query did not select them. */
|
|
106
|
+
allowedMergeMethods?: import("../config/merge-method.mts").MergeMethod[];
|
|
84
107
|
activity?: PrActivitySummary;
|
|
85
108
|
mergeQueue?: MergeQueueReport;
|
|
109
|
+
/** Required merge-target contexts with no check run and no status context. Omitted when empty. */
|
|
110
|
+
unreportedRequiredChecks?: string[];
|
|
111
|
+
/** Commits on the stack trunk that the bottom open layer does not contain. Omitted when zero. */
|
|
112
|
+
trunkBehindBy?: number;
|
|
113
|
+
/** A relevant Actions workflow suite on the head has not completed. */
|
|
114
|
+
actionsWorkflowInProgress?: true;
|
|
115
|
+
/** Bottom open layer of this PR's native stack. Starts a trunk rebase. */
|
|
116
|
+
stackBottomPr?: number;
|
|
86
117
|
}
|
|
87
118
|
export interface ResolveOptions {
|
|
88
119
|
resolveThreadIds?: string[];
|
package/package.json
CHANGED
|
@@ -22,9 +22,9 @@ If the requested PR does not exist yet, review and commit the in-scope changes,
|
|
|
22
22
|
|
|
23
23
|
2. For the CLI, convert supplied `owner/repo#N` references to `https://github.com/owner/repo/pull/N`; otherwise pass supplied URLs or bare numbers unchanged, then run `pr-shepherd [PR ...] --until-terminal`, or `pr-shepherd --stack PR --until-terminal` for a stack, omitting `[PR ...]` when none was supplied and appending `--merge` when requested. This command keeps ordinary `[WAIT]` and `[MARK_READY]` ticks inside the same invocation; aggregate selectors return their next stack action or terminal result. A qualified reference may name a fork or upstream repository: it is the GitHub target, while the current checkout continues to supply local git/config/rules context. Do not run `pr-shepherd iterate`. If the CLI is unavailable and the `iterate` MCP tool is available, first repository-qualify every supplied reference with its GitHub URL or `owner/repo#N`; resolve bare numbers through `gh pr view <number> --json url --jq .url`, and resolve an omitted target with `gh pr view --json url --jq .url`. If that does not produce the required qualified selector, stop and report that MCP cannot safely determine it. Otherwise call `iterate` with `pr`, `prs`, or `stack` as selected, plus `merge: true` when merge intent was requested, and print its full result.
|
|
24
24
|
|
|
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.
|
|
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. On a stack overview, run one-PR shepherd, mark-ready, and push steps only for rows marked `owned`. Leave every other author's layer listed and untouched. If every session belongs to someone else, report the overview and stop. If at least one owned layer needs a session, shepherd those, then rerun the same `--stack` command.
|
|
26
26
|
|
|
27
|
-
4. After completing the returned instructions, immediately repeat step 2 with the same target and canonical options unless the action is `[CANCEL]` or `[ESCALATE]`, or the human directs you to stop. Preserve `--until-terminal` and any requested `--merge`; apply any polling-cadence adjustment printed by the CLI. Every other action is non-terminal: complete its instructions and rerun without asking whether to continue. `[FIX_CODE]` is always non-terminal, as is stack-level `[SHEPHERD]`; only `[ESCALATE]` hands work to a human. After a push or `rerun:`, do not wait for CI to finish first — you may pull check logs, but do not poll with `gh pr checks`, `gh pr watch`, `gh run watch`, or equivalent GitHub MCP check waiters.
|
|
27
|
+
4. After completing the returned instructions, immediately repeat step 2 with the same target and canonical options unless the action is `[CANCEL]` or `[ESCALATE]`, or the human directs you to stop. A stack overview heading includes those same tokens when `nextAction` is `cancel` or `escalate`. On a stack overview, if no row marked `owned` needs a session, stop instead of rerunning. Preserve `--until-terminal` and any requested `--merge`; apply any polling-cadence adjustment printed by the CLI. Every other action is non-terminal: complete its instructions and rerun without asking whether to continue. `[FIX_CODE]` is always non-terminal, as is stack-level `[SHEPHERD]`; only `[ESCALATE]` hands work to a human. `[READY]` is also non-terminal: wait out its `remainingSeconds`, then rerun the same command. Do not start other work during that countdown. After a push or `rerun:`, do not wait for CI to finish first — you may pull check logs, but do not poll with `gh pr checks`, `gh pr watch`, `gh run watch`, or equivalent GitHub MCP check waiters.
|
|
28
28
|
|
|
29
29
|
## Playbooks
|
|
30
30
|
|
|
@@ -19,6 +19,6 @@ const rule: ClassifyRule = (item) => {
|
|
|
19
19
|
export default rule;
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
`suppress: true` removes a matched item from agent output. Add `autoResolve: true` only when the requested policy also calls for resolving its thread or minimizing its comment or review summary. It is unsupported for `changes-requested` reviews, whose dismissal needs a message. With both flags, `actions.autoMinimizeSuppressed: true` lets Shepherd perform the authorized mutation
|
|
22
|
+
`suppress: true` removes a matched item from agent output. Add `autoResolve: true` only when the requested policy also calls for resolving its thread or minimizing its comment or review summary. It is unsupported for `changes-requested` reviews, whose dismissal needs a message. Optional `reason` is the note printed, reported, and journaled when the rule fires. With both flags, `actions.autoMinimizeSuppressed: true` (the default) lets Shepherd perform the authorized mutation, then print a `## Classification auto-resolve` line, record `threads.autoResolved` / `comments.autoMinimized`, and append one Shepherd Journal item for the token login. Failed IDs stay on the generated `apply review` command and the failure is listed under that line. Set `actions.autoMinimizeSuppressed: false` to keep the handoff without mutating, journaling, or printing the line. When GitHub does not confirm capability, the item returns to normal first-look visibility. Matching rules combine their flags and keep every non-empty reason, so inspect existing rules before adding one.
|
|
23
23
|
|
|
24
24
|
Exercise the exported rule against the observed item and negative examples: a different author, kind, and substantive message from the same bot. Confirm only the intended item matches before enabling automatic resolution. After editing a rule, restart a persistent MCP server or long-running poll process; it caches loaded rule modules. A new CLI process loads the change. A classifier does not retroactively remove already displayed output.
|
package/src/classify/types.mts
CHANGED
|
@@ -53,7 +53,7 @@ export interface ClassifyAction {
|
|
|
53
53
|
readonly autoResolve?: boolean;
|
|
54
54
|
/** When true, hides the item from agent output (seen marker is still written). */
|
|
55
55
|
readonly suppress?: boolean;
|
|
56
|
-
/**
|
|
56
|
+
/** Note included in the auto-resolve report, tick line, and Shepherd Journal when this rule fires. */
|
|
57
57
|
readonly reason?: string;
|
|
58
58
|
}
|
|
59
59
|
|