pr-shepherd 0.25.0 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
3
  "description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
4
- "version": "0.25.0",
4
+ "version": "0.25.1",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
7
7
  "email": "jonathanrichardong@gmail.com"
@@ -5,6 +5,7 @@ import { loadConfig } from "../config/load.mjs";
5
5
  import { isConfiguredBotAuthor, isHumanAuthor, normalizeBotUsernames, } from "../comments/authors.mjs";
6
6
  import { markReplySeen } from "../state/seen-comments.mjs";
7
7
  import { threadTranscriptBody } from "../threads/transcript.mjs";
8
+ import { addPrShepherdMarker } from "../comments/marker.mjs";
8
9
  export async function runResolveMutate(opts) {
9
10
  const repo = await getRepoInfo();
10
11
  const prNumber = opts.prNumber ?? (await getCurrentPrNumber());
@@ -49,12 +50,13 @@ export async function runResolveMutate(opts) {
49
50
  if (skippedNonHumanReplies.length > 0)
50
51
  result.skippedNonHumanReplies = skippedNonHumanReplies;
51
52
  if (opts.dismissMessage) {
53
+ const markedMessage = addPrShepherdMarker(opts.dismissMessage);
52
54
  await Promise.all(result.repliedThreads.map((id) => {
53
55
  const thread = threadById.get(id);
54
56
  if (!thread)
55
57
  return Promise.resolve();
56
58
  const previousBody = threadTranscriptBody(thread);
57
- return markReplySeen({ owner: repo.owner, repo: repo.name, pr: prNumber }, id, previousBody, threadTranscriptBody(thread, [opts.dismissMessage]), opts.dismissMessage);
59
+ return markReplySeen({ owner: repo.owner, repo: repo.name, pr: prNumber }, id, previousBody, threadTranscriptBody(thread, [markedMessage]), markedMessage);
58
60
  }));
59
61
  }
60
62
  return result;
@@ -0,0 +1,7 @@
1
+ const PR_SHEPHERD_MARKER = "<!-- pr-shepherd -->";
2
+ export function hasPrShepherdMarker(body) {
3
+ return body.startsWith(PR_SHEPHERD_MARKER);
4
+ }
5
+ export function addPrShepherdMarker(body) {
6
+ return `${PR_SHEPHERD_MARKER}\n${body}`;
7
+ }
@@ -1,5 +1,6 @@
1
1
  /* eslint-disable max-lines */
2
2
  import { graphqlWithRateLimit } from "../github/client.mjs";
3
+ import { addPrShepherdMarker } from "./marker.mjs";
3
4
  import { isRateLimitMessage, rateLimitFromError, rateLimitFromGraphQlResult, } from "./rate-limit.mjs";
4
5
  import { setPendingOps } from "./pending-ops.mjs";
5
6
  import { waitForSha } from "./sha-poll.mjs";
@@ -70,8 +71,9 @@ export async function autoResolveOutdated(threadIds) {
70
71
  const BULK_CHUNK_SIZE = 10;
71
72
  function buildBulkMutation(replyIds, resolveIds, minimizeIds, dismissIds, dismissMessage) {
72
73
  const ops = [];
74
+ const replyBody = addPrShepherdMarker(dismissMessage);
73
75
  for (let i = 0; i < replyIds.length; i++) {
74
- ops.push(` p${i}: addPullRequestReviewThreadReply(input: { pullRequestReviewThreadId: ${JSON.stringify(replyIds[i])}, body: ${JSON.stringify(dismissMessage)} }) { comment { id } }`);
76
+ ops.push(` p${i}: addPullRequestReviewThreadReply(input: { pullRequestReviewThreadId: ${JSON.stringify(replyIds[i])}, body: ${JSON.stringify(replyBody)} }) { comment { id } }`);
75
77
  }
76
78
  for (let i = 0; i < resolveIds.length; i++) {
77
79
  ops.push(` r${i}: resolveReviewThread(input: { threadId: ${JSON.stringify(resolveIds[i])} }) { thread { isResolved } }`);
@@ -1,6 +1,14 @@
1
1
  import { classifyItem } from "../state/seen-comments.mjs";
2
2
  import { threadTranscriptBody } from "../threads/transcript.mjs";
3
3
  import { isConfiguredBotAuthor } from "./authors.mjs";
4
+ import { hasPrShepherdMarker } from "./marker.mjs";
5
+ function threadEndedByShepherd(thread) {
6
+ const comments = thread.comments;
7
+ if (comments && comments.length > 0) {
8
+ return hasPrShepherdMarker(comments[comments.length - 1].body);
9
+ }
10
+ return hasPrShepherdMarker(thread.body);
11
+ }
4
12
  function withEdited(thread, edited) {
5
13
  return edited ? { ...thread, edited: true } : thread;
6
14
  }
@@ -11,6 +19,8 @@ function classifyVisibleThread(thread, seenMap) {
11
19
  return withEdited(thread, cls === "edited");
12
20
  }
13
21
  function classifyFirstLookThread(thread, seenMap, firstLookStatus) {
22
+ if (threadEndedByShepherd(thread))
23
+ return null;
14
24
  const visible = classifyVisibleThread(thread, seenMap);
15
25
  if (visible === null)
16
26
  return null;
@@ -21,6 +31,8 @@ export function classifyThreadVisibility(threads, seenMap, botUsernames = new Se
21
31
  const activeThreads = unresolvedThreads
22
32
  .filter((t) => !t.isOutdated && !t.isMinimized)
23
33
  .flatMap((t) => {
34
+ if (threadEndedByShepherd(t))
35
+ return [];
24
36
  if (isConfiguredBotAuthor(t, botUsernames))
25
37
  return [t];
26
38
  const visible = classifyVisibleThread(t, seenMap);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Ong",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.25.0",
3
+ "version": "0.25.1",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for Codex.",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",