pr-shepherd 0.34.0 → 0.35.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 +3 -2
- package/.grok-plugin/marketplace.json +17 -0
- package/README.md +56 -39
- package/bin/api.d.mts +80 -0
- package/bin/api.mjs +236 -0
- package/bin/checks/classify.d.mts +41 -0
- package/bin/checks/startup-failures.d.mts +2 -0
- package/bin/checks/superseded.d.mts +21 -0
- package/bin/checks/triage.d.mts +4 -0
- package/bin/classify/apply.d.mts +18 -0
- package/bin/classify/apply.mjs +4 -0
- package/bin/classify/loader.d.mts +10 -0
- package/bin/classify/types.d.mts +35 -0
- package/bin/cli/args.d.mts +18 -0
- package/bin/cli/clean-formatter.d.mts +2 -0
- package/bin/cli/default-poll.d.mts +2 -0
- package/bin/cli/duration-flag.d.mts +2 -0
- package/bin/cli/duration.d.mts +13 -0
- package/bin/cli/fence.d.mts +1 -0
- package/bin/cli/fix-formatter-extra.d.mts +3 -0
- package/bin/cli/fix-formatter.d.mts +2 -0
- package/bin/cli/fix-formatter.mjs +6 -6
- package/bin/cli/formatters.d.mts +7 -0
- package/bin/cli/handlers.d.mts +4 -0
- package/bin/cli/handlers.mjs +11 -10
- package/bin/cli/help-command-pages.d.mts +231 -0
- package/bin/cli/help-command-pages.mjs +106 -1
- package/bin/cli/help-iterate-poll-pages.d.mts +4 -0
- package/bin/cli/help-iterate-poll-pages.mjs +4 -2
- package/bin/cli/help-log-file-page.d.mts +1 -0
- package/bin/cli/help-top-page.d.mts +1 -0
- package/bin/cli/help-top-page.mjs +14 -15
- package/bin/cli/help.d.mts +236 -0
- package/bin/cli/help.mjs +17 -0
- package/bin/cli/iterate-emitter.d.mts +8 -0
- package/bin/cli/iterate-flags.d.mts +11 -0
- package/bin/cli/iterate-formatter.d.mts +19 -0
- package/bin/cli/iterate-instructions.d.mts +6 -0
- package/bin/cli/iterate-lean.d.mts +12 -0
- package/bin/cli/journal-formatter.d.mts +2 -0
- package/bin/cli/journal-formatter.mjs +15 -0
- package/bin/cli/journal-handler.d.mts +1 -0
- package/bin/cli/journal-handler.mjs +7 -20
- package/bin/cli/list-formatters.d.mts +76 -0
- package/bin/cli/list-formatters.mjs +9 -9
- package/bin/cli/mark-files-as-viewed-flags.d.mts +11 -0
- package/bin/cli/mark-files-as-viewed-formatter.d.mts +2 -0
- package/bin/cli/mutate-formatter.d.mts +2 -0
- package/bin/cli/poll-handler.d.mts +1 -0
- package/bin/cli/poll-handler.mjs +2 -2
- package/bin/cli/resolve-validators.d.mts +3 -0
- package/bin/cli/resolve-validators.mjs +3 -3
- package/bin/cli/runner.d.mts +7 -0
- package/bin/cli/suggestion-renderer.d.mts +3 -0
- package/bin/cli/validate-default-args.d.mts +6 -0
- package/bin/cli-parser.d.mts +2 -0
- package/bin/cli-parser.mjs +72 -16
- package/bin/commands/check-annotations.d.mts +5 -0
- package/bin/commands/check-status.d.mts +3 -0
- package/bin/commands/check-terminal-report.d.mts +5 -0
- package/bin/commands/check.d.mts +6 -0
- package/bin/commands/check.mjs +2 -1
- package/bin/commands/clean.d.mts +21 -0
- package/bin/commands/commit-suggestion-instruction.d.mts +8 -0
- package/bin/commands/commit-suggestion-instruction.mjs +3 -3
- package/bin/commands/commit-suggestion.d.mts +8 -0
- package/bin/commands/commit-suggestion.mjs +11 -10
- package/bin/commands/iterate/check-instructions.d.mts +16 -0
- package/bin/commands/iterate/check-instructions.mjs +3 -3
- package/bin/commands/iterate/classify.d.mts +18 -0
- package/bin/commands/iterate/classify.mjs +4 -4
- package/bin/commands/iterate/escalate.d.mts +31 -0
- package/bin/commands/iterate/escalate.mjs +7 -4
- package/bin/commands/iterate/fix-code.d.mts +25 -0
- package/bin/commands/iterate/helpers.d.mts +13 -0
- package/bin/commands/iterate/helpers.mjs +4 -1
- package/bin/commands/iterate/index.d.mts +2 -0
- package/bin/commands/iterate/index.mjs +5 -2
- package/bin/commands/iterate/render.d.mts +5 -0
- package/bin/commands/iterate/render.mjs +8 -6
- package/bin/commands/iterate/reruns.d.mts +20 -0
- package/bin/commands/iterate/stall.d.mts +6 -0
- package/bin/commands/journal/index.d.mts +14 -0
- package/bin/commands/journal/index.mjs +1 -0
- package/bin/commands/journal/transform.d.mts +22 -0
- package/bin/commands/log-file.d.mts +5 -0
- package/bin/commands/mark-files-as-viewed.d.mts +26 -0
- package/bin/commands/mark-files-as-viewed.mjs +1 -0
- package/bin/commands/poll.d.mts +10 -0
- package/bin/commands/poll.mjs +1 -0
- package/bin/commands/ready-delay.d.mts +29 -0
- package/bin/commands/ready-mergeability.d.mts +15 -0
- package/bin/commands/resolve-mutate.d.mts +4 -0
- package/bin/commands/resolve-mutate.mjs +1 -0
- package/bin/commands/resolve.d.mts +4 -0
- package/bin/commands/shepherd-journal.d.mts +7 -0
- package/bin/commands/shepherd-journal.mjs +2 -2
- package/bin/comments/authors.d.mts +14 -0
- package/bin/comments/marker.d.mts +2 -0
- package/bin/comments/minimize-policy.d.mts +4 -0
- package/bin/comments/pending-ops.d.mts +15 -0
- package/bin/comments/rate-limit.d.mts +18 -0
- package/bin/comments/resolve.d.mts +34 -0
- package/bin/comments/resolve.mjs +1 -0
- package/bin/comments/review-thread-markers.d.mts +8 -0
- package/bin/comments/review-visibility.d.mts +28 -0
- package/bin/comments/sha-poll.d.mts +2 -0
- package/bin/comments/thread-visibility.d.mts +11 -0
- package/bin/comments/visible-comments.d.mts +11 -0
- package/bin/config/load.d.mts +60 -0
- package/bin/config/load.mjs +72 -1
- package/bin/config.json +0 -2
- package/bin/execution-context.d.mts +9 -0
- package/bin/execution-context.mjs +19 -0
- package/bin/exit-codes.d.mts +51 -0
- package/bin/github/activity.d.mts +3 -0
- package/bin/github/activity.mjs +7 -0
- package/bin/github/batch-parser-helpers.d.mts +22 -0
- package/bin/github/batch-parsers.d.mts +3 -0
- package/bin/github/batch-parsers.mjs +6 -0
- package/bin/github/batch-raw-types.d.mts +207 -0
- package/bin/github/batch-response.d.mts +4 -0
- package/bin/github/batch.d.mts +22 -0
- package/bin/github/branch-protection.d.mts +3 -0
- package/bin/github/check-annotations.d.mts +2 -0
- package/bin/github/client.d.mts +46 -0
- package/bin/github/client.mjs +7 -2
- package/bin/github/errors.d.mts +25 -0
- package/bin/github/gql/batch-pr.gql +5 -0
- package/bin/github/gql/review-thread-comments.gql +1 -0
- package/bin/github/graphql-http.d.mts +19 -0
- package/bin/github/graphql-response.d.mts +7 -0
- package/bin/github/http-auth.d.mts +4 -0
- package/bin/github/http-request.d.mts +7 -0
- package/bin/github/http-utils.d.mts +11 -0
- package/bin/github/http.d.mts +5 -0
- package/bin/github/pagination.d.mts +45 -0
- package/bin/github/queries.d.mts +24 -0
- package/bin/github/rest-http.d.mts +2 -0
- package/bin/github/thread-comments.d.mts +2 -0
- package/bin/index.d.mts +10 -0
- package/bin/index.mjs +1 -1
- package/bin/log/log-file.d.mts +28 -0
- package/bin/log/session.d.mts +31 -0
- package/bin/log/setup.d.mts +6 -0
- package/bin/mcp/index.d.mts +5 -0
- package/bin/mcp/index.mjs +8 -0
- package/bin/mcp/server.d.mts +8 -0
- package/bin/mcp/server.mjs +157 -0
- package/bin/mcp-stdio.d.mts +2 -0
- package/bin/mcp-stdio.mjs +7 -0
- package/bin/merge-status/derive.d.mts +19 -0
- package/bin/reporters/agent.d.mts +23 -0
- package/bin/reporters/agent.mjs +3 -0
- package/bin/state/base.d.mts +1 -0
- package/bin/state/bot-cr-seen.d.mts +51 -0
- package/bin/state/bot-cr-seen.mjs +1 -1
- package/bin/state/fix-attempts.d.mts +27 -0
- package/bin/state/iterate-stall.d.mts +27 -0
- package/bin/state/seen-comments.d.mts +62 -0
- package/bin/suggestions/extract.d.mts +8 -0
- package/bin/suggestions/parse.d.mts +48 -0
- package/bin/suggestions/patch.d.mts +14 -0
- package/bin/threads/transcript.d.mts +14 -0
- package/bin/threads/transcript.mjs +4 -0
- package/bin/types/activity.d.mts +30 -0
- package/bin/types/agent-thread.d.mts +9 -0
- package/bin/types/check-annotations.d.mts +14 -0
- package/bin/types/check-classification.d.mts +19 -0
- package/bin/types/github.d.mts +139 -0
- package/bin/types/iterate.d.mts +157 -0
- package/bin/types/protected-run.d.mts +6 -0
- package/bin/types/report.d.mts +176 -0
- package/bin/types/review-thread.d.mts +12 -0
- package/bin/types.d.mts +9 -0
- package/bin/util/markdown.d.mts +1 -0
- package/bin/util/path-segment.d.mts +2 -0
- package/bin/util/sleep.d.mts +1 -0
- package/bin/util/worktree.d.mts +9 -0
- package/bin/util/worktree.mjs +4 -1
- package/package.json +51 -37
- package/plugins/pr-shepherd/.codex-plugin/plugin.json +3 -2
- package/plugins/pr-shepherd/.codex.mcp.json +8 -0
- package/plugins/pr-shepherd/.mcp.json +6 -0
- package/plugins/pr-shepherd/skills/mark-files-as-viewed/SKILL.md +5 -19
- package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +6 -15
- package/src/classify/types.mts +12 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** Raw relationship between a comment author and the repository, as reported by GitHub. */
|
|
2
|
+
export type CommentAuthorAssociation = "COLLABORATOR" | "CONTRIBUTOR" | "FIRST_TIMER" | "FIRST_TIME_CONTRIBUTOR" | "MANNEQUIN" | "MEMBER" | "NONE" | "OWNER";
|
|
3
|
+
export type ClassifyItemKind = "review-thread" | "pr-comment" | "review-summary" | "changes-requested";
|
|
4
|
+
export interface ClassifyItemBase {
|
|
5
|
+
readonly kind: ClassifyItemKind;
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly author: string;
|
|
8
|
+
readonly authorType: "User" | "Bot" | "Unknown";
|
|
9
|
+
readonly authorAssociation?: CommentAuthorAssociation;
|
|
10
|
+
readonly body: string;
|
|
11
|
+
readonly url?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ClassifyReviewThread extends ClassifyItemBase {
|
|
14
|
+
readonly kind: "review-thread";
|
|
15
|
+
readonly path?: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface ClassifyPrComment extends ClassifyItemBase {
|
|
18
|
+
readonly kind: "pr-comment";
|
|
19
|
+
}
|
|
20
|
+
export interface ClassifyReviewSummary extends ClassifyItemBase {
|
|
21
|
+
readonly kind: "review-summary";
|
|
22
|
+
}
|
|
23
|
+
export interface ClassifyChangesRequested extends ClassifyItemBase {
|
|
24
|
+
readonly kind: "changes-requested";
|
|
25
|
+
}
|
|
26
|
+
export type ClassifyItem = ClassifyReviewThread | ClassifyPrComment | ClassifyReviewSummary | ClassifyChangesRequested;
|
|
27
|
+
export interface ClassifyAction {
|
|
28
|
+
/** When true, routes the item's ID to the appropriate resolve/minimize GitHub mutation. Not supported for changes-requested reviews. */
|
|
29
|
+
readonly autoResolve?: boolean;
|
|
30
|
+
/** When true, hides the item from agent output (seen marker is still written). */
|
|
31
|
+
readonly suppress?: boolean;
|
|
32
|
+
/** Optional note recorded to the debug log when this rule fires. */
|
|
33
|
+
readonly reason?: string;
|
|
34
|
+
}
|
|
35
|
+
export type ClassifyRule = (item: ClassifyItem) => ClassifyAction | null | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI argument-parsing helpers extracted from cli.mts for testability.
|
|
3
|
+
*/
|
|
4
|
+
import type { GlobalOptions } from "../types.mts";
|
|
5
|
+
export declare function parseIntStrict(value: string, flag: string): number;
|
|
6
|
+
interface ParsedArgs {
|
|
7
|
+
prNumber: number | undefined;
|
|
8
|
+
global: GlobalOptions;
|
|
9
|
+
extra: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function parseCommonArgs(args: string[]): ParsedArgs;
|
|
12
|
+
export declare function parsePrNumber(value: string): number | null;
|
|
13
|
+
/** Get the value of a flag like `--flag value` or `--flag=value`. */
|
|
14
|
+
export declare function getFlag(args: string[], name: string): string | null;
|
|
15
|
+
export declare function hasFlag(args: string[], name: string): boolean;
|
|
16
|
+
export declare function parseList(value: string | null): string[];
|
|
17
|
+
export declare function parseStatusPrNumbers(args: string[]): number[];
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface SecondsDurationParts {
|
|
2
|
+
value: number;
|
|
3
|
+
unit: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DurationParseOptions {
|
|
6
|
+
/** Unit assumed for a bare number with no suffix. Defaults to seconds. */
|
|
7
|
+
defaultUnit?: "s" | "m";
|
|
8
|
+
/** When true, 0 is accepted (used by flags where 0 means "disabled"). */
|
|
9
|
+
allowZero?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function parseSecondsDurationParts(s: string, opts?: DurationParseOptions): SecondsDurationParts | null;
|
|
12
|
+
export declare function parseDurationToSeconds(s: string, defaultSeconds: number, opts?: DurationParseOptions): number;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function safeFence(content: string): string;
|
|
@@ -15,7 +15,7 @@ export function formatFixCodeResult(header, result) {
|
|
|
15
15
|
const reviewMarker = t.reviewId ? ` [reviewId=${t.reviewId}]` : "";
|
|
16
16
|
const suggestionMarker = t.suggestion ? " [suggestion]" : "";
|
|
17
17
|
const editedMarker = t.edited ? " [edited since first look]" : "";
|
|
18
|
-
sections.push(`### ${heading} — ${loc} (${renderAuthor(t.author, t.authorType)})${reviewMarker}${suggestionMarker}${editedMarker}`);
|
|
18
|
+
sections.push(`### ${heading} — ${loc} (${renderAuthor(t.author, t.authorType, t.authorAssociation)})${reviewMarker}${suggestionMarker}${editedMarker}`);
|
|
19
19
|
sections.push(renderThreadConversation(t));
|
|
20
20
|
if (t.suggestion) {
|
|
21
21
|
sections.push(renderSuggestionBlock(t.suggestion, ""));
|
|
@@ -33,7 +33,7 @@ export function formatFixCodeResult(header, result) {
|
|
|
33
33
|
for (const c of result.fix.actionableComments) {
|
|
34
34
|
const heading = c.url ? `[commentId=${c.id}](${c.url})` : `\`commentId=${c.id}\``;
|
|
35
35
|
const editedMarker = c.edited ? " [edited since first look]" : "";
|
|
36
|
-
sections.push(`### ${heading} (${renderAuthor(c.author, c.authorType)})${editedMarker}`);
|
|
36
|
+
sections.push(`### ${heading} (${renderAuthor(c.author, c.authorType, c.authorAssociation)})${editedMarker}`);
|
|
37
37
|
sections.push(blockquote(c.body));
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -83,14 +83,14 @@ export function formatFixCodeResult(header, result) {
|
|
|
83
83
|
if (result.fix.firstLookSummaries.length > 0) {
|
|
84
84
|
sections.push("## Review summaries (first look)");
|
|
85
85
|
for (const r of result.fix.firstLookSummaries) {
|
|
86
|
-
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType)})`);
|
|
86
|
+
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType, r.authorAssociation)})`);
|
|
87
87
|
sections.push(r.body.trim() === "" ? "(no review body)" : blockquote(r.body));
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
if (result.fix.editedSummaries.length > 0) {
|
|
91
91
|
sections.push("## Review summaries (edited since first look — already minimized; do not re-minimize)");
|
|
92
92
|
for (const r of result.fix.editedSummaries) {
|
|
93
|
-
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType)})`);
|
|
93
|
+
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType, r.authorAssociation)})`);
|
|
94
94
|
sections.push(r.body.trim() === "" ? "(no review body)" : blockquote(r.body));
|
|
95
95
|
}
|
|
96
96
|
}
|
|
@@ -103,7 +103,7 @@ export function formatFixCodeResult(header, result) {
|
|
|
103
103
|
if (result.fix.surfacedApprovals.length > 0) {
|
|
104
104
|
sections.push("## Approvals (surfaced — not minimized)");
|
|
105
105
|
for (const r of result.fix.surfacedApprovals) {
|
|
106
|
-
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType)})`);
|
|
106
|
+
sections.push(`### \`reviewId=${r.id}\` (${renderAuthor(r.author, r.authorType, r.authorAssociation)})`);
|
|
107
107
|
sections.push(r.body.trim() === "" ? "(no review body)" : blockquote(r.body));
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -129,7 +129,7 @@ export function formatFixCodeResult(header, result) {
|
|
|
129
129
|
if (result.fix.resolveOnlyCommand?.hasMutations)
|
|
130
130
|
postFixLines.push(`- resolve-only: \`${renderResolveCommand(result.fix.resolveOnlyCommand)}\``);
|
|
131
131
|
if (result.fix.resolveCommand.hasMutations) {
|
|
132
|
-
postFixLines.push(`-
|
|
132
|
+
postFixLines.push(`- apply review: \`${renderResolveCommand(result.fix.resolveCommand)}\``);
|
|
133
133
|
}
|
|
134
134
|
sections.push(postFixLines.join("\n"));
|
|
135
135
|
sections.push("## Instructions");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { formatIterateResult } from "./iterate-formatter.mts";
|
|
2
|
+
export { projectIterateLean, projectIterateVerbose } from "./iterate-lean.mts";
|
|
3
|
+
export { formatCleanResult } from "./clean-formatter.mts";
|
|
4
|
+
export { formatMarkFilesAsViewedResult } from "./mark-files-as-viewed-formatter.mts";
|
|
5
|
+
export { formatMutateResult } from "./mutate-formatter.mts";
|
|
6
|
+
import type { CommitSuggestionResult } from "../types.mts";
|
|
7
|
+
export declare function formatCommitSuggestionResult(result: CommitSuggestionResult): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function handleClean(args: string[], command?: "admin clean" | "clean"): Promise<void>;
|
|
2
|
+
export declare function handleCommitSuggestion(args: string[], command?: "build-suggestion-patch" | "commit-suggestion"): Promise<void>;
|
|
3
|
+
export declare function handleIterate(args: string[]): Promise<void>;
|
|
4
|
+
export declare function handleMarkFilesAsViewed(args: string[], command?: "apply files" | "mark-files-as-viewed"): Promise<void>;
|
package/bin/cli/handlers.mjs
CHANGED
|
@@ -11,10 +11,11 @@ import { parseIterateFlags } from "./iterate-flags.mjs";
|
|
|
11
11
|
import { emitIterateResult } from "./iterate-emitter.mjs";
|
|
12
12
|
import { parseMarkFilesAsViewedArgs } from "./mark-files-as-viewed-flags.mjs";
|
|
13
13
|
const CLEAN_VARIANTS = new Set(["pr", "branch", "current", "repo", "all"]);
|
|
14
|
-
export async function handleClean(args) {
|
|
14
|
+
export async function handleClean(args, command = "admin clean") {
|
|
15
|
+
const usage = command === "admin clean" ? USAGE["admin clean"] : USAGE.clean;
|
|
15
16
|
const variant = args[0];
|
|
16
17
|
if (!variant || !CLEAN_VARIANTS.has(variant)) {
|
|
17
|
-
process.stderr.write(`${
|
|
18
|
+
process.stderr.write(`${usage}\n`);
|
|
18
19
|
process.exitCode = EXIT.USAGE;
|
|
19
20
|
return;
|
|
20
21
|
}
|
|
@@ -24,7 +25,7 @@ export async function handleClean(args) {
|
|
|
24
25
|
continue;
|
|
25
26
|
if (a === "--dry-run" || a === "--format" || a.startsWith("--format="))
|
|
26
27
|
continue;
|
|
27
|
-
process.stderr.write(`pr-shepherd:
|
|
28
|
+
process.stderr.write(`pr-shepherd: ${command}: unknown flag: "${a}"\n`);
|
|
28
29
|
process.exitCode = EXIT.USAGE;
|
|
29
30
|
return;
|
|
30
31
|
}
|
|
@@ -38,7 +39,7 @@ export async function handleClean(args) {
|
|
|
38
39
|
formatValue = rest[fmtIdx + 1];
|
|
39
40
|
}
|
|
40
41
|
if (formatValue !== undefined && formatValue !== "text" && formatValue !== "json") {
|
|
41
|
-
process.stderr.write(`pr-shepherd:
|
|
42
|
+
process.stderr.write(`pr-shepherd: ${command}: invalid --format value: "${formatValue}". Expected "text" or "json".\n`);
|
|
42
43
|
process.exitCode = EXIT.USAGE;
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
@@ -52,24 +53,24 @@ export async function handleClean(args) {
|
|
|
52
53
|
}
|
|
53
54
|
const positionals = rest.filter((a, i) => !flagConsumedIndices.has(i) && !a.startsWith("--"));
|
|
54
55
|
if (positionals.length > 1) {
|
|
55
|
-
process.stderr.write(`pr-shepherd:
|
|
56
|
+
process.stderr.write(`pr-shepherd: ${command}: too many positional arguments (expected at most 1, got ${positionals.length})\n`);
|
|
56
57
|
process.exitCode = EXIT.USAGE;
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
60
|
const value = positionals[0];
|
|
60
61
|
const result = await runClean({ variant: variant, value, dryRun });
|
|
61
62
|
if (!result.ok) {
|
|
62
|
-
process.stderr.write(`pr-shepherd:
|
|
63
|
+
process.stderr.write(`pr-shepherd: ${command}: ${result.error}\n`);
|
|
63
64
|
process.exitCode = EXIT.SOFTWARE;
|
|
64
65
|
return;
|
|
65
66
|
}
|
|
66
67
|
process.stdout.write(jsonOut ? `${JSON.stringify(result, null, 2)}\n` : `${formatCleanResult(result)}\n`);
|
|
67
68
|
}
|
|
68
|
-
export async function handleCommitSuggestion(args) {
|
|
69
|
+
export async function handleCommitSuggestion(args, command = "build-suggestion-patch") {
|
|
69
70
|
const { prNumber, global: globalOpts, extra } = parseCommonArgs(args);
|
|
70
71
|
const threadId = getFlag(extra, "--thread-id");
|
|
71
72
|
if (!threadId) {
|
|
72
|
-
process.stderr.write(`${USAGE[
|
|
73
|
+
process.stderr.write(`${USAGE[command]}\n`);
|
|
73
74
|
process.exitCode = EXIT.USAGE;
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
@@ -111,11 +112,11 @@ export async function handleIterate(args) {
|
|
|
111
112
|
readyDelaySuffix: flags.readyDelaySuffix ?? undefined,
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
|
-
export async function handleMarkFilesAsViewed(args) {
|
|
115
|
+
export async function handleMarkFilesAsViewed(args, command = "apply files") {
|
|
115
116
|
const { prNumber, global: globalOpts, extra } = parseCommonArgs(args);
|
|
116
117
|
const parsed = parseMarkFilesAsViewedArgs(extra);
|
|
117
118
|
if (!parsed.ok) {
|
|
118
|
-
process.stderr.write(`pr-shepherd:
|
|
119
|
+
process.stderr.write(`pr-shepherd: ${command}: ${parsed.error}\n`);
|
|
119
120
|
process.exitCode = EXIT.USAGE;
|
|
120
121
|
return;
|
|
121
122
|
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
export declare const COMMAND_USAGE: {
|
|
2
|
+
readonly default: string;
|
|
3
|
+
readonly apply: `pr-shepherd apply
|
|
4
|
+
|
|
5
|
+
Apply a review mutation, mark changed files as viewed, or append a PR journal item.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
pr-shepherd apply review [PR] [review-flags]
|
|
9
|
+
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
10
|
+
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
11
|
+
pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
12
|
+
|
|
13
|
+
Run 'pr-shepherd apply <review|files|journal> --help' for command-specific details.
|
|
14
|
+
--help, -h Print this help and exit before GitHub I/O.`;
|
|
15
|
+
readonly "apply review": `pr-shepherd apply review
|
|
16
|
+
|
|
17
|
+
Apply GitHub review-state mutations after fixes.
|
|
18
|
+
|
|
19
|
+
Usage:
|
|
20
|
+
pr-shepherd apply review [PR] --reply-thread-ids A,B --message MSG
|
|
21
|
+
pr-shepherd apply review [PR] --resolve-thread-ids A,B [--minimize-comment-ids X,Y]
|
|
22
|
+
[--dismiss-review-ids Q] [--message MSG]
|
|
23
|
+
[--require-sha SHA] [--format text|json]
|
|
24
|
+
|
|
25
|
+
Flags:
|
|
26
|
+
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
27
|
+
Human-authored thread IDs are skipped; use --reply-thread-ids.
|
|
28
|
+
--reply-thread-ids <ids> Comma-separated human review thread IDs to reply to.
|
|
29
|
+
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
30
|
+
--dismiss-review-ids <ids> Comma-separated CHANGES_REQUESTED review IDs to dismiss.
|
|
31
|
+
--message <text> Reply/dismiss message. Required with reply or dismiss IDs.
|
|
32
|
+
--require-sha <sha> Wait for this full 40-character lowercase PR head SHA.
|
|
33
|
+
--format text|json Output format. Default: text.
|
|
34
|
+
|
|
35
|
+
At least one action flag is required.
|
|
36
|
+
--help, -h Print this help and exit before GitHub I/O.`;
|
|
37
|
+
readonly "apply files": `pr-shepherd apply files
|
|
38
|
+
|
|
39
|
+
Mark changed files as viewed in the GitHub pull request diff.
|
|
40
|
+
|
|
41
|
+
Usage:
|
|
42
|
+
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
43
|
+
[--format text|json]
|
|
44
|
+
|
|
45
|
+
Selectors:
|
|
46
|
+
files... Exact changed-file paths from the PR diff.
|
|
47
|
+
--tests Select changed test files.
|
|
48
|
+
--match <regex> Select changed files whose paths match a case-insensitive JavaScript regex.
|
|
49
|
+
May be repeated.
|
|
50
|
+
--help, -h Print this help and exit before GitHub I/O.`;
|
|
51
|
+
readonly "apply journal": `pr-shepherd apply journal
|
|
52
|
+
|
|
53
|
+
Append a list item to the ## Shepherd Journal section of a PR body.
|
|
54
|
+
|
|
55
|
+
Usage:
|
|
56
|
+
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
57
|
+
pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
58
|
+
pr-shepherd apply journal [PR] --file - [--dry-run] [--format text|json]
|
|
59
|
+
|
|
60
|
+
PR may be a number or GitHub pull request URL. An item must start with '- ' followed by text.
|
|
61
|
+
Use --file to read an item from a file, or --file - to read it from stdin. Exactly one item source
|
|
62
|
+
is required. --dry-run previews the resulting body without writing it.
|
|
63
|
+
--help, -h Print this help and exit before GitHub I/O.`;
|
|
64
|
+
readonly "build-suggestion-patch": `pr-shepherd build-suggestion-patch
|
|
65
|
+
|
|
66
|
+
Build a patch and commit instructions for one GitHub review thread containing a suggestion block.
|
|
67
|
+
The command does not edit files or mutate git history.
|
|
68
|
+
|
|
69
|
+
Usage:
|
|
70
|
+
pr-shepherd build-suggestion-patch [PR] --thread-id ID --message MSG
|
|
71
|
+
[--description DESC] [--format text|json]
|
|
72
|
+
|
|
73
|
+
Flags:
|
|
74
|
+
--thread-id <id> Review thread containing exactly one suggestion block. Required.
|
|
75
|
+
--message <text> Suggested commit subject. Required and non-empty.
|
|
76
|
+
--description <text> Optional longer commit body.
|
|
77
|
+
--format text|json Output format. Default: text.
|
|
78
|
+
|
|
79
|
+
The current branch must match the PR head ref and local HEAD must match the PR head SHA.
|
|
80
|
+
--help, -h Print this help and exit before GitHub, git, config, or log I/O.`;
|
|
81
|
+
readonly admin: `pr-shepherd admin
|
|
82
|
+
|
|
83
|
+
Administrative state and diagnostics commands.
|
|
84
|
+
|
|
85
|
+
Usage:
|
|
86
|
+
pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
|
|
87
|
+
pr-shepherd admin log-file [--format text|json]
|
|
88
|
+
|
|
89
|
+
Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
|
|
90
|
+
--help, -h Print this help and exit before any I/O.`;
|
|
91
|
+
readonly "admin clean": `pr-shepherd admin clean
|
|
92
|
+
|
|
93
|
+
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
94
|
+
|
|
95
|
+
Usage:
|
|
96
|
+
pr-shepherd admin clean pr [number] [--dry-run] [--format text|json]
|
|
97
|
+
pr-shepherd admin clean branch [name] [--dry-run] [--format text|json]
|
|
98
|
+
pr-shepherd admin clean current [--dry-run] [--format text|json]
|
|
99
|
+
pr-shepherd admin clean repo [--dry-run] [--format text|json]
|
|
100
|
+
pr-shepherd admin clean all [--dry-run] [--format text|json]
|
|
101
|
+
|
|
102
|
+
Variants remove state for one PR, branch, current branch, repository, or all repositories.
|
|
103
|
+
Use --dry-run to preview paths without removing them.
|
|
104
|
+
--help, -h Print this help and exit before any cleanup.`;
|
|
105
|
+
readonly "admin log-file": string;
|
|
106
|
+
readonly resolve: `pr-shepherd resolve
|
|
107
|
+
|
|
108
|
+
Apply GitHub review-state mutations after fixes.
|
|
109
|
+
|
|
110
|
+
Usage:
|
|
111
|
+
pr-shepherd resolve [PR] --reply-thread-ids A,B --message MSG
|
|
112
|
+
pr-shepherd resolve [PR] --resolve-thread-ids A,B [--minimize-comment-ids X,Y]
|
|
113
|
+
[--dismiss-review-ids Q] [--message MSG]
|
|
114
|
+
[--require-sha SHA] [--format text|json]
|
|
115
|
+
|
|
116
|
+
Flags:
|
|
117
|
+
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
118
|
+
Human-authored thread IDs are skipped; use --reply-thread-ids.
|
|
119
|
+
Note: comment IDs (PRRC_*) from gh api are not thread IDs and will fail.
|
|
120
|
+
--reply-thread-ids <ids> Comma-separated human review thread IDs to reply to.
|
|
121
|
+
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
122
|
+
--dismiss-review-ids <ids> Comma-separated CHANGES_REQUESTED review IDs to dismiss.
|
|
123
|
+
--message <text> Reply/dismiss message. Required with --reply-thread-ids
|
|
124
|
+
or --dismiss-review-ids.
|
|
125
|
+
--require-sha <sha> Wait until GitHub reports this PR head SHA before mutating.
|
|
126
|
+
Must be a full 40-character lowercase hex SHA. Use $(git rev-parse HEAD).
|
|
127
|
+
--format text|json Output format. Default: text.
|
|
128
|
+
--help, -h Print this help and exit before GitHub I/O.
|
|
129
|
+
|
|
130
|
+
At least one non-empty action flag is required:
|
|
131
|
+
--reply-thread-ids, --resolve-thread-ids, --minimize-comment-ids, or --dismiss-review-ids.
|
|
132
|
+
|
|
133
|
+
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
134
|
+
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
135
|
+
readonly "commit-suggestion": `pr-shepherd commit-suggestion
|
|
136
|
+
|
|
137
|
+
Build a patch and commit instructions for one GitHub review thread containing a suggestion block.
|
|
138
|
+
The command does not edit files or mutate git history.
|
|
139
|
+
|
|
140
|
+
Usage:
|
|
141
|
+
pr-shepherd commit-suggestion [PR] --thread-id ID --message MSG
|
|
142
|
+
[--description DESC] [--format text|json]
|
|
143
|
+
|
|
144
|
+
Flags:
|
|
145
|
+
--thread-id <id> Review thread ID containing exactly one suggestion to apply. Required.
|
|
146
|
+
--message <text> Suggested commit subject. Required and must be non-empty.
|
|
147
|
+
--description <text> Optional longer commit body.
|
|
148
|
+
--format text|json Output format. Default: text.
|
|
149
|
+
--help, -h Print this help and exit before GitHub, git, config, or log I/O.
|
|
150
|
+
|
|
151
|
+
Preconditions:
|
|
152
|
+
The current branch must match the PR head ref, and local HEAD must match the PR head SHA.
|
|
153
|
+
|
|
154
|
+
Exit codes:
|
|
155
|
+
0 suggestion patch and instructions produced
|
|
156
|
+
64 usage error (missing/invalid flag)
|
|
157
|
+
69 precondition unmet (thread ineligible, branch/SHA mismatch, no open PR)
|
|
158
|
+
See docs/exit-codes.md for the full sysexits.h table.`;
|
|
159
|
+
readonly "mark-files-as-viewed": `pr-shepherd mark-files-as-viewed
|
|
160
|
+
|
|
161
|
+
Mark changed files as viewed in the GitHub pull request diff.
|
|
162
|
+
|
|
163
|
+
Usage:
|
|
164
|
+
pr-shepherd mark-files-as-viewed [PR] [files...] [--tests] [--match REGEX]
|
|
165
|
+
[--format text|json]
|
|
166
|
+
|
|
167
|
+
Selectors:
|
|
168
|
+
files... Exact changed-file paths from the PR diff.
|
|
169
|
+
--tests Select changed test files.
|
|
170
|
+
--match <regex> Select changed files whose paths match a case-insensitive JavaScript regex.
|
|
171
|
+
May be repeated.
|
|
172
|
+
|
|
173
|
+
Flags:
|
|
174
|
+
--format text|json Output format. Default: text.
|
|
175
|
+
--help, -h Print this help and exit before GitHub I/O.
|
|
176
|
+
|
|
177
|
+
PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
|
|
178
|
+
Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
179
|
+
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 Do not cancel in-progress runs before actionable fixes.\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 code action; run another iterate tick later.\n MARK_READY Draft PR was marked ready for review.\n FIX_CODE Apply fixes, commit, push, and run the printed apply command.\n CANCEL Terminal state: merged/closed or ready-delay elapsed.\n ESCALATE Terminal state requiring human direction.\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 A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
180
|
+
readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly while the action is WAIT. Print only the final tick to stdout.\nPoll exits as soon as iterate returns MARK_READY, FIX_CODE, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. With --until-terminal, 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. Bare number = seconds. Default: 4.5m.\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 Do not cancel in-progress runs before actionable fixes.\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, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a single dot to stderr by default; --quiet-status prints only changed WAIT snapshots, and --verbose emits detailed per-tick lines.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until FIX_CODE, CANCEL, or ESCALATE.\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 A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
181
|
+
readonly clean: `pr-shepherd clean
|
|
182
|
+
|
|
183
|
+
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
184
|
+
|
|
185
|
+
Usage:
|
|
186
|
+
pr-shepherd clean pr [number] [--dry-run] [--format text|json]
|
|
187
|
+
pr-shepherd clean branch [name] [--dry-run] [--format text|json]
|
|
188
|
+
pr-shepherd clean current [--dry-run] [--format text|json]
|
|
189
|
+
pr-shepherd clean repo [--dry-run] [--format text|json]
|
|
190
|
+
pr-shepherd clean all [--dry-run] [--format text|json]
|
|
191
|
+
|
|
192
|
+
Variants:
|
|
193
|
+
pr [number] Remove state for one PR. Defaults to current branch PR.
|
|
194
|
+
branch [name] Resolve a branch to its open PR, then remove that PR's state.
|
|
195
|
+
Defaults to current branch.
|
|
196
|
+
current Alias for branch against the current branch.
|
|
197
|
+
repo Remove all state for the current repository, including worktree logs.
|
|
198
|
+
all Remove all pr-shepherd state.
|
|
199
|
+
|
|
200
|
+
Flags:
|
|
201
|
+
--dry-run Preview paths without removing them.
|
|
202
|
+
--format text|json Output format. Default: text.
|
|
203
|
+
--help, -h Print this help and exit before any cleanup.
|
|
204
|
+
|
|
205
|
+
Exit code: 0 on success (including a no-op --dry-run on a nonexistent target); nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
206
|
+
readonly journal: `pr-shepherd journal
|
|
207
|
+
|
|
208
|
+
Append a list item to the ## Shepherd Journal section of a PR body.
|
|
209
|
+
Creates the section at the end if absent. Idempotent — duplicate items are skipped.
|
|
210
|
+
|
|
211
|
+
Usage:
|
|
212
|
+
pr-shepherd journal [PR] <item> [--dry-run] [--format text|json]
|
|
213
|
+
pr-shepherd journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
214
|
+
pr-shepherd journal [PR] --file - [--dry-run] [--format text|json]
|
|
215
|
+
|
|
216
|
+
PR PR number or GitHub pull request URL. Defaults to current branch PR.
|
|
217
|
+
item Markdown list item: must start with "- " followed by non-whitespace text.
|
|
218
|
+
Example: '- Rejected suggestion: kept existing pattern for consistency.'
|
|
219
|
+
Provide it as a positional argument, or via --file to avoid shell-escaping
|
|
220
|
+
backticks and multi-line Markdown. Exactly one of the two is required.
|
|
221
|
+
|
|
222
|
+
Flags:
|
|
223
|
+
--file <path> Read the entry from a file instead of a positional argument.
|
|
224
|
+
Pass --file - to read from stdin.
|
|
225
|
+
--dry-run Preview the new PR body without writing it to GitHub.
|
|
226
|
+
--format text|json Output format. Default: text.
|
|
227
|
+
--help, -h Print this help and exit before any GitHub I/O.
|
|
228
|
+
|
|
229
|
+
Exit code: 0 on success (including no-change no-op); nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
|
|
230
|
+
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.";
|
|
231
|
+
};
|
|
@@ -1,6 +1,111 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
1
2
|
import { LOG_FILE_USAGE } from "./help-log-file-page.mjs";
|
|
2
|
-
import { ITERATE_USAGE, POLL_USAGE } from "./help-iterate-poll-pages.mjs";
|
|
3
|
+
import { DEFAULT_USAGE, ITERATE_USAGE, POLL_USAGE } from "./help-iterate-poll-pages.mjs";
|
|
3
4
|
export const COMMAND_USAGE = {
|
|
5
|
+
default: DEFAULT_USAGE,
|
|
6
|
+
apply: `pr-shepherd apply
|
|
7
|
+
|
|
8
|
+
Apply a review mutation, mark changed files as viewed, or append a PR journal item.
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
pr-shepherd apply review [PR] [review-flags]
|
|
12
|
+
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
13
|
+
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
14
|
+
pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
15
|
+
|
|
16
|
+
Run 'pr-shepherd apply <review|files|journal> --help' for command-specific details.
|
|
17
|
+
--help, -h Print this help and exit before GitHub I/O.`,
|
|
18
|
+
"apply review": `pr-shepherd apply review
|
|
19
|
+
|
|
20
|
+
Apply GitHub review-state mutations after fixes.
|
|
21
|
+
|
|
22
|
+
Usage:
|
|
23
|
+
pr-shepherd apply review [PR] --reply-thread-ids A,B --message MSG
|
|
24
|
+
pr-shepherd apply review [PR] --resolve-thread-ids A,B [--minimize-comment-ids X,Y]
|
|
25
|
+
[--dismiss-review-ids Q] [--message MSG]
|
|
26
|
+
[--require-sha SHA] [--format text|json]
|
|
27
|
+
|
|
28
|
+
Flags:
|
|
29
|
+
--resolve-thread-ids <ids> Comma-separated review thread IDs (PRRT_*) to resolve.
|
|
30
|
+
Human-authored thread IDs are skipped; use --reply-thread-ids.
|
|
31
|
+
--reply-thread-ids <ids> Comma-separated human review thread IDs to reply to.
|
|
32
|
+
--minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
|
|
33
|
+
--dismiss-review-ids <ids> Comma-separated CHANGES_REQUESTED review IDs to dismiss.
|
|
34
|
+
--message <text> Reply/dismiss message. Required with reply or dismiss IDs.
|
|
35
|
+
--require-sha <sha> Wait for this full 40-character lowercase PR head SHA.
|
|
36
|
+
--format text|json Output format. Default: text.
|
|
37
|
+
|
|
38
|
+
At least one action flag is required.
|
|
39
|
+
--help, -h Print this help and exit before GitHub I/O.`,
|
|
40
|
+
"apply files": `pr-shepherd apply files
|
|
41
|
+
|
|
42
|
+
Mark changed files as viewed in the GitHub pull request diff.
|
|
43
|
+
|
|
44
|
+
Usage:
|
|
45
|
+
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
46
|
+
[--format text|json]
|
|
47
|
+
|
|
48
|
+
Selectors:
|
|
49
|
+
files... Exact changed-file paths from the PR diff.
|
|
50
|
+
--tests Select changed test files.
|
|
51
|
+
--match <regex> Select changed files whose paths match a case-insensitive JavaScript regex.
|
|
52
|
+
May be repeated.
|
|
53
|
+
--help, -h Print this help and exit before GitHub I/O.`,
|
|
54
|
+
"apply journal": `pr-shepherd apply journal
|
|
55
|
+
|
|
56
|
+
Append a list item to the ## Shepherd Journal section of a PR body.
|
|
57
|
+
|
|
58
|
+
Usage:
|
|
59
|
+
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
60
|
+
pr-shepherd apply journal [PR] --file <path> [--dry-run] [--format text|json]
|
|
61
|
+
pr-shepherd apply journal [PR] --file - [--dry-run] [--format text|json]
|
|
62
|
+
|
|
63
|
+
PR may be a number or GitHub pull request URL. An item must start with '- ' followed by text.
|
|
64
|
+
Use --file to read an item from a file, or --file - to read it from stdin. Exactly one item source
|
|
65
|
+
is required. --dry-run previews the resulting body without writing it.
|
|
66
|
+
--help, -h Print this help and exit before GitHub I/O.`,
|
|
67
|
+
"build-suggestion-patch": `pr-shepherd build-suggestion-patch
|
|
68
|
+
|
|
69
|
+
Build a patch and commit instructions for one GitHub review thread containing a suggestion block.
|
|
70
|
+
The command does not edit files or mutate git history.
|
|
71
|
+
|
|
72
|
+
Usage:
|
|
73
|
+
pr-shepherd build-suggestion-patch [PR] --thread-id ID --message MSG
|
|
74
|
+
[--description DESC] [--format text|json]
|
|
75
|
+
|
|
76
|
+
Flags:
|
|
77
|
+
--thread-id <id> Review thread containing exactly one suggestion block. Required.
|
|
78
|
+
--message <text> Suggested commit subject. Required and non-empty.
|
|
79
|
+
--description <text> Optional longer commit body.
|
|
80
|
+
--format text|json Output format. Default: text.
|
|
81
|
+
|
|
82
|
+
The current branch must match the PR head ref and local HEAD must match the PR head SHA.
|
|
83
|
+
--help, -h Print this help and exit before GitHub, git, config, or log I/O.`,
|
|
84
|
+
admin: `pr-shepherd admin
|
|
85
|
+
|
|
86
|
+
Administrative state and diagnostics commands.
|
|
87
|
+
|
|
88
|
+
Usage:
|
|
89
|
+
pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]
|
|
90
|
+
pr-shepherd admin log-file [--format text|json]
|
|
91
|
+
|
|
92
|
+
Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
|
|
93
|
+
--help, -h Print this help and exit before any I/O.`,
|
|
94
|
+
"admin clean": `pr-shepherd admin clean
|
|
95
|
+
|
|
96
|
+
Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
|
|
97
|
+
|
|
98
|
+
Usage:
|
|
99
|
+
pr-shepherd admin clean pr [number] [--dry-run] [--format text|json]
|
|
100
|
+
pr-shepherd admin clean branch [name] [--dry-run] [--format text|json]
|
|
101
|
+
pr-shepherd admin clean current [--dry-run] [--format text|json]
|
|
102
|
+
pr-shepherd admin clean repo [--dry-run] [--format text|json]
|
|
103
|
+
pr-shepherd admin clean all [--dry-run] [--format text|json]
|
|
104
|
+
|
|
105
|
+
Variants remove state for one PR, branch, current branch, repository, or all repositories.
|
|
106
|
+
Use --dry-run to preview paths without removing them.
|
|
107
|
+
--help, -h Print this help and exit before any cleanup.`,
|
|
108
|
+
"admin log-file": LOG_FILE_USAGE.replaceAll("pr-shepherd log-file", "pr-shepherd admin log-file"),
|
|
4
109
|
resolve: `pr-shepherd resolve
|
|
5
110
|
|
|
6
111
|
Apply GitHub review-state mutations after fixes.
|
|
@@ -0,0 +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 Do not cancel in-progress runs before actionable fixes.\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 code action; run another iterate tick later.\n MARK_READY Draft PR was marked ready for review.\n FIX_CODE Apply fixes, commit, push, and run the printed apply command.\n CANCEL Terminal state: merged/closed or ready-delay elapsed.\n ESCALATE Terminal state requiring human direction.\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 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 while the action is WAIT. Print only the final tick to stdout.\nPoll exits as soon as iterate returns MARK_READY, FIX_CODE, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. With --until-terminal, 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. Bare number = seconds. Default: 4.5m.\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 Do not cancel in-progress runs before actionable fixes.\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, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a single dot to stderr by default; --quiet-status prints only changed WAIT snapshots, and --verbose emits detailed per-tick lines.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until FIX_CODE, CANCEL, or ESCALATE.\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 A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
|
|
3
|
+
/** Public help page for the default PR polling invocation. */
|
|
4
|
+
export declare const DEFAULT_USAGE: string;
|
|
@@ -18,9 +18,9 @@ Iterate flags:
|
|
|
18
18
|
Durations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).
|
|
19
19
|
|
|
20
20
|
Actions:
|
|
21
|
-
WAIT No immediate code action;
|
|
21
|
+
WAIT No immediate code action; run another iterate tick later.
|
|
22
22
|
MARK_READY Draft PR was marked ready for review.
|
|
23
|
-
FIX_CODE Apply fixes, commit, push, and run the printed
|
|
23
|
+
FIX_CODE Apply fixes, commit, push, and run the printed apply command.
|
|
24
24
|
CANCEL Terminal state: merged/closed or ready-delay elapsed.
|
|
25
25
|
ESCALATE Terminal state requiring human direction.
|
|
26
26
|
|
|
@@ -70,3 +70,5 @@ Exit codes: same as iterate (the final tick's action/reason decides the code).
|
|
|
70
70
|
13 ESCALATE
|
|
71
71
|
14 CANCEL (closed without merging)
|
|
72
72
|
A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).`;
|
|
73
|
+
/** Public help page for the default PR polling invocation. */
|
|
74
|
+
export const DEFAULT_USAGE = POLL_USAGE.replaceAll("pr-shepherd poll", "pr-shepherd [PR]");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LOG_FILE_USAGE = "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.";
|
|
@@ -0,0 +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-patch [PR] --thread-id ID --message MSG [flags]\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 Mark changed files as viewed in GitHub.\n apply journal Append a list item to the ## Shepherd Journal section of a PR body.\n build-suggestion-patch\n Convert one GitHub suggestion thread into a patch 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 Do not cancel in-progress runs before actionable fixes.\n\nPolling flags:\n --interval <duration> Delay between WAIT ticks. Bare number = seconds. Default: 60s.\n --timeout <duration> Poll wall-clock cap. Bare number = seconds. Default: 4.5m.\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.";
|