@jagreehal/shepherd 0.12.0 → 0.12.1
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/swarm/SKILL.md +13 -2
- package/src/summary.ts +20 -4
- package/templates/shepherd.yml +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jagreehal/shepherd",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Agent skills that drive a PR to merge-ready: a review swarm, thread triage, CI repair, and a loop that hands the result to stamp.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "github:jagreehal/shepherd",
|
package/skills/swarm/SKILL.md
CHANGED
|
@@ -473,8 +473,19 @@ The verdict is advice to the author. It never becomes a GitHub approval.
|
|
|
473
473
|
|
|
474
474
|
Write the round as JSON first (`references/formats.md`): the inline review and
|
|
475
475
|
the summary are both rendered from it, so neither is ever hand-written Markdown.
|
|
476
|
-
With `$SHEPHERD_HANDOFF` set, write it to `$SHEPHERD_HANDOFF/round.json
|
|
477
|
-
|
|
476
|
+
With `$SHEPHERD_HANDOFF` set, write it to `$SHEPHERD_HANDOFF/round.json`,
|
|
477
|
+
then check it before you stop:
|
|
478
|
+
|
|
479
|
+
```bash
|
|
480
|
+
shepherd summary "$SHEPHERD_HANDOFF/round.json" --body > /dev/null
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
It prints every field the renderer rejects. Fix `round.json` and run it again
|
|
484
|
+
until it prints nothing. The round is its own shape (`references/formats.md`):
|
|
485
|
+
not the Step 8 report (`posted`, `counts`, `narration`) and not the local
|
|
486
|
+
record (`stages`, `candidates`). `verdict` is `blocked`, `changes`, `nits` or
|
|
487
|
+
`good`; `verified` is the text of what the verifier checked. Then stop: the
|
|
488
|
+
publish job renders and posts both. Otherwise post every inline finding as **one** review, pinned to the reviewed commit:
|
|
478
489
|
|
|
479
490
|
```bash
|
|
480
491
|
shepherd inline round.json > review.json
|
package/src/summary.ts
CHANGED
|
@@ -10,6 +10,14 @@ const Severity = z.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW", "NIT"]);
|
|
|
10
10
|
|
|
11
11
|
const THREAD_URL = /^https:\/\/github\.com\/[\w./#-]+$/;
|
|
12
12
|
|
|
13
|
+
// A model writing the round borrows words from swarm's other JSON shapes (the Step 8 report, the local record):
|
|
14
|
+
// `changes_needed`, `skipped`, `verified: true`. Each maps onto the round's own value, so a near miss still renders.
|
|
15
|
+
const alias = (table: Record<string, string>) => (v: string) => table[v.trim().toLowerCase().replaceAll(/[\s-]+/g, "_")] ?? v;
|
|
16
|
+
|
|
17
|
+
const VERDICT_ALIAS = alias({ changes_needed: "changes", approve_with_nits: "nits", looks_good: "good", approve: "good", approved: "good" });
|
|
18
|
+
|
|
19
|
+
const STATUS_ALIAS = alias({ success: "ok", done: "ok", completed: "ok", complete: "ok", passed: "ok", error: "failed", errored: "failed", skipped: "could_not_run", not_run: "could_not_run", did_not_run: "could_not_run", missing: "could_not_run" });
|
|
20
|
+
|
|
13
21
|
const Finding = z.object({
|
|
14
22
|
file: z.string().default(""),
|
|
15
23
|
line: z
|
|
@@ -29,7 +37,8 @@ const Finding = z.object({
|
|
|
29
37
|
title: z.string().default(""),
|
|
30
38
|
// A thread link that is not a GitHub URL is dropped and the finding kept.
|
|
31
39
|
url: z.string().regex(THREAD_URL).optional().catch(undefined), // the finding's inline thread, linked from the summary
|
|
32
|
-
|
|
40
|
+
// What the verifier checked, quoted code included. A bare `true` carries no evidence, so it reads as unverified.
|
|
41
|
+
verified: z.union([z.string(), z.boolean().transform(() => "")]).default(""),
|
|
33
42
|
// The claim made checkable: an input, what the code should do on it, and what it does.
|
|
34
43
|
evidence: z.object({ input: z.string().min(1), expected: z.string().min(1), actual: z.string().min(1) }).optional(),
|
|
35
44
|
suggestion: z.string().optional(), // replacement for exactly the lines the comment covers: GitHub's one-click commit
|
|
@@ -42,8 +51,8 @@ const Finding = z.object({
|
|
|
42
51
|
|
|
43
52
|
export const SummaryInput = z.object({
|
|
44
53
|
head_sha: z.string().regex(/^[0-9a-f]{7,40}$/),
|
|
45
|
-
verdict: z.enum(["blocked", "changes", "nits", "good"]),
|
|
46
|
-
why: z.string(),
|
|
54
|
+
verdict: z.string().transform(VERDICT_ALIAS).pipe(z.enum(["blocked", "changes", "nits", "good"])),
|
|
55
|
+
why: z.string().default(""),
|
|
47
56
|
confidence: z.number().int().min(0).max(5).optional(), // how safe to merge, 5 safest
|
|
48
57
|
findings: z.array(Finding).default([]),
|
|
49
58
|
walkthrough: z.array(z.string()).default([]), // what the PR does, a few bullets for a reader who never saw it
|
|
@@ -54,7 +63,14 @@ export const SummaryInput = z.object({
|
|
|
54
63
|
pre_merge: z.array(z.object({ check: z.string(), status: z.enum(["pass", "warn", "fail"]), detail: z.string() })).default([]),
|
|
55
64
|
still_open: z.array(z.object({ url: z.string().regex(THREAD_URL).catch(""), title: z.string() })).default([]), // "" renders the title alone
|
|
56
65
|
checks: z.array(z.object({ tool: z.string(), status: z.enum(["ran", "unavailable"]), findings: z.number().default(0), reason: z.string().optional() })).default([]),
|
|
57
|
-
lenses: z
|
|
66
|
+
lenses: z
|
|
67
|
+
.array(
|
|
68
|
+
z
|
|
69
|
+
.object({ lens: z.string(), model: z.string().default(""), scope: z.union([z.string(), z.array(z.string())]).default("full"), status: z.string().transform(STATUS_ALIAS).pipe(z.enum(["ok", "failed", "could_not_run"])), take: z.string().default(""), reason: z.string().default(""), skill_blob: z.string().default("") })
|
|
70
|
+
// A lens skipped "with a reason", as the local record writes it, keeps the reason as its take.
|
|
71
|
+
.transform(({ reason, ...l }) => ({ ...l, take: l.take || reason })),
|
|
72
|
+
)
|
|
73
|
+
.default([]),
|
|
58
74
|
lenses_yml_blob: z.string().default(""),
|
|
59
75
|
});
|
|
60
76
|
|
package/templates/shepherd.yml
CHANGED
|
@@ -341,7 +341,8 @@ jobs:
|
|
|
341
341
|
mkdir -p "$SHEPHERD_HANDOFF" && cp "$SHEPHERD_FANOUT" "$SHEPHERD_HANDOFF/fanout.json"
|
|
342
342
|
opencode run --auto -m "$model" --title "shepherd #$PR" "Load the shepherd skill and run exactly one iteration on PR $PR in handoff mode:
|
|
343
343
|
SHEPHERD_HANDOFF is set, so follow the skill's Handoff mode. Swarm's first wave is in $SHEPHERD_FANOUT: dispatch
|
|
344
|
-
the router and every lens listed there in one message. Write the round to $SHEPHERD_HANDOFF/round.json
|
|
344
|
+
the router and every lens listed there in one message. Write the round to $SHEPHERD_HANDOFF/round.json and check it
|
|
345
|
+
with 'shepherd summary $SHEPHERD_HANDOFF/round.json --body > /dev/null', fixing every error it prints: the publish
|
|
345
346
|
job renders and posts the inline review and the summary from it, so post neither yourself. You are running in GitHub Actions on the PR branch,
|
|
346
347
|
already checked out, and you cannot push. Nobody is watching this session: never wait for an answer. Anything you
|
|
347
348
|
would ask the user is deferred, listed in the iteration summary, and named in status.json. Do not schedule further
|