pr-shepherd 0.16.3 → 0.17.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 (50) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +16 -2
  3. package/bin/checks/triage.test-support.mjs +61 -0
  4. package/bin/cli/clean-formatter.mjs +20 -0
  5. package/bin/cli/fix-formatter.mjs +3 -10
  6. package/bin/cli/formatters.mjs +6 -10
  7. package/bin/cli/handlers.mjs +57 -1
  8. package/bin/cli/iterate-instructions.mjs +4 -2
  9. package/bin/cli/iterate-lean.test-support.mjs +5 -0
  10. package/bin/cli/list-formatters.mjs +21 -1
  11. package/bin/cli/runner.mjs +13 -3
  12. package/bin/cli-parser.clean.test-support.mjs +45 -0
  13. package/bin/cli-parser.commit-suggestion.test-support.mjs +66 -0
  14. package/bin/cli-parser.iterate-fix.test-support.mjs +48 -0
  15. package/bin/cli-parser.iterate-fixtures.mjs +1 -1
  16. package/bin/cli-parser.iterate.test-support.mjs +49 -0
  17. package/bin/cli-parser.mjs +6 -2
  18. package/bin/cli-parser.test-support.mjs +43 -0
  19. package/bin/commands/check.test-support.mjs +140 -0
  20. package/bin/commands/clean.mjs +156 -0
  21. package/bin/commands/clean.test-support.mjs +48 -0
  22. package/bin/commands/commit-suggestion.apply.test-support.mjs +87 -0
  23. package/bin/commands/commit-suggestion.test-support.mjs +112 -0
  24. package/bin/commands/iterate/classify.mjs +37 -9
  25. package/bin/commands/iterate/escalate.mjs +10 -8
  26. package/bin/commands/iterate/fix-code.mjs +17 -6
  27. package/bin/commands/iterate/index.mjs +19 -16
  28. package/bin/commands/iterate/render.mjs +12 -6
  29. package/bin/commands/iterate-stall.test-support.mjs +25 -0
  30. package/bin/commands/iterate-test-support.mjs +149 -0
  31. package/bin/commands/iterate.fix-code-in-progress.test-support.mjs +118 -0
  32. package/bin/commands/resolve.test-support.mjs +114 -0
  33. package/bin/commands/shepherd-journal.test-support.mjs +9 -0
  34. package/bin/comments/resolve.mjs +70 -11
  35. package/bin/comments/resolve.test-support.mjs +40 -0
  36. package/bin/github/batch-parsers.test-support.mjs +67 -0
  37. package/bin/github/batch.test-support.mjs +67 -0
  38. package/bin/github/client.mjs +10 -1
  39. package/bin/github/graphql-http.mjs +73 -0
  40. package/bin/github/http-auth.mjs +48 -0
  41. package/bin/github/http-request.mjs +15 -0
  42. package/bin/github/http-utils.mjs +34 -0
  43. package/bin/github/http.mjs +4 -319
  44. package/bin/github/http.test-support.mjs +52 -0
  45. package/bin/github/rest-http.mjs +131 -0
  46. package/bin/state/base.mjs +2 -1
  47. package/bin/suggestions/patch.test-support.mjs +4 -0
  48. package/package.json +2 -2
  49. package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
  50. package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +4 -4
@@ -1,319 +1,4 @@
1
- import { execFile as execFileCb } from "node:child_process";
2
- import { promisify } from "node:util";
3
- import { appendEntry, nextEntry } from "../log/log-file.mjs";
4
- import { formatRequestEntry, formatResponseEntry } from "../log/session.mjs";
5
- import { GitHubRequestError } from "./errors.mjs";
6
- export { GitHubRequestError };
7
- const execFile = promisify(execFileCb);
8
- const BASE_URL = "https://api.github.com";
9
- // ---------------------------------------------------------------------------
10
- // Auth
11
- // ---------------------------------------------------------------------------
12
- let _token;
13
- export function _resetTokenCache() {
14
- _token = undefined;
15
- }
16
- async function resolveToken() {
17
- if (_token)
18
- return _token;
19
- const envToken = process.env["GH_TOKEN"] ?? process.env["GITHUB_TOKEN"];
20
- if (envToken) {
21
- _token = envToken;
22
- return _token;
23
- }
24
- try {
25
- const { stdout } = await execFile("gh", ["auth", "token"]);
26
- const token = stdout.trim();
27
- if (token) {
28
- _token = token;
29
- return _token;
30
- }
31
- }
32
- catch {
33
- // fall through to error
34
- }
35
- const codexToken = process.env["GITHUB_PERSONAL_ACCESS_TOKEN"];
36
- if (codexToken) {
37
- _token = codexToken;
38
- return _token;
39
- }
40
- throw new Error("No GitHub token found. Set GH_TOKEN, GITHUB_TOKEN, or GITHUB_PERSONAL_ACCESS_TOKEN, or run `gh auth login`.");
41
- }
42
- async function makeHeaders() {
43
- return {
44
- Authorization: `Bearer ${await resolveToken()}`,
45
- Accept: "application/vnd.github+json",
46
- "X-GitHub-Api-Version": "2022-11-28",
47
- "User-Agent": "pr-shepherd",
48
- "Content-Type": "application/json",
49
- };
50
- }
51
- function sanitizeBody(body) {
52
- return body.replace(/Bearer\s+\S+/gi, "[REDACTED]").slice(0, 200);
53
- }
54
- function redactToken(body) {
55
- return body.replace(/Bearer\s+\S+/gi, "[REDACTED]");
56
- }
57
- function redactUrl(url) {
58
- try {
59
- const u = new URL(url);
60
- return `${u.origin}${u.pathname}`;
61
- }
62
- catch {
63
- return url;
64
- }
65
- }
66
- async function requestWithTokenRetry(fn, t0, onIntermediate) {
67
- const res = await fn();
68
- if (res.status === 401 && _token !== undefined) {
69
- onIntermediate?.(401, Math.round(performance.now() - t0));
70
- try {
71
- await res.arrayBuffer();
72
- }
73
- catch { }
74
- _token = undefined;
75
- const retryT0 = performance.now();
76
- return { res: await fn(), attempt: 2, retryT0 };
77
- }
78
- return { res, attempt: 1, retryT0: t0 };
79
- }
80
- // ---------------------------------------------------------------------------
81
- // GraphQL
82
- // ---------------------------------------------------------------------------
83
- async function graphqlInner(query, vars) {
84
- const url = `${BASE_URL}/graphql`;
85
- const n = nextEntry();
86
- appendEntry(formatRequestEntry({
87
- n,
88
- kind: "GraphQL",
89
- method: "POST",
90
- url,
91
- body: { query, variables: vars },
92
- }));
93
- const t0 = performance.now();
94
- const { res, attempt, retryT0 } = await requestWithTokenRetry(async () => fetch(url, {
95
- method: "POST",
96
- headers: await makeHeaders(),
97
- body: JSON.stringify({ query, variables: vars }),
98
- }), t0, (status, firstDurationMs) => {
99
- appendEntry(formatResponseEntry({
100
- n,
101
- kind: "GraphQL",
102
- method: "POST",
103
- url,
104
- status,
105
- durationMs: firstDurationMs,
106
- }));
107
- });
108
- const durationMs = Math.round(performance.now() - retryT0);
109
- const rateLimit = parseRateLimit(res.headers);
110
- const retryAfterSeconds = parseRetryAfter(res.headers);
111
- if (!res.ok) {
112
- const body = await res.text();
113
- appendEntry(formatResponseEntry({
114
- n,
115
- kind: "GraphQL",
116
- method: "POST",
117
- url,
118
- status: res.status,
119
- durationMs,
120
- textBody: redactToken(body),
121
- attempt: attempt > 1 ? attempt : undefined,
122
- }));
123
- throw new GitHubRequestError(`GitHub GraphQL request failed: ${res.status} ${sanitizeBody(body)}`, { status: res.status, rateLimit: rateLimit ?? undefined, retryAfterSeconds });
124
- }
125
- const parsed = (await res.json());
126
- appendEntry(formatResponseEntry({
127
- n,
128
- kind: "GraphQL",
129
- method: "POST",
130
- url,
131
- status: res.status,
132
- durationMs,
133
- body: parsed,
134
- attempt: attempt > 1 ? attempt : undefined,
135
- }));
136
- if (parsed.data == null) {
137
- const messages = (parsed.errors ?? []).map((e) => e.message).join("; ");
138
- throw new GitHubRequestError(`GitHub GraphQL error (no data): ${messages}`, {
139
- status: res.status,
140
- rateLimit: rateLimit ?? undefined,
141
- retryAfterSeconds,
142
- });
143
- }
144
- if (parsed.errors?.length) {
145
- const messages = parsed.errors.map((e) => e.message).join("; ");
146
- process.stderr.write(`pr-shepherd: GraphQL non-fatal errors: ${messages}\n`);
147
- }
148
- return { data: parsed.data, rateLimit, retryAfterSeconds, errors: parsed.errors };
149
- }
150
- export async function graphql(query, vars = {}) {
151
- const { data } = await graphqlInner(query, vars);
152
- return { data };
153
- }
154
- export async function graphqlWithRateLimit(query, vars = {}) {
155
- const { data, rateLimit, retryAfterSeconds, errors } = await graphqlInner(query, vars);
156
- return { data, rateLimit: rateLimit ?? undefined, retryAfterSeconds, errors };
157
- }
158
- // ---------------------------------------------------------------------------
159
- // REST
160
- // ---------------------------------------------------------------------------
161
- export async function rest(method, path, body) {
162
- const url = `${BASE_URL}${path}`;
163
- const n = nextEntry();
164
- appendEntry(formatRequestEntry({ n, kind: "REST", method, url, body }));
165
- const t0 = performance.now();
166
- const { res, attempt, retryT0 } = await requestWithTokenRetry(async () => fetch(url, {
167
- method,
168
- headers: await makeHeaders(),
169
- body: body !== undefined ? JSON.stringify(body) : undefined,
170
- }), t0, (status, firstDurationMs) => {
171
- appendEntry(formatResponseEntry({ n, kind: "REST", method, url, status, durationMs: firstDurationMs }));
172
- });
173
- const durationMs = Math.round(performance.now() - retryT0);
174
- const ct = res.headers.get("content-type") ?? "";
175
- if (!res.ok) {
176
- const text = await res.text();
177
- appendEntry(formatResponseEntry({
178
- n,
179
- kind: "REST",
180
- method,
181
- url,
182
- status: res.status,
183
- durationMs,
184
- textBody: redactToken(text),
185
- attempt: attempt > 1 ? attempt : undefined,
186
- }));
187
- throw new Error(`GitHub REST ${method} ${path} failed: ${res.status} ${sanitizeBody(text)}`);
188
- }
189
- if (ct.includes("application/json")) {
190
- const json = (await res.json());
191
- appendEntry(formatResponseEntry({
192
- n,
193
- kind: "REST",
194
- method,
195
- url,
196
- status: res.status,
197
- durationMs,
198
- contentType: ct,
199
- body: json,
200
- attempt: attempt > 1 ? attempt : undefined,
201
- }));
202
- return json;
203
- }
204
- appendEntry(formatResponseEntry({
205
- n,
206
- kind: "REST",
207
- method,
208
- url,
209
- status: res.status,
210
- durationMs,
211
- contentType: ct || undefined,
212
- attempt: attempt > 1 ? attempt : undefined,
213
- }));
214
- return undefined;
215
- }
216
- export async function restText(path) {
217
- const url = `${BASE_URL}${path}`;
218
- const n = nextEntry();
219
- appendEntry(formatRequestEntry({ n, kind: "restText", method: "GET", url }));
220
- const t0 = performance.now();
221
- const { res, attempt, retryT0 } = await requestWithTokenRetry(async () => fetch(url, {
222
- method: "GET",
223
- headers: await makeHeaders(),
224
- redirect: "manual",
225
- }), t0, (status, firstDurationMs) => {
226
- appendEntry(formatResponseEntry({
227
- n,
228
- kind: "restText",
229
- method: "GET",
230
- url,
231
- status,
232
- durationMs: firstDurationMs,
233
- }));
234
- });
235
- const durationMs = Math.round(performance.now() - retryT0);
236
- if (res.status === 301 || res.status === 302 || res.status === 307 || res.status === 308) {
237
- appendEntry(formatResponseEntry({
238
- n,
239
- kind: "restText",
240
- method: "GET",
241
- url,
242
- status: res.status,
243
- durationMs,
244
- attempt: attempt > 1 ? attempt : undefined,
245
- }));
246
- const location = res.headers.get("location");
247
- if (location) {
248
- const n2 = nextEntry();
249
- const logUrl = redactUrl(location);
250
- appendEntry(formatRequestEntry({ n: n2, kind: "restText", method: "GET", url: logUrl }));
251
- const t1 = performance.now();
252
- const redirectRes = await fetch(location);
253
- const duration2 = Math.round(performance.now() - t1);
254
- const clRaw = redirectRes.headers.get("content-length");
255
- const contentLength = clRaw !== null && Number.isFinite(Number(clRaw)) ? Number(clRaw) : undefined;
256
- appendEntry(formatResponseEntry({
257
- n: n2,
258
- kind: "restText",
259
- method: "GET",
260
- url: logUrl,
261
- status: redirectRes.status,
262
- durationMs: duration2,
263
- contentLength,
264
- }));
265
- if (!redirectRes.ok) {
266
- throw new Error(`redirect target ${location} failed: ${redirectRes.status}`);
267
- }
268
- return redirectRes.text();
269
- }
270
- }
271
- if (!res.ok) {
272
- const text = await res.text();
273
- appendEntry(formatResponseEntry({
274
- n,
275
- kind: "restText",
276
- method: "GET",
277
- url,
278
- status: res.status,
279
- durationMs,
280
- attempt: attempt > 1 ? attempt : undefined,
281
- }));
282
- throw new Error(`GitHub REST GET ${path} failed: ${res.status} ${sanitizeBody(text)}`);
283
- }
284
- const clRaw = res.headers.get("content-length");
285
- const contentLength = clRaw !== null && Number.isFinite(Number(clRaw)) ? Number(clRaw) : undefined;
286
- appendEntry(formatResponseEntry({
287
- n,
288
- kind: "restText",
289
- method: "GET",
290
- url,
291
- status: res.status,
292
- durationMs,
293
- contentLength,
294
- attempt: attempt > 1 ? attempt : undefined,
295
- }));
296
- return res.text();
297
- }
298
- // ---------------------------------------------------------------------------
299
- // Helpers
300
- // ---------------------------------------------------------------------------
301
- function parseRateLimit(headers) {
302
- const rRaw = headers.get("x-ratelimit-remaining");
303
- const lRaw = headers.get("x-ratelimit-limit");
304
- const tRaw = headers.get("x-ratelimit-reset");
305
- if (rRaw === null || lRaw === null || tRaw === null)
306
- return null;
307
- const remaining = Number(rRaw);
308
- const limit = Number(lRaw);
309
- const resetAt = Number(tRaw);
310
- if (Number.isFinite(remaining) && Number.isFinite(limit) && Number.isFinite(resetAt)) {
311
- return { remaining, limit, resetAt };
312
- }
313
- return null;
314
- }
315
- function parseRetryAfter(headers) {
316
- const raw = headers.get("retry-after");
317
- const seconds = Number(raw);
318
- return raw !== null && Number.isFinite(seconds) && seconds >= 0 ? seconds : undefined;
319
- }
1
+ export { GitHubRequestError } from "./errors.mjs";
2
+ export { _resetTokenCache } from "./http-auth.mjs";
3
+ export { graphql, graphqlWithRateLimit } from "./graphql-http.mjs";
4
+ export { rest, restText } from "./rest-http.mjs";
@@ -0,0 +1,52 @@
1
+ // @ts-nocheck
2
+ import { describe, it, expect, vi, beforeEach } from "vitest";
3
+ // ---------------------------------------------------------------------------
4
+ // Stub fetch and child_process globally before any imports.
5
+ // ---------------------------------------------------------------------------
6
+ const mockFetch = vi.fn();
7
+ vi.stubGlobal("fetch", mockFetch);
8
+ const { mockExecFile } = vi.hoisted(() => ({ mockExecFile: vi.fn() }));
9
+ vi.mock("node:child_process", () => ({
10
+ execFile: (cmd, args, optsOrCb, maybeCb) => {
11
+ const cb = typeof optsOrCb === "function" ? optsOrCb : maybeCb;
12
+ mockExecFile(cmd, args)
13
+ .then((result) => cb(null, result))
14
+ .catch((err) => cb(err, { stdout: "", stderr: "" }));
15
+ },
16
+ }));
17
+ import { GitHubRequestError, graphql, graphqlWithRateLimit, rest, restText, _resetTokenCache, } from "./http.mjs";
18
+ // ---------------------------------------------------------------------------
19
+ // Helpers
20
+ // ---------------------------------------------------------------------------
21
+ function jsonOk(data) {
22
+ return {
23
+ ok: true,
24
+ status: 200,
25
+ headers: new Headers({ "content-type": "application/json" }),
26
+ json: () => Promise.resolve(data),
27
+ text: () => Promise.resolve(JSON.stringify(data)),
28
+ };
29
+ }
30
+ function gqlOk(data) {
31
+ return {
32
+ ok: true,
33
+ status: 200,
34
+ headers: new Headers({ "content-type": "application/json" }),
35
+ json: () => Promise.resolve({ data }),
36
+ text: () => Promise.resolve(JSON.stringify({ data })),
37
+ };
38
+ }
39
+ // ---------------------------------------------------------------------------
40
+ // Token resolution
41
+ // ---------------------------------------------------------------------------
42
+ export function registerHooks() {
43
+ beforeEach(() => {
44
+ mockFetch.mockReset();
45
+ mockExecFile.mockReset();
46
+ _resetTokenCache();
47
+ delete process.env["GH_TOKEN"];
48
+ delete process.env["GITHUB_TOKEN"];
49
+ delete process.env["GITHUB_PERSONAL_ACCESS_TOKEN"];
50
+ });
51
+ }
52
+ export { GitHubRequestError, _resetTokenCache, gqlOk, graphql, graphqlWithRateLimit, jsonOk, mockExecFile, mockFetch, rest, restText, };
@@ -0,0 +1,131 @@
1
+ import { appendEntry, nextEntry } from "../log/log-file.mjs";
2
+ import { formatRequestEntry, formatResponseEntry } from "../log/session.mjs";
3
+ import { makeHeaders } from "./http-auth.mjs";
4
+ import { requestWithTokenRetry } from "./http-request.mjs";
5
+ import { redactToken, redactUrl, sanitizeBody } from "./http-utils.mjs";
6
+ const BASE_URL = "https://api.github.com";
7
+ export async function rest(method, path, body) {
8
+ const url = `${BASE_URL}${path}`;
9
+ const n = nextEntry();
10
+ appendEntry(formatRequestEntry({ n, kind: "REST", method, url, body }));
11
+ const t0 = performance.now();
12
+ const { res, attempt, retryT0 } = await requestWithTokenRetry(async () => fetch(url, {
13
+ method,
14
+ headers: await makeHeaders(),
15
+ body: body !== undefined ? JSON.stringify(body) : undefined,
16
+ }), t0, (status, durationMs) => appendEntry(formatResponseEntry({ n, kind: "REST", method, url, status, durationMs })));
17
+ const durationMs = Math.round(performance.now() - retryT0);
18
+ const ct = res.headers.get("content-type") ?? "";
19
+ if (!res.ok) {
20
+ const text = await res.text();
21
+ appendEntry(formatResponseEntry({
22
+ n,
23
+ kind: "REST",
24
+ method,
25
+ url,
26
+ status: res.status,
27
+ durationMs,
28
+ textBody: redactToken(text),
29
+ attempt: attempt > 1 ? attempt : undefined,
30
+ }));
31
+ throw new Error(`GitHub REST ${method} ${path} failed: ${res.status} ${sanitizeBody(text)}`);
32
+ }
33
+ if (ct.includes("application/json")) {
34
+ const json = (await res.json());
35
+ appendEntry(formatResponseEntry({
36
+ n,
37
+ kind: "REST",
38
+ method,
39
+ url,
40
+ status: res.status,
41
+ durationMs,
42
+ contentType: ct,
43
+ body: json,
44
+ attempt: attempt > 1 ? attempt : undefined,
45
+ }));
46
+ return json;
47
+ }
48
+ appendEntry(formatResponseEntry({
49
+ n,
50
+ kind: "REST",
51
+ method,
52
+ url,
53
+ status: res.status,
54
+ durationMs,
55
+ contentType: ct || undefined,
56
+ attempt: attempt > 1 ? attempt : undefined,
57
+ }));
58
+ return undefined;
59
+ }
60
+ export async function restText(path) {
61
+ const url = `${BASE_URL}${path}`;
62
+ const n = nextEntry();
63
+ appendEntry(formatRequestEntry({ n, kind: "restText", method: "GET", url }));
64
+ const t0 = performance.now();
65
+ const { res, attempt, retryT0 } = await requestWithTokenRetry(async () => fetch(url, { method: "GET", headers: await makeHeaders(), redirect: "manual" }), t0, (status, durationMs) => appendEntry(formatResponseEntry({ n, kind: "restText", method: "GET", url, status, durationMs })));
66
+ const durationMs = Math.round(performance.now() - retryT0);
67
+ if ([301, 302, 307, 308].includes(res.status)) {
68
+ const redirected = await followRestTextRedirect(res, { n, url, durationMs, attempt });
69
+ if (redirected !== null)
70
+ return redirected;
71
+ }
72
+ if (!res.ok) {
73
+ const text = await res.text();
74
+ appendEntry(formatResponseEntry({
75
+ n,
76
+ kind: "restText",
77
+ method: "GET",
78
+ url,
79
+ status: res.status,
80
+ durationMs,
81
+ attempt: attempt > 1 ? attempt : undefined,
82
+ }));
83
+ throw new Error(`GitHub REST GET ${path} failed: ${res.status} ${sanitizeBody(text)}`);
84
+ }
85
+ appendEntry(formatResponseEntry({
86
+ n,
87
+ kind: "restText",
88
+ method: "GET",
89
+ url,
90
+ status: res.status,
91
+ durationMs,
92
+ contentLength: parseContentLength(res.headers),
93
+ attempt: attempt > 1 ? attempt : undefined,
94
+ }));
95
+ return res.text();
96
+ }
97
+ async function followRestTextRedirect(res, entry) {
98
+ appendEntry(formatResponseEntry({
99
+ n: entry.n,
100
+ kind: "restText",
101
+ method: "GET",
102
+ url: entry.url,
103
+ status: res.status,
104
+ durationMs: entry.durationMs,
105
+ attempt: entry.attempt > 1 ? entry.attempt : undefined,
106
+ }));
107
+ const location = res.headers.get("location");
108
+ if (!location)
109
+ return null;
110
+ const n2 = nextEntry();
111
+ const logUrl = redactUrl(location);
112
+ appendEntry(formatRequestEntry({ n: n2, kind: "restText", method: "GET", url: logUrl }));
113
+ const t1 = performance.now();
114
+ const redirectRes = await fetch(location);
115
+ appendEntry(formatResponseEntry({
116
+ n: n2,
117
+ kind: "restText",
118
+ method: "GET",
119
+ url: logUrl,
120
+ status: redirectRes.status,
121
+ durationMs: Math.round(performance.now() - t1),
122
+ contentLength: parseContentLength(redirectRes.headers),
123
+ }));
124
+ if (!redirectRes.ok)
125
+ throw new Error(`redirect target ${location} failed: ${redirectRes.status}`);
126
+ return redirectRes.text();
127
+ }
128
+ function parseContentLength(headers) {
129
+ const raw = headers.get("content-length");
130
+ return raw !== null && Number.isFinite(Number(raw)) ? Number(raw) : undefined;
131
+ }
@@ -1,5 +1,6 @@
1
1
  import { join } from "node:path";
2
2
  import { tmpdir } from "node:os";
3
3
  export function resolveStateBase() {
4
- return process.env["PR_SHEPHERD_STATE_DIR"] ?? join(tmpdir(), "pr-shepherd-state");
4
+ const envDir = process.env["PR_SHEPHERD_STATE_DIR"];
5
+ return envDir ? envDir : join(tmpdir(), "pr-shepherd-state");
5
6
  }
@@ -0,0 +1,4 @@
1
+ // @ts-nocheck
2
+ import { describe, it, expect } from "vitest";
3
+ import { buildUnifiedDiff } from "./patch.mjs";
4
+ export { buildUnifiedDiff };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.16.3",
3
+ "version": "0.17.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",
@@ -42,7 +42,7 @@
42
42
  "format": "oxfmt src/ plugins/ .agents/plugins/ docs/ README.md",
43
43
  "format:check": "oxfmt --check src/ plugins/ .agents/plugins/ docs/ README.md",
44
44
  "test": "vitest run",
45
- "test:coverage": "vitest run --coverage",
45
+ "test:coverage": "vitest run --coverage && node scripts/strip-lcov-branches.mjs",
46
46
  "test:watch": "vitest"
47
47
  },
48
48
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pr-shepherd",
3
- "version": "0.16.3",
3
+ "version": "0.17.0",
4
4
  "description": "Autonomous PR CI monitor and review-comment resolver for Codex.",
5
5
  "author": {
6
6
  "name": "Jonathan Ong",
@@ -29,12 +29,12 @@ One-tick dispatcher for iterating a PR to completion.
29
29
  If `MERGED` or `CLOSED`, output: `PR #N is already merged/closed. Nothing to do.` and stop.
30
30
 
31
31
  3. **Select the package runner** from the target repository root:
32
- - Prefer `package.json` `packageManager`: `pnpm@...` → `pnpm exec`, `yarn@...` → `yarn run`, `npm@...` → `npx`.
33
- - If `packageManager` is absent, use lockfiles: `pnpm-lock.yaml` → `pnpm exec`, `yarn.lock` → `yarn run`, `package-lock.json` or no signal → `npx`.
32
+ - Prefer `package.json` `packageManager`: `pnpm@...` → `pnpm exec`, `yarn@...` → `yarn run`, `bun@...` → `bunx`, `npm@...` → `npx`.
33
+ - If `packageManager` is absent, use lockfiles: `pnpm-lock.yaml` → `pnpm exec`, `yarn.lock` → `yarn run`, `bun.lock` / `bun.lockb` → `bunx`, `package-lock.json` or no signal → `npx`.
34
34
 
35
35
  4. **Run one iterate tick:**
36
36
 
37
- If the package is missing in the target repository, 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`.
37
+ If the package is missing in the target repository, tell the user to install pr-shepherd with the matching dev-dependency command: `pnpm add -D pr-shepherd`, `yarn add -D pr-shepherd`, `bun add -d pr-shepherd`, or `npm install --save-dev pr-shepherd`.
38
38
 
39
39
  ```bash
40
40
  <runner> pr-shepherd <N>
@@ -45,4 +45,4 @@ One-tick dispatcher for iterating a PR to completion.
45
45
  5. **Stop conditions:**
46
46
  - Stop when the CLI emits `[CANCEL]` (ready-delay completed, or PR merged/closed).
47
47
  - Stop when the CLI emits `[ESCALATE]`, including `stall-timeout` for repeated unchanged CI failures.
48
- - All other actions (`[WAIT]`, `[MARK_READY]`, `[FIX_CODE]`) are non-terminal: follow the `## Instructions`. For Claude, schedule exactly one next session-only iteration and end the turn; do not sleep inline and do not create a recurring cron.
48
+ - All other actions (`[WAIT]`, `[MARK_READY]`, `[FIX_CODE]`) are non-terminal: follow the `## Instructions`. For Claude, schedule exactly one next session-only iteration and end the turn; do not sleep inline and do not create a recurring cron or polling loop (`while true`, repeated polling, etc.).