pr-shepherd 0.2.0 → 0.4.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.
- package/.claude-plugin/marketplace.json +18 -0
- package/.claude-plugin/plugin.json +8 -2
- package/README.md +128 -83
- package/bin/cache/file-cache.mjs +79 -0
- package/bin/cache/fix-attempts.mjs +67 -0
- package/bin/checks/classify.mjs +53 -0
- package/bin/checks/triage.mjs +77 -0
- package/bin/cli/args.mjs +173 -0
- package/bin/cli.mjs +204 -0
- package/bin/commands/check.mjs +140 -0
- package/bin/commands/iterate.mjs +301 -0
- package/bin/commands/ready-delay.mjs +87 -0
- package/bin/commands/resolve.mjs +64 -0
- package/bin/commands/status.mjs +107 -0
- package/{src/comments/outdated.mts → bin/comments/outdated.mjs} +2 -5
- package/bin/comments/resolve.mjs +111 -0
- package/bin/config/load.mjs +158 -0
- package/bin/github/batch.mjs +208 -0
- package/bin/github/client.mjs +152 -0
- package/{src/github/pagination.mts → bin/github/pagination.mjs} +26 -52
- package/{src/github/queries.mts → bin/github/queries.mjs} +1 -10
- package/{src/index.mts → bin/index.mjs} +3 -5
- package/bin/merge-status/derive.mjs +72 -0
- package/bin/pr-shepherd +2 -0
- package/bin/reporters/agent.mjs +41 -0
- package/{src/reporters/json.mts → bin/reporters/json.mjs} +2 -5
- package/bin/reporters/text.mjs +111 -0
- package/bin/types.mjs +2 -0
- package/package.json +9 -9
- package/skills/check/SKILL.md +12 -14
- package/skills/monitor/SKILL.md +9 -5
- package/src/cache/file-cache.mts +0 -101
- package/src/cache/file-cache.test.mts +0 -91
- package/src/cache/fix-attempts.mts +0 -86
- package/src/checks/classify.mts +0 -80
- package/src/checks/classify.test.mts +0 -164
- package/src/checks/triage.mock.test.mts +0 -202
- package/src/checks/triage.mts +0 -88
- package/src/cli.mts +0 -423
- package/src/commands/check.mts +0 -188
- package/src/commands/iterate.mock.test.mts +0 -1111
- package/src/commands/iterate.mts +0 -371
- package/src/commands/ready-delay.mts +0 -117
- package/src/commands/ready-delay.test.mts +0 -116
- package/src/commands/resolve.mts +0 -92
- package/src/commands/status.mts +0 -173
- package/src/comments/resolve.mts +0 -179
- package/src/config/load.mts +0 -240
- package/src/github/batch.mts +0 -351
- package/src/github/client.mts +0 -207
- package/src/github/client.test.mts +0 -19
- package/src/github/pagination.test.mts +0 -140
- package/src/merge-status/derive.mts +0 -74
- package/src/merge-status/derive.test.mts +0 -130
- package/src/reporters/text.mts +0 -140
- package/src/types.mts +0 -309
- /package/{src → bin}/config.json +0 -0
- /package/{src → bin}/github/gql/batch-pr.gql +0 -0
- /package/{src → bin}/github/gql/dismiss-review.gql +0 -0
- /package/{src → bin}/github/gql/minimize-comment.gql +0 -0
- /package/{src → bin}/github/gql/multi-pr-status-paged.gql +0 -0
- /package/{src → bin}/github/gql/multi-pr-status.gql +0 -0
- /package/{src → bin}/github/gql/resolve-thread.gql +0 -0
- /package/{src/util/path-segment.mts → bin/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
|
-
}
|
/package/{src → bin}/config.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|