pr-shepherd 0.43.0 → 0.44.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 +18 -17
- package/bin/api.d.mts +3 -2
- package/bin/api.mjs +13 -18
- package/bin/cli/args.mjs +13 -9
- package/bin/cli/fix-formatter.mjs +8 -6
- package/bin/cli/help-command-pages.d.mts +9 -6
- package/bin/cli/help-command-pages.mjs +7 -4
- package/bin/cli/help-iterate-poll-pages.d.mts +2 -2
- package/bin/cli/help-iterate-poll-pages.mjs +2 -2
- 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 +10 -7
- package/bin/cli/iterate-formatter.d.mts +1 -1
- package/bin/cli/iterate-formatter.mjs +5 -5
- package/bin/cli/iterate-lean.mjs +4 -0
- package/bin/cli/journal-formatter.mjs +3 -0
- package/bin/cli/journal-handler.mjs +11 -7
- package/bin/cli/list-formatters.d.mts +3 -1
- package/bin/cli/list-formatters.mjs +9 -7
- package/bin/cli/mark-files-as-viewed-formatter.mjs +7 -1
- package/bin/cli/mutate-formatter.mjs +4 -0
- package/bin/commands/check.mjs +22 -6
- package/bin/commands/commit-suggestion-instruction.d.mts +1 -1
- package/bin/commands/commit-suggestion-instruction.mjs +2 -2
- package/bin/commands/commit-suggestion.mjs +3 -1
- package/bin/commands/iterate/check-instructions.d.mts +5 -19
- package/bin/commands/iterate/check-instructions.mjs +24 -25
- package/bin/commands/iterate/classify.d.mts +2 -2
- package/bin/commands/iterate/classify.mjs +43 -25
- package/bin/commands/iterate/escalate.d.mts +1 -1
- package/bin/commands/iterate/escalate.mjs +11 -0
- package/bin/commands/iterate/fix-code.mjs +81 -42
- package/bin/commands/iterate/helpers.d.mts +0 -2
- package/bin/commands/iterate/helpers.mjs +0 -15
- package/bin/commands/iterate/index.mjs +6 -12
- package/bin/commands/iterate/mark-ready.d.mts +2 -0
- package/bin/commands/iterate/mark-ready.mjs +38 -0
- package/bin/commands/iterate/merge-state.mjs +38 -9
- package/bin/commands/iterate/merge.mjs +0 -1
- package/bin/commands/iterate/render.d.mts +2 -2
- package/bin/commands/iterate/render.mjs +19 -20
- package/bin/commands/iterate/stall.mjs +4 -2
- package/bin/commands/iterate/thread-mutation-routing.d.mts +9 -0
- package/bin/commands/iterate/thread-mutation-routing.mjs +29 -0
- package/bin/commands/journal/index.d.mts +5 -0
- package/bin/commands/journal/index.mjs +11 -2
- package/bin/commands/mark-files-as-viewed.d.mts +2 -1
- package/bin/commands/mark-files-as-viewed.mjs +5 -92
- package/bin/commands/resolve-mutate.mjs +51 -9
- package/bin/commands/shepherd-journal.d.mts +1 -1
- package/bin/commands/shepherd-journal.mjs +2 -2
- package/bin/commands/suggestion-patch-item.d.mts +1 -1
- package/bin/commands/suggestion-patch-item.mjs +3 -11
- package/bin/commands/suggestion-patches.mjs +3 -3
- package/bin/comments/authors.d.mts +6 -0
- package/bin/comments/authors.mjs +5 -0
- package/bin/comments/marker.d.mts +6 -1
- package/bin/comments/marker.mjs +8 -1
- package/bin/comments/resolve.d.mts +4 -0
- package/bin/comments/thread-visibility.mjs +10 -10
- package/bin/comments/visible-comments.mjs +2 -1
- package/bin/config/load.d.mts +1 -1
- package/bin/github/batch-parsers.d.mts +2 -2
- package/bin/github/batch-parsers.mjs +17 -1
- package/bin/github/batch-raw-types.d.mts +12 -0
- package/bin/github/batch.mjs +1 -1
- package/bin/github/client.d.mts +1 -0
- package/bin/github/client.mjs +8 -1
- package/bin/github/gql/batch-pr-page.gql +6 -0
- package/bin/github/gql/batch-pr.gql +13 -0
- package/bin/github/gql/get-pr-body.gql +1 -0
- package/bin/github/gql/review-thread-comments.gql +1 -0
- package/bin/github/gql/suggestion-threads.gql +1 -0
- package/bin/github/suggestion-thread.mjs +1 -0
- package/bin/mcp/server.mjs +12 -6
- package/bin/pr-reference.d.mts +13 -0
- package/bin/pr-reference.mjs +23 -1
- package/bin/reporters/agent.mjs +5 -0
- package/bin/threads/transcript.d.mts +2 -0
- package/bin/threads/transcript.mjs +2 -0
- package/bin/types/agent-thread.d.mts +1 -0
- package/bin/types/escalate.d.mts +6 -1
- package/bin/types/github.d.mts +19 -0
- package/bin/types/iterate.d.mts +9 -8
- package/bin/types/report.d.mts +14 -1
- package/bin/types/review-thread.d.mts +1 -0
- package/bin/types/suggestion-patch.d.mts +1 -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/mark-files-as-viewed/SKILL.md +3 -3
- package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +15 -13
- package/bin/commands/iterate/reruns.d.mts +0 -20
- package/bin/commands/iterate/reruns.mjs +0 -105
package/README.md
CHANGED
|
@@ -25,14 +25,14 @@ Full reference: [docs/README.md](docs/README.md). Feature matrix: [docs/features
|
|
|
25
25
|
|
|
26
26
|
`pr-shepherd` moves deterministic PR orchestration into a local MCP server, with a CLI for shells and CI. Both interfaces fetch the same GitHub state, emit raw-enough context, and return a numbered plan for the calling agent to follow.
|
|
27
27
|
|
|
28
|
-
The MCP server exposes canonical `iterate`, `apply`, and `build_suggestion_patches` tools. `apply` accepts ordered review mutations, file-view
|
|
28
|
+
The MCP server exposes canonical `iterate`, `apply`, and `build_suggestion_patches` tools. `apply` accepts ordered review mutations, selection-only file-view diagnostics, and journal entries; the deprecated singular suggestion tool remains temporarily as an adapter. Direct MCP calls require a repository-qualified `pr`: a GitHub PR URL or `owner/repo#N`; the explicit repository is the target for GitHub I/O, even when it differs from the local checkout. The CLI and programmatic API also retain bare-number and current-branch PR discovery. The shipped skills are thin dispatchers for those tools.
|
|
29
29
|
|
|
30
30
|
Each tick returns exactly one action:
|
|
31
31
|
|
|
32
32
|
- `WAIT` — no immediate action; continue with the next poll.
|
|
33
33
|
- `MARK_READY` — the CLI converted an eligible draft PR to ready; continue polling.
|
|
34
34
|
- `FIX_CODE` — agent work is required; complete it, then continue polling.
|
|
35
|
-
- `MERGE` — run the emitted auto-merge
|
|
35
|
+
- `MERGE` — run the emitted auto-merge command only when GitHub reports `viewerCanEnableAutoMerge`; queue enrollment otherwise hands off for authorization.
|
|
36
36
|
- `CANCEL` — stop polling because the PR merged, closed, or completed its ready-delay.
|
|
37
37
|
- `ESCALATE` — stop polling until a human provides direction.
|
|
38
38
|
|
|
@@ -59,7 +59,7 @@ Conversations Resolved: No [Not Required]
|
|
|
59
59
|
- `24697658766` — `CI › lint / typecheck / test (22.x)` [conclusion: FAILURE]
|
|
60
60
|
> oxfmt
|
|
61
61
|
|
|
62
|
-
## Post-fix
|
|
62
|
+
## Post-fix actions
|
|
63
63
|
|
|
64
64
|
- base: `main`
|
|
65
65
|
- apply review: `pr-shepherd apply review 123 --reply-thread-ids PRRT_kwDOSGizTs58XB1L --message "$DISMISS_MESSAGE" --require-sha "$HEAD_SHA"`
|
|
@@ -68,13 +68,13 @@ Conversations Resolved: No [Not Required]
|
|
|
68
68
|
|
|
69
69
|
1. Review each item under `## Review threads` and `## Failing checks` and decide whether it needs a code change.
|
|
70
70
|
2. Apply every warranted review fix in each file referenced above.
|
|
71
|
-
3. Triage every failure under `## Failing checks`. See "CI failure triage" in the pr-shepherd skill for
|
|
72
|
-
4. If you changed code, commit any remaining changes and push
|
|
73
|
-
5.
|
|
74
|
-
6.
|
|
71
|
+
3. Triage every failure under `## Failing checks`. See "CI failure triage" in the pr-shepherd skill for read-only inspection rules.
|
|
72
|
+
4. If you changed code, commit any remaining changes, then stop and hand off for a push whose authorization is established outside Shepherd; do not run review mutations or iterate until the remote PR head changes. If you did not change code, do not commit and continue.
|
|
73
|
+
5. Run the generated thread IDs unchanged. A latest comment beginning `<!-- pr-shepherd -->` is an earlier Shepherd reply: a marked viewer-authored human thread is emitted resolve-only when authorized, while a marked other-human thread is already acknowledged and has no further mutation.
|
|
74
|
+
6. If you did not change code, replace `$HEAD_SHA` with `$(git rev-parse HEAD)`, which must equal the current remote PR head. After changed code, wait for an authorized push and use its SHA.
|
|
75
75
|
7. Replace `$DISMISS_MESSAGE` with one sentence describing what changed.
|
|
76
76
|
8. Run the `apply review:` command shown above. See "Review-mutation mechanics" in the pr-shepherd skill for dismiss-ID retention.
|
|
77
|
-
9. `[FIX_CODE]` is
|
|
77
|
+
9. `[FIX_CODE]` is conditional: after changed code, stop until an authorized push changes the remote PR head; without code changes, complete the authorized review mutations and iterate again.
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
See [docs/actions.md](docs/actions.md) for the complete output contract. Iterate/poll PR outcomes use exit codes `0` and `10`–`15`; command and GitHub failures use `sysexits.h` codes — [docs/exit-codes.md](docs/exit-codes.md).
|
|
@@ -83,12 +83,13 @@ See [docs/actions.md](docs/actions.md) for the complete output contract. Iterate
|
|
|
83
83
|
|
|
84
84
|
This system is opinionated and works best with PRs that use required status checks and conversation resolution.
|
|
85
85
|
|
|
86
|
-
-
|
|
86
|
+
- A human inline thread whose original comment has `viewerDidAuthor: true` is replied to and resolved when its latest comment is unmarked. An unmarked other-human inline thread remains reply-only; a marker-ended other-human thread is already acknowledged and receives no further mutation. Human items are never minimized.
|
|
87
87
|
- Detected bots and configured `botUsernames` review threads are returned until resolved; bot/non-human threads, PR comments, and review summaries can be resolved or minimized when eligible. Review summaries are not minimized while known inline child threads from that review remain unresolved.
|
|
88
|
-
-
|
|
88
|
+
- Shepherd identifies its own latest reply only when that comment begins `<!-- pr-shepherd -->`, not from author equality. A marked viewer-authored thread can be resolved without another reply as a retry.
|
|
89
89
|
- Every review thread/comment/review summary is surfaced at least once, even if already outdated, resolved, or minimized; edited items re-surface through seen markers.
|
|
90
90
|
- Draft PRs can be marked ready automatically when clean; disable with `actions.autoMarkReady: false` or `--no-auto-mark-ready`.
|
|
91
|
-
- The CLI never performs git mutations. It
|
|
91
|
+
- The CLI never performs git mutations. It may emit local commit guidance, but it does not recommend a push because GitHub viewer fields cannot verify the local Git credential.
|
|
92
|
+
- Every GitHub mutation is permission-aware. Shepherd uses raw viewer capability fields, omits unauthorized commands, and repeats authorization checks in direct `apply` commands. Missing capability data fails closed.
|
|
92
93
|
- `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.
|
|
93
94
|
|
|
94
95
|
## Usage
|
|
@@ -127,13 +128,15 @@ pr-shepherd 42 --quiet-status # print only changed WAIT status snapshot
|
|
|
127
128
|
pr-shepherd 42 --until-terminal # continue through WAIT/MARK_READY until work or terminal state
|
|
128
129
|
pr-shepherd 42 --debounce 5m # wait 5m after first FIX_CODE, then return one batched tick
|
|
129
130
|
pr-shepherd 42 --ready-delay 15m
|
|
130
|
-
pr-shepherd 42 --merge # enable auto-merge
|
|
131
|
+
pr-shepherd 42 --merge # enable auto-merge when GitHub confirms viewer authorization
|
|
131
132
|
pr-shepherd iterate 42 # single tick
|
|
133
|
+
pr-shepherd owner/repo#42 # poll a PR in an explicit repository
|
|
134
|
+
pr-shepherd https://github.com/owner/repo/pull/42
|
|
132
135
|
```
|
|
133
136
|
|
|
134
|
-
### Apply Review
|
|
137
|
+
### Apply Review And Journal Changes, Or Select Files
|
|
135
138
|
|
|
136
|
-
Use `apply` with ordered operations to reply/resolve/minimize/dismiss review items,
|
|
139
|
+
Use `apply` with ordered operations to reply/resolve/minimize/dismiss review items, select changed files for viewed-state authorization diagnostics, or append an idempotent Shepherd Journal item. File-view selection never mutates viewed state because GitHub exposes no exact viewer capability. Use `build_suggestion_patches` to turn ordered review suggestions into checked patches and commit metadata; it never changes the worktree or git history.
|
|
137
140
|
|
|
138
141
|
### Extract Shepherd Journal Entries
|
|
139
142
|
|
|
@@ -245,8 +248,6 @@ merge:
|
|
|
245
248
|
actions:
|
|
246
249
|
autoMinimizeSuppressed: true
|
|
247
250
|
autoMarkReady: false
|
|
248
|
-
neverCancelRuns:
|
|
249
|
-
- "Final Code Review"
|
|
250
251
|
```
|
|
251
252
|
|
|
252
253
|
Environment variables:
|
|
@@ -273,7 +274,7 @@ const rule: ClassifyRule = (item) => {
|
|
|
273
274
|
export default rule;
|
|
274
275
|
```
|
|
275
276
|
|
|
276
|
-
`suppress: true` hides the item from agent output. `autoResolve: true` queues it for the minimize/resolve mutation. When both apply together, Shepherd performs that mutation silently during `iterate` by default (`actions.autoMinimizeSuppressed: true`)
|
|
277
|
+
`suppress: true` hides the item from agent output. `autoResolve: true` queues it for the minimize/resolve mutation. When both apply together, Shepherd performs that mutation silently during `iterate` by default (`actions.autoMinimizeSuppressed: true`) only when GitHub reports the exact per-object capability. Denied or unverifiable items return to the normal first-look/edit visibility gate and produce no mutation recommendation.
|
|
277
278
|
|
|
278
279
|
TypeScript rules are loaded by the runtime's native TypeScript support; keep them to erasable syntax such as type annotations and `import type`. Runtime TypeScript features that need transpilation, such as enums, namespaces, parameter properties, and decorators, are not supported. Use `.mts` for portable ESM rules across Node, Bun, and Deno.
|
|
279
280
|
|
package/bin/api.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ export interface CreatePrShepherdOptions {
|
|
|
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
|
-
export type IterateInput = Omit<IterateCommandOptions, "format" | "prNumber"> & {
|
|
11
|
+
export type IterateInput = Omit<IterateCommandOptions, "format" | "prNumber" | "targetRepository"> & {
|
|
12
12
|
pr?: PrReference;
|
|
13
13
|
};
|
|
14
14
|
export interface ReviewMutationsOperation {
|
|
@@ -22,6 +22,7 @@ export interface ReviewMutationsOperation {
|
|
|
22
22
|
requireSha?: string;
|
|
23
23
|
}
|
|
24
24
|
export interface MarkFilesViewedOperation {
|
|
25
|
+
/** Compatibility-named selection only; always skips mutation because authorization is unverifiable. */
|
|
25
26
|
type: "mark_files_viewed";
|
|
26
27
|
files?: string[];
|
|
27
28
|
tests?: boolean;
|
|
@@ -32,7 +33,7 @@ export interface AppendJournalOperation {
|
|
|
32
33
|
item: string;
|
|
33
34
|
dryRun?: boolean;
|
|
34
35
|
}
|
|
35
|
-
/**
|
|
36
|
+
/** Operations run in this exact list order after validation; file-view selection is non-mutating. */
|
|
36
37
|
export type ApplyOperation = ReviewMutationsOperation | MarkFilesViewedOperation | AppendJournalOperation;
|
|
37
38
|
export interface ApplyInput {
|
|
38
39
|
/** PR shared by every operation in this ordered apply request. */
|
package/bin/api.mjs
CHANGED
|
@@ -8,8 +8,7 @@ import { validateJournalItem } from "./commands/journal/transform.mjs";
|
|
|
8
8
|
import { runMarkFilesAsViewed, } from "./commands/mark-files-as-viewed.mjs";
|
|
9
9
|
import { runResolveMutate } from "./commands/resolve-mutate.mjs";
|
|
10
10
|
import { runWithExecutionCwd } from "./execution-context.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import { parsePrReference } from "./pr-reference.mjs";
|
|
11
|
+
import { parsePrReference, resolveParsedPrTarget, } from "./pr-reference.mjs";
|
|
13
12
|
/** Raised before any API mutation when an input cannot be validated. */
|
|
14
13
|
export class PrShepherdValidationError extends Error {
|
|
15
14
|
constructor(message) {
|
|
@@ -39,14 +38,14 @@ export function createPrShepherd(options = {}) {
|
|
|
39
38
|
iterate(input = {}) {
|
|
40
39
|
const { pr: _pr, ...options } = input;
|
|
41
40
|
return runWithExecutionCwd(cwd, async () => {
|
|
42
|
-
const
|
|
43
|
-
return runIterate({ ...options,
|
|
41
|
+
const target = resolvePrReference(input.pr);
|
|
42
|
+
return runIterate({ ...options, ...target, format: "json" });
|
|
44
43
|
});
|
|
45
44
|
},
|
|
46
45
|
apply(input) {
|
|
47
46
|
return runWithExecutionCwd(cwd, async () => {
|
|
48
47
|
validateApplyInput(input);
|
|
49
|
-
const prNumber =
|
|
48
|
+
const { prNumber, targetRepository } = resolvePrReference(input.pr);
|
|
50
49
|
const results = [];
|
|
51
50
|
for (let index = 0; index < input.operations.length; index += 1) {
|
|
52
51
|
const operation = input.operations[index];
|
|
@@ -57,6 +56,7 @@ export function createPrShepherd(options = {}) {
|
|
|
57
56
|
const result = await runResolveMutate({
|
|
58
57
|
...options,
|
|
59
58
|
prNumber,
|
|
59
|
+
targetRepository,
|
|
60
60
|
dismissMessage: message,
|
|
61
61
|
format: "json",
|
|
62
62
|
});
|
|
@@ -66,6 +66,7 @@ export function createPrShepherd(options = {}) {
|
|
|
66
66
|
case "mark_files_viewed": {
|
|
67
67
|
const result = await runMarkFilesAsViewed({
|
|
68
68
|
prNumber,
|
|
69
|
+
targetRepository,
|
|
69
70
|
files: operation.files ?? [],
|
|
70
71
|
tests: operation.tests,
|
|
71
72
|
matchPatterns: operation.matchPatterns,
|
|
@@ -77,6 +78,7 @@ export function createPrShepherd(options = {}) {
|
|
|
77
78
|
case "append_journal": {
|
|
78
79
|
const result = await runJournal({
|
|
79
80
|
prNumber,
|
|
81
|
+
targetRepository,
|
|
80
82
|
rawItem: operation.item,
|
|
81
83
|
dryRun: operation.dryRun ?? false,
|
|
82
84
|
});
|
|
@@ -98,16 +100,16 @@ export function createPrShepherd(options = {}) {
|
|
|
98
100
|
validateSuggestionPatchInput(input);
|
|
99
101
|
const { pr: _pr, ...options } = input;
|
|
100
102
|
return runWithExecutionCwd(cwd, async () => {
|
|
101
|
-
const
|
|
102
|
-
return runCommitSuggestion({ ...options,
|
|
103
|
+
const target = resolvePrReference(input.pr);
|
|
104
|
+
return runCommitSuggestion({ ...options, ...target, format: "json" });
|
|
103
105
|
});
|
|
104
106
|
},
|
|
105
107
|
buildSuggestionPatches(input) {
|
|
106
108
|
validateSuggestionPatchesInput(input);
|
|
107
109
|
const { pr: _pr, ...options } = input;
|
|
108
110
|
return runWithExecutionCwd(cwd, async () => {
|
|
109
|
-
const
|
|
110
|
-
return runSuggestionPatches({ ...options,
|
|
111
|
+
const target = resolvePrReference(input.pr);
|
|
112
|
+
return runSuggestionPatches({ ...options, ...target, format: "json" });
|
|
111
113
|
});
|
|
112
114
|
},
|
|
113
115
|
});
|
|
@@ -234,16 +236,9 @@ function validatePrReference(pr) {
|
|
|
234
236
|
return parsed;
|
|
235
237
|
throw new PrShepherdValidationError("pr must be a positive number, a GitHub pull-request URL, or owner/repo#number");
|
|
236
238
|
}
|
|
237
|
-
|
|
239
|
+
function resolvePrReference(pr) {
|
|
238
240
|
const parsed = validatePrReference(pr);
|
|
239
|
-
|
|
240
|
-
const repo = await getRepoInfo();
|
|
241
|
-
const currentRepository = `${repo.owner}/${repo.name}`;
|
|
242
|
-
if (parsed.repository.toLowerCase() !== currentRepository.toLowerCase()) {
|
|
243
|
-
throw new PrShepherdValidationError(`PR reference repository ${parsed.repository} does not match the configured repository ${currentRepository}`);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
return parsed.number;
|
|
241
|
+
return resolveParsedPrTarget(parsed);
|
|
247
242
|
}
|
|
248
243
|
function validateStringArray(value, label) {
|
|
249
244
|
if (value !== undefined &&
|
package/bin/cli/args.mjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* CLI argument-parsing helpers extracted from cli.mts for testability.
|
|
3
3
|
*/
|
|
4
4
|
import { parseArgs } from "node:util";
|
|
5
|
+
import { parseCliPrReference, resolveParsedPrTarget } from "../pr-reference.mjs";
|
|
5
6
|
// Flags that consume the next argument as their value (used for PR-number
|
|
6
7
|
// detection only — prevents a flag's value from being mistaken for a PR number).
|
|
7
8
|
const FLAGS_WITH_VALUES = new Set([
|
|
@@ -101,25 +102,28 @@ export function parseCommonArgs(args) {
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
const prIndex = args.findIndex((a, index) => !skipForPrDetect.has(index) && !a.startsWith("--") && parsePrNumber(a) !== null);
|
|
104
|
-
const
|
|
105
|
+
const target = prIndex !== -1
|
|
106
|
+
? resolveParsedPrTarget(parseCliPrReference(args[prIndex]))
|
|
107
|
+
: { prNumber: undefined };
|
|
105
108
|
// Remove consumed global-flag indices (and the PR number itself) from extra.
|
|
106
109
|
if (prIndex !== -1) {
|
|
107
110
|
consumedIndices.add(prIndex);
|
|
108
111
|
}
|
|
109
112
|
const extra = args.filter((_, i) => !consumedIndices.has(i));
|
|
110
113
|
return {
|
|
111
|
-
prNumber,
|
|
112
|
-
global: {
|
|
114
|
+
prNumber: target.prNumber,
|
|
115
|
+
global: {
|
|
116
|
+
format,
|
|
117
|
+
verbose,
|
|
118
|
+
...(target.targetRepository !== undefined
|
|
119
|
+
? { targetRepository: target.targetRepository }
|
|
120
|
+
: undefined),
|
|
121
|
+
},
|
|
113
122
|
extra,
|
|
114
123
|
};
|
|
115
124
|
}
|
|
116
125
|
export function parsePrNumber(value) {
|
|
117
|
-
|
|
118
|
-
return parseInt(value, 10);
|
|
119
|
-
const match = value.match(/^https?:\/\/github\.com\/[^/]+\/[^/]+\/pull\/(\d+)(?:[/?#].*)?$/);
|
|
120
|
-
if (match)
|
|
121
|
-
return parseInt(match[1], 10);
|
|
122
|
-
return null;
|
|
126
|
+
return parseCliPrReference(value)?.number ?? null;
|
|
123
127
|
}
|
|
124
128
|
/** Get the value of a flag like `--flag value` or `--flag=value`. */
|
|
125
129
|
export function getFlag(args, name) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
1
2
|
import { renderResolveCommand } from "../commands/iterate/render.mjs";
|
|
2
3
|
import { inlineCode, joinSections } from "../util/markdown.mjs";
|
|
3
4
|
import { renderSuggestionBlock, renderLineRange } from "./suggestion-renderer.mjs";
|
|
@@ -17,7 +18,7 @@ export function formatFixCodeResult(header, result) {
|
|
|
17
18
|
const reviewMarker = t.reviewId ? ` [reviewId=${t.reviewId}]` : "";
|
|
18
19
|
const suggestionMarker = t.suggestion ? " [suggestion]" : "";
|
|
19
20
|
const editedMarker = t.edited ? " [edited since first look]" : "";
|
|
20
|
-
sections.push(`### ${heading} — ${loc} (${renderAuthor(t.author, t.authorType, t.authorAssociation)})${reviewMarker}${suggestionMarker}${editedMarker}`);
|
|
21
|
+
sections.push(`### ${heading} — ${loc} (${renderAuthor(t.author, t.authorType, t.authorAssociation, t.viewerDidAuthor)})${reviewMarker}${suggestionMarker}${editedMarker}`);
|
|
21
22
|
sections.push(renderThreadConversation(t));
|
|
22
23
|
if (t.suggestion) {
|
|
23
24
|
sections.push(renderSuggestionBlock(t.suggestion, ""));
|
|
@@ -35,7 +36,8 @@ export function formatFixCodeResult(header, result) {
|
|
|
35
36
|
for (const c of result.fix.actionableComments) {
|
|
36
37
|
const heading = c.url ? `[commentId=${c.id}](${c.url})` : `\`commentId=${c.id}\``;
|
|
37
38
|
const editedMarker = c.edited ? " [edited since first look]" : "";
|
|
38
|
-
|
|
39
|
+
const authorizationMarker = c.viewerCanMinimize === false ? " [viewer cannot minimize]" : "";
|
|
40
|
+
sections.push(`### ${heading} (${renderAuthor(c.author, c.authorType, c.authorAssociation)})${authorizationMarker}${editedMarker}`);
|
|
39
41
|
sections.push(blockquote(c.body));
|
|
40
42
|
}
|
|
41
43
|
}
|
|
@@ -89,14 +91,14 @@ export function formatFixCodeResult(header, result) {
|
|
|
89
91
|
if (result.fix.firstLookSummaries.length > 0) {
|
|
90
92
|
sections.push("## Review summaries (first look)");
|
|
91
93
|
for (const r of result.fix.firstLookSummaries) {
|
|
92
|
-
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType, r.authorAssociation)})`);
|
|
94
|
+
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType, r.authorAssociation)})${r.viewerCanMinimize === false ? " [viewer cannot minimize]" : ""}`);
|
|
93
95
|
sections.push(r.body.trim() === "" ? "(no review body)" : blockquote(r.body));
|
|
94
96
|
}
|
|
95
97
|
}
|
|
96
98
|
if (result.fix.editedSummaries.length > 0) {
|
|
97
99
|
sections.push("## Review summaries (edited since first look — already minimized; do not re-minimize)");
|
|
98
100
|
for (const r of result.fix.editedSummaries) {
|
|
99
|
-
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType, r.authorAssociation)})`);
|
|
101
|
+
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType, r.authorAssociation)})${r.viewerCanMinimize === false ? " [viewer cannot minimize]" : ""}`);
|
|
100
102
|
sections.push(r.body.trim() === "" ? "(no review body)" : blockquote(r.body));
|
|
101
103
|
}
|
|
102
104
|
}
|
|
@@ -109,7 +111,7 @@ export function formatFixCodeResult(header, result) {
|
|
|
109
111
|
if (result.fix.surfacedApprovals.length > 0) {
|
|
110
112
|
sections.push("## Approvals (surfaced — not minimized)");
|
|
111
113
|
for (const r of result.fix.surfacedApprovals) {
|
|
112
|
-
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType, r.authorAssociation)})`);
|
|
114
|
+
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType, r.authorAssociation)})${r.viewerCanMinimize === false ? " [viewer cannot minimize]" : ""}`);
|
|
113
115
|
sections.push(r.body.trim() === "" ? "(no review body)" : blockquote(r.body));
|
|
114
116
|
}
|
|
115
117
|
}
|
|
@@ -130,7 +132,7 @@ export function formatFixCodeResult(header, result) {
|
|
|
130
132
|
sections.push("## Cancelled runs");
|
|
131
133
|
sections.push(result.cancelled.map((id) => `- \`${id}\``).join("\n"));
|
|
132
134
|
}
|
|
133
|
-
sections.push("## Post-fix
|
|
135
|
+
sections.push("## Post-fix actions");
|
|
134
136
|
const postFixLines = [`- base: \`${result.baseBranch}\``];
|
|
135
137
|
if (result.fix.resolveOnlyCommand?.hasMutations)
|
|
136
138
|
postFixLines.push(`- resolve-only: \`${renderResolveCommand(result.fix.resolveOnlyCommand)}\``);
|
|
@@ -2,7 +2,7 @@ export declare const COMMAND_USAGE: {
|
|
|
2
2
|
readonly default: string;
|
|
3
3
|
readonly apply: `pr-shepherd apply
|
|
4
4
|
|
|
5
|
-
Apply a review mutation,
|
|
5
|
+
Apply a review mutation, select changed files for authorization diagnostics, or append a PR journal item.
|
|
6
6
|
|
|
7
7
|
Usage:
|
|
8
8
|
pr-shepherd apply review [PR] [review-flags]
|
|
@@ -36,7 +36,8 @@ At least one action flag is required.
|
|
|
36
36
|
--help, -h Print this help and exit before GitHub I/O.`;
|
|
37
37
|
readonly "apply files": `pr-shepherd apply files
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
Select changed files and report that viewed-state authorization cannot be verified.
|
|
40
|
+
No file viewed-state mutation is attempted.
|
|
40
41
|
|
|
41
42
|
Usage:
|
|
42
43
|
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
@@ -139,7 +140,8 @@ Flags:
|
|
|
139
140
|
--message <text> Reply/dismiss message. Required with --reply-thread-ids
|
|
140
141
|
or --dismiss-review-ids.
|
|
141
142
|
--require-sha <sha> Wait until GitHub reports this PR head SHA before mutating.
|
|
142
|
-
Must be a full 40-character lowercase hex SHA.
|
|
143
|
+
Must be a full 40-character lowercase hex SHA. Local HEAD is valid
|
|
144
|
+
only when it equals the current remote PR head.
|
|
143
145
|
--format text|json Output format. Default: text.
|
|
144
146
|
--help, -h Print this help and exit before GitHub I/O.
|
|
145
147
|
|
|
@@ -174,7 +176,8 @@ Exit codes:
|
|
|
174
176
|
See docs/exit-codes.md for the full sysexits.h table.`;
|
|
175
177
|
readonly "mark-files-as-viewed": `pr-shepherd mark-files-as-viewed
|
|
176
178
|
|
|
177
|
-
|
|
179
|
+
Deprecated compatibility alias for selection-only file-view authorization diagnostics.
|
|
180
|
+
No file viewed-state mutation is attempted.
|
|
178
181
|
|
|
179
182
|
Usage:
|
|
180
183
|
pr-shepherd mark-files-as-viewed [PR] [files...] [--tests] [--match REGEX]
|
|
@@ -192,8 +195,8 @@ Flags:
|
|
|
192
195
|
|
|
193
196
|
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
194
197
|
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
195
|
-
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
|
|
196
|
-
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 or --merge, 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
|
|
198
|
+
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).";
|
|
199
|
+
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 or --merge, 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 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; --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, 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).";
|
|
197
200
|
readonly clean: `pr-shepherd clean
|
|
198
201
|
|
|
199
202
|
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
@@ -5,7 +5,7 @@ export const COMMAND_USAGE = {
|
|
|
5
5
|
default: DEFAULT_USAGE,
|
|
6
6
|
apply: `pr-shepherd apply
|
|
7
7
|
|
|
8
|
-
Apply a review mutation,
|
|
8
|
+
Apply a review mutation, select changed files for authorization diagnostics, or append a PR journal item.
|
|
9
9
|
|
|
10
10
|
Usage:
|
|
11
11
|
pr-shepherd apply review [PR] [review-flags]
|
|
@@ -39,7 +39,8 @@ At least one action flag is required.
|
|
|
39
39
|
--help, -h Print this help and exit before GitHub I/O.`,
|
|
40
40
|
"apply files": `pr-shepherd apply files
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
Select changed files and report that viewed-state authorization cannot be verified.
|
|
43
|
+
No file viewed-state mutation is attempted.
|
|
43
44
|
|
|
44
45
|
Usage:
|
|
45
46
|
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
@@ -142,7 +143,8 @@ Flags:
|
|
|
142
143
|
--message <text> Reply/dismiss message. Required with --reply-thread-ids
|
|
143
144
|
or --dismiss-review-ids.
|
|
144
145
|
--require-sha <sha> Wait until GitHub reports this PR head SHA before mutating.
|
|
145
|
-
Must be a full 40-character lowercase hex SHA.
|
|
146
|
+
Must be a full 40-character lowercase hex SHA. Local HEAD is valid
|
|
147
|
+
only when it equals the current remote PR head.
|
|
146
148
|
--format text|json Output format. Default: text.
|
|
147
149
|
--help, -h Print this help and exit before GitHub I/O.
|
|
148
150
|
|
|
@@ -177,7 +179,8 @@ Exit codes:
|
|
|
177
179
|
See docs/exit-codes.md for the full sysexits.h table.`,
|
|
178
180
|
"mark-files-as-viewed": `pr-shepherd mark-files-as-viewed
|
|
179
181
|
|
|
180
|
-
|
|
182
|
+
Deprecated compatibility alias for selection-only file-view authorization diagnostics.
|
|
183
|
+
No file viewed-state mutation is attempted.
|
|
181
184
|
|
|
182
185
|
Usage:
|
|
183
186
|
pr-shepherd mark-files-as-viewed [PR] [files...] [--tests] [--match REGEX]
|
|
@@ -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
|
|
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 or --merge, 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
|
|
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 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 or --merge, 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 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; --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, 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;
|
|
@@ -10,7 +10,7 @@ Iterate flags:
|
|
|
10
10
|
--ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.
|
|
11
11
|
--stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
|
|
12
12
|
--no-auto-mark-ready Do not convert draft PRs to ready for review.
|
|
13
|
-
--no-auto-cancel-actionable
|
|
13
|
+
--no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
|
|
14
14
|
--merge Shepherd through readiness, then emit a merge or merge-queue command.
|
|
15
15
|
--format text|json Output Markdown text or JSON. Default: text.
|
|
16
16
|
--verbose Include verbose iterate fields.
|
|
@@ -58,7 +58,7 @@ Forwarded iterate flags:
|
|
|
58
58
|
--ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.
|
|
59
59
|
--stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
|
|
60
60
|
--no-auto-mark-ready Do not convert draft PRs to ready for review.
|
|
61
|
-
--no-auto-cancel-actionable
|
|
61
|
+
--no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
|
|
62
62
|
--merge Shepherd through readiness, then emit a merge or merge-queue command.
|
|
63
63
|
--format text|json Output Markdown text or JSON. Default: text.
|
|
64
64
|
--verbose Include verbose iterate fields and detailed per-tick lines.
|
|
@@ -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 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 until non-WAIT or timeout. This is the default command.\n iterate Run one iterate tick (single-tick alias).\n apply review Apply review-state mutations after fixes.\n apply files
|
|
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 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 until non-WAIT or timeout. This is the default command.\n iterate Run one iterate tick (single-tick alias).\n apply review Apply review-state mutations after fixes.\n apply files Select changed files; no viewed-state mutation is attempted.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\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 such as 42 or a GitHub pull request URL.\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\nPolling flags:\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: 60s.\n --timeout <duration> Poll wall-clock cap 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\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)\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.";
|
|
@@ -18,7 +18,7 @@ Commands:
|
|
|
18
18
|
[PR] Poll until non-WAIT or timeout. This is the default command.
|
|
19
19
|
iterate Run one iterate tick (single-tick alias).
|
|
20
20
|
apply review Apply review-state mutations after fixes.
|
|
21
|
-
apply files
|
|
21
|
+
apply files Select changed files; no viewed-state mutation is attempted.
|
|
22
22
|
apply journal Append a list item to the Shepherd Journal details block of a PR body.
|
|
23
23
|
build-suggestion-patches
|
|
24
24
|
Convert ordered GitHub suggestion threads into patches and commit instructions.
|
|
@@ -38,7 +38,7 @@ Iterate flags:
|
|
|
38
38
|
--ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.
|
|
39
39
|
--stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.
|
|
40
40
|
--no-auto-mark-ready Do not convert draft PRs to ready for review.
|
|
41
|
-
--no-auto-cancel-actionable
|
|
41
|
+
--no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
|
|
42
42
|
|
|
43
43
|
Polling flags:
|
|
44
44
|
--interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: 60s.
|