pr-shepherd 0.12.0 → 0.13.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.
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "jonathanong",
3
+ "interface": {
4
+ "displayName": "Jonathan Ong"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "pr-shepherd",
9
+ "source": {
10
+ "source": "local",
11
+ "path": "./plugins/pr-shepherd"
12
+ },
13
+ "policy": {
14
+ "installation": "AVAILABLE",
15
+ "authentication": "ON_INSTALL"
16
+ },
17
+ "category": "Coding"
18
+ }
19
+ ]
20
+ }
@@ -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.12.0",
4
+ "version": "0.13.0",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
7
7
  "email": "jonathanrichardong@gmail.com"
package/README.md CHANGED
@@ -205,7 +205,18 @@ On each tick (4-minute default, tunable via `watch.interval`): fetch PR state in
205
205
  >
206
206
  > A plain `npm install pr-shepherd` adds it to regular dependencies instead; use that only if you specifically want it under `dependencies`. Or install globally: `npm install -g pr-shepherd`.
207
207
 
208
- ### As individual skills via `npx skills`
208
+ ### Claude Code
209
+
210
+ Install as a Claude Code plugin:
211
+
212
+ ```bash
213
+ claude /plugin marketplace add jonathanong/pr-shepherd
214
+ claude /plugin install pr-shepherd
215
+ ```
216
+
217
+ This repo ships two `marketplace.json` files that serve different Claude install flows: the root `marketplace.json` resolves the plugin from the npm registry (used by the `claude /plugin marketplace add` command above); `.claude-plugin/marketplace.json` is the owner-level registry manifest that resolves the plugin from the local plugin directory (used when Claude Code installs from a local or git-based source). Both files are needed to support these two install paths.
218
+
219
+ Alternatively, install the Claude skills individually via `npx skills`:
209
220
 
210
221
  ```bash
211
222
  npx skills add jonathanong/pr-shepherd
@@ -213,23 +224,39 @@ npx skills add jonathanong/pr-shepherd
213
224
 
214
225
  Installs the three skills (`check`, `monitor`, `resolve`) into your agent's skill directory (`.claude/skills/` for project scope, `~/.claude/skills/` with `-g` for global scope). Powered by [skills.sh](https://skills.sh).
215
226
 
216
- ### As a Claude Code plugin (recommended)
227
+ ### Codex
228
+
229
+ Codex uses the repo-shipped Codex plugin rather than the Claude plugin or `/pr-shepherd:*` slash commands. The plugin provides one umbrella `pr-shepherd` skill for check, resolve, monitor, and iterate workflows.
230
+
231
+ Install the Codex plugin marketplace from GitHub:
217
232
 
218
233
  ```bash
219
- claude /plugin marketplace add jonathanong/pr-shepherd
220
- claude /plugin install pr-shepherd
234
+ codex plugin marketplace add jonathanong/pr-shepherd
235
+ ```
236
+
237
+ Or pin a branch/tag/ref:
238
+
239
+ ```bash
240
+ codex plugin marketplace add jonathanong/pr-shepherd --ref main
221
241
  ```
222
242
 
223
- This repo ships two `marketplace.json` files that serve different install flows: the root `marketplace.json` resolves the plugin from the npm registry (used by the `claude /plugin marketplace add` command above); `.claude-plugin/marketplace.json` is the owner-level registry manifest that resolves the plugin from the local plugin directory (used when Claude Code installs from a local or git-based source). Both files are needed to support these two install paths.
243
+ For local development, point Codex at a checkout:
224
244
 
225
- ### For Codex
245
+ ```bash
246
+ git clone https://github.com/jonathanong/pr-shepherd ~/.codex/plugin-sources/pr-shepherd
247
+ codex plugin marketplace add ~/.codex/plugin-sources/pr-shepherd
248
+ ```
226
249
 
227
- Codex does not use the Claude plugin or `/pr-shepherd:*` slash commands. Install the CLI where Codex will run it, then call `npx pr-shepherd` directly:
250
+ After adding the marketplace, open the Codex plugin directory, choose the `jonathanong` marketplace, and install/enable `pr-shepherd`. The marketplace root must contain `.agents/plugins/marketplace.json` and `plugins/pr-shepherd/`.
251
+
252
+ Install the CLI where Codex will run it:
228
253
 
229
254
  ```bash
230
255
  npm install --save-dev pr-shepherd
231
256
  ```
232
257
 
258
+ The plugin only installs the skill; it does not install the CLI into target repositories. To install the CLI globally instead, use `npm install -g pr-shepherd`.
259
+
233
260
  If your Codex environment does not already set `CODEX_CI=1`, set `AGENT=codex` so `pr-shepherd` emits Codex-compatible instructions instead of Claude `/loop` instructions:
234
261
 
235
262
  ```bash
@@ -242,7 +269,7 @@ Then start a PR monitor from Codex:
242
269
  npx pr-shepherd monitor 42
243
270
  ```
244
271
 
245
- Follow the output's `## Instructions`. The monitor bootstrap runs one tick and prints the reusable follow-up command, usually:
272
+ Or ask Codex to use the `pr-shepherd` skill, for example: `run pr-shepherd until this PR is ready`. Follow the output's `## Instructions`. The monitor bootstrap runs one tick and prints the reusable follow-up command, usually:
246
273
 
247
274
  ```bash
248
275
  npx pr-shepherd 42
@@ -276,14 +303,14 @@ actions:
276
303
  autoMarkReady: false # disable to stay draft until you manually promote
277
304
  ```
278
305
 
279
- Environment variables: `GH_TOKEN` / `GITHUB_TOKEN` (auth; falls back to `gh auth token`), `PR_SHEPHERD_STATE_DIR` (override loop-state and log base dir), `PR_SHEPHERD_LOG_DISABLED=1` (disable the per-worktree debug log), `AGENT=codex` or `CODEX_CI=1` (emit Codex-compatible monitor instructions).
306
+ Environment variables: `GH_TOKEN` / `GITHUB_TOKEN` (auth; falls back to `gh auth token`, then `GITHUB_PERSONAL_ACCESS_TOKEN`), `PR_SHEPHERD_STATE_DIR` (override loop-state and log base dir), `PR_SHEPHERD_LOG_DISABLED=1` (disable the per-worktree debug log), `AGENT=codex` or `CODEX_CI=1` (emit Codex-compatible monitor instructions).
280
307
 
281
308
  See [docs/configuration.md](docs/configuration.md) for full semantics and deprecated-key migration.
282
309
 
283
310
  ## Requirements
284
311
 
285
312
  - Node.js ≥ 22.0.0
286
- - A GitHub token: set `GH_TOKEN` or `GITHUB_TOKEN`, **or** install and authenticate the `gh` CLI (`gh auth login`) — pr-shepherd uses `gh auth token` as a fallback. The `repo` scope is required for private repositories.
313
+ - A GitHub token: set `GH_TOKEN` or `GITHUB_TOKEN`, **or** install and authenticate the `gh` CLI (`gh auth login`) — pr-shepherd uses `gh auth token` as a fallback before trying `GITHUB_PERSONAL_ACCESS_TOKEN`. The `repo` scope is required for private repositories.
287
314
  - `git`
288
315
 
289
316
  ## Docs
@@ -52,12 +52,10 @@ export async function handleFixCode(ctx) {
52
52
  const checks = toAgentChecks(failingChecks);
53
53
  const { changesRequestedReviews } = report;
54
54
  const hasConflicts = report.mergeStatus.status === "CONFLICTS";
55
- const needsPush = threads.length > 0 ||
56
- actionableComments.length > 0 ||
57
- checks.length > 0 ||
58
- changesRequestedReviews.length > 0 ||
59
- hasConflicts;
60
- const inProgressRunIds = needsPush ? buildInProgressRunIds(report, cancelledSet) : [];
55
+ const hasGuaranteedSupersedingPush = threads.length > 0 || checks.length > 0 || changesRequestedReviews.length > 0 || hasConflicts;
56
+ const inProgressRunIds = hasGuaranteedSupersedingPush
57
+ ? buildInProgressRunIds(report, cancelledSet)
58
+ : [];
61
59
  const allCommentIds = [...actionableComments.map((c) => c.id), ...reviewSummaryIds];
62
60
  const resolveCommand = buildResolveCommand(threads, resolutionOnlyThreads, allCommentIds, changesRequestedReviews, checks, prNumber);
63
61
  if (baseLookup.isFallback && (resolveCommand.requiresHeadSha || hasConflicts)) {
@@ -60,7 +60,7 @@ export function buildFixInstructions(threads, actionableComments, checks, review
60
60
  if (reviews.length > 0) {
61
61
  instructions.push(`For each bullet under \`## Changes-requested reviews\` above: read the review body and apply the requested changes.`);
62
62
  }
63
- const hasCodeChanges = threads.length > 0 || actionableComments.length > 0 || checks.length > 0 || reviews.length > 0;
63
+ const hasCodeChanges = threads.length > 0 || checks.length > 0 || reviews.length > 0;
64
64
  const needsPush = hasCodeChanges || hasConflicts;
65
65
  if (hasCodeChanges) {
66
66
  instructions.push(`Commit changed files: \`git add <files> && git commit -m "<descriptive message>"\``);
@@ -30,7 +30,12 @@ async function resolveToken() {
30
30
  catch {
31
31
  // fall through to error
32
32
  }
33
- throw new Error("No GitHub token found. Set GH_TOKEN or GITHUB_TOKEN, or run `gh auth login`.");
33
+ const codexToken = process.env["GITHUB_PERSONAL_ACCESS_TOKEN"];
34
+ if (codexToken) {
35
+ _token = codexToken;
36
+ return _token;
37
+ }
38
+ throw new Error("No GitHub token found. Set GH_TOKEN, GITHUB_TOKEN, or GITHUB_PERSONAL_ACCESS_TOKEN, or run `gh auth login`.");
34
39
  }
35
40
  async function makeHeaders() {
36
41
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for agentic coding tools",
5
5
  "license": "MIT",
6
6
  "author": "Jonathan Ong",
@@ -11,7 +11,10 @@
11
11
  "files": [
12
12
  "bin/**",
13
13
  "plugin/**",
14
+ "plugins/**",
15
+ "plugins/**/.codex-plugin/**",
14
16
  ".claude-plugin/**",
17
+ ".agents/plugins/marketplace.json",
15
18
  "marketplace.json",
16
19
  "README.md",
17
20
  "LICENSE"
@@ -36,9 +39,9 @@
36
39
  "prepare": "node scripts/install-husky.mjs && node scripts/install-plugin-symlink.mjs && npm run build",
37
40
  "prepublishOnly": "npm run typecheck && npm test && npm run build",
38
41
  "typecheck": "tsc --noEmit",
39
- "lint": "oxlint src/ plugin/skills/",
40
- "format": "oxfmt src/ plugin/skills/ docs/ README.md",
41
- "format:check": "oxfmt --check src/ plugin/skills/ docs/ README.md",
42
+ "lint": "oxlint src/ plugin/skills/ plugins/ .agents/plugins/",
43
+ "format": "oxfmt src/ plugin/skills/ plugins/ .agents/plugins/ docs/ README.md",
44
+ "format:check": "oxfmt --check src/ plugin/skills/ plugins/ .agents/plugins/ docs/ README.md",
42
45
  "test": "vitest run",
43
46
  "test:coverage": "vitest run --coverage",
44
47
  "test:watch": "vitest"
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "pr-shepherd",
3
+ "version": "0.13.0",
4
+ "description": "Autonomous PR CI monitor and review-comment resolver for Codex.",
5
+ "author": {
6
+ "name": "Jonathan Ong",
7
+ "email": "jonathanrichardong@gmail.com",
8
+ "url": "https://github.com/jonathanong"
9
+ },
10
+ "homepage": "https://github.com/jonathanong/pr-shepherd",
11
+ "repository": "https://github.com/jonathanong/pr-shepherd",
12
+ "license": "MIT",
13
+ "keywords": [
14
+ "github",
15
+ "pull-request",
16
+ "ci",
17
+ "code-review",
18
+ "automation",
19
+ "codex"
20
+ ],
21
+ "skills": "../skills/",
22
+ "interface": {
23
+ "displayName": "pr-shepherd",
24
+ "shortDescription": "Monitor PR CI and review comments from Codex",
25
+ "longDescription": "Use pr-shepherd from Codex to check pull requests, resolve review feedback, and keep explicit iterate cycles running until a PR is ready, merged, closed, or escalated.",
26
+ "developerName": "Jonathan Ong",
27
+ "category": "Coding",
28
+ "capabilities": [
29
+ "Interactive",
30
+ "Write"
31
+ ],
32
+ "websiteURL": "https://github.com/jonathanong/pr-shepherd",
33
+ "privacyPolicyURL": "https://github.com/jonathanong/pr-shepherd",
34
+ "termsOfServiceURL": "https://github.com/jonathanong/pr-shepherd",
35
+ "defaultPrompt": [
36
+ "Check this PR with pr-shepherd",
37
+ "Run pr-shepherd until this PR is ready",
38
+ "Resolve this PR's review comments"
39
+ ],
40
+ "brandColor": "#2563EB",
41
+ "screenshots": []
42
+ }
43
+ }
@@ -0,0 +1,50 @@
1
+ ---
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 `npx --no-install pr-shepherd PR_NUMBER` cycles every configured interval until Shepherd emits `[CANCEL]` for ready-delay completion or merged/closed, or `[ESCALATE]` including repeated unchanged CI failures.'
4
+ ---
5
+
6
+ # pr-shepherd
7
+
8
+ Codex-only workflow for getting actionable PR updates from `pr-shepherd`.
9
+
10
+ ## Workflow
11
+
12
+ 1. Resolve the PR number.
13
+ - If the user provides a PR number, use it.
14
+ - If the user provides a GitHub PR URL, extract the PR number.
15
+ - If no PR is provided, infer it from the current branch with:
16
+ `gh pr view --json number --jq .number`
17
+ - If no PR is found, report that and stop.
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 npx --no-install pr-shepherd PR_NUMBER cycles every configured interval 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
+
24
+ 3. Verify the CLI is available.
25
+ - In the pr-shepherd source checkout, before any `npx --no-install pr-shepherd` invocation, verify `bin/` and `node_modules/` exist. If either is missing, run:
26
+ `npm install`
27
+ - In other repositories, use `npx --no-install pr-shepherd` so Codex does not install packages implicitly. If that fails because the package is missing, tell the user to install `pr-shepherd` in the target repo with `npm install --save-dev pr-shepherd`.
28
+
29
+ 4. Run the appropriate command from the repository root.
30
+ - For a status check:
31
+ `npx --no-install pr-shepherd check PR_NUMBER`
32
+ - For review comment resolution:
33
+ `npx --no-install pr-shepherd resolve PR_NUMBER --fetch`
34
+ - For a monitor bootstrap:
35
+ `npx --no-install pr-shepherd monitor PR_NUMBER`
36
+ - For the recurring explicit monitor tick:
37
+ `npx --no-install pr-shepherd PR_NUMBER`
38
+ - `npx --no-install pr-shepherd iterate PR_NUMBER` remains supported as a legacy alias, but use the default `pr-shepherd PR_NUMBER` form for recurring Codex cycles.
39
+
40
+ 5. Print or summarize the important status, then follow the output's `## Instructions` exactly.
41
+
42
+ 6. Do not call `/loop`, `ScheduleWakeup`, `CronCreate`, or `npx pr-shepherd monitor` for recurrence. Codex does explicit `pr-shepherd PR_NUMBER` cycles.
43
+
44
+ 7. For open-ended goal requests, complete the CLI-provided instructions for the current cycle. If the output says to continue the active Codex goal, wait for the configured interval named in the output and run another explicit `pr-shepherd PR_NUMBER` cycle.
45
+
46
+ 8. 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.
47
+
48
+ 9. 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.
49
+
50
+ 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.