pr-shepherd 0.42.0 → 0.43.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.
Files changed (82) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +8 -3
  3. package/bin/checks/classify.d.mts +3 -1
  4. package/bin/checks/classify.mjs +5 -2
  5. package/bin/cli/args.mjs +1 -0
  6. package/bin/cli/default-poll.mjs +1 -0
  7. package/bin/cli/fix-formatter.mjs +12 -2
  8. package/bin/cli/handlers.mjs +1 -0
  9. package/bin/cli/help-command-pages.d.mts +2 -2
  10. package/bin/cli/help-iterate-poll-pages.d.mts +2 -2
  11. package/bin/cli/help-iterate-poll-pages.mjs +7 -2
  12. package/bin/cli/help.d.mts +2 -2
  13. package/bin/cli/iterate-flags.d.mts +1 -0
  14. package/bin/cli/iterate-flags.mjs +2 -0
  15. package/bin/cli/iterate-formatter.mjs +4 -1
  16. package/bin/cli/iterate-instructions.mjs +15 -0
  17. package/bin/cli/iterate-lean.d.mts +1 -2
  18. package/bin/cli/iterate-lean.mjs +12 -17
  19. package/bin/cli/iterate-merge-formatter.d.mts +3 -0
  20. package/bin/cli/iterate-merge-formatter.mjs +52 -0
  21. package/bin/cli/iterate-verbose.d.mts +6 -0
  22. package/bin/cli/iterate-verbose.mjs +14 -0
  23. package/bin/cli/poll-handler.mjs +1 -0
  24. package/bin/cli/runner.mjs +4 -3
  25. package/bin/commands/check-terminal-report.mjs +1 -0
  26. package/bin/commands/check.mjs +42 -1
  27. package/bin/commands/iterate/base.d.mts +5 -0
  28. package/bin/commands/iterate/base.mjs +25 -0
  29. package/bin/commands/iterate/escalate.d.mts +3 -1
  30. package/bin/commands/iterate/escalate.mjs +18 -2
  31. package/bin/commands/iterate/fix-code.mjs +16 -0
  32. package/bin/commands/iterate/helpers.mjs +6 -2
  33. package/bin/commands/iterate/index.mjs +29 -35
  34. package/bin/commands/iterate/merge-state.d.mts +15 -0
  35. package/bin/commands/iterate/merge-state.mjs +53 -0
  36. package/bin/commands/iterate/merge.d.mts +13 -0
  37. package/bin/commands/iterate/merge.mjs +46 -0
  38. package/bin/commands/poll.mjs +3 -1
  39. package/bin/config/load.d.mts +4 -0
  40. package/bin/config/load.mjs +34 -0
  41. package/bin/config/merge-command-args.d.mts +2 -0
  42. package/bin/config/merge-command-args.mjs +44 -0
  43. package/bin/config.json +3 -0
  44. package/bin/exit-codes.d.mts +2 -0
  45. package/bin/exit-codes.mjs +4 -0
  46. package/bin/github/batch-parse-checks.d.mts +3 -0
  47. package/bin/github/batch-parse-checks.mjs +29 -0
  48. package/bin/github/batch-parsers-rules.d.mts +3 -1
  49. package/bin/github/batch-parsers-rules.mjs +33 -0
  50. package/bin/github/batch-parsers.mjs +23 -26
  51. package/bin/github/batch-raw-rules.d.mts +48 -0
  52. package/bin/github/batch-raw-types.mjs +0 -1
  53. package/bin/github/batch.mjs +2 -0
  54. package/bin/github/gql/batch-pr.gql +92 -0
  55. package/bin/github/gql/commit-check-contexts.gql +58 -0
  56. package/bin/github/merge-queue-checks.d.mts +4 -0
  57. package/bin/github/merge-queue-checks.mjs +48 -0
  58. package/bin/github/queries.d.mts +2 -0
  59. package/bin/github/queries.mjs +2 -0
  60. package/bin/mcp/server.mjs +1 -0
  61. package/bin/reporters/agent.mjs +6 -3
  62. package/bin/types/activity.d.mts +2 -0
  63. package/bin/types/escalate.d.mts +30 -0
  64. package/bin/types/escalate.mjs +1 -0
  65. package/bin/types/github.d.mts +8 -0
  66. package/bin/types/github.mjs +0 -3
  67. package/bin/types/iterate.d.mts +14 -31
  68. package/bin/types/merge-action.d.mts +12 -0
  69. package/bin/types/merge-action.mjs +1 -0
  70. package/bin/types/merge-queue.d.mts +13 -0
  71. package/bin/types/merge-queue.mjs +1 -0
  72. package/bin/types/merge-requirements.d.mts +17 -0
  73. package/bin/types/report.d.mts +8 -0
  74. package/bin/types.d.mts +3 -0
  75. package/bin/types.mjs +3 -0
  76. package/bin/util/markdown.d.mts +2 -0
  77. package/bin/util/markdown.mjs +7 -0
  78. package/package.json +1 -1
  79. package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
  80. package/plugins/pr-shepherd/.codex.mcp.json +1 -1
  81. package/plugins/pr-shepherd/.mcp.json +1 -1
  82. package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +3 -3
@@ -0,0 +1,12 @@
1
+ interface ShellCommand {
2
+ argv: string[];
3
+ }
4
+ export interface MergeCommandPlan {
5
+ mode: "auto" | "queue";
6
+ command: ShellCommand;
7
+ /** Ordinary merge retry without `--auto`, used only when auto-merge is unavailable. */
8
+ fallbackCommand?: ShellCommand;
9
+ /** Direct enqueuePullRequest fallback for the known gh CLI queue limitation. */
10
+ queueApiFallbackCommand?: ShellCommand;
11
+ }
12
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type { AutoMergeRequestStatus, MergeQueueEntryStatus, MergeQueueRemovalStatus } from "./merge-requirements.mts";
2
+ export interface MergeQueueReport {
3
+ enabled: boolean;
4
+ inQueue: boolean;
5
+ autoMergeRequest?: AutoMergeRequestStatus;
6
+ entry?: MergeQueueEntryStatus;
7
+ latestRemoval?: MergeQueueRemovalStatus;
8
+ checkCommitOid?: string;
9
+ /** GitHub reported more than the first 100 contexts on the queue commit. */
10
+ checksIncomplete?: true;
11
+ /** The current PR head is not a parent of the removed synthetic queue commit. */
12
+ headUpdatedAfterRemoval?: true;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -17,6 +17,21 @@ export interface MergeQueueEntryStatus {
17
17
  position: number;
18
18
  state: string;
19
19
  estimatedTimeToMerge: number | null;
20
+ headCommitOid?: string;
21
+ enqueuedAtUnix?: number;
22
+ enqueuer?: string;
23
+ }
24
+ export interface AutoMergeRequestStatus {
25
+ enabledAtUnix: number;
26
+ mergeMethod: string;
27
+ enabledBy?: string;
28
+ }
29
+ export interface MergeQueueRemovalStatus {
30
+ reason: string | null;
31
+ actor?: string;
32
+ createdAtUnix: number;
33
+ beforeCommitOid?: string;
34
+ beforeCommitParentOids?: string[];
20
35
  }
21
36
  export interface StackStatus {
22
37
  number: number;
@@ -30,6 +45,8 @@ export interface BatchPrMergeFields {
30
45
  isInMergeQueue?: boolean;
31
46
  isMergeQueueEnabled?: boolean;
32
47
  mergeQueueEntry?: MergeQueueEntryStatus | null;
48
+ autoMergeRequest?: AutoMergeRequestStatus | null;
49
+ latestMergeQueueRemoval?: MergeQueueRemovalStatus | null;
33
50
  stack?: StackStatus | null;
34
51
  }
35
52
  /** Snapshot of "why can't I merge" requirements vs current PR state. */
@@ -3,6 +3,7 @@ import type { ClassifiedCheck, TriagedCheck } from "./check-classification.mts";
3
3
  import type { AgentThreadComment } from "./agent-thread.mts";
4
4
  import type { CheckAnnotation } from "./check-annotations.mts";
5
5
  import type { PrActivitySummary } from "./activity.mts";
6
+ import type { MergeQueueReport } from "./merge-queue.mts";
6
7
  export interface FirstLookThread extends ReviewThread {
7
8
  firstLookStatus: "outdated" | "resolved" | "minimized";
8
9
  autoResolved?: boolean;
@@ -20,6 +21,8 @@ export interface ShepherdReport {
20
21
  pr: number;
21
22
  /** GitHub node ID of the PR — used for mutations (e.g. markPullRequestReadyForReview). */
22
23
  nodeId: string;
24
+ /** GitHub PR head OID from the same batch used to decide the action. */
25
+ headSha?: string;
23
26
  repo: string;
24
27
  status: ShepherdStatus;
25
28
  /** PR base branch from the GraphQL batch. */
@@ -71,6 +74,7 @@ export interface ShepherdReport {
71
74
  /** Branch protection rule for the PR's base branch. Null when no rule exists or the base ref is unavailable. */
72
75
  branchProtection: import("./github.mts").BranchProtection | null;
73
76
  activity?: PrActivitySummary;
77
+ mergeQueue?: MergeQueueReport;
74
78
  }
75
79
  export interface ResolveOptions {
76
80
  resolveThreadIds?: string[];
@@ -125,6 +129,8 @@ export interface AgentCheck {
125
129
  logExcerpt?: string;
126
130
  annotations?: CheckAnnotation[];
127
131
  annotationOnly?: true;
132
+ scope?: "merge_group";
133
+ commitOid?: string;
128
134
  }
129
135
  /**
130
136
  * A single CI check that is relevant to PR readiness — triggered by a PR event
@@ -149,6 +155,8 @@ export interface RelevantCheck {
149
155
  logExcerpt?: string;
150
156
  /** Marker-gated inline annotations from this check. */
151
157
  annotations?: CheckAnnotation[];
158
+ scope?: "merge_group";
159
+ commitOid?: string;
152
160
  }
153
161
  export interface GlobalOptions {
154
162
  prNumber?: number;
package/bin/types.d.mts CHANGED
@@ -9,3 +9,6 @@ export * from "./types/report.mts";
9
9
  export * from "./types/suggestion-patch.mts";
10
10
  export * from "./types/iterate.mts";
11
11
  export * from "./types/merge-requirements.mts";
12
+ export * from "./types/merge-action.mts";
13
+ export * from "./types/escalate.mts";
14
+ export * from "./types/merge-queue.mts";
package/bin/types.mjs CHANGED
@@ -9,3 +9,6 @@ export * from "./types/report.mjs";
9
9
  export * from "./types/suggestion-patch.mjs";
10
10
  export * from "./types/iterate.mjs";
11
11
  export * from "./types/merge-requirements.mjs";
12
+ export * from "./types/merge-action.mjs";
13
+ export * from "./types/escalate.mjs";
14
+ export * from "./types/merge-queue.mjs";
@@ -1 +1,3 @@
1
1
  export declare function joinSections(sections: (string | null | undefined)[]): string;
2
+ /** Wrap arbitrary text in a CommonMark code span without colliding with embedded backticks. */
3
+ export declare function inlineCode(value: string): string;
@@ -5,3 +5,10 @@ export function joinSections(sections) {
5
5
  .filter((s) => s !== "")
6
6
  .join("\n\n");
7
7
  }
8
+ /** Wrap arbitrary text in a CommonMark code span without colliding with embedded backticks. */
9
+ export function inlineCode(value) {
10
+ const longestRun = Math.max(0, ...Array.from(value.matchAll(/`+/g), (match) => match[0].length));
11
+ const delimiter = "`".repeat(longestRun + 1);
12
+ const padding = value.startsWith("`") || value.endsWith("`") ? " " : "";
13
+ return `${delimiter}${padding}${value}${padding}${delimiter}`;
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
5
5
  "keywords": [
6
6
  "automation",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.42.0",
3
+ "version": "0.43.0",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for Codex.",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
@@ -2,7 +2,7 @@
2
2
  "mcpServers": {
3
3
  "pr-shepherd": {
4
4
  "command": "npx",
5
- "args": ["--yes", "--package", "pr-shepherd@0.42.0", "pr-shepherd-mcp"]
5
+ "args": ["--yes", "--package", "pr-shepherd@0.43.0", "pr-shepherd-mcp"]
6
6
  }
7
7
  }
8
8
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "pr-shepherd": {
3
3
  "command": "npx",
4
- "args": ["--yes", "--package", "pr-shepherd@0.42.0", "pr-shepherd-mcp"]
4
+ "args": ["--yes", "--package", "pr-shepherd@0.43.0", "pr-shepherd-mcp"]
5
5
  }
6
6
  }
@@ -2,7 +2,7 @@
2
2
  name: pr-shepherd
3
3
  description: 'Iterate a GitHub pull request with pr-shepherd (MCP or CLI). Use for requests like "use pr-shepherd", "iterate PR #123", or "run pr-shepherd until this PR is ready".'
4
4
  user-invocable: true
5
- argument-hint: "[PR number or URL]"
5
+ argument-hint: "[PR number or URL] [--merge]"
6
6
  allowed-tools: ["MCP", "Bash", "Read", "Grep", "Glob", "Edit", "Write"]
7
7
  ---
8
8
 
@@ -12,9 +12,9 @@ Thin dispatcher for iterating a PR. Poll with the CLI; use MCP `iterate` only wh
12
12
 
13
13
  ## Arguments: $ARGUMENTS
14
14
 
15
- 1. Parse an optional PR number, repository-qualified `owner/repo#N`, or GitHub PR URL from `$ARGUMENTS`; otherwise let pr-shepherd infer the current branch PR.
15
+ 1. Parse an optional PR number, repository-qualified `owner/repo#N`, or GitHub PR URL and an optional `--merge` flag from `$ARGUMENTS`; otherwise let pr-shepherd infer the current branch PR. Reject any remaining argument. Follow the target repository's local `AGENTS.md` and `CLAUDE.md` standards while making changes.
16
16
 
17
- 2. Before passing a supplied GitHub PR URL or `owner/repo#N` to the CLI, run `gh repo view --json nameWithOwner --jq .nameWithOwner` and verify that repository matches the reference case-insensitively. Stop on a mismatch or failed lookup; the CLI does not validate the URL repository. Convert a verified `owner/repo#N` to `https://github.com/owner/repo/pull/N`, then run the poll command `pr-shepherd` with the optional PR argument and print its full result. Do not run `pr-shepherd iterate`. If the CLI is unavailable and the `iterate` MCP tool is available, first obtain a repository-qualified reference: use a supplied GitHub PR URL or `owner/repo#N` unchanged; for a bare number, run `gh pr view <number> --json url --jq .url`; when omitted, run `gh pr view --json url --jq .url`. If that does not produce one qualified PR reference, stop and report that MCP cannot safely determine the PR. Otherwise call `iterate` with that qualified reference and print its full result.
17
+ 2. Before passing a supplied GitHub PR URL or `owner/repo#N` to the CLI, run `gh repo view --json nameWithOwner --jq .nameWithOwner` and verify that repository matches the reference case-insensitively. Stop on a mismatch or failed lookup; the CLI does not validate the URL repository. Convert a verified `owner/repo#N` to `https://github.com/owner/repo/pull/N`, then run the poll command `pr-shepherd` with the optional PR argument and forward `--merge` when supplied; print its full result. Do not run `pr-shepherd iterate`. If the CLI is unavailable and the `iterate` MCP tool is available, first obtain a repository-qualified reference: use a supplied GitHub PR URL or `owner/repo#N` unchanged; for a bare number, run `gh pr view <number> --json url --jq .url`; when omitted, run `gh pr view --json url --jq .url`. If that does not produce one qualified PR reference, stop and report that MCP cannot safely determine the PR. Otherwise call `iterate` with that qualified reference, plus `merge: true` when `--merge` was supplied, and print its full result.
18
18
 
19
19
  3. Print the full result and follow every returned `## Instructions` step exactly. For CLI output, run each printed mutation command when instructed. For MCP output, use MCP `apply` and `build_suggestion_patches` with the same qualified PR reference; do not run a shell `pr-shepherd apply` command.
20
20