@iceinvein/agent-skills 0.1.35 → 0.1.36
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/index.json +2 -2
- package/skills/magpie/README.md +2 -2
- package/skills/magpie/SKILL.md +26 -12
- package/skills/magpie/scripts/__tests__/preflight.test.ts +15 -3
- package/skills/magpie/scripts/__tests__/render-progress.test.ts +1 -1
- package/skills/magpie/scripts/preflight.ts +13 -2
- package/skills/magpie/scripts/render-progress.ts +2 -2
- package/skills/magpie/scripts/setup-cmd.ts +12 -1
- package/skills/magpie/skill.json +2 -2
package/package.json
CHANGED
package/skills/index.json
CHANGED
|
@@ -219,9 +219,9 @@
|
|
|
219
219
|
},
|
|
220
220
|
{
|
|
221
221
|
"name": "magpie",
|
|
222
|
-
"description": "Interactive PR review pipeline. Runs five parallel specialist subagents (security, bugs, performance, code-smells, architecture), dedupes findings, applies a critic rubric, peer-reviews via codex exec, and serves an interactive HTML report for selecting findings to post via gh. Bundles a Bun CLI installed onto PATH via the skill's postinstall step. Use when the user asks to review a GitHub pull request.",
|
|
222
|
+
"description": "Interactive PR review pipeline. Runs five parallel specialist subagents (security, bugs, performance, code-smells, architecture), dedupes findings, applies a critic rubric, peer-reviews via codex exec (falling back to a Claude second opinion when codex is unavailable), and serves an interactive HTML report for selecting findings to post via gh. Bundles a Bun CLI installed onto PATH via the skill's postinstall step. Use when the user asks to review a GitHub pull request.",
|
|
223
223
|
"type": "prompt",
|
|
224
|
-
"version": "0.
|
|
224
|
+
"version": "0.6.0"
|
|
225
225
|
},
|
|
226
226
|
{
|
|
227
227
|
"name": "module-secret-auditor",
|
package/skills/magpie/README.md
CHANGED
|
@@ -4,14 +4,14 @@ Interactive Claude Code skill that runs a multi-stage PR review pipeline inside
|
|
|
4
4
|
|
|
5
5
|
## What it does
|
|
6
6
|
|
|
7
|
-
Given a GitHub PR number, dispatches five specialist subagents in parallel (security, bugs, performance, code-smells, architecture), dedupes their findings, applies a critic rubric, peer-reviews via `codex exec
|
|
7
|
+
Given a GitHub PR number, dispatches five specialist subagents in parallel (security, bugs, performance, code-smells, architecture), dedupes their findings, applies a critic rubric, peer-reviews via `codex exec` (falling back to a Claude second-opinion subagent when codex is unavailable), serves an interactive HTML report, and posts the findings the user selects via `gh`.
|
|
8
8
|
|
|
9
9
|
## Requirements
|
|
10
10
|
|
|
11
11
|
- `bun` on PATH (https://bun.sh)
|
|
12
12
|
- `gh` on PATH, authenticated (`gh auth status`)
|
|
13
|
-
- `codex` on PATH, authenticated
|
|
14
13
|
- `git` on PATH
|
|
14
|
+
- `codex` on PATH, authenticated (optional; if absent the peer-review stage falls back to a Claude second-opinion subagent)
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
package/skills/magpie/SKILL.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: magpie
|
|
3
|
-
description: Interactive PR review pipeline. Runs five parallel specialist subagents (security, bugs, performance, code-smells, architecture), dedupes findings, applies a critic rubric, peer-reviews via codex exec, and serves an interactive HTML report for selecting findings to post via gh. Use when the user asks to review a GitHub pull request.
|
|
3
|
+
description: Interactive PR review pipeline. Runs five parallel specialist subagents (security, bugs, performance, code-smells, architecture), dedupes findings, applies a critic rubric, peer-reviews via codex exec (falling back to a Claude second opinion when codex is unavailable), and serves an interactive HTML report for selecting findings to post via gh. Use when the user asks to review a GitHub pull request.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Magpie
|
|
7
7
|
|
|
8
8
|
## Prerequisites
|
|
9
9
|
|
|
10
|
-
The skill pre-flights `bun`, `gh`, `
|
|
10
|
+
The skill pre-flights `bun`, `gh`, `git` (required) and `codex` (optional). If a required binary is missing the run aborts with a single install hint line. `codex` is the preferred peer reviewer, but it is optional: if it is missing the run continues and the peer-review stage falls back to a Claude second-opinion subagent (setup prints a one-line notice and logs `{stage: preflight, status: done, missingOptional: ["codex"]}`).
|
|
11
11
|
|
|
12
12
|
## Stage walkthrough
|
|
13
13
|
|
|
@@ -147,17 +147,23 @@ Read `$RUN_DIR/findings.deduped.json`. Apply the critic rubric from this SKILL.m
|
|
|
147
147
|
|
|
148
148
|
### 6. Peer review
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
This stage always runs. `codex` is the preferred reviewer because it is a different model from the Claude agents that produced the findings; when `codex` is unavailable, a Claude second-opinion subagent stands in.
|
|
151
|
+
|
|
152
|
+
Build the peer-review prompt first: take the `magpie-peer-review` block from this SKILL.md and substitute the placeholders listed in its `## Substitute before use` preamble. Write the substituted prompt to `$RUN_DIR/peer-prompt.md`.
|
|
153
|
+
|
|
154
|
+
**Codex path (preferred).** If `codex` is available (setup did not log `missingOptional: ["codex"]` and `command -v codex` succeeds), set `<<PEER_PROVIDER>>` to `codex` and run codex with the prompt piped on stdin:
|
|
151
155
|
|
|
152
156
|
```
|
|
153
157
|
codex exec < "$RUN_DIR/peer-prompt.md" > "$RUN_DIR/peer.out"
|
|
154
158
|
```
|
|
155
159
|
|
|
156
|
-
`peer.out` is codex's full transcript; extract the fenced JSON block tagged `review-peer-review` from it to get the verdicts array. Write that verdicts array to `$RUN_DIR/peer.json`
|
|
160
|
+
`peer.out` is codex's full transcript; extract the fenced JSON block tagged `review-peer-review` from it to get the verdicts array. Write that verdicts array to `$RUN_DIR/peer.json`, append `{stage: peer-review, status: done, provider: codex}`, then apply the verdicts as described below.
|
|
161
|
+
|
|
162
|
+
If codex returns non-zero, do not abort: fall through to the Claude path and record `{stage: peer-review, provider: codex, status: error}` first.
|
|
157
163
|
|
|
158
|
-
|
|
164
|
+
**Claude path (fallback).** When `codex` is unavailable or failed, get the second opinion from a Claude subagent instead. Set `<<PEER_PROVIDER>>` to `claude`, then prepend the `magpie-peer-review-claude-preamble` block from this SKILL.md to the substituted peer-review prompt (the preamble forces genuine independence, since the reviewer shares a model family with the primary reviewers). Dispatch one subagent (Agent tool, `general-purpose`) whose entire task is that combined prompt, and instruct it to return only the fenced `review-peer-review` JSON block. Write its output to `$RUN_DIR/peer.out`, extract the `review-peer-review` block to `$RUN_DIR/peer.json`, and append `{stage: peer-review, status: done, provider: claude}`.
|
|
159
165
|
|
|
160
|
-
|
|
166
|
+
**Apply the verdicts (both paths).** Parse the verdicts JSON and apply the `update` / `add` entries (an empty array means no change), then write `findings.final.json`. Re-render progress.
|
|
161
167
|
|
|
162
168
|
### 7. Report
|
|
163
169
|
|
|
@@ -564,13 +570,9 @@ Output every candidate exactly once. Do not invent ids. Do not output anything o
|
|
|
564
570
|
|
|
565
571
|
## Peer-review prompt
|
|
566
572
|
|
|
567
|
-
The agent substitutes the placeholders below
|
|
568
|
-
|
|
569
|
-
```
|
|
570
|
-
codex exec < <run-dir>/peer-prompt.md > <run-dir>/peer.out
|
|
571
|
-
```
|
|
573
|
+
The agent substitutes the placeholders below and writes the result to `<run-dir>/peer-prompt.md`. Step 6 then feeds that prompt to the peer reviewer: `codex exec < <run-dir>/peer-prompt.md > <run-dir>/peer.out` when codex is available, or a Claude `general-purpose` subagent (with the `magpie-peer-review-claude-preamble` prepended) writing to `<run-dir>/peer.out` when it is not.
|
|
572
574
|
|
|
573
|
-
|
|
575
|
+
Either way, extract the fenced `review-peer-review` block from `peer.out` and save it to `<run-dir>/peer.json`.
|
|
574
576
|
|
|
575
577
|
## Substitute before use
|
|
576
578
|
|
|
@@ -638,6 +640,18 @@ Rules:
|
|
|
638
640
|
```
|
|
639
641
|
````
|
|
640
642
|
|
|
643
|
+
## Claude peer-review preamble
|
|
644
|
+
|
|
645
|
+
Used only by the Claude fallback path in step 6. Prepend this block verbatim (no substitutions) to the substituted `magpie-peer-review` prompt before dispatching the subagent. Its job is to buy back the independence you lose by using the same model family that produced the findings: the reviewer must re-derive each verdict from the diff rather than trusting the finding text, and must actively resist rubber-stamping.
|
|
646
|
+
|
|
647
|
+
````magpie-peer-review-claude-preamble
|
|
648
|
+
You are a fresh, independent second-opinion reviewer. You have no memory of, and no stake in, how the findings below were produced. They were generated by other agents that share your model family, so they may carry the same blind spots you would: do not defer to them, and do not assume they are correct because they sound confident.
|
|
649
|
+
|
|
650
|
+
Ground every verdict in the diff hunks provided, not in the prose of the finding. For each finding, independently re-derive whether the described problem is actually present on the cited line before you accept it. If a finding's reasoning does not hold against the hunk, or the anchor is wrong, or the severity is off, say so with "update"; if you can see a clearly actionable adjacent issue in the same hunks that was missed, add it. When the existing finding survives your own check unchanged, leave it alone.
|
|
651
|
+
|
|
652
|
+
Hold yourself to the exact same output contract and constraints described below. Return [] when the review is already sound.
|
|
653
|
+
````
|
|
654
|
+
|
|
641
655
|
## Resuming a crashed run
|
|
642
656
|
|
|
643
657
|
If the user re-invokes the skill and a `$RUN_DIR/state/server-info` exists:
|
|
@@ -10,18 +10,30 @@ test('returns ok when all binaries resolve', async () => {
|
|
|
10
10
|
})
|
|
11
11
|
expect(result.ok).toBe(true)
|
|
12
12
|
expect(result.missing).toEqual([])
|
|
13
|
+
expect(result.missingOptional).toEqual([])
|
|
13
14
|
})
|
|
14
15
|
|
|
15
|
-
test('returns missing list when binaries do not resolve', async () => {
|
|
16
|
+
test('returns missing list when required binaries do not resolve', async () => {
|
|
16
17
|
const result = await preflight({
|
|
17
18
|
bun: 'bun',
|
|
18
19
|
gh: 'definitely-not-a-binary-xyz123',
|
|
19
|
-
codex: '
|
|
20
|
+
codex: 'echo',
|
|
20
21
|
git: 'git',
|
|
21
22
|
})
|
|
22
23
|
expect(result.ok).toBe(false)
|
|
23
24
|
expect(result.missing).toContain('gh')
|
|
24
|
-
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('missing codex is optional and does not abort the run', async () => {
|
|
28
|
+
const result = await preflight({
|
|
29
|
+
bun: 'bun',
|
|
30
|
+
gh: 'echo',
|
|
31
|
+
codex: 'also-not-real-abc456',
|
|
32
|
+
git: 'git',
|
|
33
|
+
})
|
|
34
|
+
expect(result.ok).toBe(true)
|
|
35
|
+
expect(result.missing).not.toContain('codex')
|
|
36
|
+
expect(result.missingOptional).toContain('codex')
|
|
25
37
|
})
|
|
26
38
|
|
|
27
39
|
test('renderInstallHint produces a single-line message per missing tool', () => {
|
|
@@ -92,7 +92,7 @@ test('each pipeline stage exposes a short sublabel so first-timers can learn wha
|
|
|
92
92
|
})
|
|
93
93
|
expect(html).toContain('class="hint"')
|
|
94
94
|
expect(html).toContain('five reviewers in parallel')
|
|
95
|
-
expect(html).toContain('second opinion
|
|
95
|
+
expect(html).toContain('independent second opinion')
|
|
96
96
|
})
|
|
97
97
|
|
|
98
98
|
test('renderProgressHtml includes the archived banner element', () => {
|
|
@@ -7,10 +7,17 @@ export type Deps = {
|
|
|
7
7
|
|
|
8
8
|
export type PreflightResult = {
|
|
9
9
|
ok: boolean
|
|
10
|
+
/** Required binaries that did not resolve; any entry here aborts the run. */
|
|
10
11
|
missing: string[]
|
|
12
|
+
/** Optional binaries that did not resolve; these only degrade features, they never abort. */
|
|
13
|
+
missingOptional: string[]
|
|
11
14
|
resolved: Record<keyof Deps, string | null>
|
|
12
15
|
}
|
|
13
16
|
|
|
17
|
+
// codex only powers the optional peer-review stage; a missing codex degrades that
|
|
18
|
+
// stage to skipped rather than blocking the whole run.
|
|
19
|
+
const OPTIONAL_DEPS: ReadonlySet<keyof Deps> = new Set<keyof Deps>(['codex'])
|
|
20
|
+
|
|
14
21
|
export async function preflight(deps: Deps): Promise<PreflightResult> {
|
|
15
22
|
const resolved: Record<keyof Deps, string | null> = {
|
|
16
23
|
bun: Bun.which(deps.bun),
|
|
@@ -18,8 +25,12 @@ export async function preflight(deps: Deps): Promise<PreflightResult> {
|
|
|
18
25
|
codex: Bun.which(deps.codex),
|
|
19
26
|
git: Bun.which(deps.git),
|
|
20
27
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
28
|
+
const unresolved = (Object.keys(resolved) as Array<keyof Deps>).filter(
|
|
29
|
+
(k) => resolved[k] === null,
|
|
30
|
+
)
|
|
31
|
+
const missing = unresolved.filter((k) => !OPTIONAL_DEPS.has(k))
|
|
32
|
+
const missingOptional = unresolved.filter((k) => OPTIONAL_DEPS.has(k))
|
|
33
|
+
return { ok: missing.length === 0, missing, missingOptional, resolved }
|
|
23
34
|
}
|
|
24
35
|
|
|
25
36
|
const HINTS: Record<string, string> = {
|
|
@@ -19,7 +19,7 @@ const STAGE_HINT: Record<StageId, string> = {
|
|
|
19
19
|
specialists: 'five reviewers in parallel',
|
|
20
20
|
dedupe: 'merge overlaps',
|
|
21
21
|
critic: 'keep the high-signal ones',
|
|
22
|
-
'peer-review': 'second opinion
|
|
22
|
+
'peer-review': 'independent second opinion',
|
|
23
23
|
report: 'render this page',
|
|
24
24
|
post: 'comment on the PR',
|
|
25
25
|
}
|
|
@@ -30,7 +30,7 @@ const STAGE_NOW_DOING: Record<StageId, string> = {
|
|
|
30
30
|
specialists: 'Five reviewers reading the diff in parallel',
|
|
31
31
|
dedupe: 'Merging overlapping findings',
|
|
32
32
|
critic: 'Keeping only the high-signal ones',
|
|
33
|
-
'peer-review': '
|
|
33
|
+
'peer-review': 'Getting an independent second opinion',
|
|
34
34
|
report: 'Composing the report page',
|
|
35
35
|
post: 'Ready to post; switch tabs to pick findings',
|
|
36
36
|
}
|
|
@@ -32,7 +32,18 @@ export async function runSetup(input: RunSetupInput): Promise<number> {
|
|
|
32
32
|
await cleanup(input.runDir)
|
|
33
33
|
return 3
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
if (preResult.missingOptional.length > 0) {
|
|
36
|
+
await logLine(input.runDir, {
|
|
37
|
+
stage: 'preflight',
|
|
38
|
+
status: 'done',
|
|
39
|
+
missingOptional: preResult.missingOptional,
|
|
40
|
+
})
|
|
41
|
+
process.stderr.write(
|
|
42
|
+
`magpie: optional dependency unavailable, some stages will be skipped:\n${renderInstallHint(preResult.missingOptional)}\n`,
|
|
43
|
+
)
|
|
44
|
+
} else {
|
|
45
|
+
await logLine(input.runDir, { stage: 'preflight', status: 'done' })
|
|
46
|
+
}
|
|
36
47
|
|
|
37
48
|
const fetched = await fetchPr({
|
|
38
49
|
ghBin: deps.gh,
|
package/skills/magpie/skill.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magpie",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Interactive PR review pipeline. Runs five parallel specialist subagents (security, bugs, performance, code-smells, architecture), dedupes findings, applies a critic rubric, peer-reviews via codex exec, and serves an interactive HTML report for selecting findings to post via gh. Bundles a Bun CLI installed onto PATH via the skill's postinstall step. Use when the user asks to review a GitHub pull request.",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Interactive PR review pipeline. Runs five parallel specialist subagents (security, bugs, performance, code-smells, architecture), dedupes findings, applies a critic rubric, peer-reviews via codex exec (falling back to a Claude second opinion when codex is unavailable), and serves an interactive HTML report for selecting findings to post via gh. Bundles a Bun CLI installed onto PATH via the skill's postinstall step. Use when the user asks to review a GitHub pull request.",
|
|
5
5
|
"author": "iceinvein",
|
|
6
6
|
"type": "prompt",
|
|
7
7
|
"tools": [
|