pr-shepherd 2.4.1 → 2.6.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 (80) hide show
  1. package/.claude-plugin/plugin.json +3 -3
  2. package/.grok-plugin/marketplace.json +1 -1
  3. package/README.md +7 -9
  4. package/bin/classify/apply.d.mts +8 -1
  5. package/bin/classify/apply.mjs +37 -47
  6. package/bin/classify/items.d.mts +7 -0
  7. package/bin/classify/items.mjs +57 -0
  8. package/bin/classify/standard/coderabbit-notices.d.mts +2 -1
  9. package/bin/classify/standard/coderabbit-notices.mjs +35 -3
  10. package/bin/classify/standard/index.d.mts +2 -1
  11. package/bin/classify/standard/index.mjs +2 -1
  12. package/bin/classify/types.d.mts +8 -3
  13. package/bin/cli/iterate-lean.mjs +3 -0
  14. package/bin/cli/list-formatters.d.mts +1 -0
  15. package/bin/cli/list-formatters.mjs +3 -1
  16. package/bin/cli/triage-formatter.mjs +6 -1
  17. package/bin/commands/check-activity.mjs +2 -1
  18. package/bin/commands/check-fingerprint.mjs +1 -0
  19. package/bin/commands/check.mjs +39 -9
  20. package/bin/commands/iterate/branch-update.d.mts +19 -0
  21. package/bin/commands/iterate/branch-update.mjs +39 -0
  22. package/bin/commands/iterate/check-instructions.d.mts +3 -1
  23. package/bin/commands/iterate/check-instructions.mjs +26 -6
  24. package/bin/commands/iterate/classify.d.mts +17 -3
  25. package/bin/commands/iterate/classify.mjs +105 -66
  26. package/bin/commands/iterate/escalate.mjs +6 -1
  27. package/bin/commands/iterate/index.mjs +16 -24
  28. package/bin/commands/iterate/native-stack-rebase.d.mts +5 -0
  29. package/bin/commands/iterate/native-stack-rebase.mjs +16 -8
  30. package/bin/commands/iterate/queue-recovery-instructions.mjs +7 -4
  31. package/bin/commands/iterate/queue-removal.mjs +2 -1
  32. package/bin/commands/iterate/render.d.mts +2 -11
  33. package/bin/commands/iterate/render.mjs +10 -19
  34. package/bin/commands/iterate/stall.mjs +3 -0
  35. package/bin/commands/iterate/triage.d.mts +1 -0
  36. package/bin/commands/iterate/triage.mjs +19 -14
  37. package/bin/commands/iterate/unreported-required.mjs +6 -4
  38. package/bin/commands/resolve-mutate.mjs +39 -4
  39. package/bin/commands/resolve-review-guard.d.mts +19 -0
  40. package/bin/commands/resolve-review-guard.mjs +61 -0
  41. package/bin/comments/resolve.mjs +4 -4
  42. package/bin/comments/review-thread-markers.d.mts +1 -1
  43. package/bin/comments/review-thread-markers.mjs +23 -9
  44. package/bin/comments/superseded-approvals.d.mts +28 -0
  45. package/bin/comments/superseded-approvals.mjs +99 -0
  46. package/bin/config/schema.d.mts +10 -0
  47. package/bin/config/schema.mjs +2 -0
  48. package/bin/github/batch-parsers.mjs +31 -0
  49. package/bin/github/batch-raw-types.d.mts +3 -0
  50. package/bin/github/batch-viewer.d.mts +2 -2
  51. package/bin/github/batch.mjs +1 -1
  52. package/bin/github/gql/batch-pr-page.gql +8 -2
  53. package/bin/github/gql/batch-pr.gql +4 -1
  54. package/bin/github/poll-summary-review-helpers.d.mts +20 -0
  55. package/bin/github/poll-summary-review-helpers.mjs +81 -0
  56. package/bin/github/poll-summary-review.mjs +37 -46
  57. package/bin/github/poll-summary-rule-auto-resolve.mjs +1 -0
  58. package/bin/github/poll-summary-rule-items.d.mts +1 -1
  59. package/bin/github/poll-summary-rule-items.mjs +3 -2
  60. package/bin/github/rest-batch-snapshot.mjs +25 -1
  61. package/bin/github/review-unresolved-threads.d.mts +13 -0
  62. package/bin/github/review-unresolved-threads.mjs +152 -0
  63. package/bin/github/stack-handoff-page.mjs +5 -1
  64. package/bin/state/seen-comments.d.mts +3 -1
  65. package/bin/state/seen-comments.mjs +28 -2
  66. package/bin/types/escalate.d.mts +1 -0
  67. package/bin/types/github.d.mts +7 -1
  68. package/bin/types/iterate.d.mts +4 -2
  69. package/bin/types/report.d.mts +8 -0
  70. package/package.json +5 -5
  71. package/plugins/pr-shepherd/.claude-plugin/plugin.json +3 -3
  72. package/plugins/pr-shepherd/.codex-plugin/plugin.json +6 -6
  73. package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +1 -1
  74. package/plugins/pr-shepherd/skills/pr-shepherd/references/merge-queue-ejection.md +2 -2
  75. package/plugins/pr-shepherd/skills/pr-shepherd/references/triage-loop.md +1 -1
  76. package/plugins/pr-shepherd/skills/setup-pr-shepherd/SKILL.md +1 -1
  77. package/plugins/pr-shepherd/skills/setup-pr-shepherd/references/classifiers.md +3 -3
  78. package/plugins/pr-shepherd/skills/setup-pr-shepherd/references/upstream-standard-rule.md +2 -2
  79. package/pr-shepherd.schema.json +12 -0
  80. package/src/classify/types.mts +9 -1
@@ -0,0 +1,152 @@
1
+ import { graphqlWithRateLimit } from "./client.mjs";
2
+ import { githubOperation } from "./transport.mjs";
3
+ import { readRestFeedback } from "./rest-feedback-read.mjs";
4
+ import { resolveGraphqlThreadId, resolveRestIdentity } from "./rest-identities.mjs";
5
+ import { chunksOf } from "../util/chunks.mjs";
6
+ const REVIEW_THREADS_QUERY = `query ReviewUnresolvedThreads($owner: String!, $repo: String!, $pr: Int!, $cursor: String) {
7
+ _shepherdRateLimit: rateLimit { cost limit nodeCount remaining resetAt used }
8
+ repository(owner: $owner, name: $repo) {
9
+ pullRequest(number: $pr) {
10
+ reviewThreads(first: 100, after: $cursor) {
11
+ pageInfo { hasNextPage endCursor }
12
+ nodes {
13
+ id
14
+ isResolved
15
+ comments(first: 1) {
16
+ nodes {
17
+ pullRequestReview { id }
18
+ }
19
+ }
20
+ }
21
+ }
22
+ }
23
+ }
24
+ }`;
25
+ const THREAD_STATES_QUERY = `query ReviewThreadStates($ids: [ID!]!) {
26
+ _shepherdRateLimit: rateLimit { cost limit nodeCount remaining resetAt used }
27
+ nodes(ids: $ids) {
28
+ ... on PullRequestReviewThread {
29
+ id
30
+ isResolved
31
+ }
32
+ }
33
+ }`;
34
+ /** True when a node ID identifies a GitHub PullRequestReview (next-gen `PRR_` or legacy base64). */
35
+ export function isReviewNodeId(id) {
36
+ if (id.startsWith("PRR_"))
37
+ return true;
38
+ if (id.length < 24 || !/^[A-Za-z0-9+/=]+$/.test(id))
39
+ return false;
40
+ return Buffer.from(id, "base64").toString("utf8").includes("PullRequestReview");
41
+ }
42
+ /**
43
+ * Re-check only the specific thread IDs that local state last saw as unresolved, in case a
44
+ * reviewer or human resolved them outside `pr-shepherd`. Returns the subset still unresolved.
45
+ */
46
+ export async function checkThreadsStillUnresolved(pr, repo, threadIds) {
47
+ const unique = [...new Set(threadIds)];
48
+ const unresolved = new Set();
49
+ if (unique.length === 0)
50
+ return unresolved;
51
+ await githubOperation("ReviewThreadStates", async () => {
52
+ const gqlToOriginal = new Map();
53
+ for (const id of unique) {
54
+ try {
55
+ // eslint-disable-next-line no-await-in-loop
56
+ const gqlId = await resolveGraphqlThreadId(id);
57
+ const list = gqlToOriginal.get(gqlId) ?? [];
58
+ list.push(id);
59
+ gqlToOriginal.set(gqlId, list);
60
+ }
61
+ catch {
62
+ unresolved.add(id);
63
+ }
64
+ }
65
+ for (const batch of chunksOf([...gqlToOriginal.keys()], 100)) {
66
+ // eslint-disable-next-line no-await-in-loop
67
+ const res = await graphqlWithRateLimit(THREAD_STATES_QUERY, { ids: batch });
68
+ const byId = new Map(res.data.nodes.flatMap((node) => (node?.id ? [[node.id, node.isResolved]] : [])));
69
+ for (const gqlId of batch) {
70
+ if (byId.get(gqlId) !== true) {
71
+ for (const origId of gqlToOriginal.get(gqlId))
72
+ unresolved.add(origId);
73
+ }
74
+ }
75
+ }
76
+ }, async () => {
77
+ const feedback = await readRestFeedback(pr, repo);
78
+ const resolvedIds = new Set();
79
+ for (const thread of feedback.threads) {
80
+ if (thread.isResolved !== true)
81
+ continue;
82
+ resolvedIds.add(thread.id);
83
+ try {
84
+ // eslint-disable-next-line no-await-in-loop
85
+ const entry = await resolveRestIdentity(thread.id, "thread");
86
+ if (entry.graphqlThreadId)
87
+ resolvedIds.add(entry.graphqlThreadId);
88
+ }
89
+ catch {
90
+ // No recorded GraphQL alias for this REST thread; match by REST thread ID only.
91
+ }
92
+ }
93
+ for (const id of unique) {
94
+ if (!resolvedIds.has(id))
95
+ unresolved.add(id);
96
+ }
97
+ });
98
+ return unresolved;
99
+ }
100
+ /**
101
+ * Cold-cache fallback when no local `unresolvedInlineThreadIds` record exists for a review:
102
+ * scan the PR's review threads and return `reviewId -> unresolvedThreadIds[]`.
103
+ */
104
+ export async function findUnresolvedThreadsByReviewId(pr, repo, reviewIds) {
105
+ const wanted = new Set(reviewIds);
106
+ const blocked = new Map();
107
+ if (wanted.size === 0)
108
+ return blocked;
109
+ const record = (reviewId, threadId) => {
110
+ if (!reviewId || !wanted.has(reviewId))
111
+ return;
112
+ const list = blocked.get(reviewId) ?? [];
113
+ if (!list.includes(threadId))
114
+ list.push(threadId);
115
+ blocked.set(reviewId, list);
116
+ };
117
+ await githubOperation("ReviewUnresolvedThreads", async () => {
118
+ let cursor = null;
119
+ for (;;) {
120
+ // eslint-disable-next-line no-await-in-loop
121
+ const res = await graphqlWithRateLimit(REVIEW_THREADS_QUERY, {
122
+ owner: repo.owner,
123
+ repo: repo.name,
124
+ pr,
125
+ cursor,
126
+ });
127
+ const connection = res.data.repository?.pullRequest?.reviewThreads;
128
+ if (!connection)
129
+ break;
130
+ for (const thread of connection.nodes) {
131
+ if (!thread || thread.isResolved !== false)
132
+ continue;
133
+ const reviewId = thread.comments.nodes[0]?.pullRequestReview?.id;
134
+ record(reviewId, thread.id);
135
+ }
136
+ if (!connection.pageInfo.hasNextPage)
137
+ break;
138
+ const nextCursor = connection.pageInfo.endCursor;
139
+ if (!nextCursor || nextCursor === cursor) {
140
+ throw new Error("Review thread pagination returned hasNextPage without advancing endCursor");
141
+ }
142
+ cursor = nextCursor;
143
+ }
144
+ }, async () => {
145
+ const feedback = await readRestFeedback(pr, repo);
146
+ for (const thread of feedback.threads) {
147
+ if (thread.isResolved !== true)
148
+ record(thread.reviewId, thread.id);
149
+ }
150
+ });
151
+ return blocked;
152
+ }
@@ -246,6 +246,8 @@ export function batchResponseFromSummary(layer, source, runs) {
246
246
  pageInfo: firstPage,
247
247
  nodes: reviewsIn(layer, "CHANGES_REQUESTED").map((review) => ({
248
248
  id: review.id,
249
+ isMinimized: review.isMinimized === true,
250
+ viewerCanMinimize: review.viewerCanMinimize === true,
249
251
  authorAssociation: review.authorAssociation,
250
252
  author: review.author,
251
253
  body: review.body,
@@ -255,7 +257,9 @@ export function batchResponseFromSummary(layer, source, runs) {
255
257
  },
256
258
  reviewSummaries: {
257
259
  pageInfo: firstPage,
258
- nodes: reviewsIn(layer, "COMMENTED").map(reviewSummary),
260
+ nodes: layer.reviews.nodes
261
+ .filter((review) => review.state === "COMMENTED" || review.state === "DISMISSED")
262
+ .map((review) => ({ ...reviewSummary(review), state: review.state })),
259
263
  },
260
264
  allReviews: {
261
265
  totalCount: layer.reviews.totalCount,
@@ -51,7 +51,9 @@ export declare function markSeen(key: StateKey, id: string, body: string): Promi
51
51
  /** A definite permission denial suppresses generated retries until the feedback changes. */
52
52
  export declare function markMutationDenied(key: StateKey, id: string, body?: string): Promise<void>;
53
53
  export declare function mutationWasDenied(id: string, body: string, map: Map<string, SeenMarker>): boolean;
54
- export declare function markReviewInlineThreads(key: StateKey, reviewId: string, inlineThreadIds: readonly string[]): Promise<void>;
54
+ export declare function markReviewInlineThreads(key: StateKey, reviewId: string, inlineThreadIds: readonly string[], unresolvedInlineThreadIds?: readonly string[]): Promise<void>;
55
+ export declare function markReviewUnresolvedThreads(key: StateKey, reviewId: string, unresolvedInlineThreadIds: readonly string[]): Promise<void>;
56
+ export declare function pruneResolvedReviewThreads(key: StateKey, resolvedThreadIds: readonly string[]): Promise<void>;
55
57
  /**
56
58
  * Write a marker after Shepherd successfully replies to a review thread.
57
59
  *
@@ -31,7 +31,8 @@ export function classifyItem(id, body, map) {
31
31
  }
32
32
  if (typeof m.bodyHash === "string" && m.bodyHash !== currentHash)
33
33
  return "edited";
34
- if (m.bodyHash === undefined && Array.isArray(m.inlineThreadIds))
34
+ if (m.bodyHash === undefined &&
35
+ (Array.isArray(m.inlineThreadIds) || Array.isArray(m.unresolvedInlineThreadIds)))
35
36
  return "new";
36
37
  return "unchanged";
37
38
  }
@@ -117,11 +118,36 @@ export async function markMutationDenied(key, id, body) {
117
118
  export function mutationWasDenied(id, body, map) {
118
119
  return map.get(id)?.deniedMutationBodyHash === hashBody(body);
119
120
  }
120
- export async function markReviewInlineThreads(key, reviewId, inlineThreadIds) {
121
+ export async function markReviewInlineThreads(key, reviewId, inlineThreadIds, unresolvedInlineThreadIds) {
121
122
  await writeSeenMarker(key, reviewId, {
122
123
  inlineThreadIds: [...new Set(inlineThreadIds)].sort((a, b) => a.localeCompare(b)),
124
+ ...(unresolvedInlineThreadIds !== undefined && {
125
+ unresolvedInlineThreadIds: [...new Set(unresolvedInlineThreadIds)].sort((a, b) => a.localeCompare(b)),
126
+ }),
123
127
  });
124
128
  }
129
+ export async function markReviewUnresolvedThreads(key, reviewId, unresolvedInlineThreadIds) {
130
+ await writeSeenMarker(key, reviewId, {
131
+ unresolvedInlineThreadIds: [...new Set(unresolvedInlineThreadIds)].sort((a, b) => a.localeCompare(b)),
132
+ });
133
+ }
134
+ export async function pruneResolvedReviewThreads(key, resolvedThreadIds) {
135
+ if (resolvedThreadIds.length === 0)
136
+ return;
137
+ const resolved = new Set(resolvedThreadIds);
138
+ const seen = await loadSeenMap(key);
139
+ const updates = [];
140
+ for (const [reviewId, marker] of seen) {
141
+ if (!Array.isArray(marker.unresolvedInlineThreadIds))
142
+ continue;
143
+ const current = marker.unresolvedInlineThreadIds.filter((id) => typeof id === "string");
144
+ const remaining = current.filter((id) => !resolved.has(id));
145
+ if (remaining.length !== current.length) {
146
+ updates.push(markReviewUnresolvedThreads(key, reviewId, remaining));
147
+ }
148
+ }
149
+ await Promise.allSettled(updates);
150
+ }
125
151
  /**
126
152
  * Write a marker after Shepherd successfully replies to a review thread.
127
153
  *
@@ -51,6 +51,7 @@ export interface EscalateDetails {
51
51
  pendingReviewCommands?: {
52
52
  resolveOnlyCommand?: ResolveCommand;
53
53
  resolveCommand?: ResolveCommand;
54
+ dismissReviewsCommand?: ResolveCommand;
54
55
  };
55
56
  suggestion: string;
56
57
  humanMessage: string;
@@ -149,13 +149,17 @@ export interface Review {
149
149
  author: string;
150
150
  authorType: AuthorType;
151
151
  authorAssociation?: CommentAuthorAssociation;
152
- /** Present for minimizable COMMENTED/APPROVED reviews; false for non-minimizable review rows. */
152
+ /** Present when GitHub reports the review is already minimized. */
153
+ isMinimized?: boolean;
154
+ /** Present for minimizable reviews; false for non-minimizable review rows. */
153
155
  viewerCanMinimize?: boolean;
154
156
  body: string;
155
157
  createdAtUnix?: number;
156
158
  edited?: boolean;
157
159
  /** True for bot CR re-surfaced after first look (body unchanged). Terse render. */
158
160
  staleBotCr?: boolean;
161
+ /** True when a re-surfaced bot CR is still held back from dismissal by unresolved inline threads. */
162
+ pendingInlineThreads?: boolean;
159
163
  /** Commit OID the review was made against, when available from GraphQL. */
160
164
  commitOid?: string;
161
165
  /** PR head OID, set on changes-requested reviews only when `commitOid` differs from it. Raw data, not a staleness verdict. */
@@ -241,6 +245,8 @@ export interface BatchPrData extends BatchPrMergeFields {
241
245
  changesRequestedReviews: Review[];
242
246
  reviewSummaries: Review[];
243
247
  approvedReviews: Review[];
248
+ /** Internal: APPROVED review IDs superseded by a newer review from the same author (including already-minimized reviews). */
249
+ supersededApprovalIds?: string[];
244
250
  checks: CheckRun[];
245
251
  mergeQueueChecks?: CheckRun[];
246
252
  mergeQueueChecksIncomplete?: true;
@@ -138,10 +138,12 @@ interface TriageDetails {
138
138
  /** Checks still unstarted after the CI-start stall timeout, on the one investigation tick. Omitted otherwise. */
139
139
  stalledChecks?: AgentStalledCheck[];
140
140
  changesRequestedReviews: Review[];
141
- /** Pre-built apply command. Run after committing and pushing. */
141
+ /** Pre-built apply command for inline thread replies/resolves and PR-level comments. Run after committing and pushing. */
142
142
  resolveCommand: ResolveCommand;
143
- /** When present, run this command first (no SHA substitution needed) for standalone thread resolves and comment minimization, independent of any push. */
143
+ /** When present, run this command first (no SHA substitution needed) for standalone thread resolves and PR-comment minimization, independent of any push. */
144
144
  resolveOnlyCommand?: ResolveCommand;
145
+ /** Separate command to dismiss and/or hide reviews (`CHANGES_REQUESTED`, `COMMENTED`/`DISMISSED`, and eligible `APPROVED` reviews) whose inline items are all resolved. */
146
+ dismissReviewsCommand?: ResolveCommand;
145
147
  /** Ordered steps for the model to follow. */
146
148
  instructions: string[];
147
149
  /** Requeue command emitted after merge-group remediation. */
@@ -110,6 +110,8 @@ export interface ShepherdReport {
110
110
  editedSummaries: Review[];
111
111
  /** APPROVED reviews not yet minimized — opt-in minimize target. */
112
112
  approvedReviews: Review[];
113
+ /** Internal: APPROVED reviews superseded by a newer review from the same author, eligible for hiding when `iterate.minimize-superseded-approvals` is enabled. */
114
+ supersededApprovedReviews?: Review[];
113
115
  /**
114
116
  * Set only when `iterate.review-output-max-chars` held review items back this tick: `shown` of
115
117
  * `total` review items appear in this report. Held items are absent from every review list,
@@ -124,6 +126,12 @@ export interface ShepherdReport {
124
126
  * summaries are not minimized this tick. Not rendered.
125
127
  */
126
128
  heldThreadReviewIds?: string[];
129
+ /**
130
+ * Internal, iterate-only: parent review IDs of every unresolved review thread on the PR (after
131
+ * any in-run auto-resolve). Reviews in this set are not dismissed or minimized until their
132
+ * inline items are resolved. Not rendered.
133
+ */
134
+ unresolvedThreadReviewIds?: string[];
127
135
  /** COMMENTED review summary IDs matched by user rules with autoResolve:true — minimized without surfacing to agent. */
128
136
  ruleAutoResolveReviewSummaryIds?: string[];
129
137
  /** Branch protection rule for the PR's base branch. Null when no rule exists or the base ref is unavailable. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "2.4.1",
3
+ "version": "2.6.0",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
5
5
  "keywords": [
6
6
  "automation",
@@ -12,15 +12,15 @@
12
12
  "github",
13
13
  "pull-request"
14
14
  ],
15
- "homepage": "https://jongleberry.com/pr-shepherd/",
15
+ "homepage": "https://jongleberry.github.io/pr-shepherd/",
16
16
  "bugs": {
17
- "url": "https://github.com/jonathanong/pr-shepherd/issues"
17
+ "url": "https://github.com/jongleberry/pr-shepherd/issues"
18
18
  },
19
19
  "license": "MIT",
20
20
  "author": "Jonathan Ong",
21
21
  "repository": {
22
22
  "type": "git",
23
- "url": "git+https://github.com/jonathanong/pr-shepherd.git"
23
+ "url": "git+https://github.com/jongleberry/pr-shepherd.git"
24
24
  },
25
25
  "bin": {
26
26
  "pr-shepherd": "bin/index.mjs",
@@ -88,7 +88,7 @@
88
88
  "husky": "^9.1.7",
89
89
  "knip": "^6.14.1",
90
90
  "marked": "^18.0.11",
91
- "oxfmt": "^0.78.0",
91
+ "oxfmt": "^0.79.0",
92
92
  "oxlint": "^1.60.0",
93
93
  "typescript": "^7.0.2",
94
94
  "vitest": "^5.0.0"
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
3
  "description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
4
- "version": "2.4.1",
4
+ "version": "2.6.0",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
7
7
  "email": "jonathanrichardong@gmail.com"
8
8
  },
9
- "homepage": "https://github.com/jonathanong/pr-shepherd",
10
- "repository": "https://github.com/jonathanong/pr-shepherd",
9
+ "homepage": "https://github.com/jongleberry/pr-shepherd",
10
+ "repository": "https://github.com/jongleberry/pr-shepherd",
11
11
  "license": "MIT",
12
12
  "keywords": ["github", "pull-request", "ci", "code-review", "automation"],
13
13
  "skills": "./skills/",
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "2.4.1",
3
+ "version": "2.6.0",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for Codex.",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
7
7
  "email": "jonathanrichardong@gmail.com",
8
8
  "url": "https://github.com/jonathanong"
9
9
  },
10
- "homepage": "https://github.com/jonathanong/pr-shepherd",
11
- "repository": "https://github.com/jonathanong/pr-shepherd",
10
+ "homepage": "https://github.com/jongleberry/pr-shepherd",
11
+ "repository": "https://github.com/jongleberry/pr-shepherd",
12
12
  "license": "MIT",
13
13
  "keywords": ["github", "pull-request", "ci", "code-review", "automation", "codex"],
14
14
  "skills": "./skills/",
@@ -19,9 +19,9 @@
19
19
  "developerName": "Jonathan Ong",
20
20
  "category": "Coding",
21
21
  "capabilities": ["Interactive", "Write"],
22
- "websiteURL": "https://github.com/jonathanong/pr-shepherd",
23
- "privacyPolicyURL": "https://github.com/jonathanong/pr-shepherd",
24
- "termsOfServiceURL": "https://github.com/jonathanong/pr-shepherd",
22
+ "websiteURL": "https://github.com/jongleberry/pr-shepherd",
23
+ "privacyPolicyURL": "https://github.com/jongleberry/pr-shepherd",
24
+ "termsOfServiceURL": "https://github.com/jongleberry/pr-shepherd",
25
25
  "defaultPrompt": [
26
26
  "Check this PR with pr-shepherd",
27
27
  "Run pr-shepherd until this PR is ready",
@@ -15,7 +15,7 @@ allowed-tools: Bash(npx pr-shepherd:*), Bash(pnpm exec pr-shepherd:*), Bash(pnpm
15
15
  - `$ARGUMENTS`: PR numbers, PR URLs, or `'owner/repo#N'` (quoted), or `stack PR...` / `stack owner/repo#N` (the number owns all layers), plus one optional merge flag: `--merge`, `--merge-ready`, `--merge-through PR`; reject anything else. Use `stack` only when asked or routed. With no PR, pass none. A qualified PR picks the GitHub target; this checkout supplies git and config.
16
16
  - Add a merge flag only when the user asks to merge, land, enqueue, or requeue. A stack or PR named with no such request ("the stack", "#N", a URL) gets no merge flag: shepherd it to ready, report, and leave the merge to them. A merge flag, or a request to merge, land, enqueue, or requeue after an ejection, allows the printed merge/enqueue/dequeue commands. Run Shepherd first: never merge, enqueue or retarget with `gh` or a GitHub MCP tool before Shepherd prints that step. Run them without asking again; escalate only when the host requires it.
17
17
  - Only when asked to merge: "merge the stack" -> `stack owner/repo#N --merge` (given only a PR, `stack PR --merge`, then on `unowned-stack-layers` run its printed stack-number command); "merge them as they're ready"/"drain" -> `--merge-ready`; "merge #N" -> one-PR `--merge`, but if they claim other layers or say "up to #N" -> `stack <claimed PRs incl. N> --merge-through N`; "ship it" -> ask.
18
- - Follow printed branch-update steps without asking: rebase or merge the base, resolve conflicts, push your own PR head with `--force-with-lease`.
18
+ - Follow printed branch-update steps without asking: update the branch the way the step names (a rebase, or a merge of the base when the repository configured `iterate.branch-update: merge`), resolve conflicts, push your own PR head (`--force-with-lease` after a rebase, a normal push after a merge). Never merge any other branch into the PR.
19
19
  - Run `pr-shepherd [PR ...]` or `pr-shepherd stack PR...`, plus any merge flag, with `--until-terminal` in the background only if its exit wakes you, else in the foreground ([Waiting](references/waiting.md)). Requeue commands print only under `--merge`. PRs with the same flags share one command; if the set changes, stop and rerun with the new list. Do not run `pr-shepherd iterate`, except once for a one-time status question.
20
20
  - Print the full result and follow every `## Instructions` step with every ID it lists. When a step says `Playbook: "<name>"`, read that playbook once.
21
21
 
@@ -2,12 +2,12 @@
2
2
 
3
3
  Apply when a step says `Playbook: "Merge queue ejection"`. The `**queue removal**` header names the queue commit. That commit combined the PR head with the base and any entries queued ahead of it, so a failure there may come from this PR, the base, another entry, or a flake. Do not requeue without triage. After triage, continue with the remaining numbered steps; iterate only at the final step.
4
4
 
5
- 1. If the step names a failed queue-commit check, inspect any `Same workflow elsewhere` runs under `## Failing checks` first; if the failure is already failing on the base branch itself, follow step 4 instead of updating the head. Otherwise, update the PR head from the latest base following the repository's branch-update convention (on a native stack, use the printed stack update route instead) and reproduce the failing step on the updated head.
5
+ 1. If the step names a failed queue-commit check, inspect any `Same workflow elsewhere` runs under `## Failing checks` first; if the failure is already failing on the base branch itself, follow step 4 instead of updating the head. Otherwise, update the PR head from the latest base the way the step names, rebase or merge (on a native stack, use the printed stack update route instead) and reproduce the failing step on the updated head.
6
6
  2. If the failure belongs to this PR, fix it. The printed push step commits and pushes the fix.
7
7
  3. If the failure does not reproduce and the update changed the head, the printed push step pushes it (`gh stack push` on a native stack). Never run a printed `requeue:` or `acknowledge queue removal:` command after a push. Shepherd prints a fresh queue command once the new head is READY.
8
8
  4. If the failure comes from the base itself, do not requeue or acknowledge it. Make no change. The unchanged failure escalates through the stall timeout.
9
9
  5. If the removal reason suggests a person dequeued the PR, skip the step 1 update unless a conflict step requires it. Fix a failure that belongs to this PR; otherwise make no change. Never enqueue.
10
- 6. If the step names a removal with no failed queue-commit check, the `**queue removal**` header carries the raw reason and actor. A conflict-style reason (`merge_conflict`, `invalid_merge_commit`, `stack_invalidated`) means update the head from the base following the same branch-update convention (printed stack route on a native stack) and push. A person's dequeue means make no change and report it. Otherwise find out why before acting. Never enqueue. If the head is unchanged on the next poll, Shepherd escalates.
10
+ 6. If the step names a removal with no failed queue-commit check, the `**queue removal**` header carries the raw reason and actor. A conflict-style reason (`merge_conflict`, `invalid_merge_commit`, `stack_invalidated`) means update the head from the base the same way (printed stack route on a native stack) and push. A person's dequeue means make no change and report it. Otherwise find out why before acting. Never enqueue. If the head is unchanged on the next poll, Shepherd escalates.
11
11
  7. If the step says no queue command was printed, never enqueue. A failure that does not reproduce follows step 4. Shepherd prints no queue command once the same head was already removed before (`removals on this head` in the header), so a flaky failure is not retried indefinitely.
12
12
  8. Otherwise, run the printed `requeue:` or `acknowledge queue removal:` command exactly as printed, and only if all of these hold:
13
13
  - the head did not change;
@@ -3,7 +3,7 @@
3
3
  Apply when a step says `Playbook: "Triage loop"`. It replaces the commit and push procedure that `--instructions=inline` prints on every `[TRIAGE]` tick. Run the numbered steps in `## Instructions` in order; this is the one that names it.
4
4
 
5
5
  - Review and fix first. Decide per item whether it needs a code change; the reply and resolve mutations are generated either way.
6
- - Commit and push. If you changed any files (code, docs, or config), commit them and push to the PR head branch. If you did not, do not commit. The repository's pre-push hooks and `AGENTS.md` own lint, typecheck, and format, and its conventions own rebase style and push flags.
6
+ - Commit and push. If you changed any files (code, docs, or config), commit them and push to the PR head branch. If you did not, do not commit. The repository's pre-push hooks and `AGENTS.md` own lint, typecheck, and format, and the printed branch-update step owns whether to rebase or merge and the push flags.
7
7
  - The `apply review` step stays inline because it needs `$CHANGE_MESSAGE` substitution. Push first: its `--require-sha HEAD` must read the pushed SHA.
8
8
  - `[TRIAGE]` is non-terminal. After the last step, iterate again immediately with the same options. Only `[ESCALATE]` hands work to a human, and `[CANCEL]` ends polling.
9
9
  - Playbooks named by other steps (`Playbook: "<name>"`) ship with the package. Without the skill, print one with `pr-shepherd playbook "<name>"`.
@@ -14,7 +14,7 @@ Work through these steps in order. Skip any the request clearly does not need. `
14
14
  2. Match first against the bundled `classify.standard` rules and the existing config. Propose a custom rule only for what they do not cover. See [bot-comment classifiers](references/classifiers.md).
15
15
  3. Ask the user, in plain words, whether to put the config and any custom rules in this repository (`.pr-shepherdrc.yml`, `.pr-shepherd/classification/`) or in their own user configuration (`~/.pr-shepherdrc.yml`). Wait for the answer before writing files. Shared policy belongs in the repository; personal preferences belong in the home file.
16
16
  4. Configure with the smallest change that fits: `classify.standard`, `checks.never-cancel` for code-review workflows, and the polling, log, and comment-visibility settings in [noise settings](references/settings.md). Validate the result: Shepherd checks config before any GitHub call and exits 78 with the offending key on an invalid file, so a run against an open PR (or `pr-shepherd iterate <PR>`) confirms the file loads.
17
- 5. If a recurring bot comment is common enough to belong in the bundled set, offer to file an issue or open a PR on jonathanong/pr-shepherd. Only proceed with the user's OK; see [upstreaming a standard rule](references/upstream-standard-rule.md).
17
+ 5. If a recurring bot comment is common enough to belong in the bundled set, offer to file an issue or open a PR on jongleberry/pr-shepherd. Only proceed with the user's OK; see [upstreaming a standard rule](references/upstream-standard-rule.md).
18
18
 
19
19
  If the user asks only how to configure something, answer without editing files.
20
20
 
@@ -2,11 +2,11 @@
2
2
 
3
3
  Use a classification rule when the unwanted item has a recognizable author and message pattern. Inspect a representative item first so the rule does not hide other feedback from the same bot. Prefer an existing settings control for polling- or output-wide behavior.
4
4
 
5
- Check the bundled rules first. Under `classify.standard` in the active config file, `all: true` enables every rule, and a named boolean such as `codecov-report: false` overrides `all`. They cover vendor bot notices on conversation comments only: `claude-notices`, `coderabbit-notices`, `codecov-report`, `codex-notices`, `dependabot-notices`, `dependency-review-no-issues`, `gemini-notices`, `kilo-no-issues`, `snyk-no-issues`, `socket-reports`, `sonarqube-gate-passed`, `sourcery-notices`, and `sourcery-review-guide`. They do not match review summaries or inline review comments. Write a custom rule only when no bundled rule fits. If a name here is rejected as unknown, this list is stale for the installed version; trust the error.
5
+ Check the bundled rules first. Under `classify.standard` in the active config file, `all: true` enables every rule, and a named boolean such as `codecov-report: false` overrides `all`. They cover vendor bot notices on conversation comments (`claude-notices`, `coderabbit-notices`, `codecov-report`, `codex-notices`, `dependabot-notices`, `dependency-review-no-issues`, `gemini-notices`, `kilo-no-issues`, `snyk-no-issues`, `socket-reports`, `sonarqube-gate-passed`, `sourcery-notices`, and `sourcery-review-guide`), and `coderabbit-notices` also suppresses CodeRabbit chat rate-limit replies on review threads (`review-thread-reply`, suppress-only). They do not match review summaries or review-thread root comments. Write a custom rule only when no bundled rule fits. If a name here is rejected as unknown, this list is stale for the installed version; trust the error.
6
6
 
7
7
  Place an `.mjs` file in `.pr-shepherd/classification/` in the project. Shepherd uses the first classification directory on the working directory's ancestor chain; it stops at the home directory if reached, otherwise at the filesystem root. A home-level rule directory is not discovered when the project is outside the home tree. Rule directories do not merge. Files ending in `.ts`, `.mts`, `.mjs`, or `.js` load, except names beginning with `_` or `.`. Prefer `.mjs`; an `.mts` rule also works if it uses only erasable TypeScript syntax.
8
8
 
9
- Each file default-exports a `ClassifyRule` from `pr-shepherd/classify`. A rule receives one of `review-thread`, `pr-comment`, `review-summary`, or `changes-requested`, with `author`, `authorType`, `body`, `id`, and optional `url` or thread `path`. Match the observed `kind`, login, and distinctive body text. For example:
9
+ Each file default-exports a `ClassifyRule` from `pr-shepherd/classify`. A rule receives one of `review-thread`, `review-thread-reply`, `pr-comment`, `review-summary`, or `changes-requested`, with `author`, `authorType`, `body`, `id`, optional `url` or thread `path`, and `threadId` on `review-thread-reply`. Match the observed `kind`, login, and distinctive body text. For example:
10
10
 
11
11
  ```js
12
12
  /** @type {import("pr-shepherd/classify").ClassifyRule} */
@@ -20,6 +20,6 @@ const rule = (item) => {
20
20
  export default rule;
21
21
  ```
22
22
 
23
- `suppress: true` removes a matched item from agent output. Add `autoResolve: true` only when the requested policy also calls for resolving its thread or minimizing its comment or review summary. It is unsupported for `changes-requested` reviews, whose dismissal needs a message. Optional `reason` is printed and reported when the rule fires. With both flags, `actions.auto-minimize-suppressed: true` (the default) lets Shepherd perform the authorized mutation, then print a `## Classification auto-resolve` line and record `threads.autoResolved` / `comments.autoMinimized`. It does not append to the Shepherd Journal. Journal notes are optional agent-authored updates made only through an explicit `apply journal` call. Failed IDs stay on the generated `apply review` command and the failure is listed under that line. Set `actions.auto-minimize-suppressed: false` to keep the handoff without mutating or printing the line. When GitHub does not confirm capability, the item returns to normal first-look visibility. Matching rules combine their flags and keep every non-empty reason, so inspect existing rules before adding one.
23
+ `suppress: true` removes a matched item from agent output (on `review-thread-reply`, only that reply is removed from the thread). Add `autoResolve: true` only when the requested policy also calls for resolving its thread or minimizing its comment or review summary. It is unsupported for `changes-requested` reviews (whose dismissal needs a message) and `review-thread-reply` items. Optional `reason` is printed and reported when the rule fires. With both flags, `actions.auto-minimize-suppressed: true` (the default) lets Shepherd perform the authorized mutation, then print a `## Classification auto-resolve` line and record `threads.autoResolved` / `comments.autoMinimized`. It does not append to the Shepherd Journal. Journal notes are optional agent-authored updates made only through an explicit `apply journal` call. Failed IDs stay on the generated `apply review` command and the failure is listed under that line. Set `actions.auto-minimize-suppressed: false` to keep the handoff without mutating or printing the line. When GitHub does not confirm capability, the item returns to normal first-look visibility. Matching rules combine their flags and keep every non-empty reason, so inspect existing rules before adding one.
24
24
 
25
25
  Exercise the exported rule against the observed item and negative examples: a different author, kind, and substantive message from the same bot. Confirm only the intended item matches before enabling automatic resolution. After editing a rule, restart any long-running poll process; it caches loaded rule modules. A new CLI process loads the change. A classifier does not retroactively remove already displayed output.
@@ -2,12 +2,12 @@
2
2
 
3
3
  Use this when a recurring bot comment is common enough that most repositories would want it hidden, and no bundled `classify.standard` rule covers it. Do nothing here without the user's explicit OK, and let them review the text before it is sent.
4
4
 
5
- 1. Check for an existing proposal: `gh issue list --repo jonathanong/pr-shepherd --search "<bot login> in:title,body" --state all`. If one exists, tell the user instead of filing a duplicate.
5
+ 1. Check for an existing proposal: `gh issue list --repo jongleberry/pr-shepherd --search "<bot login> in:title,body" --state all`. If one exists, tell the user instead of filing a duplicate.
6
6
  2. Draft the proposal with:
7
7
  - the bot's author login and `authorType`;
8
8
  - the item `kind` (`pr-comment`, `review-summary`, `review-thread`);
9
9
  - a sanitized example body: remove secrets, private repository names, user names, internal URLs, and anything unrelated to the bot's boilerplate;
10
10
  - the match pattern you tested (the working custom rule from [bot-comment classifiers](classifiers.md) if one exists), plus a negative example that must stay visible;
11
11
  - how often it recurred and why it carries no actionable feedback.
12
- 3. Show the draft and ask the user whether to file an issue or open a PR. For an issue, run `gh issue create --repo jonathanong/pr-shepherd --title "<title>" --body-file <file>`. A PR needs a fork and a checkout of that repository, which this skill does not set up; offer the issue unless the user already has a checkout.
12
+ 3. Show the draft and ask the user whether to file an issue or open a PR. For an issue, run `gh issue create --repo jongleberry/pr-shepherd --title "<title>" --body-file <file>`. A PR needs a fork and a checkout of that repository, which this skill does not set up; offer the issue unless the user already has a checkout.
13
13
  4. Report the resulting URL. Keep using the local custom rule meanwhile.
@@ -123,6 +123,10 @@
123
123
  "default": false,
124
124
  "type": "boolean"
125
125
  },
126
+ "minimize-superseded-approvals": {
127
+ "default": true,
128
+ "type": "boolean"
129
+ },
126
130
  "minimize-comments": {
127
131
  "default": "bots",
128
132
  "type": "string",
@@ -136,6 +140,14 @@
136
140
  "default": "",
137
141
  "type": "string"
138
142
  },
143
+ "branch-update": {
144
+ "default": "rebase",
145
+ "type": "string",
146
+ "enum": [
147
+ "rebase",
148
+ "merge"
149
+ ]
150
+ },
139
151
  "review-output-max-chars": {
140
152
  "default": 50000,
141
153
  "type": "integer",
@@ -11,6 +11,7 @@ export type CommentAuthorAssociation =
11
11
 
12
12
  export type ClassifyItemKind =
13
13
  | "review-thread"
14
+ | "review-thread-reply"
14
15
  | "pr-comment"
15
16
  | "review-summary"
16
17
  | "changes-requested";
@@ -30,6 +31,12 @@ export interface ClassifyReviewThread extends ClassifyItemBase {
30
31
  readonly path?: string | null;
31
32
  }
32
33
 
34
+ export interface ClassifyReviewThreadReply extends ClassifyItemBase {
35
+ readonly kind: "review-thread-reply";
36
+ readonly threadId: string;
37
+ readonly path?: string | null;
38
+ }
39
+
33
40
  export interface ClassifyPrComment extends ClassifyItemBase {
34
41
  readonly kind: "pr-comment";
35
42
  }
@@ -44,12 +51,13 @@ export interface ClassifyChangesRequested extends ClassifyItemBase {
44
51
 
45
52
  export type ClassifyItem =
46
53
  | ClassifyReviewThread
54
+ | ClassifyReviewThreadReply
47
55
  | ClassifyPrComment
48
56
  | ClassifyReviewSummary
49
57
  | ClassifyChangesRequested;
50
58
 
51
59
  export interface ClassifyAction {
52
- /** When true, routes the item's ID to the appropriate resolve/minimize GitHub mutation. Not supported for changes-requested reviews. */
60
+ /** When true, routes the item's ID to the appropriate resolve/minimize GitHub mutation. Not supported for changes-requested reviews or review-thread replies. */
53
61
  readonly autoResolve?: boolean;
54
62
  /** When true, hides the item from agent output (seen marker is still written). */
55
63
  readonly suppress?: boolean;