pr-shepherd 0.53.1 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +1 -1
- package/bin/cli/args.mjs +3 -0
- package/bin/cli/check-blocker-handler.d.mts +2 -0
- package/bin/cli/check-blocker-handler.mjs +82 -0
- package/bin/cli/help-command-pages.d.mts +22 -3
- package/bin/cli/help-command-pages.mjs +21 -2
- package/bin/cli/help-iterate-poll-pages.d.mts +1 -1
- package/bin/cli/help-iterate-poll-pages.mjs +1 -1
- package/bin/cli/help-top-page.d.mts +1 -1
- package/bin/cli/help-top-page.mjs +3 -1
- package/bin/cli/help.d.mts +23 -4
- package/bin/cli/help.mjs +2 -0
- package/bin/cli/iterate-branch-segment.d.mts +3 -0
- package/bin/cli/iterate-branch-segment.mjs +13 -0
- package/bin/cli/iterate-formatter.mjs +5 -13
- package/bin/cli/iterate-lean.mjs +1 -0
- package/bin/cli/poll-handler.mjs +5 -1
- package/bin/cli-parser.mjs +4 -0
- package/bin/commands/apply-check-blocker.d.mts +22 -0
- package/bin/commands/apply-check-blocker.mjs +36 -0
- package/bin/commands/check-annotations.d.mts +1 -1
- package/bin/commands/check-annotations.mjs +27 -17
- package/bin/commands/check-blocker-ref.d.mts +3 -0
- package/bin/commands/check-blocker-ref.mjs +50 -0
- package/bin/commands/check.mjs +1 -0
- package/bin/commands/iterate/check-blocker-gate.d.mts +18 -0
- package/bin/commands/iterate/check-blocker-gate.mjs +115 -0
- package/bin/commands/iterate/check-instructions.d.mts +2 -0
- package/bin/commands/iterate/check-instructions.mjs +4 -0
- package/bin/commands/iterate/conflicting-head-ci.d.mts +18 -0
- package/bin/commands/iterate/conflicting-head-ci.mjs +32 -0
- package/bin/commands/iterate/fix-code.d.mts +2 -0
- package/bin/commands/iterate/fix-code.mjs +61 -16
- package/bin/commands/iterate/index.mjs +22 -8
- package/bin/commands/iterate/native-stack-rebase.d.mts +8 -2
- package/bin/commands/iterate/native-stack-rebase.mjs +14 -4
- package/bin/commands/iterate/stack-trunk-conflict.d.mts +13 -0
- package/bin/commands/iterate/stack-trunk-conflict.mjs +51 -0
- package/bin/commands/poll-quota.d.mts +2 -0
- package/bin/commands/poll-quota.mjs +25 -12
- package/bin/commands/poll-rate-limit-cancel.d.mts +35 -0
- package/bin/commands/poll-rate-limit-cancel.mjs +101 -0
- package/bin/commands/poll-rate-limit-delay.d.mts +1 -0
- package/bin/commands/poll-rate-limit-delay.mjs +7 -0
- package/bin/commands/poll-rate-limit-wait.d.mts +14 -0
- package/bin/commands/poll-rate-limit-wait.mjs +125 -0
- package/bin/commands/poll-summary.mjs +21 -9
- package/bin/commands/poll.mjs +22 -17
- package/bin/config/load.d.mts +2 -0
- package/bin/config/load.mjs +24 -2
- package/bin/config.json +1 -0
- package/bin/github/batch-parse-suites.d.mts +2 -0
- package/bin/github/batch-parse-suites.mjs +5 -0
- package/bin/github/batch.d.mts +2 -0
- package/bin/github/batch.mjs +2 -1
- package/bin/github/check-annotation-cache.d.mts +8 -0
- package/bin/github/check-annotation-cache.mjs +23 -0
- package/bin/github/check-annotation-pages.d.mts +11 -0
- package/bin/github/check-annotation-pages.mjs +36 -0
- package/bin/github/check-annotation-shape.d.mts +21 -0
- package/bin/github/check-annotation-shape.mjs +50 -0
- package/bin/github/check-annotations-batch.d.mts +17 -0
- package/bin/github/check-annotations-batch.mjs +92 -0
- package/bin/github/check-annotations.d.mts +8 -11
- package/bin/github/check-annotations.mjs +14 -103
- package/bin/github/gql/batch-pr.gql +1 -1
- package/bin/github/gql/check-run-annotations-batch.gql +41 -0
- package/bin/github/gql/upper-layer-conflict-target.gql +36 -0
- package/bin/github/pagination.d.mts +1 -1
- package/bin/github/pagination.mjs +1 -1
- package/bin/github/poll-summary-check-blockers.d.mts +16 -0
- package/bin/github/poll-summary-check-blockers.mjs +25 -0
- package/bin/github/poll-summary-checks.d.mts +2 -0
- package/bin/github/poll-summary-checks.mjs +35 -20
- package/bin/github/poll-summary-projector.mjs +5 -0
- package/bin/github/queries.d.mts +11 -0
- package/bin/github/queries.mjs +11 -0
- package/bin/state/check-blockers.d.mts +30 -0
- package/bin/state/check-blockers.mjs +88 -0
- package/bin/state/conflicting-head-seen.d.mts +13 -0
- package/bin/state/conflicting-head-seen.mjs +44 -0
- package/bin/types/iterate.d.mts +5 -0
- package/bin/types/report.d.mts +2 -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/README.md
CHANGED
|
@@ -166,7 +166,7 @@ above it. Layers above the prefix keep their one-PR sessions. After the merge, G
|
|
|
166
166
|
the next layer, so the rerun continues until the stack returns `CANCEL`. API and MCP aggregate
|
|
167
167
|
calls perform one summary tick and leave recurrence to the caller.
|
|
168
168
|
|
|
169
|
-
Polling defaults can be set under `poll` in `.pr-shepherdrc.yml`: `intervalSeconds
|
|
169
|
+
Polling defaults can be set under `poll` in `.pr-shepherdrc.yml`: `intervalSeconds` (built-in 60 for one PR), `stackIntervalFactor` (built-in 2, so `--stack` and multi-PR polls wait 120s), `timeoutSeconds`, `debounceSeconds`, and `quietStatus`. Explicit `--interval` overrides either period for that invocation and is not multiplied. Other explicit flags override configuration, including `--no-quiet-status` when a shared config enables quiet output. Quiet status remains off by default. Quota-warning bands stay multiples of `intervalSeconds`; the dispatcher sleeps the slower of the effective interval and the active band, so a default stack waits 120s until a tighter band is slower than that.
|
|
170
170
|
|
|
171
171
|
### Apply Review And Journal Changes, Or Select Files
|
|
172
172
|
|
package/bin/cli/args.mjs
CHANGED
|
@@ -21,6 +21,8 @@ const FLAGS_WITH_VALUES = new Set([
|
|
|
21
21
|
"--timeout",
|
|
22
22
|
"--debounce",
|
|
23
23
|
"--match",
|
|
24
|
+
"--check",
|
|
25
|
+
"--blocked-by",
|
|
24
26
|
]);
|
|
25
27
|
// Boolean flags that do NOT consume the next argument. Any --flag not in this
|
|
26
28
|
// set and not in FLAGS_WITH_VALUES is treated conservatively as value-taking
|
|
@@ -35,6 +37,7 @@ const BOOLEAN_FLAGS = new Set([
|
|
|
35
37
|
"--merge",
|
|
36
38
|
"--dry-run",
|
|
37
39
|
"--verbose",
|
|
40
|
+
"--clear",
|
|
38
41
|
]);
|
|
39
42
|
// ---------------------------------------------------------------------------
|
|
40
43
|
// Strict integer parsing
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { EXIT, errorToExitCode } from "../exit-codes.mjs";
|
|
2
|
+
import { applyCheckBlocker, formatCheckBlockerResult } from "../commands/apply-check-blocker.mjs";
|
|
3
|
+
import { parseBlockedByRef } from "../commands/check-blocker-ref.mjs";
|
|
4
|
+
import { getFlag, hasFlag, parseCommonArgs } from "./args.mjs";
|
|
5
|
+
import { maybePrintHelp } from "./help.mjs";
|
|
6
|
+
/** `apply check-blocker`. `--help`/`-h` returns before flag validation or state I/O. */
|
|
7
|
+
export async function handleCheckBlocker(args) {
|
|
8
|
+
if (maybePrintHelp(args, "apply check-blocker"))
|
|
9
|
+
return;
|
|
10
|
+
const { prNumber, global, extra } = parseCommonArgs(args);
|
|
11
|
+
const flagError = validateFlags(extra);
|
|
12
|
+
if (flagError) {
|
|
13
|
+
usage(flagError);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const checkName = getFlag(extra, "--check");
|
|
17
|
+
const blockedBy = getFlag(extra, "--blocked-by");
|
|
18
|
+
const clear = hasFlag(extra, "--clear");
|
|
19
|
+
if (checkName === null || checkName.length === 0) {
|
|
20
|
+
usage("`--check` requires the exact check name.");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (clear && blockedBy !== null) {
|
|
24
|
+
usage("pass either `--blocked-by` or `--clear`, not both.");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!clear && blockedBy === null) {
|
|
28
|
+
usage("pass `--blocked-by <ref>` or `--clear`.");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let blocker;
|
|
32
|
+
if (!clear) {
|
|
33
|
+
blocker = parseBlockedByRef(blockedBy ?? "") ?? undefined;
|
|
34
|
+
if (!blocker) {
|
|
35
|
+
usage(`invalid --blocked-by reference: "${blockedBy}".`);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
const result = await applyCheckBlocker({
|
|
41
|
+
prNumber,
|
|
42
|
+
targetRepository: global.targetRepository,
|
|
43
|
+
checkName,
|
|
44
|
+
...(clear ? { clear: true } : { blocker: blocker }),
|
|
45
|
+
});
|
|
46
|
+
const body = global.format === "json" ? JSON.stringify(result, null, 2) : formatCheckBlockerResult(result);
|
|
47
|
+
process.stdout.write(`${body}\n`);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
51
|
+
process.stderr.write(`pr-shepherd: apply check-blocker: ${message}\n`);
|
|
52
|
+
process.exitCode = errorToExitCode(err);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function usage(message) {
|
|
56
|
+
process.stderr.write(`pr-shepherd: apply check-blocker: ${message}\n`);
|
|
57
|
+
process.exitCode = EXIT.USAGE;
|
|
58
|
+
}
|
|
59
|
+
function validateFlags(args) {
|
|
60
|
+
for (let i = 0; i < args.length; i++) {
|
|
61
|
+
const arg = args[i];
|
|
62
|
+
if (!arg.startsWith("--"))
|
|
63
|
+
return `unexpected argument: "${arg}"`;
|
|
64
|
+
const eq = arg.indexOf("=");
|
|
65
|
+
const name = eq === -1 ? arg : arg.slice(0, eq);
|
|
66
|
+
if (name !== "--check" && name !== "--blocked-by" && name !== "--clear") {
|
|
67
|
+
return `unknown flag: "${name}"`;
|
|
68
|
+
}
|
|
69
|
+
if (name === "--clear") {
|
|
70
|
+
if (eq !== -1)
|
|
71
|
+
return `unknown flag: "${arg}"`;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (eq === -1) {
|
|
75
|
+
const value = args[i + 1];
|
|
76
|
+
if (value === undefined || value.startsWith("--"))
|
|
77
|
+
return `${name} requires a value.`;
|
|
78
|
+
i += 1;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
@@ -2,15 +2,17 @@ export declare const COMMAND_USAGE: {
|
|
|
2
2
|
readonly default: string;
|
|
3
3
|
readonly apply: `pr-shepherd apply
|
|
4
4
|
|
|
5
|
-
Apply review mutations, mark selected changed files as viewed,
|
|
5
|
+
Apply review mutations, mark selected changed files as viewed, append a PR journal item, or record an external check blocker.
|
|
6
6
|
|
|
7
7
|
Usage:
|
|
8
8
|
pr-shepherd apply review [PR] [review-flags]
|
|
9
9
|
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
10
10
|
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
11
11
|
pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
12
|
+
pr-shepherd apply check-blocker [PR] --check <name> --blocked-by <ref>
|
|
13
|
+
pr-shepherd apply check-blocker [PR] --check <name> --clear
|
|
12
14
|
|
|
13
|
-
Run 'pr-shepherd apply <review|files|journal> --help' for command-specific details.
|
|
15
|
+
Run 'pr-shepherd apply <review|files|journal|check-blocker> --help' for command-specific details.
|
|
14
16
|
--help, -h Print this help and exit before GitHub I/O.`;
|
|
15
17
|
readonly "apply review": `pr-shepherd apply review
|
|
16
18
|
|
|
@@ -61,6 +63,23 @@ PR may be a number or GitHub pull request URL. An item must start with '- ' foll
|
|
|
61
63
|
Use --file to read an item from a file, or --file - to read it from stdin. Exactly one item source
|
|
62
64
|
is required. --dry-run previews the resulting body without writing it.
|
|
63
65
|
--help, -h Print this help and exit before GitHub I/O.`;
|
|
66
|
+
readonly "apply check-blocker": `pr-shepherd apply check-blocker
|
|
67
|
+
|
|
68
|
+
Record that a failing check is blocked on an external pull request or issue, or clear that record.
|
|
69
|
+
While the blocker is open, iterate waits instead of treating that check as agent work.
|
|
70
|
+
|
|
71
|
+
Usage:
|
|
72
|
+
pr-shepherd apply check-blocker [PR] --check <name> --blocked-by <ref> [--format text|json]
|
|
73
|
+
pr-shepherd apply check-blocker [PR] --check <name> --clear [--format text|json]
|
|
74
|
+
|
|
75
|
+
\`--check\` is the exact check name. \`--blocked-by\` accepts:
|
|
76
|
+
https://github.com/owner/repo/pull/N
|
|
77
|
+
https://github.com/owner/repo/issues/N
|
|
78
|
+
owner/repo#N
|
|
79
|
+
issue:owner/repo#N
|
|
80
|
+
|
|
81
|
+
\`--clear\` removes that check's record and leaves other checks alone.
|
|
82
|
+
--help, -h Print this help and exit before any I/O.`;
|
|
64
83
|
readonly "build-suggestion-patches": `pr-shepherd build-suggestion-patches
|
|
65
84
|
|
|
66
85
|
Build an ordered list of patches and commit instructions from GitHub review suggestions.
|
|
@@ -194,7 +213,7 @@ Flags:
|
|
|
194
213
|
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
195
214
|
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
196
215
|
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 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 or stack SHEPHERD 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/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\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 a stderr line naming what it is waiting on 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 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
216
|
+
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). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\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 or stack SHEPHERD 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/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\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 a stderr line naming what it is waiting on 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 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
198
217
|
readonly clean: `pr-shepherd clean
|
|
199
218
|
|
|
200
219
|
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
@@ -5,15 +5,17 @@ export const COMMAND_USAGE = {
|
|
|
5
5
|
default: DEFAULT_USAGE,
|
|
6
6
|
apply: `pr-shepherd apply
|
|
7
7
|
|
|
8
|
-
Apply review mutations, mark selected changed files as viewed,
|
|
8
|
+
Apply review mutations, mark selected changed files as viewed, append a PR journal item, or record an external check blocker.
|
|
9
9
|
|
|
10
10
|
Usage:
|
|
11
11
|
pr-shepherd apply review [PR] [review-flags]
|
|
12
12
|
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
13
13
|
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
14
14
|
pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
15
|
+
pr-shepherd apply check-blocker [PR] --check <name> --blocked-by <ref>
|
|
16
|
+
pr-shepherd apply check-blocker [PR] --check <name> --clear
|
|
15
17
|
|
|
16
|
-
Run 'pr-shepherd apply <review|files|journal> --help' for command-specific details.
|
|
18
|
+
Run 'pr-shepherd apply <review|files|journal|check-blocker> --help' for command-specific details.
|
|
17
19
|
--help, -h Print this help and exit before GitHub I/O.`,
|
|
18
20
|
"apply review": `pr-shepherd apply review
|
|
19
21
|
|
|
@@ -64,6 +66,23 @@ PR may be a number or GitHub pull request URL. An item must start with '- ' foll
|
|
|
64
66
|
Use --file to read an item from a file, or --file - to read it from stdin. Exactly one item source
|
|
65
67
|
is required. --dry-run previews the resulting body without writing it.
|
|
66
68
|
--help, -h Print this help and exit before GitHub I/O.`,
|
|
69
|
+
"apply check-blocker": `pr-shepherd apply check-blocker
|
|
70
|
+
|
|
71
|
+
Record that a failing check is blocked on an external pull request or issue, or clear that record.
|
|
72
|
+
While the blocker is open, iterate waits instead of treating that check as agent work.
|
|
73
|
+
|
|
74
|
+
Usage:
|
|
75
|
+
pr-shepherd apply check-blocker [PR] --check <name> --blocked-by <ref> [--format text|json]
|
|
76
|
+
pr-shepherd apply check-blocker [PR] --check <name> --clear [--format text|json]
|
|
77
|
+
|
|
78
|
+
\`--check\` is the exact check name. \`--blocked-by\` accepts:
|
|
79
|
+
https://github.com/owner/repo/pull/N
|
|
80
|
+
https://github.com/owner/repo/issues/N
|
|
81
|
+
owner/repo#N
|
|
82
|
+
issue:owner/repo#N
|
|
83
|
+
|
|
84
|
+
\`--clear\` removes that check's record and leaves other checks alone.
|
|
85
|
+
--help, -h Print this help and exit before any I/O.`,
|
|
67
86
|
"build-suggestion-patches": `pr-shepherd build-suggestion-patches
|
|
68
87
|
|
|
69
88
|
Build an ordered list of patches and commit instructions from GitHub review suggestions.
|
|
@@ -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 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 or stack SHEPHERD 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/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\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 a stderr line naming what it is waiting on 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 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\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 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). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\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 or stack SHEPHERD 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/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\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 a stderr line naming what it is waiting on 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 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\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;
|
|
@@ -51,7 +51,7 @@ Usage:
|
|
|
51
51
|
|
|
52
52
|
Poll flags:
|
|
53
53
|
--stack PR Select all entries in PR's native GitHub stack, bottom to top.
|
|
54
|
-
--interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s).
|
|
54
|
+
--interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.
|
|
55
55
|
--timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).
|
|
56
56
|
--debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.
|
|
57
57
|
--quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.
|
|
@@ -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 --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 or stack SHEPHERD 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/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\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\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\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.";
|
|
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 apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\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 apply check-blocker Record that a failing check is blocked on an external PR or issue.\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). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\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 or stack SHEPHERD 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/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\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\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\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.";
|
|
@@ -11,6 +11,7 @@ Usage:
|
|
|
11
11
|
pr-shepherd apply review [PR] [review-flags]
|
|
12
12
|
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
13
13
|
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
14
|
+
pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)
|
|
14
15
|
pr-shepherd journal extract --body-file <path>
|
|
15
16
|
pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]
|
|
16
17
|
pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
|
|
@@ -22,6 +23,7 @@ Commands:
|
|
|
22
23
|
apply review Apply review-state mutations after fixes.
|
|
23
24
|
apply files Mark selected changed files as viewed.
|
|
24
25
|
apply journal Append a list item to the Shepherd Journal details block of a PR body.
|
|
26
|
+
apply check-blocker Record that a failing check is blocked on an external PR or issue.
|
|
25
27
|
journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.
|
|
26
28
|
build-suggestion-patches
|
|
27
29
|
Convert ordered GitHub suggestion threads into patches and commit instructions.
|
|
@@ -46,7 +48,7 @@ Iterate flags:
|
|
|
46
48
|
--merge Shepherd through readiness, then emit a merge or merge-queue command.
|
|
47
49
|
|
|
48
50
|
Polling flags:
|
|
49
|
-
--interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s).
|
|
51
|
+
--interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.
|
|
50
52
|
--timeout <duration> Poll wall-clock cap for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).
|
|
51
53
|
--debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.
|
|
52
54
|
--quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.
|
package/bin/cli/help.d.mts
CHANGED
|
@@ -2,15 +2,17 @@ export declare const USAGE: {
|
|
|
2
2
|
readonly default: string;
|
|
3
3
|
readonly apply: `pr-shepherd apply
|
|
4
4
|
|
|
5
|
-
Apply review mutations, mark selected changed files as viewed,
|
|
5
|
+
Apply review mutations, mark selected changed files as viewed, append a PR journal item, or record an external check blocker.
|
|
6
6
|
|
|
7
7
|
Usage:
|
|
8
8
|
pr-shepherd apply review [PR] [review-flags]
|
|
9
9
|
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
10
10
|
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
11
11
|
pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
12
|
+
pr-shepherd apply check-blocker [PR] --check <name> --blocked-by <ref>
|
|
13
|
+
pr-shepherd apply check-blocker [PR] --check <name> --clear
|
|
12
14
|
|
|
13
|
-
Run 'pr-shepherd apply <review|files|journal> --help' for command-specific details.
|
|
15
|
+
Run 'pr-shepherd apply <review|files|journal|check-blocker> --help' for command-specific details.
|
|
14
16
|
--help, -h Print this help and exit before GitHub I/O.`;
|
|
15
17
|
readonly "apply review": `pr-shepherd apply review
|
|
16
18
|
|
|
@@ -61,6 +63,23 @@ PR may be a number or GitHub pull request URL. An item must start with '- ' foll
|
|
|
61
63
|
Use --file to read an item from a file, or --file - to read it from stdin. Exactly one item source
|
|
62
64
|
is required. --dry-run previews the resulting body without writing it.
|
|
63
65
|
--help, -h Print this help and exit before GitHub I/O.`;
|
|
66
|
+
readonly "apply check-blocker": `pr-shepherd apply check-blocker
|
|
67
|
+
|
|
68
|
+
Record that a failing check is blocked on an external pull request or issue, or clear that record.
|
|
69
|
+
While the blocker is open, iterate waits instead of treating that check as agent work.
|
|
70
|
+
|
|
71
|
+
Usage:
|
|
72
|
+
pr-shepherd apply check-blocker [PR] --check <name> --blocked-by <ref> [--format text|json]
|
|
73
|
+
pr-shepherd apply check-blocker [PR] --check <name> --clear [--format text|json]
|
|
74
|
+
|
|
75
|
+
\`--check\` is the exact check name. \`--blocked-by\` accepts:
|
|
76
|
+
https://github.com/owner/repo/pull/N
|
|
77
|
+
https://github.com/owner/repo/issues/N
|
|
78
|
+
owner/repo#N
|
|
79
|
+
issue:owner/repo#N
|
|
80
|
+
|
|
81
|
+
\`--clear\` removes that check's record and leaves other checks alone.
|
|
82
|
+
--help, -h Print this help and exit before any I/O.`;
|
|
64
83
|
readonly "build-suggestion-patches": `pr-shepherd build-suggestion-patches
|
|
65
84
|
|
|
66
85
|
Build an ordered list of patches and commit instructions from GitHub review suggestions.
|
|
@@ -194,7 +213,7 @@ Flags:
|
|
|
194
213
|
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
195
214
|
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
196
215
|
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 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 or stack SHEPHERD 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/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\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 a stderr line naming what it is waiting on 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 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
216
|
+
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). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\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 or stack SHEPHERD 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/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\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 a stderr line naming what it is waiting on 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 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
198
217
|
readonly clean: `pr-shepherd clean
|
|
199
218
|
|
|
200
219
|
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
@@ -258,7 +277,7 @@ On POSIX, the final body-file path entry must be a readable regular file in a tr
|
|
|
258
277
|
symlinks, FIFOs, devices, and unreadable paths exit 66. Unsupported platforms fail closed with exit 66.
|
|
259
278
|
--help, -h Print this help and exit before any I/O.`;
|
|
260
279
|
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 --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 or stack SHEPHERD 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/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\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\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\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.";
|
|
280
|
+
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 apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\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 apply check-blocker Record that a failing check is blocked on an external PR or issue.\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). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\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 or stack SHEPHERD 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/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\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\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\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
281
|
};
|
|
263
282
|
/** Resolve help keys for nested public commands before any command I/O. */
|
|
264
283
|
export declare function helpKeyForArgs(args: string[]): keyof typeof USAGE;
|
package/bin/cli/help.mjs
CHANGED
|
@@ -13,6 +13,8 @@ export function helpKeyForArgs(args) {
|
|
|
13
13
|
return "apply files";
|
|
14
14
|
if (args[0] === "apply" && args[1] === "journal")
|
|
15
15
|
return "apply journal";
|
|
16
|
+
if (args[0] === "apply" && args[1] === "check-blocker")
|
|
17
|
+
return "apply check-blocker";
|
|
16
18
|
if (args[0] === "journal" && args[1] === "extract")
|
|
17
19
|
return "journal extract";
|
|
18
20
|
if (args[0] === "admin" && args[1] === "clean")
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Summary-line branch phrase. Empty when the PR is not behind or conflicting. */
|
|
2
|
+
export function branchStateSegment(result) {
|
|
3
|
+
if (result.mergeStatus === "BEHIND" && result.baseBranch) {
|
|
4
|
+
return `**branch** behind PR base \`${result.baseBranch}\``;
|
|
5
|
+
}
|
|
6
|
+
if (result.mergeStatus === "CONFLICTS" && result.stackTrunkConflict) {
|
|
7
|
+
return `**branch** conflicts with stack trunk \`${result.stackTrunkConflict}\``;
|
|
8
|
+
}
|
|
9
|
+
if (result.mergeStatus === "CONFLICTS" && result.baseBranch) {
|
|
10
|
+
return `**branch** conflicts with PR base \`${result.baseBranch}\``;
|
|
11
|
+
}
|
|
12
|
+
return "";
|
|
13
|
+
}
|
|
@@ -6,6 +6,7 @@ import { formatMergeRequirementLines } from "../merge-status/requirements-format
|
|
|
6
6
|
import { appendMergeQueueHeader, formatDeferredWorkLine, formatMergeAction, } from "./iterate-merge-formatter.mjs";
|
|
7
7
|
import { formatApiUsage, formatQuotaWarning } from "./api-usage-formatter.mjs";
|
|
8
8
|
import { formatActivityLine } from "./iterate-activity-formatter.mjs";
|
|
9
|
+
import { branchStateSegment } from "./iterate-branch-segment.mjs";
|
|
9
10
|
/**
|
|
10
11
|
* Format an IterateResult as human-readable Markdown.
|
|
11
12
|
*
|
|
@@ -29,15 +30,10 @@ export function formatIterateResult(result, opts) {
|
|
|
29
30
|
: "";
|
|
30
31
|
const baseBranchSeg = verbose && result.baseBranch ? ` · **baseBranch** \`${result.baseBranch}\`` : "";
|
|
31
32
|
const baseLine = `**status** \`${result.status}\` · **merge** \`${result.mergeStateStatus}\`${reviewDecisionSeg} · **state** \`${result.state}\` · **repo** \`${result.repo}\`${baseBranchSeg}`;
|
|
33
|
+
const branchSeg = branchStateSegment(result);
|
|
32
34
|
let summaryLine;
|
|
33
35
|
if (verbose) {
|
|
34
|
-
|
|
35
|
-
if (result.mergeStatus === "BEHIND" && result.baseBranch) {
|
|
36
|
-
verboseBranch = ` · **branch** behind PR base \`${result.baseBranch}\``;
|
|
37
|
-
}
|
|
38
|
-
else if (result.mergeStatus === "CONFLICTS" && result.baseBranch) {
|
|
39
|
-
verboseBranch = ` · **branch** conflicts with PR base \`${result.baseBranch}\``;
|
|
40
|
-
}
|
|
36
|
+
const verboseBranch = branchSeg ? ` · ${branchSeg}` : "";
|
|
41
37
|
summaryLine = `**summary** ${result.summary.passing} passing, ${result.summary.skipped} skipped, ${result.summary.filtered} filtered, ${result.summary.inProgress} inProgress, ${result.summary.superseded} superseded · **remainingSeconds** ${result.remainingSeconds} · **blockingBotReviewInProgress** ${result.blockingBotReviewInProgress} · **isDraft** ${result.isDraft} · **shouldCancel** ${result.shouldCancel}${verboseBranch}`;
|
|
42
38
|
}
|
|
43
39
|
else {
|
|
@@ -58,12 +54,8 @@ export function formatIterateResult(result, opts) {
|
|
|
58
54
|
segs.push(`**blockingBotReviewInProgress**`);
|
|
59
55
|
if (result.isDraft)
|
|
60
56
|
segs.push(`**isDraft**`);
|
|
61
|
-
if (
|
|
62
|
-
segs.push(
|
|
63
|
-
}
|
|
64
|
-
else if (result.mergeStatus === "CONFLICTS" && result.baseBranch) {
|
|
65
|
-
segs.push(`**branch** conflicts with PR base \`${result.baseBranch}\``);
|
|
66
|
-
}
|
|
57
|
+
if (branchSeg)
|
|
58
|
+
segs.push(branchSeg);
|
|
67
59
|
summaryLine = segs.join(" · ");
|
|
68
60
|
}
|
|
69
61
|
// Surface an explicit `--ready-delay` override (set only when the user passed the flag)
|
package/bin/cli/iterate-lean.mjs
CHANGED
|
@@ -41,6 +41,7 @@ export function projectIterateLean(result, opts) {
|
|
|
41
41
|
remainingSeconds: result.remainingSeconds,
|
|
42
42
|
}),
|
|
43
43
|
...(result.baseBranch && { baseBranch: result.baseBranch }),
|
|
44
|
+
...(result.stackTrunkConflict && { stackTrunkConflict: result.stackTrunkConflict }),
|
|
44
45
|
...(result.branchProtection !== null && { branchProtection: result.branchProtection }),
|
|
45
46
|
...(result.mergeRequirements && { mergeRequirements: result.mergeRequirements }),
|
|
46
47
|
...(result.mergeQueue && { mergeQueue: result.mergeQueue }),
|
package/bin/cli/poll-handler.mjs
CHANGED
|
@@ -29,7 +29,11 @@ export async function handlePoll(args) {
|
|
|
29
29
|
const intervalSuffix = validateSecondsDurationFlag("pr-shepherd", "--interval", intervalStr, hasFlag(extra, "--interval"));
|
|
30
30
|
if (intervalSuffix === null)
|
|
31
31
|
return;
|
|
32
|
-
|
|
32
|
+
let intervalSeconds = parseDurationToSeconds(intervalSuffix ?? "", cfg.poll.intervalSeconds);
|
|
33
|
+
// `--interval` is the invocation interval. Only an omitted flag is scaled, and only for aggregates.
|
|
34
|
+
if (isAggregate && intervalSuffix === undefined) {
|
|
35
|
+
intervalSeconds *= cfg.poll.stackIntervalFactor;
|
|
36
|
+
}
|
|
33
37
|
const timeoutStr = getFlag(extra, "--timeout");
|
|
34
38
|
const timeoutSuffix = validateSecondsDurationFlag("pr-shepherd", "--timeout", timeoutStr, hasFlag(extra, "--timeout"));
|
|
35
39
|
if (timeoutSuffix === null)
|
package/bin/cli-parser.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import { handleJournal } from "./cli/journal-handler.mjs";
|
|
|
13
13
|
import { handleJournalExtract } from "./cli/journal-extract-handler.mjs";
|
|
14
14
|
import { handlePoll } from "./cli/poll-handler.mjs";
|
|
15
15
|
import { warnPrrcThreadIds, validateRequireSha, rejectPrrcMinimizeIds, } from "./cli/resolve-validators.mjs";
|
|
16
|
+
import { handleCheckBlocker } from "./cli/check-blocker-handler.mjs";
|
|
16
17
|
import { setupLog } from "./log/setup.mjs";
|
|
17
18
|
// ---------------------------------------------------------------------------
|
|
18
19
|
// Entry
|
|
@@ -131,6 +132,9 @@ async function handleApply(args) {
|
|
|
131
132
|
case "journal":
|
|
132
133
|
await handleJournal(args.slice(1));
|
|
133
134
|
return;
|
|
135
|
+
case "check-blocker":
|
|
136
|
+
await handleCheckBlocker(args.slice(1));
|
|
137
|
+
return;
|
|
134
138
|
default:
|
|
135
139
|
process.stderr.write(`Unknown apply action: ${action ?? "(none)"}\n`);
|
|
136
140
|
process.stderr.write(`${USAGE.apply}\n`);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type CheckBlockerRef } from "../state/check-blockers.mts";
|
|
2
|
+
export interface CheckBlockerCommandResult {
|
|
3
|
+
checkName: string;
|
|
4
|
+
blocker?: CheckBlockerRef;
|
|
5
|
+
recordedAt?: number;
|
|
6
|
+
}
|
|
7
|
+
type ApplyInput = {
|
|
8
|
+
prNumber?: number;
|
|
9
|
+
targetRepository?: {
|
|
10
|
+
owner: string;
|
|
11
|
+
name: string;
|
|
12
|
+
};
|
|
13
|
+
checkName: string;
|
|
14
|
+
} & ({
|
|
15
|
+
clear: true;
|
|
16
|
+
} | {
|
|
17
|
+
blocker: CheckBlockerRef;
|
|
18
|
+
});
|
|
19
|
+
export declare function formatCheckBlockerResult(result: CheckBlockerCommandResult): string;
|
|
20
|
+
/** Record or clear one check blocker. Validates the PR, then writes per-PR state. */
|
|
21
|
+
export declare function applyCheckBlocker(input: ApplyInput): Promise<CheckBlockerCommandResult>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { getCurrentPrNumber, getRepoInfo } from "../github/client.mjs";
|
|
2
|
+
import { EXIT, ShepherdError } from "../exit-codes.mjs";
|
|
3
|
+
import { clearCheckBlocker, writeCheckBlocker, } from "../state/check-blockers.mjs";
|
|
4
|
+
export function formatCheckBlockerResult(result) {
|
|
5
|
+
const lines = [`checkName: ${result.checkName}`];
|
|
6
|
+
if (result.blocker) {
|
|
7
|
+
lines.push(`blocker.owner: ${result.blocker.owner}`, `blocker.name: ${result.blocker.name}`, `blocker.number: ${result.blocker.number}`, `blocker.kind: ${result.blocker.kind}`);
|
|
8
|
+
}
|
|
9
|
+
if (result.recordedAt !== undefined)
|
|
10
|
+
lines.push(`recordedAt: ${result.recordedAt}`);
|
|
11
|
+
return lines.join("\n");
|
|
12
|
+
}
|
|
13
|
+
/** Record or clear one check blocker. Validates the PR, then writes per-PR state. */
|
|
14
|
+
export async function applyCheckBlocker(input) {
|
|
15
|
+
const repo = input.targetRepository ?? (await getRepoInfo());
|
|
16
|
+
const pr = input.prNumber ?? (await getCurrentPrNumber());
|
|
17
|
+
if (pr === null) {
|
|
18
|
+
throw new ShepherdError("No open PR found for current branch. Pass a PR number explicitly.", EXIT.UNAVAILABLE);
|
|
19
|
+
}
|
|
20
|
+
const key = { owner: repo.owner, repo: repo.name, pr };
|
|
21
|
+
if ("clear" in input) {
|
|
22
|
+
if (!(await clearCheckBlocker(key, input.checkName))) {
|
|
23
|
+
throw new ShepherdError("Could not write check blocker state.", EXIT.UNAVAILABLE);
|
|
24
|
+
}
|
|
25
|
+
return { checkName: input.checkName };
|
|
26
|
+
}
|
|
27
|
+
const record = {
|
|
28
|
+
checkName: input.checkName,
|
|
29
|
+
blocker: input.blocker,
|
|
30
|
+
recordedAt: Math.floor(Date.now() / 1000),
|
|
31
|
+
};
|
|
32
|
+
if (!(await writeCheckBlocker(key, record))) {
|
|
33
|
+
throw new ShepherdError("Could not write check blocker state.", EXIT.UNAVAILABLE);
|
|
34
|
+
}
|
|
35
|
+
return record;
|
|
36
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { AnnotationCacheOptions } from "../github/check-annotation-cache.mts";
|
|
2
2
|
import type { CheckAnnotation, ClassifiedCheck, ShepherdReport, TriagedCheck } from "../types.mts";
|
|
3
3
|
export declare function checksWithActionableAnnotations(report: ShepherdReport): TriagedCheck[];
|
|
4
4
|
/**
|