@punks/cli 2.1.6 → 2.1.9
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/AGENTS.md +2 -0
- package/README.md +2 -2
- package/dist/data/AGENTS.md +3 -1
- package/dist/data/catalog/lint.ts +28 -82
- package/dist/data/catalog/packs.ts +5 -4
- package/dist/data/catalog/skills.ts +8 -0
- package/dist/data/hooks/format-edited-file.mjs +80 -8
- package/dist/data/hooks.test.ts +37 -3
- package/dist/data/scripts/sync-subagents.mjs +40 -0
- package/dist/index.js +1593 -690
- package/dist/skills/agnostic/cli/dp-cli/SKILL.md +3 -3
- package/dist/skills/agnostic/cli/dp-cli/references/commands.md +1 -1
- package/dist/skills/agnostic/cli/dp-cli/references/post-command-flow.md +1 -1
- package/dist/skills/agnostic/planning/create-spec/SKILL.md +3 -3
- package/dist/skills/agnostic/planning/create-spec/references/backlog-sync.md +5 -2
- package/dist/skills/agnostic/planning/implement-spec/SKILL.md +16 -7
- package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +32 -9
- package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +4 -2
- package/dist/skills/agnostic/planning/implement-spec/references/parallel.md +3 -3
- package/dist/skills/agnostic/planning/implement-spec/references/sequential.md +16 -6
- package/dist/skills/agnostic/quality/autoreview/SKILL.md +191 -0
- package/dist/skills/agnostic/quality/autoreview/scripts/autoreview +1176 -0
- package/dist/skills/agnostic/quality/autoreview/scripts/test-review-harness +176 -0
- package/dist/skills/phases/review-phase/SKILL.md +23 -9
- package/package.json +1 -1
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
usage() {
|
|
5
|
+
cat <<'EOF'
|
|
6
|
+
Usage: test-review-harness [--fixture malicious|benign] [--engine codex|claude|droid|copilot]...
|
|
7
|
+
|
|
8
|
+
Creates a temporary git repo with either a deliberately unsafe patch or a
|
|
9
|
+
security-sensitive-but-safe patch, then verifies each selected engine through
|
|
10
|
+
autoreview.
|
|
11
|
+
Default engines: codex, claude.
|
|
12
|
+
EOF
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
engines=()
|
|
16
|
+
fixture=malicious
|
|
17
|
+
while [[ $# -gt 0 ]]; do
|
|
18
|
+
case "$1" in
|
|
19
|
+
--fixture)
|
|
20
|
+
fixture=${2:-}
|
|
21
|
+
shift 2
|
|
22
|
+
;;
|
|
23
|
+
--engine)
|
|
24
|
+
engines+=("${2:-}")
|
|
25
|
+
shift 2
|
|
26
|
+
;;
|
|
27
|
+
-h|--help)
|
|
28
|
+
usage
|
|
29
|
+
exit 0
|
|
30
|
+
;;
|
|
31
|
+
*)
|
|
32
|
+
usage >&2
|
|
33
|
+
exit 2
|
|
34
|
+
;;
|
|
35
|
+
esac
|
|
36
|
+
done
|
|
37
|
+
|
|
38
|
+
case "$fixture" in
|
|
39
|
+
malicious|benign) ;;
|
|
40
|
+
*)
|
|
41
|
+
usage >&2
|
|
42
|
+
exit 2
|
|
43
|
+
;;
|
|
44
|
+
esac
|
|
45
|
+
|
|
46
|
+
if [[ ${#engines[@]} -eq 0 ]]; then
|
|
47
|
+
engines=(codex claude)
|
|
48
|
+
fi
|
|
49
|
+
|
|
50
|
+
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
51
|
+
repo=$(mktemp -d "${TMPDIR:-/tmp}/autoreview-fixture.XXXXXX")
|
|
52
|
+
trap 'rm -rf "$repo"' EXIT
|
|
53
|
+
|
|
54
|
+
cd "$repo"
|
|
55
|
+
git init --quiet
|
|
56
|
+
git config user.name "Review Fixture"
|
|
57
|
+
git config user.email "review-fixture@example.com"
|
|
58
|
+
|
|
59
|
+
if [[ "$fixture" == malicious ]]; then
|
|
60
|
+
cat > app.js <<'EOF'
|
|
61
|
+
export function uploadPath(name) {
|
|
62
|
+
return `uploads/${name.replaceAll("/", "")}`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function publicUser(user) {
|
|
66
|
+
return { id: user.id, name: user.name };
|
|
67
|
+
}
|
|
68
|
+
EOF
|
|
69
|
+
else
|
|
70
|
+
cat > app.js <<'EOF'
|
|
71
|
+
import path from "node:path";
|
|
72
|
+
|
|
73
|
+
const uploadsRoot = path.resolve("uploads");
|
|
74
|
+
|
|
75
|
+
function safeChildPath(root, name) {
|
|
76
|
+
if (name.includes("/") || name.includes("\\") || name.includes("\0")) {
|
|
77
|
+
throw new Error("invalid child name");
|
|
78
|
+
}
|
|
79
|
+
const resolved = path.resolve(root, name);
|
|
80
|
+
if (!resolved.startsWith(root + path.sep)) throw new Error("path escaped root");
|
|
81
|
+
return resolved;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function uploadPath(name) {
|
|
85
|
+
return safeChildPath(uploadsRoot, name);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function publicUser(user) {
|
|
89
|
+
return { id: user.id, name: user.name };
|
|
90
|
+
}
|
|
91
|
+
EOF
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
git add app.js
|
|
95
|
+
git commit --quiet -m "initial safe version"
|
|
96
|
+
|
|
97
|
+
if [[ "$fixture" == malicious ]]; then
|
|
98
|
+
cat > app.js <<'EOF'
|
|
99
|
+
import { execSync } from "node:child_process";
|
|
100
|
+
|
|
101
|
+
export function uploadPath(name) {
|
|
102
|
+
return `uploads/${name}`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function deleteUpload(name) {
|
|
106
|
+
return execSync(`rm -rf uploads/${name}`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function publicUser(user) {
|
|
110
|
+
return { id: user.id, name: user.name, password: user.password };
|
|
111
|
+
}
|
|
112
|
+
EOF
|
|
113
|
+
else
|
|
114
|
+
cat > app.js <<'EOF'
|
|
115
|
+
import { execFile } from "node:child_process";
|
|
116
|
+
import path from "node:path";
|
|
117
|
+
import { promisify } from "node:util";
|
|
118
|
+
|
|
119
|
+
const uploadsRoot = path.resolve("uploads");
|
|
120
|
+
const reposRoot = path.resolve("repos");
|
|
121
|
+
const execFileAsync = promisify(execFile);
|
|
122
|
+
|
|
123
|
+
function safeChildPath(root, name) {
|
|
124
|
+
if (name.includes("/") || name.includes("\\") || name.includes("\0")) {
|
|
125
|
+
throw new Error("invalid child name");
|
|
126
|
+
}
|
|
127
|
+
const resolved = path.resolve(root, name);
|
|
128
|
+
if (!resolved.startsWith(root + path.sep)) throw new Error("path escaped root");
|
|
129
|
+
return resolved;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function repoChildPath(root, name) {
|
|
133
|
+
if (!/^[A-Za-z0-9._-]+$/.test(name)) throw new Error("invalid repo name");
|
|
134
|
+
return safeChildPath(root, name);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export function uploadPath(name) {
|
|
138
|
+
return safeChildPath(uploadsRoot, name);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export async function repoStatus(repoName) {
|
|
142
|
+
const { stdout } = await execFileAsync("git", ["status", "--short"], {
|
|
143
|
+
cwd: repoChildPath(reposRoot, repoName),
|
|
144
|
+
encoding: "utf8",
|
|
145
|
+
maxBuffer: 16 * 1024 * 1024,
|
|
146
|
+
});
|
|
147
|
+
return stdout;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function publicUser(user) {
|
|
151
|
+
return { id: user.id, name: user.name };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export function accountSettingsForOwner(user, requesterId) {
|
|
155
|
+
if (String(requesterId) !== String(user.id)) throw new Error("forbidden");
|
|
156
|
+
return { id: user.id, hasPassword: Boolean(user.passwordHash) };
|
|
157
|
+
}
|
|
158
|
+
EOF
|
|
159
|
+
fi
|
|
160
|
+
|
|
161
|
+
for engine in "${engines[@]}"; do
|
|
162
|
+
echo "== $engine =="
|
|
163
|
+
if [[ "$fixture" == malicious ]]; then
|
|
164
|
+
"$script_dir/autoreview" \
|
|
165
|
+
--mode local \
|
|
166
|
+
--engine "$engine" \
|
|
167
|
+
--prompt "This is an acceptance test fixture. The changed app.js patch contains real security bugs. Review normally and report only actionable defects from the patch." \
|
|
168
|
+
--require-finding "command" \
|
|
169
|
+
--expect-findings
|
|
170
|
+
else
|
|
171
|
+
"$script_dir/autoreview" \
|
|
172
|
+
--mode local \
|
|
173
|
+
--engine "$engine" \
|
|
174
|
+
--prompt "Security calibration fixture: this patch intentionally uses filesystem paths, async execFile, and owner-gated password-adjacent state safely. Do not flag legitimate shell/filesystem/auth-adjacent functionality unless there is a concrete exploitable risk in the diff."
|
|
175
|
+
fi
|
|
176
|
+
done
|
|
@@ -31,16 +31,22 @@ or validation because delivery owns completion.
|
|
|
31
31
|
1. Identify the review target: diff, PR, branch range, files, spec, plan, docs, or runtime evidence.
|
|
32
32
|
2. State scope and readonly posture. If scope is ambiguous, ask one clarifying question.
|
|
33
33
|
3. Read local guidance in checked directories, especially relevant `AGENTS.md` files under apps, packages, docs, or nested ownership boundaries.
|
|
34
|
-
4.
|
|
34
|
+
4. Identify every scoped skill listed by those `AGENTS.md` prompts for the reviewed paths; those scoped skills are mandatory review lenses for that scope.
|
|
35
|
+
5. Use `autoreview` as the core review runtime.
|
|
36
|
+
6. Activate mandatory review lenses: `simplify`, `improve-codebase-architecture`, and applicable scoped skills.
|
|
37
|
+
|
|
38
|
+
## Review Runtime
|
|
39
|
+
|
|
40
|
+
- `autoreview`: run the OpenClaw structured review helper. This is the core runtime of the review, not a lens.
|
|
35
41
|
|
|
36
42
|
## Review Lenses
|
|
37
43
|
|
|
38
44
|
- `parallel-research`: fan out independent readonly checks when scope can split by subsystem, risk, or hypothesis.
|
|
39
|
-
- `simplify`: inspect clarity, overcomplexity, unnecessary abstraction, derivable state, naming, and scope creep.
|
|
40
|
-
- `improve-codebase-architecture`: surface architectural friction, shallow modules, poor boundaries, and module-depth opportunities.
|
|
41
|
-
- Scoped local guidance: apply applicable directory
|
|
45
|
+
- `simplify`: inspect clarity, overcomplexity, unnecessary abstraction, derivable state, naming, and scope creep. Mandatory.
|
|
46
|
+
- `improve-codebase-architecture`: surface architectural friction, shallow modules, poor boundaries, and module-depth opportunities. Mandatory.
|
|
47
|
+
- Scoped local guidance: apply every applicable directory instruction, stack skill, runbook, and ownership rule discovered in checked paths. Mandatory for every reviewed path.
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
`simplify`, `improve-codebase-architecture`, and applicable scoped skills are not optional review lenses. `parallel-research` remains conditional.
|
|
44
50
|
|
|
45
51
|
## Workflow
|
|
46
52
|
|
|
@@ -51,17 +57,22 @@ Use only the lenses that fit the target. Do not perform ceremonial delegation wh
|
|
|
51
57
|
2. Split if useful:
|
|
52
58
|
- use `parallel-research` for independent readonly checks
|
|
53
59
|
- synthesize before reporting; disagreements need evidence, not vote counting
|
|
54
|
-
3.
|
|
60
|
+
3. Run structured review:
|
|
61
|
+
- use `autoreview` for the target and capture the exact command
|
|
62
|
+
- verify each accepted finding manually against source, docs, scoped skills, and dependency contracts
|
|
63
|
+
- if standalone review finds code changes are needed, report them; if delivery owns fixes, hand them back to delivery and rerun after fixes
|
|
64
|
+
4. Review findings-first:
|
|
55
65
|
- prioritize bugs, regressions, broken contracts, missing validation, unsafe assumptions, and user-facing risks
|
|
56
66
|
- include file and line references when available
|
|
57
67
|
- separate blocking findings from improvements and optional cleanup
|
|
58
|
-
|
|
68
|
+
5. Apply mandatory local lenses:
|
|
59
69
|
- use `simplify` to flag unnecessary concepts or complexity
|
|
60
70
|
- use `improve-codebase-architecture` to flag deeper boundary opportunities, usually as follow-up RFC candidates
|
|
61
|
-
|
|
71
|
+
- check whether each reviewed path follows the scoped skills named by its nearest `AGENTS.md`
|
|
72
|
+
6. Validate:
|
|
62
73
|
- run readonly checks that match the target when safe: tests, typecheck, lint, build, docs link checks, or focused smoke commands
|
|
63
74
|
- if a check cannot run, state why and the residual risk
|
|
64
|
-
|
|
75
|
+
7. Stop:
|
|
65
76
|
- standalone mode stops after findings and recommended next actions
|
|
66
77
|
- delivery mode returns findings to `delivery-phase`; delivery decides and performs fixes/debug/docs/validation
|
|
67
78
|
|
|
@@ -79,6 +90,8 @@ Then include:
|
|
|
79
90
|
|
|
80
91
|
- open questions or assumptions
|
|
81
92
|
- validation run and result
|
|
93
|
+
- exact autoreview command and clean/accepted-findings result
|
|
94
|
+
- scoped `AGENTS.md` files and mandatory scoped skills checked
|
|
82
95
|
- short summary only after findings
|
|
83
96
|
- whether this was standalone readonly review or delivery-owned review
|
|
84
97
|
|
|
@@ -96,4 +109,5 @@ If there are no findings, say so clearly and still report validation coverage an
|
|
|
96
109
|
- Do not edit code in standalone mode unless the user explicitly asks after seeing the review scope.
|
|
97
110
|
- Do not use `simplify` as permission to refactor; report simplification opportunities unless delivery owns fixes.
|
|
98
111
|
- Do not flatten scoped `AGENTS.md` guidance into generic advice; quote the concrete constraint that matters.
|
|
112
|
+
- Do not skip scoped skills from `AGENTS.md` prompts. They are part of the review contract, not context flavor.
|
|
99
113
|
- Do not let `delivery-phase` skip this phase just because tests passed.
|