pr-shepherd 0.2.0 → 0.3.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 (62) hide show
  1. package/.claude-plugin/plugin.json +8 -2
  2. package/README.md +126 -83
  3. package/dist/cache/file-cache.mjs +78 -0
  4. package/dist/cache/fix-attempts.mjs +67 -0
  5. package/dist/checks/classify.mjs +53 -0
  6. package/dist/checks/triage.mjs +77 -0
  7. package/dist/cli/args.mjs +153 -0
  8. package/dist/cli.mjs +203 -0
  9. package/dist/commands/check.mjs +140 -0
  10. package/dist/commands/iterate.mjs +295 -0
  11. package/dist/commands/ready-delay.mjs +87 -0
  12. package/dist/commands/resolve.mjs +64 -0
  13. package/dist/commands/status.mjs +107 -0
  14. package/{src/comments/outdated.mts → dist/comments/outdated.mjs} +2 -5
  15. package/dist/comments/resolve.mjs +113 -0
  16. package/dist/config/load.mjs +154 -0
  17. package/dist/github/batch.mjs +208 -0
  18. package/dist/github/client.mjs +153 -0
  19. package/{src/github/pagination.mts → dist/github/pagination.mjs} +26 -52
  20. package/{src/github/queries.mts → dist/github/queries.mjs} +1 -10
  21. package/{src/index.mts → dist/index.mjs} +3 -5
  22. package/dist/merge-status/derive.mjs +72 -0
  23. package/dist/reporters/agent.mjs +41 -0
  24. package/{src/reporters/json.mts → dist/reporters/json.mjs} +2 -5
  25. package/dist/reporters/text.mjs +111 -0
  26. package/dist/types.mjs +2 -0
  27. package/package.json +6 -6
  28. package/skills/check/SKILL.md +1 -1
  29. package/skills/monitor/SKILL.md +9 -5
  30. package/src/cache/file-cache.mts +0 -101
  31. package/src/cache/file-cache.test.mts +0 -91
  32. package/src/cache/fix-attempts.mts +0 -86
  33. package/src/checks/classify.mts +0 -80
  34. package/src/checks/classify.test.mts +0 -164
  35. package/src/checks/triage.mock.test.mts +0 -202
  36. package/src/checks/triage.mts +0 -88
  37. package/src/cli.mts +0 -423
  38. package/src/commands/check.mts +0 -188
  39. package/src/commands/iterate.mock.test.mts +0 -1111
  40. package/src/commands/iterate.mts +0 -371
  41. package/src/commands/ready-delay.mts +0 -117
  42. package/src/commands/ready-delay.test.mts +0 -116
  43. package/src/commands/resolve.mts +0 -92
  44. package/src/commands/status.mts +0 -173
  45. package/src/comments/resolve.mts +0 -179
  46. package/src/config/load.mts +0 -240
  47. package/src/github/batch.mts +0 -351
  48. package/src/github/client.mts +0 -207
  49. package/src/github/client.test.mts +0 -19
  50. package/src/github/pagination.test.mts +0 -140
  51. package/src/merge-status/derive.mts +0 -74
  52. package/src/merge-status/derive.test.mts +0 -130
  53. package/src/reporters/text.mts +0 -140
  54. package/src/types.mts +0 -309
  55. /package/{src → dist}/config.json +0 -0
  56. /package/{src → dist}/github/gql/batch-pr.gql +0 -0
  57. /package/{src → dist}/github/gql/dismiss-review.gql +0 -0
  58. /package/{src → dist}/github/gql/minimize-comment.gql +0 -0
  59. /package/{src → dist}/github/gql/multi-pr-status-paged.gql +0 -0
  60. /package/{src → dist}/github/gql/multi-pr-status.gql +0 -0
  61. /package/{src → dist}/github/gql/resolve-thread.gql +0 -0
  62. /package/{src/util/path-segment.mts → dist/util/path-segment.mjs} +0 -0
package/src/types.mts DELETED
@@ -1,309 +0,0 @@
1
- /** Shared type definitions for the shepherd CLI. */
2
-
3
- // ---------------------------------------------------------------------------
4
- // GitHub primitives
5
- // ---------------------------------------------------------------------------
6
-
7
- export type CheckConclusion =
8
- | "ACTION_REQUIRED"
9
- | "CANCELLED"
10
- | "FAILURE"
11
- | "NEUTRAL"
12
- | "SKIPPED"
13
- | "STALE"
14
- | "STARTUP_FAILURE"
15
- | "SUCCESS"
16
- | "TIMED_OUT"
17
- | null;
18
-
19
- export type CheckStatus =
20
- | "COMPLETED"
21
- | "IN_PROGRESS"
22
- | "PENDING"
23
- | "QUEUED"
24
- | "REQUESTED"
25
- | "WAITING";
26
-
27
- export type MergeableState = "CONFLICTING" | "MERGEABLE" | "UNKNOWN";
28
-
29
- export type MergeStateStatus =
30
- | "BEHIND"
31
- | "BLOCKED"
32
- | "CLEAN"
33
- | "DIRTY"
34
- | "DRAFT"
35
- | "HAS_HOOKS"
36
- | "UNKNOWN"
37
- | "UNSTABLE";
38
-
39
- export type ReviewDecision = "APPROVED" | "CHANGES_REQUESTED" | "REVIEW_REQUIRED" | null;
40
-
41
- // ---------------------------------------------------------------------------
42
- // Check runs
43
- // ---------------------------------------------------------------------------
44
-
45
- export interface CheckRun {
46
- name: string;
47
- status: CheckStatus;
48
- conclusion: CheckConclusion;
49
- detailsUrl: string;
50
- /** The workflow event that triggered this run (e.g. pull_request, push, schedule). */
51
- event: string | null;
52
- /** GitHub Actions run ID extracted from detailsUrl. */
53
- runId: string | null;
54
- }
55
-
56
- export type CheckCategory = "passed" | "failing" | "in_progress" | "skipped" | "filtered";
57
-
58
- export interface ClassifiedCheck extends CheckRun {
59
- category: CheckCategory;
60
- }
61
-
62
- export type FailureKind = "timeout" | "infrastructure" | "actionable" | "flaky";
63
-
64
- export interface TriagedCheck extends ClassifiedCheck {
65
- failureKind?: FailureKind;
66
- /** Log excerpt for actionable failures. */
67
- logExcerpt?: string;
68
- }
69
-
70
- // ---------------------------------------------------------------------------
71
- // Review threads and comments
72
- // ---------------------------------------------------------------------------
73
-
74
- export interface ReviewThread {
75
- id: string;
76
- isResolved: boolean;
77
- isOutdated: boolean;
78
- path: string | null;
79
- line: number | null;
80
- author: string;
81
- body: string;
82
- createdAtUnix: number;
83
- }
84
-
85
- export interface PrComment {
86
- id: string;
87
- isMinimized: boolean;
88
- author: string;
89
- body: string;
90
- createdAtUnix: number;
91
- }
92
-
93
- export interface Review {
94
- id: string;
95
- author: string;
96
- body: string;
97
- }
98
-
99
- // ---------------------------------------------------------------------------
100
- // Merge status
101
- // ---------------------------------------------------------------------------
102
-
103
- export type ShepherdMergeStatus =
104
- | "CLEAN"
105
- | "BEHIND"
106
- | "CONFLICTS"
107
- | "BLOCKED"
108
- | "UNSTABLE"
109
- | "DRAFT"
110
- | "UNKNOWN";
111
-
112
- export interface MergeStatusResult {
113
- status: ShepherdMergeStatus;
114
- state: "OPEN" | "CLOSED" | "MERGED";
115
- isDraft: boolean;
116
- mergeable: MergeableState;
117
- reviewDecision: ReviewDecision;
118
- copilotReviewInProgress: boolean;
119
- mergeStateStatus: MergeStateStatus;
120
- }
121
-
122
- // ---------------------------------------------------------------------------
123
- // Batch query response (the combined GraphQL shape)
124
- // ---------------------------------------------------------------------------
125
-
126
- export interface BatchPrData {
127
- number: number;
128
- state: "OPEN" | "CLOSED" | "MERGED";
129
- isDraft: boolean;
130
- mergeable: MergeableState;
131
- mergeStateStatus: MergeStateStatus;
132
- reviewDecision: ReviewDecision;
133
- headRefOid: string;
134
- reviewRequests: Array<{ login: string }>;
135
- latestReviews: Array<{ login: string; state: string }>;
136
- reviewThreads: ReviewThread[];
137
- comments: PrComment[];
138
- changesRequestedReviews: Review[];
139
- checks: CheckRun[];
140
- }
141
-
142
- // ---------------------------------------------------------------------------
143
- // Shepherd check report (output of the check command)
144
- // ---------------------------------------------------------------------------
145
-
146
- export type ShepherdStatus =
147
- | "READY"
148
- | "FAILING"
149
- | "IN_PROGRESS"
150
- | "UNRESOLVED_COMMENTS"
151
- | "UNKNOWN";
152
-
153
- export interface ShepherdReport {
154
- pr: number;
155
- repo: string;
156
- status: ShepherdStatus;
157
- mergeStatus: MergeStatusResult;
158
- checks: {
159
- passing: ClassifiedCheck[];
160
- failing: TriagedCheck[];
161
- inProgress: ClassifiedCheck[];
162
- skipped: ClassifiedCheck[];
163
- /** Checks filtered out because they were triggered by a non-PR event (push, schedule, etc.). */
164
- filtered: ClassifiedCheck[];
165
- filteredNames: string[];
166
- blockedByFilteredCheck: boolean;
167
- };
168
- threads: {
169
- actionable: ReviewThread[];
170
- autoResolved: ReviewThread[];
171
- autoResolveErrors: string[];
172
- };
173
- comments: {
174
- actionable: PrComment[];
175
- };
176
- changesRequestedReviews: Review[];
177
- lastPushTime?: number;
178
- }
179
-
180
- // ---------------------------------------------------------------------------
181
- // Resolve command input
182
- // ---------------------------------------------------------------------------
183
-
184
- export interface ResolveOptions {
185
- resolveThreadIds?: string[];
186
- minimizeCommentIds?: string[];
187
- dismissReviewIds?: string[];
188
- dismissMessage?: string;
189
- /** When set, shepherd verifies GitHub has received this commit before resolving. */
190
- requireSha?: string;
191
- }
192
-
193
- // ---------------------------------------------------------------------------
194
- // Iterate command types
195
- // ---------------------------------------------------------------------------
196
-
197
- export type ShepherdAction =
198
- | "cooldown"
199
- | "wait"
200
- | "fix_code"
201
- | "rerun_ci"
202
- | "rebase"
203
- | "mark_ready"
204
- | "cancel"
205
- | "escalate";
206
-
207
- export interface EscalateDetails {
208
- triggers: string[];
209
- unresolvedThreads: ReviewThread[];
210
- ambiguousComments: PrComment[];
211
- changesRequestedReviews: Review[];
212
- /** Populated when fix-thrash triggered — threads that have been attempted too many times. */
213
- attemptHistory?: Array<{ threadId: string; attempts: number }>;
214
- /** One-line hint for the human on what to do. */
215
- suggestion: string;
216
- }
217
-
218
- export interface IterateResultSummary {
219
- passing: number;
220
- skipped: number;
221
- filtered: number;
222
- inProgress: number;
223
- }
224
-
225
- export interface IterateResultBase {
226
- pr: number;
227
- repo: string;
228
- status: ShepherdStatus;
229
- /** `'UNKNOWN'` during the cooldown early-return (no sweep has been run yet). */
230
- state: "OPEN" | "CLOSED" | "MERGED" | "UNKNOWN";
231
- mergeStateStatus: MergeStateStatus;
232
- copilotReviewInProgress: boolean;
233
- isDraft: boolean;
234
- shouldCancel: boolean;
235
- remainingSeconds: number;
236
- summary: IterateResultSummary;
237
- }
238
-
239
- export interface IterateResultCooldown extends IterateResultBase {
240
- action: "cooldown";
241
- }
242
-
243
- export interface IterateResultWait extends IterateResultBase {
244
- action: "wait";
245
- }
246
-
247
- export interface IterateResultCancel extends IterateResultBase {
248
- action: "cancel";
249
- }
250
-
251
- export interface IterateResultFixCode extends IterateResultBase {
252
- action: "fix_code";
253
- fix: {
254
- threads: ReviewThread[];
255
- comments: PrComment[];
256
- checks: TriagedCheck[];
257
- changesRequestedReviews: Review[];
258
- };
259
- cancelled: string[];
260
- }
261
-
262
- export interface IterateResultRerunCi extends IterateResultBase {
263
- action: "rerun_ci";
264
- reran: string[];
265
- }
266
-
267
- export interface IterateResultRebase extends IterateResultBase {
268
- action: "rebase";
269
- }
270
-
271
- export interface IterateResultMarkReady extends IterateResultBase {
272
- action: "mark_ready";
273
- markedReady: boolean;
274
- }
275
-
276
- export interface IterateResultEscalate extends IterateResultBase {
277
- action: "escalate";
278
- escalate: EscalateDetails;
279
- }
280
-
281
- export type IterateResult =
282
- | IterateResultCooldown
283
- | IterateResultWait
284
- | IterateResultCancel
285
- | IterateResultFixCode
286
- | IterateResultRerunCi
287
- | IterateResultRebase
288
- | IterateResultMarkReady
289
- | IterateResultEscalate;
290
-
291
- export interface IterateCommandOptions extends GlobalOptions {
292
- cooldownSeconds?: number;
293
- readyDelaySeconds?: number;
294
- lastPushTime?: number;
295
- noAutoRerun?: boolean;
296
- noAutoMarkReady?: boolean;
297
- noAutoCancelActionable?: boolean;
298
- }
299
-
300
- // ---------------------------------------------------------------------------
301
- // CLI options
302
- // ---------------------------------------------------------------------------
303
-
304
- export interface GlobalOptions {
305
- prNumber?: number;
306
- format: "text" | "json";
307
- noCache: boolean;
308
- cacheTtlSeconds: number;
309
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes