pr-shepherd 0.15.1 → 0.15.2

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.15.1",
4
+ "version": "0.15.2",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
7
7
  "email": "jonathanrichardong@gmail.com"
package/README.md CHANGED
@@ -89,7 +89,7 @@ _(schematic — actual steps depend on PR state)_
89
89
  3. Commit changed files.
90
90
  4. Rebase and push: `git fetch origin && git rebase origin/main && git push --force-with-lease` — capture `HEAD_SHA=$(git rev-parse HEAD)`.
91
91
  5. Run the `resolve:` command above, substituting `"$HEAD_SHA"`.
92
- 6. Add a `## Shepherd Journal` entry to the PR description for any large decisions made.
92
+ 6. Add or update a `## Shepherd Journal` section in the PR description for any large decisions made, appending under the existing heading if it already exists.
93
93
  7. Stop this iteration.
94
94
  ```
95
95
 
@@ -1,5 +1,6 @@
1
1
  import { buildPrShepherdCommand, renderShellCommand } from "../../cli/runner.mjs";
2
2
  import { buildFailingCheckInstructions } from "./check-instructions.mjs";
3
+ import { SHEPHERD_JOURNAL_FIRST_LOOK_GUIDANCE, SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS, buildShepherdJournalInstruction, } from "../shepherd-journal.mjs";
3
4
  export const FIX_INSTRUCTION_STOP_AFTER_PUSH = "Stop this iteration — CI needs time to run on the new push before the next tick.";
4
5
  export const FIX_INSTRUCTION_STOP_BEFORE_NEXT_TICK = "Stop this iteration before the next tick.";
5
6
  export const FIX_INSTRUCTION_END_ITERATION = "End this iteration.";
@@ -68,7 +69,7 @@ export function buildFixInstructions(threads, actionableComments, checks, review
68
69
  instructions.push(`Items in \`## First-look items\` are shown so you can acknowledge their current status before acting. If a first-look thread also appears under \`## Review threads to resolve\`, its ID is already included in the \`resolve:\` command; otherwise do not pass first-look-only IDs to mutation flags.`);
69
70
  }
70
71
  if (firstLookSummaries.length > 0) {
71
- instructions.push(`Review the bodies shown under \`## Review summaries (first look — to be minimized)\` — you are seeing these for the first time. Their IDs are already included in the \`resolve:\` command's \`--minimize-comment-ids\`; if any warrants a \`## Shepherd Journal\` entry, record it before running resolve.`);
72
+ instructions.push(SHEPHERD_JOURNAL_FIRST_LOOK_GUIDANCE);
72
73
  }
73
74
  const editedTotal = editedSummaries.length +
74
75
  firstLookThreads.filter((t) => t.edited).length +
@@ -91,7 +92,7 @@ export function buildFixInstructions(threads, actionableComments, checks, review
91
92
  instructions.push(`Do not re-run \`gh run cancel\` on the IDs listed under \`## Cancelled runs\` — the CLI cancelled those runs before your push, and your push has already triggered new runs with different IDs.`);
92
93
  }
93
94
  if (resolveCommand.hasMutations) {
94
- instructions.push(`For any large decisions or rejections you made this iteration, add or update a \`## Shepherd Journal\` section in the PR description (\`gh pr edit ${prNumber} --body …\`) summarizing each decision. For threads and comments, use the markdown link shown in its heading above; for reviews, reference the review ID.`);
95
+ instructions.push(buildShepherdJournalInstruction(prNumber, SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS));
95
96
  }
96
97
  if (needsPush) {
97
98
  instructions.push(FIX_INSTRUCTION_STOP_AFTER_PUSH);
@@ -1,4 +1,5 @@
1
1
  import { buildPrShepherdCommand } from "../cli/runner.mjs";
2
+ import { SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEMS, buildShepherdJournalInstruction, } from "./shepherd-journal.mjs";
2
3
  /**
3
4
  * Build the numbered triage/fix/resolve instruction steps for the agent to follow.
4
5
  * Steps are conditionally emitted based on what the fetch returned (mirrors
@@ -64,7 +65,7 @@ export function buildFetchInstructions(prNumber, result, runner) {
64
65
  runner,
65
66
  }).text} [--resolve-thread-ids <ids>] [--minimize-comment-ids <ids>] [--dismiss-review-ids <ids> --message "<reason>"]`;
66
67
  instructions.push(`Run \`${resolveCommand}\` with only the non-empty flag subsets. Skip the command entirely if all three ID lists are empty.${requireShaHint}${dismissNote}`);
67
- instructions.push(`For any large decisions or rejections you made this iteration, add or update a \`## Shepherd Journal\` section in the PR description (\`gh pr edit ${prNumber} --body …\`) summarizing each decision. For threads and comments, use the markdown link shown in each item's bullet above; for reviews, reference the review ID.`);
68
+ instructions.push(buildShepherdJournalInstruction(prNumber, SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEMS));
68
69
  instructions.push(`Report: echo the CLI's mutation output, then one line per Acknowledged item: \`Acknowledged <id> (@<author>): <reason>\`. If any fetched item was neither resolved nor acknowledged, stop and escalate: "<N> item(s) fetched but not acted on or acknowledged — need human direction before closing".`);
69
70
  return instructions;
70
71
  }
@@ -0,0 +1,13 @@
1
+ export const SHEPHERD_JOURNAL_SECTION = "## Shepherd Journal";
2
+ export const SHEPHERD_JOURNAL_SECTION_PATTERN = /^##\s+Shepherd\s+Journal$/;
3
+ export const SHEPHERD_JOURNAL_APPEND_HINT = "If this section already exists, append your entries under it instead of creating a duplicate heading.";
4
+ export const SHEPHERD_JOURNAL_FIRST_LOOK_GUIDANCE = "Review the bodies shown under `## Review summaries (first look — to be minimized)` — you are seeing these for the first time. Their IDs are already included in the resolve command's `--minimize-comment-ids`; if any warrants a Shepherd Journal note, append it before running resolve.";
5
+ export function buildShepherdJournalInstruction(prNumber, itemReferenceGuidance) {
6
+ return [
7
+ `For any large decisions or rejections you made this iteration, add or update a \`${SHEPHERD_JOURNAL_SECTION}\` section in the PR description (\`gh pr edit ${prNumber} --body …\`) summarizing each decision.`,
8
+ itemReferenceGuidance,
9
+ SHEPHERD_JOURNAL_APPEND_HINT,
10
+ ].join(" ");
11
+ }
12
+ export const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEM_HEADINGS = "For threads and comments, use the markdown link shown in its heading above; for reviews, reference the review ID.";
13
+ export const SHEPHERD_JOURNAL_REFERENCE_GUIDANCE_THREADS_AND_COMMENTS_IN_ITEMS = "For threads and comments, use the markdown link shown in each item's bullet above; for reviews, reference the review ID.";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Ong",
@@ -29,7 +29,7 @@
29
29
  "@types/node": "^25.6.0",
30
30
  "@vitest/coverage-v8": "^4.1.4",
31
31
  "husky": "^9.1.7",
32
- "oxfmt": "^0.47.0",
32
+ "oxfmt": "^0.48.0",
33
33
  "oxlint": "^1.60.0",
34
34
  "typescript": "^6.0.3",
35
35
  "vitest": "^4.1.4"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for Codex.",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pr-shepherd
3
- description: 'Codex-only skill for checking, updating, monitoring, or resolving a GitHub pull request with pr-shepherd. Use for requests like "check this PR", "use pr-shepherd", "iterate PR #123", "resolve this PR''s comments", or "run pr-shepherd until this PR is ready". For open-ended requests, create a Codex goal and run explicit pr-shepherd cycles through the target repo package runner, picking a fresh sleep/timeout between 1 and 4 minutes before each rerun until Shepherd emits `[CANCEL]` for ready-delay completion or merged/closed, or `[ESCALATE]` including repeated unchanged CI failures.'
3
+ description: 'Codex-only skill for iterating a GitHub pull request to completion with pr-shepherd. Use for requests like "use pr-shepherd", "iterate PR #123", or "run pr-shepherd until this PR is ready".'
4
4
  ---
5
5
 
6
6
  # pr-shepherd
@@ -16,10 +16,8 @@ Codex-only workflow for getting actionable PR updates from `pr-shepherd`.
16
16
  `gh pr view --json number --jq .number`
17
17
  - If no PR is found, report that and stop.
18
18
 
19
- 2. Decide whether this is one cycle or an open-ended goal.
20
- - For one-off requests such as "check this PR", "run pr-shepherd once", or "resolve this PR's comments", run one explicit CLI command.
21
- - For requests such as "continue", "until ready", "until this PR is ready", or "keep iterating", create a Codex goal before the first recurring cycle with this objective:
22
- `Run pr-shepherd PR_NUMBER cycles through the target repo package runner, picking a fresh sleep/timeout between 1 and 4 minutes before each rerun, until Shepherd emits [CANCEL] for ready-delay completion or PR #PR_NUMBER is merged/closed, or pr-shepherd escalates, including repeated unchanged CI failures.`
19
+ 2. Use this objective for the whole goal:
20
+ - `Run pr-shepherd PR_NUMBER cycles through the target repo package runner, picking a fresh sleep/timeout between 1 and 4 minutes before each rerun, until Shepherd emits [CANCEL] for ready-delay completion or PR #PR_NUMBER is merged/closed, or pr-shepherd escalates, including repeated unchanged CI failures.`
23
21
 
24
22
  3. Select the package runner from the target repository root.
25
23
  - Prefer `package.json` `packageManager`: `pnpm@...` -> `pnpm exec`, `yarn@...` -> `yarn run`, `npm@...` -> `npx --no-install`.
@@ -32,24 +30,14 @@ Codex-only workflow for getting actionable PR updates from `pr-shepherd`.
32
30
  - In other repositories, run through the selected package runner so Codex does not install packages implicitly. If the package is missing, tell the user to install `pr-shepherd` with the matching dev-dependency command: `pnpm add -D pr-shepherd`, `yarn add -D pr-shepherd`, or `npm install --save-dev pr-shepherd`.
33
31
 
34
32
  5. Run the appropriate command from the repository root.
35
- - For a status check:
36
- `<runner> pr-shepherd check PR_NUMBER`
37
- - For review comment resolution:
38
- `<runner> pr-shepherd resolve PR_NUMBER --fetch`
39
- - For a monitor bootstrap:
40
- `<runner> pr-shepherd monitor PR_NUMBER`
41
- - For the recurring explicit monitor tick:
42
- `<runner> pr-shepherd PR_NUMBER`
43
- - `pr-shepherd iterate PR_NUMBER` remains supported as a legacy alias, but use the default `pr-shepherd PR_NUMBER` form for recurring Codex cycles.
33
+ - `<runner> pr-shepherd PR_NUMBER`
44
34
 
45
35
  6. Print or summarize the important status, then follow the output's `## Instructions` exactly.
46
36
 
47
- 7. Do not call `/loop`, `ScheduleWakeup`, `CronCreate`, or `pr-shepherd monitor` for recurrence. Codex does explicit `pr-shepherd PR_NUMBER` cycles.
37
+ 7. If the output indicates continuation, pick a fresh sleep/timeout between 1 and 4 minutes, wait that long, and run another explicit `<runner> pr-shepherd PR_NUMBER` cycle through the same runner.
48
38
 
49
- 8. For open-ended goal requests, complete the CLI-provided instructions for the current cycle. If the output says to continue the active Codex goal, pick a fresh sleep/timeout between 1 and 4 minutes, wait that long, and run another explicit `pr-shepherd PR_NUMBER` cycle through the same runner.
39
+ 8. Do not stop on `[WAIT]`, `[COOLDOWN]`, `[MARK_READY]`, or post-fix CI wait states. These are nonterminal Codex recurrence states.
50
40
 
51
- 9. Do not stop an open-ended goal only because the output is `[WAIT]`, `[COOLDOWN]`, `[MARK_READY]`, or a post-fix CI wait. These are nonterminal Codex recurrence states.
41
+ 9. Stop only when Shepherd emits `[CANCEL]` for ready-delay completion or PR #PR_NUMBER is merged/closed, or when it emits `[ESCALATE]`, including `stall-timeout` for repeated unchanged CI failures.
52
42
 
53
- 10. Stop only when Shepherd emits `[CANCEL]` for ready-delay completion or merged/closed, or when it emits `[ESCALATE]`, including `stall-timeout` for repeated unchanged CI failures. If a Codex goal is active, mark it complete only when one of those terminal conditions is actually satisfied.
54
-
55
- 11. If the output includes fixes, pushes, rebases, or resolve commands, perform only the instructed scoped actions. Do not resolve, minimize, or dismiss comments until the CLI-provided post-push and `--require-sha` instructions are satisfied.
43
+ 10. If the output includes fixes, pushes, rebases, or resolve commands, perform only the instructed scoped actions. Do not resolve, minimize, or dismiss comments until the CLI-provided post-push and `--require-sha` instructions are satisfied.