pr-shepherd 0.48.0 → 0.50.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 +14 -2
- package/bin/api.d.mts +19 -3
- package/bin/api.mjs +57 -8
- package/bin/classify/apply.d.mts +2 -0
- package/bin/classify/apply.mjs +1 -1
- package/bin/cli/default-poll.mjs +1 -0
- package/bin/cli/help-command-pages.d.mts +9 -9
- package/bin/cli/help-command-pages.mjs +8 -8
- package/bin/cli/help-iterate-poll-pages.d.mts +1 -1
- package/bin/cli/help-iterate-poll-pages.mjs +10 -5
- package/bin/cli/help-top-page.d.mts +1 -1
- package/bin/cli/help-top-page.mjs +5 -3
- package/bin/cli/help.d.mts +10 -10
- package/bin/cli/iterate-instructions.mjs +9 -2
- package/bin/cli/iterate-lean.mjs +11 -0
- package/bin/cli/poll-handler.mjs +25 -4
- package/bin/cli/poll-summary-emitter.d.mts +4 -0
- package/bin/cli/poll-summary-emitter.mjs +22 -0
- package/bin/cli/poll-summary-formatter.d.mts +2 -0
- package/bin/cli/poll-summary-formatter.mjs +96 -0
- package/bin/cli/poll-targets.d.mts +15 -0
- package/bin/cli/poll-targets.mjs +114 -0
- package/bin/cli/validate-default-args.mjs +1 -4
- package/bin/cli-parser.mjs +3 -0
- package/bin/commands/iterate/check-instructions.d.mts +2 -8
- package/bin/commands/iterate/check-instructions.mjs +2 -11
- package/bin/commands/iterate/escalate.mjs +30 -2
- package/bin/commands/iterate/fix-code.mjs +62 -20
- package/bin/commands/iterate/render.mjs +1 -1
- package/bin/commands/iterate/stall.mjs +30 -0
- package/bin/commands/iterate/thread-mutation-routing.d.mts +0 -2
- package/bin/commands/iterate/thread-mutation-routing.mjs +1 -2
- package/bin/commands/poll-summary.d.mts +10 -0
- package/bin/commands/poll-summary.mjs +163 -0
- package/bin/commands/ready-delay.d.mts +3 -1
- package/bin/commands/ready-delay.mjs +3 -2
- package/bin/commands/resolve-mutate.mjs +22 -68
- package/bin/comments/resolve.d.mts +5 -0
- package/bin/comments/resolve.mjs +2 -11
- package/bin/github/gql/poll-stack-summary.gql +33 -0
- package/bin/github/gql/poll-summary-fragment.gql +198 -0
- package/bin/github/poll-summary-checks.d.mts +3 -0
- package/bin/github/poll-summary-checks.mjs +61 -0
- package/bin/github/poll-summary-projector.d.mts +4 -0
- package/bin/github/poll-summary-projector.mjs +81 -0
- package/bin/github/poll-summary-raw.d.mts +134 -0
- package/bin/github/poll-summary-raw.mjs +1 -0
- package/bin/github/poll-summary-review.d.mts +4 -0
- package/bin/github/poll-summary-review.mjs +85 -0
- package/bin/github/poll-summary-route.d.mts +4 -0
- package/bin/github/poll-summary-route.mjs +47 -0
- package/bin/github/poll-summary.d.mts +7 -0
- package/bin/github/poll-summary.mjs +110 -0
- package/bin/github/queries.d.mts +4 -0
- package/bin/github/queries.mjs +4 -0
- package/bin/mcp/server.mjs +39 -6
- package/bin/pr-reference.d.mts +2 -0
- package/bin/pr-reference.mjs +4 -0
- package/bin/state/fix-attempts.d.mts +3 -4
- package/bin/state/fix-attempts.mjs +2 -3
- package/bin/types/escalate.d.mts +10 -0
- package/bin/types/poll-summary.d.mts +82 -0
- package/bin/types/poll-summary.mjs +1 -0
- package/bin/types.d.mts +1 -0
- package/bin/types.mjs +1 -0
- 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 +5 -10
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ Conversations Resolved: No [Not Required]
|
|
|
72
72
|
2. Apply every warranted review fix in each file referenced above.
|
|
73
73
|
3. Triage every failure under `## Failing checks`. See "CI failure triage" in the pr-shepherd skill for read-only inspection rules.
|
|
74
74
|
4. If you changed code, commit any remaining changes and push to the PR head branch, then run review mutations using the pushed commit SHA and iterate immediately with the same options. If you did not change code, do not commit and continue.
|
|
75
|
-
5.
|
|
75
|
+
5. Substitute any command placeholders and run the generated review mutations.
|
|
76
76
|
6. If you did not change code, replace `$HEAD_SHA` with `$(git rev-parse HEAD)`, which must equal the current remote PR head. If you changed code, commit and push to the PR head branch first, then replace `$HEAD_SHA` with the pushed commit SHA.
|
|
77
77
|
7. Replace `$DISMISS_MESSAGE` with one sentence describing what changed.
|
|
78
78
|
8. Run the `apply review:` command shown above. See "Review-mutation mechanics" in the pr-shepherd skill for dismiss-ID retention.
|
|
@@ -92,7 +92,7 @@ This system is opinionated and works best with PRs that use required status chec
|
|
|
92
92
|
- Draft PRs can be marked ready automatically when clean; disable with `actions.autoMarkReady: false` or `--no-auto-mark-ready`.
|
|
93
93
|
- With `--merge`, actionable review threads/comments/reviews/summaries are held back (`WAIT`, with raw deferred-work counts) while a PR sits in the merge queue, since a Shepherd-initiated push would eject it; set `actions.workWhileQueued: true` to act on them immediately instead. Failing checks and merge conflicts are never deferred.
|
|
94
94
|
- The CLI never performs git mutations itself — it only emits commit/push instructions for the agent to run. Push access to the PR head is a usage precondition; GitHub viewer fields do not create a separate push-authorization handoff.
|
|
95
|
-
- Generated iterate mutations and automatic actions are capability-aware and omit unauthorized commands. Explicit `apply` operations
|
|
95
|
+
- Generated iterate mutations and automatic actions are capability-aware and omit unauthorized commands. Explicit `apply` operations forward the caller's requested IDs without iterate's author or capability policy and surface GitHub's result.
|
|
96
96
|
- `build_suggestion_patches` turns one or more ordered GitHub suggestion threads into checked patches and commit metadata, but never edits the working tree or git history. Local HEAD may be ahead when the live PR head is its ancestor.
|
|
97
97
|
|
|
98
98
|
## Usage
|
|
@@ -135,8 +135,20 @@ pr-shepherd 42 --merge # request head-pinned auto-merge/queue;
|
|
|
135
135
|
pr-shepherd iterate 42 # single tick
|
|
136
136
|
pr-shepherd owner/repo#42 # poll a PR in an explicit repository
|
|
137
137
|
pr-shepherd https://github.com/owner/repo/pull/42
|
|
138
|
+
pr-shepherd 42 43 44 # summarize an explicit same-repository set
|
|
139
|
+
pr-shepherd --stack 43 # summarize every PR in a native GitHub stack
|
|
138
140
|
```
|
|
139
141
|
|
|
142
|
+
Multi-PR and `--stack` polling use compact, read-only GraphQL summaries. They return when any row
|
|
143
|
+
needs agent work, all rows are terminal, the bounded timeout expires, or `--until-terminal` crosses
|
|
144
|
+
a configured GraphQL quota-warning band. Check counts use the same ignored, protected-run,
|
|
145
|
+
superseded-run, and event rules as singular iteration and include active merge-queue commit checks.
|
|
146
|
+
Bounded review/check overflow remains visible without permanently forcing work, and clean rows use
|
|
147
|
+
the configured ready-delay before becoming terminal. Each actionable row includes
|
|
148
|
+
an exact single-PR `pollCommand`; run independent actionable rows, then invoke the aggregate selector again.
|
|
149
|
+
Stack rows are ordered bottom-to-top. API and MCP aggregate calls perform one summary tick and leave
|
|
150
|
+
recurrence to the caller.
|
|
151
|
+
|
|
140
152
|
Polling defaults can be set under `poll` in `.pr-shepherdrc.yml`: `intervalSeconds`, `timeoutSeconds`, `debounceSeconds`, and `quietStatus`. Explicit flags override configuration, including `--no-quiet-status` when a shared config enables quiet output. Quiet status remains off by default.
|
|
141
153
|
|
|
142
154
|
### Apply Review And Journal Changes, Or Select Files
|
package/bin/api.d.mts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
import { type JournalResult } from "./commands/journal/index.mts";
|
|
2
2
|
import { type MarkFilesAsViewedResult } from "./commands/mark-files-as-viewed.mts";
|
|
3
3
|
import type { ResolveResult } from "./comments/resolve.mts";
|
|
4
|
-
import type { BuildSuggestionPatchesResult, CommitSuggestionResult, IterateCommandOptions, IterateResult } from "./types.mts";
|
|
4
|
+
import type { BuildSuggestionPatchesResult, CommitSuggestionResult, IterateCommandOptions, IterateResult, PollSummaryResult } from "./types.mts";
|
|
5
5
|
export interface CreatePrShepherdOptions {
|
|
6
6
|
/** Working directory used for git, config, and classification-rule lookups. */
|
|
7
7
|
cwd?: string;
|
|
8
8
|
}
|
|
9
9
|
/** A positive PR number, GitHub pull-request URL, or owner/repo#number reference. */
|
|
10
10
|
export type PrReference = number | string;
|
|
11
|
-
|
|
11
|
+
type IterateOptions = Omit<IterateCommandOptions, "format" | "prNumber" | "targetRepository" | "persistSeen" | "fingerprintCache" | "deferQuotaWarning" | "quotaWarningMinimumPollIntervalMinutes">;
|
|
12
|
+
export type SingleIterateInput = IterateOptions & {
|
|
12
13
|
pr?: PrReference;
|
|
14
|
+
prs?: never;
|
|
15
|
+
stack?: never;
|
|
13
16
|
};
|
|
17
|
+
export type AggregateIterateInput = IterateOptions & ({
|
|
18
|
+
prs: PrReference[];
|
|
19
|
+
pr?: never;
|
|
20
|
+
stack?: never;
|
|
21
|
+
} | {
|
|
22
|
+
stack: PrReference;
|
|
23
|
+
pr?: never;
|
|
24
|
+
prs?: never;
|
|
25
|
+
});
|
|
26
|
+
export type IterateInput = SingleIterateInput | AggregateIterateInput;
|
|
14
27
|
export interface ReviewMutationsOperation {
|
|
15
28
|
type: "review_mutations";
|
|
16
29
|
resolveThreadIds?: string[];
|
|
@@ -69,7 +82,9 @@ export interface BuildSuggestionPatchesInput {
|
|
|
69
82
|
suggestions: SuggestionPatchInput[];
|
|
70
83
|
}
|
|
71
84
|
export interface PrShepherd {
|
|
72
|
-
iterate(input?:
|
|
85
|
+
iterate(input?: SingleIterateInput): Promise<IterateResult>;
|
|
86
|
+
iterate(input: AggregateIterateInput): Promise<PollSummaryResult>;
|
|
87
|
+
iterate(input: IterateInput): Promise<IterateResult | PollSummaryResult>;
|
|
73
88
|
apply(input: ApplyInput): Promise<ApplyResult>;
|
|
74
89
|
buildSuggestionPatches(input: BuildSuggestionPatchesInput): Promise<BuildSuggestionPatchesResult>;
|
|
75
90
|
/** Compatibility adapter; prefer buildSuggestionPatches. */
|
|
@@ -90,3 +105,4 @@ export declare class PartialApplyError extends Error {
|
|
|
90
105
|
* read/plan, ordered apply, and suggestion-patch operations.
|
|
91
106
|
*/
|
|
92
107
|
export declare function createPrShepherd(options?: CreatePrShepherdOptions): PrShepherd;
|
|
108
|
+
export {};
|
package/bin/api.mjs
CHANGED
|
@@ -3,12 +3,14 @@ import { resolve } from "node:path";
|
|
|
3
3
|
import { runCommitSuggestion } from "./commands/commit-suggestion.mjs";
|
|
4
4
|
import { runSuggestionPatches } from "./commands/suggestion-patches.mjs";
|
|
5
5
|
import { runIterate } from "./commands/iterate/index.mjs";
|
|
6
|
+
import { runPollSummary } from "./commands/poll-summary.mjs";
|
|
6
7
|
import { runJournal } from "./commands/journal/index.mjs";
|
|
7
8
|
import { validateJournalItem } from "./commands/journal/transform.mjs";
|
|
8
9
|
import { runMarkFilesAsViewed, } from "./commands/mark-files-as-viewed.mjs";
|
|
9
10
|
import { runResolveMutate } from "./commands/resolve-mutate.mjs";
|
|
10
11
|
import { runWithExecutionCwd } from "./execution-context.mjs";
|
|
11
|
-
import { parsePrReference, resolveParsedPrTarget, } from "./pr-reference.mjs";
|
|
12
|
+
import { parsePrReference, normalizeRepositoryIdentity, resolveParsedPrTarget, } from "./pr-reference.mjs";
|
|
13
|
+
import { getRepoInfo } from "./github/client.mjs";
|
|
12
14
|
/** Raised before any API mutation when an input cannot be validated. */
|
|
13
15
|
export class PrShepherdValidationError extends Error {
|
|
14
16
|
constructor(message) {
|
|
@@ -34,14 +36,20 @@ export class PartialApplyError extends Error {
|
|
|
34
36
|
*/
|
|
35
37
|
export function createPrShepherd(options = {}) {
|
|
36
38
|
const cwd = options.cwd === undefined ? undefined : resolve(options.cwd);
|
|
39
|
+
function iterate(input = {}) {
|
|
40
|
+
return runWithExecutionCwd(cwd, async () => {
|
|
41
|
+
validateIterateSelectors(input);
|
|
42
|
+
if ("prs" in input || "stack" in input) {
|
|
43
|
+
const target = await resolveAggregateIterateInput(input);
|
|
44
|
+
return runPollSummary(target);
|
|
45
|
+
}
|
|
46
|
+
const { pr: _pr, ...iterateOptions } = input;
|
|
47
|
+
const target = resolvePrReference(input.pr);
|
|
48
|
+
return runIterate({ ...iterateOptions, ...target, format: "json" });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
37
51
|
return Object.freeze({
|
|
38
|
-
iterate
|
|
39
|
-
const { pr: _pr, ...options } = input;
|
|
40
|
-
return runWithExecutionCwd(cwd, async () => {
|
|
41
|
-
const target = resolvePrReference(input.pr);
|
|
42
|
-
return runIterate({ ...options, ...target, format: "json" });
|
|
43
|
-
});
|
|
44
|
-
},
|
|
52
|
+
iterate,
|
|
45
53
|
apply(input) {
|
|
46
54
|
return runWithExecutionCwd(cwd, async () => {
|
|
47
55
|
validateApplyInput(input);
|
|
@@ -114,6 +122,47 @@ export function createPrShepherd(options = {}) {
|
|
|
114
122
|
},
|
|
115
123
|
});
|
|
116
124
|
}
|
|
125
|
+
async function resolveAggregateIterateInput(input) {
|
|
126
|
+
const refs = "prs" in input ? input.prs : [input.stack];
|
|
127
|
+
if (!refs || refs.length === 0) {
|
|
128
|
+
throw new PrShepherdValidationError("iterate.prs must contain at least one PR reference");
|
|
129
|
+
}
|
|
130
|
+
const parsedRefs = refs.map((ref) => {
|
|
131
|
+
const parsed = parsePrReference(ref);
|
|
132
|
+
const prNumber = parsed?.number;
|
|
133
|
+
if (!parsed || !prNumber) {
|
|
134
|
+
throw new PrShepherdValidationError(`Invalid PR reference: ${String(ref)}`);
|
|
135
|
+
}
|
|
136
|
+
return { parsed, prNumber };
|
|
137
|
+
});
|
|
138
|
+
const checkout = parsedRefs.some(({ parsed }) => parsed?.repository === undefined)
|
|
139
|
+
? await getRepoInfo()
|
|
140
|
+
: undefined;
|
|
141
|
+
let repository;
|
|
142
|
+
const numbers = [];
|
|
143
|
+
for (const { parsed, prNumber } of parsedRefs) {
|
|
144
|
+
const target = resolveParsedPrTarget(parsed);
|
|
145
|
+
const nextRepository = target.targetRepository ?? checkout;
|
|
146
|
+
if (repository &&
|
|
147
|
+
normalizeRepositoryIdentity(`${repository.owner}/${repository.name}`) !==
|
|
148
|
+
normalizeRepositoryIdentity(`${nextRepository.owner}/${nextRepository.name}`)) {
|
|
149
|
+
throw new PrShepherdValidationError("aggregate iterate only supports PRs from one repository");
|
|
150
|
+
}
|
|
151
|
+
repository = nextRepository;
|
|
152
|
+
if (!numbers.includes(prNumber))
|
|
153
|
+
numbers.push(prNumber);
|
|
154
|
+
}
|
|
155
|
+
const { pr: _pr, prs: _prs, stack: _stack, ...options } = input;
|
|
156
|
+
return "prs" in input
|
|
157
|
+
? { ...options, prNumbers: numbers, targetRepository: repository }
|
|
158
|
+
: { ...options, stackPrNumber: numbers[0], targetRepository: repository };
|
|
159
|
+
}
|
|
160
|
+
function validateIterateSelectors(input) {
|
|
161
|
+
const selectorCount = ["pr", "prs", "stack"].filter((key) => key in input).length;
|
|
162
|
+
if (selectorCount > 1) {
|
|
163
|
+
throw new PrShepherdValidationError("iterate pr, prs, and stack selectors are mutually exclusive");
|
|
164
|
+
}
|
|
165
|
+
}
|
|
117
166
|
function validateApplyInput(input) {
|
|
118
167
|
if (!input || !Array.isArray(input.operations) || input.operations.length === 0) {
|
|
119
168
|
throw new PrShepherdValidationError("apply requires a non-empty operations array");
|
package/bin/classify/apply.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BatchPrData } from "../types.mts";
|
|
2
|
+
import type { ClassifyItem, ClassifyAction } from "./types.mts";
|
|
2
3
|
import type { LoadedRule } from "./loader.mts";
|
|
3
4
|
export interface ClassifyIndex {
|
|
4
5
|
suppressedIds: Set<string>;
|
|
@@ -14,5 +15,6 @@ export interface BatchPartition {
|
|
|
14
15
|
/** COMMENTED review summary IDs — minimized without surfacing to the agent. */
|
|
15
16
|
ruleAutoResolveReviewSummaryIds: string[];
|
|
16
17
|
}
|
|
18
|
+
export declare function applyRules(rules: LoadedRule[], item: ClassifyItem): ClassifyAction;
|
|
17
19
|
export declare function buildClassifyIndex(rules: LoadedRule[], batch: BatchPrData): ClassifyIndex;
|
|
18
20
|
export declare function partitionBatch(index: ClassifyIndex, batch: BatchPrData): BatchPartition;
|
package/bin/classify/apply.mjs
CHANGED
package/bin/cli/default-poll.mjs
CHANGED
|
@@ -14,7 +14,8 @@ Run 'pr-shepherd apply <review|files|journal> --help' for command-specific detai
|
|
|
14
14
|
--help, -h Print this help and exit before GitHub I/O.`;
|
|
15
15
|
readonly "apply review": `pr-shepherd apply review
|
|
16
16
|
|
|
17
|
-
Apply GitHub review-state mutations after fixes.
|
|
17
|
+
Apply user-directed GitHub review-state mutations after fixes. Supplied IDs are forwarded to GitHub;
|
|
18
|
+
GitHub accepts or rejects each mutation.
|
|
18
19
|
|
|
19
20
|
Usage:
|
|
20
21
|
pr-shepherd apply review [PR] --reply-thread-ids A,B --message MSG
|
|
@@ -24,10 +25,9 @@ Usage:
|
|
|
24
25
|
|
|
25
26
|
Flags:
|
|
26
27
|
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
27
|
-
|
|
28
|
-
--reply-thread-ids <ids> Comma-separated human review thread IDs to reply to.
|
|
28
|
+
--reply-thread-ids <ids> Comma-separated review thread IDs to reply to.
|
|
29
29
|
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
30
|
-
--dismiss-review-ids <ids> Comma-separated
|
|
30
|
+
--dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
|
|
31
31
|
--message <text> Reply/dismiss message. Required with reply or dismiss IDs.
|
|
32
32
|
--require-sha <sha> Wait for this full 40-character lowercase PR head SHA.
|
|
33
33
|
--format text|json Output format. Default: text.
|
|
@@ -121,7 +121,8 @@ Use --dry-run to preview paths without removing them.
|
|
|
121
121
|
readonly "admin log-file": string;
|
|
122
122
|
readonly resolve: `pr-shepherd resolve
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
Deprecated compatibility alias for user-directed GitHub review-state mutations. Supplied IDs are forwarded to GitHub;
|
|
125
|
+
GitHub accepts or rejects each mutation.
|
|
125
126
|
|
|
126
127
|
Usage:
|
|
127
128
|
pr-shepherd resolve [PR] --reply-thread-ids A,B --message MSG
|
|
@@ -131,11 +132,10 @@ Usage:
|
|
|
131
132
|
|
|
132
133
|
Flags:
|
|
133
134
|
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
134
|
-
Human-authored thread IDs are skipped; use --reply-thread-ids.
|
|
135
135
|
Note: comment IDs (PRRC_*) from gh api are not thread IDs and will fail.
|
|
136
|
-
--reply-thread-ids <ids> Comma-separated
|
|
136
|
+
--reply-thread-ids <ids> Comma-separated review thread IDs to reply to.
|
|
137
137
|
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
138
|
-
--dismiss-review-ids <ids> Comma-separated
|
|
138
|
+
--dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
|
|
139
139
|
--message <text> Reply/dismiss message. Required with --reply-thread-ids
|
|
140
140
|
or --dismiss-review-ids.
|
|
141
141
|
--require-sha <sha> Wait until GitHub reports this PR head SHA before mutating.
|
|
@@ -194,7 +194,7 @@ Flags:
|
|
|
194
194
|
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
195
195
|
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
196
196
|
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 Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\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 MERGE Run the emitted merge/queue command, then continue monitoring.\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 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
197
|
-
readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for
|
|
197
|
+
readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\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:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s).\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\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 Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\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 an explicit still-running line to stderr by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, 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, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged 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 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
198
198
|
readonly clean: `pr-shepherd clean
|
|
199
199
|
|
|
200
200
|
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
@@ -17,7 +17,8 @@ Run 'pr-shepherd apply <review|files|journal> --help' for command-specific detai
|
|
|
17
17
|
--help, -h Print this help and exit before GitHub I/O.`,
|
|
18
18
|
"apply review": `pr-shepherd apply review
|
|
19
19
|
|
|
20
|
-
Apply GitHub review-state mutations after fixes.
|
|
20
|
+
Apply user-directed GitHub review-state mutations after fixes. Supplied IDs are forwarded to GitHub;
|
|
21
|
+
GitHub accepts or rejects each mutation.
|
|
21
22
|
|
|
22
23
|
Usage:
|
|
23
24
|
pr-shepherd apply review [PR] --reply-thread-ids A,B --message MSG
|
|
@@ -27,10 +28,9 @@ Usage:
|
|
|
27
28
|
|
|
28
29
|
Flags:
|
|
29
30
|
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
30
|
-
|
|
31
|
-
--reply-thread-ids <ids> Comma-separated human review thread IDs to reply to.
|
|
31
|
+
--reply-thread-ids <ids> Comma-separated review thread IDs to reply to.
|
|
32
32
|
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
33
|
-
--dismiss-review-ids <ids> Comma-separated
|
|
33
|
+
--dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
|
|
34
34
|
--message <text> Reply/dismiss message. Required with reply or dismiss IDs.
|
|
35
35
|
--require-sha <sha> Wait for this full 40-character lowercase PR head SHA.
|
|
36
36
|
--format text|json Output format. Default: text.
|
|
@@ -124,7 +124,8 @@ Use --dry-run to preview paths without removing them.
|
|
|
124
124
|
"admin log-file": LOG_FILE_USAGE.replaceAll("pr-shepherd log-file", "pr-shepherd admin log-file"),
|
|
125
125
|
resolve: `pr-shepherd resolve
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
Deprecated compatibility alias for user-directed GitHub review-state mutations. Supplied IDs are forwarded to GitHub;
|
|
128
|
+
GitHub accepts or rejects each mutation.
|
|
128
129
|
|
|
129
130
|
Usage:
|
|
130
131
|
pr-shepherd resolve [PR] --reply-thread-ids A,B --message MSG
|
|
@@ -134,11 +135,10 @@ Usage:
|
|
|
134
135
|
|
|
135
136
|
Flags:
|
|
136
137
|
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
137
|
-
Human-authored thread IDs are skipped; use --reply-thread-ids.
|
|
138
138
|
Note: comment IDs (PRRC_*) from gh api are not thread IDs and will fail.
|
|
139
|
-
--reply-thread-ids <ids> Comma-separated
|
|
139
|
+
--reply-thread-ids <ids> Comma-separated review thread IDs to reply to.
|
|
140
140
|
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
141
|
-
--dismiss-review-ids <ids> Comma-separated
|
|
141
|
+
--dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
|
|
142
142
|
--message <text> Reply/dismiss message. Required with --reply-thread-ids
|
|
143
143
|
or --dismiss-review-ids.
|
|
144
144
|
--require-sha <sha> Wait until GitHub reports this PR head SHA before mutating.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
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 Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\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 MERGE Run the emitted merge/queue command, then continue monitoring.\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 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
2
|
-
export declare const POLL_USAGE = "pr-shepherd poll\n\nRun iterate repeatedly for
|
|
2
|
+
export declare const POLL_USAGE = "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\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:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s).\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\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 Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\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 an explicit still-running line to stderr by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, 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, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged 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 15 MERGE\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;
|
|
@@ -37,17 +37,20 @@ Exit codes:
|
|
|
37
37
|
A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).`;
|
|
38
38
|
export const POLL_USAGE = `pr-shepherd poll
|
|
39
39
|
|
|
40
|
-
Run iterate repeatedly for
|
|
41
|
-
|
|
40
|
+
Run iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native
|
|
41
|
+
GitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.
|
|
42
42
|
Poll exits as soon as iterate returns MARK_READY, CANCEL, or ESCALATE, or when timeout
|
|
43
|
-
returns the last WAIT result. FIX_CODE starts a --debounce settle window (default
|
|
43
|
+
returns the last WAIT result. FIX_CODE starts a --debounce settle window (default:
|
|
44
|
+
poll.debounceSeconds; built-in 1m): poll keeps
|
|
44
45
|
iterating at --interval, then runs one more tick after the window and returns that result.
|
|
45
46
|
With --until-terminal or --merge, poll also continues through MARK_READY.
|
|
46
47
|
|
|
47
48
|
Usage:
|
|
48
|
-
pr-shepherd poll [PR] [poll-flags] [iterate-flags]
|
|
49
|
+
pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]
|
|
50
|
+
pr-shepherd poll --stack PR [poll-flags] [iterate-flags]
|
|
49
51
|
|
|
50
52
|
Poll flags:
|
|
53
|
+
--stack PR Select all entries in PR's native GitHub stack, bottom to top.
|
|
51
54
|
--interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s).
|
|
52
55
|
--timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).
|
|
53
56
|
--debounce <duration> Settle window after first FIX_CODE before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.
|
|
@@ -82,4 +85,6 @@ Exit codes: same as iterate (the final tick's action/reason decides the code).
|
|
|
82
85
|
15 MERGE
|
|
83
86
|
A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).`;
|
|
84
87
|
/** Public help page for the default PR polling invocation. */
|
|
85
|
-
export const DEFAULT_USAGE = POLL_USAGE.replace(/^pr-shepherd poll$/m, "pr-shepherd [PR]")
|
|
88
|
+
export const DEFAULT_USAGE = POLL_USAGE.replace(/^pr-shepherd poll$/m, "pr-shepherd [PR]")
|
|
89
|
+
.replace(/^ {2}pr-shepherd poll \[PR \.\.\.\]/m, " pr-shepherd [PR ...]")
|
|
90
|
+
.replace(/^ {2}pr-shepherd poll --stack/m, " pr-shepherd --stack");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const TOP_USAGE = "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR] [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR]
|
|
1
|
+
export declare const TOP_USAGE = "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. 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 Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n\nPolling flags:\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s).\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until FIX_CODE/CANCEL/ESCALATE.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged 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 15 MERGE\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
|
|
@@ -5,7 +5,8 @@ Autonomous PR CI monitor and review-comment resolver for agentic coding tools.
|
|
|
5
5
|
Usage:
|
|
6
6
|
pr-shepherd --version | -v
|
|
7
7
|
pr-shepherd --help | -h
|
|
8
|
-
pr-shepherd [PR] [poll-flags] [iterate-flags]
|
|
8
|
+
pr-shepherd [PR ...] [poll-flags] [iterate-flags]
|
|
9
|
+
pr-shepherd --stack PR [poll-flags] [iterate-flags]
|
|
9
10
|
pr-shepherd iterate [PR] [iterate-flags]
|
|
10
11
|
pr-shepherd apply review [PR] [review-flags]
|
|
11
12
|
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
@@ -16,7 +17,7 @@ Usage:
|
|
|
16
17
|
pr-shepherd admin log-file [--format text|json]
|
|
17
18
|
|
|
18
19
|
Commands:
|
|
19
|
-
[PR]
|
|
20
|
+
[PR ...] Poll one PR, an explicit same-repository set, or a native stack.
|
|
20
21
|
iterate Run one iterate tick (single-tick alias).
|
|
21
22
|
apply review Apply review-state mutations after fixes.
|
|
22
23
|
apply files Mark selected changed files as viewed.
|
|
@@ -28,7 +29,8 @@ Commands:
|
|
|
28
29
|
admin log-file Print the per-worktree debug log path.
|
|
29
30
|
|
|
30
31
|
PR argument:
|
|
31
|
-
PR may be a number
|
|
32
|
+
PR may be a number, owner/repo#number, or a GitHub pull request URL.
|
|
33
|
+
Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.
|
|
32
34
|
When omitted, pr-shepherd infers the current branch's pull request.
|
|
33
35
|
|
|
34
36
|
Common flags:
|
package/bin/cli/help.d.mts
CHANGED
|
@@ -14,7 +14,8 @@ Run 'pr-shepherd apply <review|files|journal> --help' for command-specific detai
|
|
|
14
14
|
--help, -h Print this help and exit before GitHub I/O.`;
|
|
15
15
|
readonly "apply review": `pr-shepherd apply review
|
|
16
16
|
|
|
17
|
-
Apply GitHub review-state mutations after fixes.
|
|
17
|
+
Apply user-directed GitHub review-state mutations after fixes. Supplied IDs are forwarded to GitHub;
|
|
18
|
+
GitHub accepts or rejects each mutation.
|
|
18
19
|
|
|
19
20
|
Usage:
|
|
20
21
|
pr-shepherd apply review [PR] --reply-thread-ids A,B --message MSG
|
|
@@ -24,10 +25,9 @@ Usage:
|
|
|
24
25
|
|
|
25
26
|
Flags:
|
|
26
27
|
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
27
|
-
|
|
28
|
-
--reply-thread-ids <ids> Comma-separated human review thread IDs to reply to.
|
|
28
|
+
--reply-thread-ids <ids> Comma-separated review thread IDs to reply to.
|
|
29
29
|
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
30
|
-
--dismiss-review-ids <ids> Comma-separated
|
|
30
|
+
--dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
|
|
31
31
|
--message <text> Reply/dismiss message. Required with reply or dismiss IDs.
|
|
32
32
|
--require-sha <sha> Wait for this full 40-character lowercase PR head SHA.
|
|
33
33
|
--format text|json Output format. Default: text.
|
|
@@ -121,7 +121,8 @@ Use --dry-run to preview paths without removing them.
|
|
|
121
121
|
readonly "admin log-file": string;
|
|
122
122
|
readonly resolve: `pr-shepherd resolve
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
Deprecated compatibility alias for user-directed GitHub review-state mutations. Supplied IDs are forwarded to GitHub;
|
|
125
|
+
GitHub accepts or rejects each mutation.
|
|
125
126
|
|
|
126
127
|
Usage:
|
|
127
128
|
pr-shepherd resolve [PR] --reply-thread-ids A,B --message MSG
|
|
@@ -131,11 +132,10 @@ Usage:
|
|
|
131
132
|
|
|
132
133
|
Flags:
|
|
133
134
|
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
134
|
-
Human-authored thread IDs are skipped; use --reply-thread-ids.
|
|
135
135
|
Note: comment IDs (PRRC_*) from gh api are not thread IDs and will fail.
|
|
136
|
-
--reply-thread-ids <ids> Comma-separated
|
|
136
|
+
--reply-thread-ids <ids> Comma-separated review thread IDs to reply to.
|
|
137
137
|
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
138
|
-
--dismiss-review-ids <ids> Comma-separated
|
|
138
|
+
--dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
|
|
139
139
|
--message <text> Reply/dismiss message. Required with --reply-thread-ids
|
|
140
140
|
or --dismiss-review-ids.
|
|
141
141
|
--require-sha <sha> Wait until GitHub reports this PR head SHA before mutating.
|
|
@@ -194,7 +194,7 @@ Flags:
|
|
|
194
194
|
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
195
195
|
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
196
196
|
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 Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\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 MERGE Run the emitted merge/queue command, then continue monitoring.\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 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
197
|
-
readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for
|
|
197
|
+
readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\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:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s).\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\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 Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\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 an explicit still-running line to stderr by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, 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, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged 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 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
198
198
|
readonly clean: `pr-shepherd clean
|
|
199
199
|
|
|
200
200
|
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
@@ -258,7 +258,7 @@ On POSIX, the final body-file path entry must be a readable regular file in a tr
|
|
|
258
258
|
symlinks, FIFOs, devices, and unreadable paths exit 66. Unsupported platforms fail closed with exit 66.
|
|
259
259
|
--help, -h Print this help and exit before any I/O.`;
|
|
260
260
|
readonly "log-file": "pr-shepherd log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd log-file [--format text|json]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
|
|
261
|
-
readonly top: "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR] [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR]
|
|
261
|
+
readonly top: "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. 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 Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n\nPolling flags:\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s).\n --timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until FIX_CODE/CANCEL/ESCALATE.\n\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\n 0 CANCEL (merged 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 15 MERGE\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
|
|
262
262
|
};
|
|
263
263
|
/** Resolve help keys for nested public commands before any command I/O. */
|
|
264
264
|
export declare function helpKeyForArgs(args: string[]): keyof typeof USAGE;
|
|
@@ -38,8 +38,15 @@ export function buildSimpleIterateInstructions(result) {
|
|
|
38
38
|
}
|
|
39
39
|
case "cancel":
|
|
40
40
|
return ["Stop — the PR loop is complete. No further polling is needed."];
|
|
41
|
-
case "escalate":
|
|
42
|
-
|
|
41
|
+
case "escalate": {
|
|
42
|
+
const pending = result.escalate.pendingReviewCommands;
|
|
43
|
+
if (!pending)
|
|
44
|
+
return ["Stop — human direction is required before automated polling can resume."];
|
|
45
|
+
return [
|
|
46
|
+
"Stop polling. Ask the user whether to run the pending review commands shown above.",
|
|
47
|
+
"If yes, replace any `$HEAD_SHA` with the full 40-character pushed PR-head SHA and any `$DISMISS_MESSAGE` with a one-sentence disposition, run every pending command, then rerun Shepherd with the same options.",
|
|
48
|
+
];
|
|
49
|
+
}
|
|
43
50
|
}
|
|
44
51
|
}
|
|
45
52
|
export function adaptIterateLog(log) {
|
package/bin/cli/iterate-lean.mjs
CHANGED
|
@@ -160,6 +160,14 @@ export function projectIterateLean(result, opts) {
|
|
|
160
160
|
...(result.escalate.changesRequestedReviews.length > 0 && {
|
|
161
161
|
changesRequestedReviews: result.escalate.changesRequestedReviews,
|
|
162
162
|
}),
|
|
163
|
+
...(result.escalate.firstLookSummaries &&
|
|
164
|
+
result.escalate.firstLookSummaries.length > 0 && {
|
|
165
|
+
firstLookSummaries: result.escalate.firstLookSummaries,
|
|
166
|
+
}),
|
|
167
|
+
...(result.escalate.editedSummaries &&
|
|
168
|
+
result.escalate.editedSummaries.length > 0 && {
|
|
169
|
+
editedSummaries: result.escalate.editedSummaries,
|
|
170
|
+
}),
|
|
163
171
|
...(result.escalate.checks &&
|
|
164
172
|
result.escalate.checks.length > 0 && {
|
|
165
173
|
checks: result.escalate.checks,
|
|
@@ -182,6 +190,9 @@ export function projectIterateLean(result, opts) {
|
|
|
182
190
|
result.escalate.authorization.length > 0 && {
|
|
183
191
|
authorization: result.escalate.authorization,
|
|
184
192
|
}),
|
|
193
|
+
...(result.escalate.pendingReviewCommands && {
|
|
194
|
+
pendingReviewCommands: result.escalate.pendingReviewCommands,
|
|
195
|
+
}),
|
|
185
196
|
suggestion: result.escalate.suggestion,
|
|
186
197
|
humanMessage: result.escalate.humanMessage,
|
|
187
198
|
},
|