@brainervirus/workit-core 7.1.0 → 7.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.
- package/package.json +1 -1
- package/skills/workit-fanout/SKILL.md +29 -20
- package/skills/workit-fanout/references/brief.md +45 -0
- package/skills/workit-implement/SKILL.md +3 -2
- package/skills/workit-ship/SKILL.md +31 -13
- package/src/autonomy.ts +132 -25
- package/src/core/methods.ts +4 -4
- package/src/core/workspaces.ts +7 -2
- package/src/fanout-check.ts +294 -0
- package/src/fanout.ts +916 -0
- package/src/forge/report.ts +59 -0
package/src/forge/report.ts
CHANGED
|
@@ -34,6 +34,23 @@ export type NextAction =
|
|
|
34
34
|
| "NOT_MERGEABLE"
|
|
35
35
|
| "READY";
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* The next babysitting step for a `green`/`merged` endpoint, coarser than
|
|
39
|
+
* `next`: `wait` is CI running (`workit ci wait`); `wait-forge` is CI done
|
|
40
|
+
* but the forge still deciding (merge queue, mergeability computing);
|
|
41
|
+
* `ready` means nothing is left for the agent (a human approval may still be
|
|
42
|
+
* pending); null for a closed, unmerged PR.
|
|
43
|
+
*/
|
|
44
|
+
export type BabysitAction =
|
|
45
|
+
| "wait"
|
|
46
|
+
| "wait-forge"
|
|
47
|
+
| "mark-ready"
|
|
48
|
+
| "fix-ci"
|
|
49
|
+
| "address-threads"
|
|
50
|
+
| "update-branch"
|
|
51
|
+
| "ready"
|
|
52
|
+
| "merged";
|
|
53
|
+
|
|
37
54
|
export type FailingCheck = {
|
|
38
55
|
name: string;
|
|
39
56
|
url: string | null;
|
|
@@ -90,6 +107,7 @@ export type PrStatusDoc = {
|
|
|
90
107
|
identity: { login: string | null; credential: string; note?: string } | null;
|
|
91
108
|
truncated: boolean;
|
|
92
109
|
next: NextAction;
|
|
110
|
+
babysit: BabysitAction | null;
|
|
93
111
|
};
|
|
94
112
|
|
|
95
113
|
/** Failing checks whose log tail is fetched; the rest list without a tail. */
|
|
@@ -192,6 +210,42 @@ export function nextAction(input: NextInput): NextAction {
|
|
|
192
210
|
return blockersOf(input)[0]?.next ?? "READY";
|
|
193
211
|
}
|
|
194
212
|
|
|
213
|
+
/**
|
|
214
|
+
* Map `next` (plus the first blocker's reason) to one babysitting step. The
|
|
215
|
+
* branch is updated only when the forge requires it (conflicts, a required
|
|
216
|
+
* rebase): merely behind its base is still `ready`, so a busy base never
|
|
217
|
+
* starts a rebase/CI loop or drops approvals. A draft reads `mark-ready` once
|
|
218
|
+
* nothing else is open, even when a review is also pending.
|
|
219
|
+
*/
|
|
220
|
+
export function babysitAction(
|
|
221
|
+
next: NextAction,
|
|
222
|
+
reason: string | null,
|
|
223
|
+
draft: boolean,
|
|
224
|
+
): BabysitAction | null {
|
|
225
|
+
switch (next) {
|
|
226
|
+
case "MERGED":
|
|
227
|
+
return "merged";
|
|
228
|
+
case "CLOSED":
|
|
229
|
+
return null;
|
|
230
|
+
case "RESOLVE_CONFLICTS":
|
|
231
|
+
case "REBASE":
|
|
232
|
+
return "update-branch";
|
|
233
|
+
case "RESOLVE_THREADS":
|
|
234
|
+
case "ADDRESS_REVIEW":
|
|
235
|
+
return "address-threads";
|
|
236
|
+
case "FIX_CI":
|
|
237
|
+
return "fix-ci";
|
|
238
|
+
case "WAITING_CI":
|
|
239
|
+
return "wait";
|
|
240
|
+
case "IN_MERGE_QUEUE":
|
|
241
|
+
return "wait-forge";
|
|
242
|
+
default:
|
|
243
|
+
if (draft) return "mark-ready";
|
|
244
|
+
if (next === "NOT_MERGEABLE" && reason === "mergeability_unknown") return "wait-forge";
|
|
245
|
+
return "ready";
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
195
249
|
/**
|
|
196
250
|
* Count head against the base tip the API reported, locally. A pure read:
|
|
197
251
|
* missing commits are fetched by id (no destination ref, no FETCH_HEAD), so
|
|
@@ -363,6 +417,11 @@ export function buildStatusDoc(
|
|
|
363
417
|
identity: options.identity ?? null,
|
|
364
418
|
truncated: status.truncated,
|
|
365
419
|
next: blockers[0]?.next ?? "READY",
|
|
420
|
+
babysit: babysitAction(
|
|
421
|
+
blockers[0]?.next ?? "READY",
|
|
422
|
+
blockers[0]?.reason ?? null,
|
|
423
|
+
status.draft || blockers.some((blocker) => blocker.next === "MARK_READY"),
|
|
424
|
+
),
|
|
366
425
|
});
|
|
367
426
|
}
|
|
368
427
|
|