claude-everything-workflow 0.1.9 → 0.2.2
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 +19 -20
- package/README.md +112 -104
- package/agents/code-reviewer.md +15 -44
- package/agents/harness-optimizer.md +3 -2
- package/agents/planner.md +23 -107
- package/commands/code-review.md +25 -9
- package/commands/learn.md +97 -0
- package/commands/pr.md +4 -0
- package/commands/to-spec.md +11 -0
- package/hooks/check-code-size.js +33 -12
- package/hooks/check-console-log.js +72 -24
- package/package.json +5 -2
- package/rules/01-base.md +19 -42
- package/rules/02-code-size.md +6 -17
- package/rules/03-architecture.md +16 -54
- package/rules/04-error-handling.md +4 -25
- package/rules/05-git-workflow.md +9 -37
- package/rules/06-comments.md +3 -37
- package/rules/07-forbidden.md +6 -30
- package/rules/08-specialty-rules-index.md +18 -0
- package/rules/09-first-principles-adversarial-testing.md +6 -18
- package/rules/common/agent-orchestration.md +10 -47
- package/rules/common/context-hygiene.md +9 -72
- package/rules/common/harness-engineering.md +11 -38
- package/rules/common/hooks.md +11 -82
- package/rules/common/performance.md +8 -71
- package/rules/common/pr-automation.md +7 -68
- package/rules/common/skills-learning.md +12 -36
- package/rules/common/testing.md +15 -59
- package/scripts/cleanup-retired-skills.js +214 -0
- package/scripts/install.ps1 +73 -85
- package/scripts/install.sh +54 -77
- package/scripts/learning/review-confidence.js +1 -4
- package/scripts/merge-claude-settings.cjs +75 -0
- package/scripts/retired-skill-files.json +37 -0
- package/scripts/upstream-capability-baseline.json +27 -0
- package/scripts/upstream-capability-map.json +150 -0
- package/scripts/verify/core.js +91 -0
- package/scripts/verify/grilling-spec-gate-checks.js +260 -0
- package/scripts/verify/metadata-checks.js +724 -0
- package/scripts/verify/repository-checks.js +435 -0
- package/scripts/verify/runtime-checks.js +593 -0
- package/scripts/verify/workflow-checks.js +741 -0
- package/scripts/verify/workflow-ownership-fixtures.js +371 -0
- package/scripts/verify/workflow-ownership.js +780 -0
- package/scripts/verify-harness.js +16 -1075
- package/scripts/verify-upstream-capability-map.js +117 -0
- package/skills/README.md +24 -11
- package/skills/code-review/SKILL.md +50 -0
- package/skills/code-review/references/spec-reviewer-prompt.md +24 -0
- package/skills/code-review/references/standards-reviewer-prompt.md +35 -0
- package/skills/codebase-design/SKILL.md +63 -0
- package/skills/codebase-design/references/deepening.md +27 -0
- package/skills/codebase-design/references/design-it-twice.md +17 -0
- package/skills/continuous-learning-v2/SKILL.md +7 -7
- package/skills/continuous-learning-v2/config.json +0 -4
- package/skills/domain-modeling/SKILL.md +100 -0
- package/skills/feature-acceptance/SKILL.md +89 -0
- package/skills/grilling/SKILL.md +83 -0
- package/skills/handoff/SKILL.md +56 -0
- package/skills/implement/SKILL.md +97 -0
- package/skills/improve-codebase-architecture/SKILL.md +48 -0
- package/skills/iterative-retrieval/SKILL.md +10 -1
- package/skills/learn/README.md +2 -2
- package/skills/project-context/SKILL.md +94 -0
- package/skills/project-context/agents/openai.yaml +6 -0
- package/skills/project-context/references/project-context-template.md +61 -0
- package/skills/prototype/SKILL.md +50 -0
- package/skills/prototype/references/logic.md +28 -0
- package/skills/prototype/references/ui.md +30 -0
- package/skills/research/SKILL.md +48 -0
- package/skills/resolving-merge-conflicts/SKILL.md +27 -0
- package/skills/spec-gate/SKILL.md +149 -0
- package/skills/spec-gate/agents/openai.yaml +4 -0
- package/skills/spec-gate/references/spec-document-reviewer-prompt.md +31 -0
- package/skills/subagent-driven-development/SKILL.md +95 -414
- package/skills/systematic-debugging/SKILL.md +7 -51
- package/skills/systematic-debugging/references/diagnosing-bugs.upstream.md +129 -0
- package/skills/systematic-debugging/scripts/hitl-loop.template.js +75 -0
- package/skills/systematic-debugging/scripts/hitl-loop.template.sh +41 -0
- package/skills/test-driven-development/SKILL.md +18 -2
- package/skills/to-tickets/SKILL.md +94 -0
- package/skills/triage/SKILL.md +53 -0
- package/skills/triage/references/agent-brief.md +32 -0
- package/skills/triage/references/out-of-scope.md +14 -0
- package/skills/using-superpowers/SKILL.md +140 -40
- package/skills/visual-companion/SKILL.md +62 -0
- package/skills/visual-companion/agents/openai.yaml +4 -0
- package/skills/{brainstorming/visual-companion.md → visual-companion/references/guide.md} +1 -1
- package/skills/{brainstorming → visual-companion}/scripts/frame-template.html +42 -12
- package/skills/visual-companion/scripts/pages.cjs +28 -0
- package/skills/visual-companion/scripts/server-utils.cjs +82 -0
- package/skills/{brainstorming → visual-companion}/scripts/server.cjs +108 -248
- package/skills/{brainstorming → visual-companion}/scripts/start-server.sh +18 -4
- package/skills/visual-companion/scripts/websocket.cjs +86 -0
- package/skills/wayfinder/SKILL.md +57 -0
- package/commands/e2e.md +0 -28
- package/commands/evolve.md +0 -42
- package/commands/harness-audit.md +0 -27
- package/commands/instinct-status.md +0 -38
- package/commands/learn-eval.md +0 -91
- package/commands/projects.md +0 -27
- package/commands/promote.md +0 -29
- package/commands/prune.md +0 -46
- package/commands/tdd.md +0 -27
- package/homunculus/instincts/personal/always-test-first.md +0 -28
- package/homunculus/instincts/personal/pr-ci-quality-gate.md +0 -30
- package/rules/08-ecc-integration.md +0 -46
- package/rules/common/implementation.md +0 -25
- package/rules/common/security.md +0 -19
- package/skills/brainstorming/SKILL.md +0 -185
- package/skills/brainstorming/agents/openai.yaml +0 -3
- package/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
- package/skills/context-budget/SKILL.md +0 -59
- package/skills/discover-unknowns-zh/SKILL.md +0 -112
- package/skills/discover-unknowns-zh/agents/openai.yaml +0 -4
- package/skills/discover-unknowns-zh/references/prompt-patterns.md +0 -144
- package/skills/documentation-lookup/SKILL.md +0 -90
- package/skills/executing-plans/SKILL.md +0 -66
- package/skills/skill-creator/LICENSE.txt +0 -202
- package/skills/skill-creator/SKILL.md +0 -356
- package/skills/skill-creator/references/output-patterns.md +0 -82
- package/skills/skill-creator/references/workflows.md +0 -28
- package/skills/skill-creator/scripts/init_skill.py +0 -303
- package/skills/skill-creator/scripts/package_skill.py +0 -110
- package/skills/skill-creator/scripts/quick_validate.py +0 -95
- package/skills/subagent-driven-development/implementer-prompt.md +0 -139
- package/skills/subagent-driven-development/scripts/review-package +0 -44
- package/skills/subagent-driven-development/scripts/sdd-workspace +0 -22
- package/skills/subagent-driven-development/scripts/task-brief +0 -40
- package/skills/subagent-driven-development/task-reviewer-prompt.md +0 -188
- package/skills/writing-plans/SKILL.md +0 -206
- package/skills/writing-plans/plan-document-reviewer-prompt.md +0 -49
- /package/skills/{brainstorming → visual-companion}/scripts/helper.js +0 -0
- /package/skills/{brainstorming → visual-companion}/scripts/stop-server.sh +0 -0
|
@@ -1,1089 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
const fs = require("fs");
|
|
5
4
|
const path = require("path");
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
function rel(...parts) {
|
|
13
|
-
return path.join(root, ...parts);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function exists(file) {
|
|
17
|
-
return fs.existsSync(rel(file));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function read(file) {
|
|
21
|
-
return fs.readFileSync(rel(file), "utf8");
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function walk(dir = "") {
|
|
25
|
-
const base = rel(dir);
|
|
26
|
-
if (!fs.existsSync(base)) return [];
|
|
27
|
-
|
|
28
|
-
const out = [];
|
|
29
|
-
for (const entry of fs.readdirSync(base, { withFileTypes: true })) {
|
|
30
|
-
if (entry.name === ".git" || entry.name === "node_modules") continue;
|
|
31
|
-
|
|
32
|
-
const child = path.join(dir, entry.name);
|
|
33
|
-
if (entry.isDirectory()) {
|
|
34
|
-
out.push(...walk(child));
|
|
35
|
-
} else {
|
|
36
|
-
out.push(child.replace(/\\/g, "/"));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return out;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function managedFiles() {
|
|
43
|
-
const roots = [
|
|
44
|
-
"README.md",
|
|
45
|
-
"AGENTS.md",
|
|
46
|
-
"CLAUDE.md",
|
|
47
|
-
"settings.json",
|
|
48
|
-
"commands",
|
|
49
|
-
"agents",
|
|
50
|
-
"skills/continuous-learning-v2",
|
|
51
|
-
"skills/README.md",
|
|
52
|
-
"skills/test-driven-development",
|
|
53
|
-
"skills/e2e-testing",
|
|
54
|
-
"skills/context-budget",
|
|
55
|
-
"skills/iterative-retrieval",
|
|
56
|
-
"skills/using-superpowers",
|
|
57
|
-
"skills/subagent-driven-development",
|
|
58
|
-
"skills/brainstorming",
|
|
59
|
-
"skills/using-git-worktrees",
|
|
60
|
-
"skills/executing-plans",
|
|
61
|
-
"skills/writing-plans",
|
|
62
|
-
"skills/systematic-debugging",
|
|
63
|
-
"skills/verification-before-completion",
|
|
64
|
-
"skills/learn",
|
|
65
|
-
"hooks",
|
|
66
|
-
"scripts",
|
|
67
|
-
"rules",
|
|
68
|
-
];
|
|
69
|
-
|
|
70
|
-
return roots.flatMap((item) => {
|
|
71
|
-
const full = rel(item);
|
|
72
|
-
if (!fs.existsSync(full)) return [];
|
|
73
|
-
|
|
74
|
-
if (fs.statSync(full).isDirectory()) return walk(item);
|
|
75
|
-
return [item];
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function fail(message) {
|
|
80
|
-
errors.push(message);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function warn(message) {
|
|
84
|
-
warnings.push(message);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function checkCommands() {
|
|
88
|
-
const commandsDir = rel("commands");
|
|
89
|
-
const commands = fs.existsSync(commandsDir)
|
|
90
|
-
? fs
|
|
91
|
-
.readdirSync(commandsDir)
|
|
92
|
-
.filter((file) => file.endsWith(".md"))
|
|
93
|
-
.sort()
|
|
94
|
-
: [];
|
|
95
|
-
|
|
96
|
-
if (!exists("README.md")) {
|
|
97
|
-
fail("README.md is missing");
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const listed = Array.from(read("README.md").matchAll(/`\/([^`\s]+)`/g))
|
|
102
|
-
.map((match) => `${match[1]}.md`)
|
|
103
|
-
.filter((value, index, array) => array.indexOf(value) === index)
|
|
104
|
-
.sort();
|
|
105
|
-
|
|
106
|
-
for (const file of listed) {
|
|
107
|
-
if (!commands.includes(file)) {
|
|
108
|
-
fail(
|
|
109
|
-
`README lists /${file.replace(/\.md$/, "")} but commands/${file} is missing`,
|
|
110
|
-
);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
for (const file of commands) {
|
|
115
|
-
if (!listed.includes(file)) {
|
|
116
|
-
fail(
|
|
117
|
-
`commands/${file} exists but README does not list /${file.replace(/\.md$/, "")}`,
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function checkReadmeTreePaths() {
|
|
124
|
-
if (!exists("README.md")) return;
|
|
125
|
-
|
|
126
|
-
const body = read("README.md");
|
|
127
|
-
const treeMatch = body.match(/## 目录结构[\s\S]*?```([\s\S]*?)```/);
|
|
128
|
-
if (!treeMatch) {
|
|
129
|
-
fail("README.md should include a directory tree under ## 目录结构");
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const ignored = new Set([
|
|
134
|
-
"claude-everything-Workflow",
|
|
135
|
-
"agents/...",
|
|
136
|
-
]);
|
|
137
|
-
const stack = [];
|
|
138
|
-
|
|
139
|
-
for (const rawLine of treeMatch[1].split(/\r?\n/)) {
|
|
140
|
-
const markerIndex = rawLine.search(/[├└]──/);
|
|
141
|
-
if (markerIndex < 0) continue;
|
|
142
|
-
|
|
143
|
-
const match = rawLine.match(/[├└]──\s+([^#\s]+)/);
|
|
144
|
-
if (!match) continue;
|
|
145
|
-
|
|
146
|
-
const normalized = match[1].replace(/\/$/, "");
|
|
147
|
-
if (!normalized || ignored.has(normalized)) continue;
|
|
148
|
-
|
|
149
|
-
const depth = Math.floor(markerIndex / 4);
|
|
150
|
-
stack[depth] = normalized;
|
|
151
|
-
stack.length = depth + 1;
|
|
152
|
-
|
|
153
|
-
const pathInTree = stack.join("/").replace(/\\/g, "/");
|
|
154
|
-
if (ignored.has(pathInTree)) continue;
|
|
155
|
-
|
|
156
|
-
if (!exists(pathInTree)) {
|
|
157
|
-
fail(`README directory tree lists missing path: ${pathInTree}`);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function checkInstallRuntimePolicy() {
|
|
163
|
-
requireTokens("README.md", [
|
|
164
|
-
"Codex 安装共享 Workflow 材料,不默认消费 Claude Code `settings.json`",
|
|
165
|
-
"Codex 安装同一套 `hooks/` 脚本材料,但不会因为安装本仓文件而自动启用 Claude Code hooks",
|
|
166
|
-
]);
|
|
167
|
-
|
|
168
|
-
requireTokens("scripts/install.ps1", [
|
|
169
|
-
"Copy-ClaudeSettings",
|
|
170
|
-
"Install-CodexWorkflow",
|
|
171
|
-
"Copy-ConfigFile -Source (Join-Path $RootDir \"AGENTS.md\")",
|
|
172
|
-
"Remove-PackageOnlyPaths",
|
|
173
|
-
"scripts\\install.ps1",
|
|
174
|
-
]);
|
|
175
|
-
requireTokens("scripts/install.sh", [
|
|
176
|
-
"copy_claude_settings",
|
|
177
|
-
"install_codex()",
|
|
178
|
-
"copy_file \"$ROOT_DIR/AGENTS.md\" \"$dest/AGENTS.md\"",
|
|
179
|
-
"remove_package_only_paths",
|
|
180
|
-
"scripts/install.sh",
|
|
181
|
-
]);
|
|
182
|
-
|
|
183
|
-
const ps = read("scripts/install.ps1");
|
|
184
|
-
const sh = read("scripts/install.sh");
|
|
185
|
-
const sharedDirs = [
|
|
186
|
-
"rules",
|
|
187
|
-
"agents",
|
|
188
|
-
"commands",
|
|
189
|
-
"scripts",
|
|
190
|
-
"hooks",
|
|
191
|
-
"skills",
|
|
192
|
-
"homunculus",
|
|
193
|
-
"references",
|
|
194
|
-
];
|
|
195
|
-
|
|
196
|
-
for (const dir of sharedDirs) {
|
|
197
|
-
if (!ps.includes(`"${dir}"`)) {
|
|
198
|
-
fail(`scripts/install.ps1 shared dirs should include ${dir}`);
|
|
199
|
-
}
|
|
200
|
-
if (!sh.includes(`copy_dir ${dir} "$dest"`)) {
|
|
201
|
-
fail(`scripts/install.sh shared dirs should include ${dir}`);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const psCodexBody = ps.match(/function Install-CodexWorkflow \{[\s\S]*?\n\}/);
|
|
206
|
-
if (psCodexBody && psCodexBody[0].includes("settings.json")) {
|
|
207
|
-
fail("Install-CodexWorkflow should not install Claude Code settings.json");
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const shCodexBody = sh.match(/install_codex\(\) \{[\s\S]*?\n\}/);
|
|
211
|
-
if (shCodexBody && shCodexBody[0].includes("settings.json")) {
|
|
212
|
-
fail("install_codex should not install Claude Code settings.json");
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
function checkHookConfigReferences() {
|
|
217
|
-
if (!exists("settings.json")) {
|
|
218
|
-
fail("settings.json is missing");
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
const settings = JSON.parse(read("settings.json"));
|
|
223
|
-
const commands = [];
|
|
224
|
-
|
|
225
|
-
function collect(value) {
|
|
226
|
-
if (!value) return;
|
|
227
|
-
if (Array.isArray(value)) {
|
|
228
|
-
value.forEach(collect);
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
if (typeof value !== "object") return;
|
|
232
|
-
if (typeof value.command === "string") {
|
|
233
|
-
commands.push(value.command);
|
|
234
|
-
}
|
|
235
|
-
Object.values(value).forEach(collect);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
collect(settings.hooks);
|
|
239
|
-
|
|
240
|
-
const LEGACY_HOOK_PATTERNS = [
|
|
241
|
-
"scripts/hooks/run-with-flags.js",
|
|
242
|
-
"scripts/hooks/commit-quality.js",
|
|
243
|
-
"scripts/hooks/session-start.js",
|
|
244
|
-
"scripts/hooks/session-end.js",
|
|
245
|
-
"scripts/lib/hook-flags.js",
|
|
246
|
-
"hooks/observe.js",
|
|
247
|
-
"hooks/review-confidence.js",
|
|
248
|
-
"hooks/session-start.js",
|
|
249
|
-
"hooks/session-end.js",
|
|
250
|
-
"hooks/evaluate-session.js",
|
|
251
|
-
"hooks/pre-compact.js",
|
|
252
|
-
"hooks/runtime/session-utils.js",
|
|
253
|
-
];
|
|
254
|
-
|
|
255
|
-
for (const command of commands) {
|
|
256
|
-
if (command.includes("$HOME/.codex")) {
|
|
257
|
-
fail("settings.json should not point hooks at ~/.codex");
|
|
258
|
-
}
|
|
259
|
-
for (const legacy of LEGACY_HOOK_PATTERNS) {
|
|
260
|
-
if (command.includes(legacy)) {
|
|
261
|
-
fail(`settings.json contains legacy hook path: ${legacy}`);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
const matches = [...command.matchAll(/\$HOME\/\.claude\/([^" ]+)/g)];
|
|
265
|
-
for (const match of matches) {
|
|
266
|
-
const referenced = match[1];
|
|
267
|
-
if (!exists(referenced)) {
|
|
268
|
-
fail(`settings.json references missing hook path: ${referenced}`);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// 验证安装脚本包含旧版 Hook 清理逻辑
|
|
274
|
-
for (const installer of ["scripts/install.sh", "scripts/install.ps1"]) {
|
|
275
|
-
if (!exists(installer)) continue;
|
|
276
|
-
const body = read(installer);
|
|
277
|
-
if (!body.includes("LEGACY_HOOK_PATTERNS") && !body.includes("isLegacyHook")) {
|
|
278
|
-
fail(`${installer} should include legacy hook path cleanup logic`);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function checkGitHubWorkflows() {
|
|
284
|
-
requireTokens(".github/workflows/ci.yml", [
|
|
285
|
-
"pull_request",
|
|
286
|
-
"npm run verify",
|
|
287
|
-
"npm run pack:dry-run",
|
|
288
|
-
]);
|
|
289
|
-
|
|
290
|
-
requireTokens(".github/workflows/npm-publish.yml", [
|
|
291
|
-
"workflow_dispatch",
|
|
292
|
-
"id-token: write",
|
|
293
|
-
"node-version: 22.14.0",
|
|
294
|
-
"package-manager-cache: false",
|
|
295
|
-
"npm install -g npm@11.5.1",
|
|
296
|
-
"npm view \"$PACKAGE_NAME\" version --registry=https://registry.npmjs.org",
|
|
297
|
-
"BASE_VERSION=\"${REGISTRY_VERSION:-$LOCAL_VERSION}\"",
|
|
298
|
-
"npm version \"$VERSION\" --no-git-tag-version",
|
|
299
|
-
"npm publish",
|
|
300
|
-
"git push --follow-tags origin HEAD:main",
|
|
301
|
-
"[skip npm]",
|
|
302
|
-
]);
|
|
303
|
-
|
|
304
|
-
requireTokens("README.md", [
|
|
305
|
-
"npm 自动发布",
|
|
306
|
-
"受信任的发布商",
|
|
307
|
-
"npm registry 的当前 `latest` 版本",
|
|
308
|
-
]);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
function checkLearningPathPolicy() {
|
|
312
|
-
for (const dir of [
|
|
313
|
-
"skills/learn",
|
|
314
|
-
"skills/learn/pr",
|
|
315
|
-
"skills/learn/testing",
|
|
316
|
-
"skills/learn/debugging",
|
|
317
|
-
]) {
|
|
318
|
-
if (!exists(dir)) {
|
|
319
|
-
fail(`${dir} is missing`);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
if (exists("skills/learn")) {
|
|
324
|
-
const rootEntries = fs.readdirSync(rel("skills/learn"), {
|
|
325
|
-
withFileTypes: true,
|
|
326
|
-
});
|
|
327
|
-
for (const entry of rootEntries) {
|
|
328
|
-
if (entry.isFile() && ![".gitkeep", "README.md"].includes(entry.name)) {
|
|
329
|
-
fail(
|
|
330
|
-
`skills/learn root should not contain ${entry.name}; use a category directory`,
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
requireTokens("README.md", [
|
|
337
|
-
"skills/learn/<category>/",
|
|
338
|
-
"观察、候选和迁移来源",
|
|
339
|
-
]);
|
|
340
|
-
requireTokens("commands/evolve.md", [
|
|
341
|
-
"skills/learn/<category>/",
|
|
342
|
-
"候选证据来源",
|
|
343
|
-
]);
|
|
344
|
-
requireTokens("commands/learn-eval.md", [
|
|
345
|
-
"skills/learn/<category>/",
|
|
346
|
-
"权威学习产物",
|
|
347
|
-
]);
|
|
348
|
-
requireTokens("rules/common/skills-learning.md", [
|
|
349
|
-
"skills/learn/<category>/",
|
|
350
|
-
"最终可复用学习产物",
|
|
351
|
-
]);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
function checkSkillCategoryIndex() {
|
|
355
|
-
requireTokens("skills/README.md", [
|
|
356
|
-
"正式 skill 保持 `skills/<skill-name>/SKILL.md` 平铺结构",
|
|
357
|
-
"Process / 门禁",
|
|
358
|
-
"Engineering / 开发实践",
|
|
359
|
-
"Harness / 上下文与编排",
|
|
360
|
-
"Meta / Skill 管理",
|
|
361
|
-
"Learn / 学习沉淀",
|
|
362
|
-
]);
|
|
363
|
-
|
|
364
|
-
const indexed = new Set(
|
|
365
|
-
[...read("skills/README.md").matchAll(/^- `([^`]+)`:/gm)].map(
|
|
366
|
-
(match) => match[1],
|
|
367
|
-
),
|
|
368
|
-
);
|
|
369
|
-
const skillsDir = rel("skills");
|
|
370
|
-
const actual = fs
|
|
371
|
-
.readdirSync(skillsDir, { withFileTypes: true })
|
|
372
|
-
.filter((entry) => entry.isDirectory())
|
|
373
|
-
.map((entry) => entry.name)
|
|
374
|
-
.filter((name) => name !== "learn")
|
|
375
|
-
.filter((name) => exists(path.join("skills", name, "SKILL.md")))
|
|
376
|
-
.sort();
|
|
377
|
-
|
|
378
|
-
for (const name of actual) {
|
|
379
|
-
if (!indexed.has(name)) {
|
|
380
|
-
fail(`skills/README.md should categorize skill ${name}`);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
for (const name of indexed) {
|
|
385
|
-
if (name === "learn") continue;
|
|
386
|
-
if (!exists(path.join("skills", name, "SKILL.md"))) {
|
|
387
|
-
fail(`skills/README.md lists missing skill ${name}`);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
requireTokens("README.md", [
|
|
392
|
-
"Skill 分类索引",
|
|
393
|
-
"物理目录保持平铺以兼容发现",
|
|
394
|
-
"只有学习产物使用物理分类目录 `skills/learn/<category>/`",
|
|
395
|
-
]);
|
|
396
|
-
|
|
397
|
-
requireTokens("rules/common/skills-learning.md", [
|
|
398
|
-
"正式 skill 目录保持 `skills/<skill-name>/SKILL.md` 平铺结构",
|
|
399
|
-
"分类维护在 `skills/README.md`",
|
|
400
|
-
]);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
function checkRouterTargets() {
|
|
404
|
-
const expected = [
|
|
405
|
-
["commands/code-review.md", ["agents/code-reviewer.md"]],
|
|
406
|
-
[
|
|
407
|
-
"commands/tdd.md",
|
|
408
|
-
["agents/tdd-guide.md", "skills/test-driven-development/SKILL.md"],
|
|
409
|
-
],
|
|
410
|
-
[
|
|
411
|
-
"commands/e2e.md",
|
|
412
|
-
["agents/e2e-runner.md", "skills/e2e-testing/SKILL.md"],
|
|
413
|
-
],
|
|
414
|
-
["commands/harness-audit.md", ["agents/harness-optimizer.md"]],
|
|
415
|
-
];
|
|
416
|
-
|
|
417
|
-
for (const [command, targets] of expected) {
|
|
418
|
-
if (!exists(command)) {
|
|
419
|
-
fail(`${command} is missing`);
|
|
420
|
-
continue;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
const body = read(command);
|
|
424
|
-
for (const target of targets) {
|
|
425
|
-
if (!exists(target)) {
|
|
426
|
-
fail(`${command} references missing ${target}`);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
const token = target
|
|
430
|
-
.replace(/^agents\//, "")
|
|
431
|
-
.replace(/^skills\//, "skills/")
|
|
432
|
-
.replace(/\.md$/, "")
|
|
433
|
-
.replace(/\/SKILL$/, "");
|
|
434
|
-
|
|
435
|
-
if (!body.includes(token) && !body.includes(target)) {
|
|
436
|
-
fail(`${command} should mention ${target}`);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
function checkNpmPackageSurface() {
|
|
443
|
-
requireTokens("package.json", [
|
|
444
|
-
'"name": "claude-everything-workflow"',
|
|
445
|
-
'"bin"',
|
|
446
|
-
'"claude-everything-workflow": "bin/claude-everything-workflow.js"',
|
|
447
|
-
'"cew": "bin/claude-everything-workflow.js"',
|
|
448
|
-
'"scripts/"',
|
|
449
|
-
]);
|
|
450
|
-
|
|
451
|
-
requireTokens("bin/claude-everything-workflow.js", [
|
|
452
|
-
"cew install",
|
|
453
|
-
"cew verify",
|
|
454
|
-
]);
|
|
455
|
-
|
|
456
|
-
const cliHelp = spawnSync(
|
|
457
|
-
process.execPath,
|
|
458
|
-
["bin/claude-everything-workflow.js", "--help"],
|
|
459
|
-
{
|
|
460
|
-
cwd: root,
|
|
461
|
-
encoding: "utf8",
|
|
462
|
-
timeout: 10000,
|
|
463
|
-
},
|
|
464
|
-
);
|
|
465
|
-
if (cliHelp.status !== 0 || !cliHelp.stdout.includes("cew install")) {
|
|
466
|
-
fail(
|
|
467
|
-
`npm CLI help failed:\n${cliHelp.stdout}${cliHelp.stderr}`,
|
|
468
|
-
);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
function checkSkillLinks() {
|
|
473
|
-
requireTokens("skills/using-superpowers/SKILL.md", [
|
|
474
|
-
"Skill Invocation Rule",
|
|
475
|
-
"Task arrives",
|
|
476
|
-
"approved plan + SDD/commit approved?",
|
|
477
|
-
"external skill learning or edit?",
|
|
478
|
-
"process skills before implementation skills",
|
|
479
|
-
"skills/brainstorming/SKILL.md",
|
|
480
|
-
"skills/systematic-debugging/SKILL.md",
|
|
481
|
-
"skills/verification-before-completion/SKILL.md",
|
|
482
|
-
"User instructions",
|
|
483
|
-
]);
|
|
484
|
-
|
|
485
|
-
requireTokens("skills/subagent-driven-development/SKILL.md", [
|
|
486
|
-
".superpowers/sdd/progress.md",
|
|
487
|
-
"scripts/task-brief",
|
|
488
|
-
"scripts/review-package BASE HEAD",
|
|
489
|
-
"task-reviewer-prompt.md",
|
|
490
|
-
"Local Git Boundary",
|
|
491
|
-
"skills/executing-plans/SKILL.md",
|
|
492
|
-
]);
|
|
493
|
-
|
|
494
|
-
requireTokens("skills/subagent-driven-development/task-reviewer-prompt.md", [
|
|
495
|
-
"Spec Compliance",
|
|
496
|
-
"Task quality",
|
|
497
|
-
"Cannot verify from diff",
|
|
498
|
-
"[BRIEF_FILE]",
|
|
499
|
-
"[DIFF_FILE]",
|
|
500
|
-
]);
|
|
501
|
-
|
|
502
|
-
for (const script of [
|
|
503
|
-
"skills/subagent-driven-development/scripts/sdd-workspace",
|
|
504
|
-
"skills/subagent-driven-development/scripts/task-brief",
|
|
505
|
-
"skills/subagent-driven-development/scripts/review-package",
|
|
506
|
-
]) {
|
|
507
|
-
if (!exists(script)) fail(`${script} is missing`);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
const expected = [
|
|
511
|
-
["agents/e2e-runner.md", "skills/e2e-testing/SKILL.md"],
|
|
512
|
-
["agents/tdd-guide.md", "skills/test-driven-development/SKILL.md"],
|
|
513
|
-
];
|
|
514
|
-
|
|
515
|
-
for (const [agent, skill] of expected) {
|
|
516
|
-
if (!exists(agent)) fail(`${agent} is missing`);
|
|
517
|
-
if (!exists(skill)) fail(`${skill} is missing`);
|
|
518
|
-
if (exists(agent) && !read(agent).includes(skill)) {
|
|
519
|
-
fail(`${agent} should reference ${skill}`);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
for (const agent of ["agents/harness-optimizer.md", "agents/planner.md"]) {
|
|
524
|
-
if (!exists(agent)) {
|
|
525
|
-
fail(`${agent} is missing`);
|
|
526
|
-
continue;
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
if (!read(agent).includes("brainstorming")) {
|
|
530
|
-
fail(`${agent} should reference brainstorming skill`);
|
|
531
|
-
}
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
if (!exists("skills/writing-plans/SKILL.md")) {
|
|
535
|
-
fail("skills/writing-plans/SKILL.md is missing");
|
|
536
|
-
} else {
|
|
537
|
-
const writingPlans = read("skills/writing-plans/SKILL.md");
|
|
538
|
-
const requiredTokens = [
|
|
539
|
-
"Project-Agent Loop",
|
|
540
|
-
"skills/using-git-worktrees/SKILL.md",
|
|
541
|
-
"skills/executing-plans/SKILL.md",
|
|
542
|
-
"agents/tdd-guide.md",
|
|
543
|
-
"agents/code-reviewer.md",
|
|
544
|
-
"skills/systematic-debugging/SKILL.md",
|
|
545
|
-
"skills/verification-before-completion/SKILL.md",
|
|
546
|
-
"skills/subagent-driven-development/SKILL.md",
|
|
547
|
-
"## Global Constraints",
|
|
548
|
-
"**Interfaces:**",
|
|
549
|
-
"Completion Loop",
|
|
550
|
-
"`/verify`",
|
|
551
|
-
"`/pr`",
|
|
552
|
-
];
|
|
553
|
-
|
|
554
|
-
for (const token of requiredTokens) {
|
|
555
|
-
if (!writingPlans.includes(token)) {
|
|
556
|
-
fail(`skills/writing-plans/SKILL.md should include ${token}`);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
for (const forbidden of [
|
|
561
|
-
"superpowers:subagent-driven-development",
|
|
562
|
-
"superpowers:executing-plans",
|
|
563
|
-
]) {
|
|
564
|
-
if (writingPlans.includes(forbidden)) {
|
|
565
|
-
fail(`skills/writing-plans/SKILL.md contains dangling ${forbidden}`);
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
if (!exists("skills/systematic-debugging/SKILL.md")) {
|
|
571
|
-
fail("skills/systematic-debugging/SKILL.md is missing");
|
|
572
|
-
} else {
|
|
573
|
-
const debugging = read("skills/systematic-debugging/SKILL.md");
|
|
574
|
-
for (const token of [
|
|
575
|
-
"Phase 1: Root Cause Investigation",
|
|
576
|
-
"Phase 2: Pattern Analysis",
|
|
577
|
-
"Phase 3: Hypothesis Test",
|
|
578
|
-
"Phase 4: Fix And Verify",
|
|
579
|
-
"Return To Plan",
|
|
580
|
-
]) {
|
|
581
|
-
if (!debugging.includes(token)) {
|
|
582
|
-
fail(`skills/systematic-debugging/SKILL.md should include ${token}`);
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
requireTokens("skills/using-git-worktrees/SKILL.md", [
|
|
588
|
-
"git worktree add",
|
|
589
|
-
"git worktree remove",
|
|
590
|
-
"Do not create a worktree for simple single-file edits",
|
|
591
|
-
]);
|
|
592
|
-
|
|
593
|
-
requireTokens("skills/executing-plans/SKILL.md", [
|
|
594
|
-
"approved implementation plan",
|
|
595
|
-
"Inline Execution",
|
|
596
|
-
"Project-Agent Loop",
|
|
597
|
-
"skills/systematic-debugging/SKILL.md",
|
|
598
|
-
"skills/verification-before-completion/SKILL.md",
|
|
599
|
-
]);
|
|
600
|
-
|
|
601
|
-
requireTokens("skills/verification-before-completion/SKILL.md", [
|
|
602
|
-
"fresh verification evidence",
|
|
603
|
-
"skills/systematic-debugging/SKILL.md",
|
|
604
|
-
"skipped checks",
|
|
605
|
-
"remaining risk",
|
|
606
|
-
]);
|
|
607
|
-
|
|
608
|
-
requireTokens("skills/context-budget/SKILL.md", [
|
|
609
|
-
"MCP 默认策略",
|
|
610
|
-
"通用",
|
|
611
|
-
"MCP 明显优于 CLI/API/原生能力",
|
|
612
|
-
"报告格式",
|
|
613
|
-
]);
|
|
614
|
-
|
|
615
|
-
requireTokens("skills/iterative-retrieval/SKILL.md", [
|
|
616
|
-
"Dispatch",
|
|
617
|
-
"Evaluate",
|
|
618
|
-
"Refine",
|
|
619
|
-
"最多跑 3 轮",
|
|
620
|
-
"回传格式",
|
|
621
|
-
]);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
function checkRuleLoadingPolicy() {
|
|
625
|
-
if (!exists("AGENTS.md")) {
|
|
626
|
-
fail("AGENTS.md is missing");
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
const agentsBody = read("AGENTS.md");
|
|
631
|
-
if (!agentsBody.includes("规则加载策略")) {
|
|
632
|
-
fail("AGENTS.md should include a rule loading policy section");
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
const forbidsFullRulesLoad =
|
|
636
|
-
agentsBody.includes("不要默认全量加载 `rules/`") ||
|
|
637
|
-
agentsBody.includes("不要默认全量加载`rules/`") ||
|
|
638
|
-
agentsBody.includes("仍然只读取当前任务直接相关的规则文件");
|
|
639
|
-
|
|
640
|
-
const forbidsFullCommonLoad =
|
|
641
|
-
agentsBody.includes("不要默认全量加载 `rules/common/`") ||
|
|
642
|
-
agentsBody.includes("不要默认全量加载`rules/common/`") ||
|
|
643
|
-
agentsBody.includes("`rules/common/` 是专项参考区");
|
|
644
|
-
|
|
645
|
-
if (!forbidsFullRulesLoad || !forbidsFullCommonLoad) {
|
|
646
|
-
fail("AGENTS.md should forbid loading all rules by default");
|
|
647
|
-
}
|
|
648
|
-
if (!agentsBody.includes("~/.codex/rules/")) {
|
|
649
|
-
fail("AGENTS.md should mention Codex user-level rules fallback");
|
|
650
|
-
}
|
|
651
|
-
if (!agentsBody.includes("~/.claude/rules/")) {
|
|
652
|
-
fail("AGENTS.md should mention Claude Code user-level rules fallback");
|
|
653
|
-
}
|
|
654
|
-
if (!agentsBody.includes("不能把项目规则目录缺失等同于") || !agentsBody.includes("无规则")) {
|
|
655
|
-
fail("AGENTS.md should forbid treating a missing project rules directory as no rules");
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
if (exists("CLAUDE.md")) {
|
|
659
|
-
const claudeBody = read("CLAUDE.md");
|
|
660
|
-
if (!claudeBody.includes("AGENTS.md")) {
|
|
661
|
-
fail("CLAUDE.md should reference AGENTS.md");
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
|
|
665
|
-
if (!exists("rules/08-ecc-integration.md")) {
|
|
666
|
-
fail("rules/08-ecc-integration.md is missing");
|
|
667
|
-
return;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
const ecc = read("rules/08-ecc-integration.md");
|
|
671
|
-
if (!ecc.includes("触发矩阵")) {
|
|
672
|
-
fail("rules/08-ecc-integration.md should include a trigger matrix");
|
|
673
|
-
}
|
|
674
|
-
if (!ecc.includes("不得因为") || !ecc.includes("可能有用") || !ecc.includes("而一次性读取完整")) {
|
|
675
|
-
fail(
|
|
676
|
-
"rules/08-ecc-integration.md should forbid full rules loading just because it might be useful",
|
|
677
|
-
);
|
|
678
|
-
}
|
|
679
|
-
}
|
|
680
|
-
|
|
681
|
-
function requireTokens(file, tokens) {
|
|
682
|
-
if (!exists(file)) {
|
|
683
|
-
fail(`${file} is missing`);
|
|
684
|
-
return;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
const body = read(file);
|
|
688
|
-
for (const token of tokens) {
|
|
689
|
-
if (!body.includes(token)) {
|
|
690
|
-
fail(`${file} should include ${token}`);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
function checkSuperpowersDevLoop() {
|
|
696
|
-
requireTokens("README.md", [
|
|
697
|
-
"Superpowers 风格开发闭环",
|
|
698
|
-
"using-superpowers",
|
|
699
|
-
"subagent-driven-development",
|
|
700
|
-
".superpowers/sdd",
|
|
701
|
-
"Global Constraints",
|
|
702
|
-
"Interfaces",
|
|
703
|
-
"?key=",
|
|
704
|
-
"4 小时",
|
|
705
|
-
"using-git-worktrees",
|
|
706
|
-
"context-budget",
|
|
707
|
-
"iterative-retrieval",
|
|
708
|
-
"executing-plans",
|
|
709
|
-
"verification-before-completion",
|
|
710
|
-
"没有 spec,不进入 plan",
|
|
711
|
-
"没有用户审核,不进入实现",
|
|
712
|
-
"没有 failing test,不写行为代码",
|
|
713
|
-
"没有 review,不标记任务完成",
|
|
714
|
-
"没有新鲜验证证据,不声明完成、通过、已修复或 ready",
|
|
715
|
-
"没有 verify,不进入 PR",
|
|
716
|
-
"`/learn-eval --preview` 是非阻塞学习建议门",
|
|
717
|
-
]);
|
|
718
|
-
|
|
719
|
-
requireTokens("rules/01-base.md", [
|
|
720
|
-
"Spec Gate",
|
|
721
|
-
"User Review Gate",
|
|
722
|
-
"Plan Gate",
|
|
723
|
-
"Red Test Gate",
|
|
724
|
-
"Task Review Gate",
|
|
725
|
-
"Verify Gate",
|
|
726
|
-
"PR Gate",
|
|
727
|
-
]);
|
|
728
|
-
|
|
729
|
-
requireTokens("rules/common/skills-learning.md", [
|
|
730
|
-
"skills/using-superpowers/SKILL.md",
|
|
731
|
-
"process skill 优先于 implementation skill",
|
|
732
|
-
"不凭记忆执行 skill",
|
|
733
|
-
]);
|
|
734
|
-
|
|
735
|
-
requireTokens("skills/brainstorming/SKILL.md", [
|
|
736
|
-
"Spec Gate",
|
|
737
|
-
"reviewed and approved the saved spec",
|
|
738
|
-
]);
|
|
739
|
-
|
|
740
|
-
requireTokens("skills/writing-plans/SKILL.md", [
|
|
741
|
-
"## Preconditions",
|
|
742
|
-
"approved spec",
|
|
743
|
-
"Plan Gate",
|
|
744
|
-
"## Global Constraints",
|
|
745
|
-
"**Interfaces:**",
|
|
746
|
-
"skills/subagent-driven-development/SKILL.md",
|
|
747
|
-
]);
|
|
748
|
-
|
|
749
|
-
requireTokens("skills/test-driven-development/SKILL.md", [
|
|
750
|
-
"## Red Test Gate",
|
|
751
|
-
"失败测试",
|
|
752
|
-
"替代验证",
|
|
753
|
-
]);
|
|
754
|
-
|
|
755
|
-
requireTokens("commands/verify.md", [
|
|
756
|
-
"Verify Gate",
|
|
757
|
-
"已运行检查",
|
|
758
|
-
"未运行检查",
|
|
759
|
-
"是否可以进入 `/pr`",
|
|
760
|
-
]);
|
|
761
|
-
|
|
762
|
-
requireTokens("commands/pr.md", [
|
|
763
|
-
"PR Gate",
|
|
764
|
-
"`/verify` 或等价验证结果",
|
|
765
|
-
"先回到验证和修复阶段",
|
|
766
|
-
]);
|
|
767
|
-
|
|
768
|
-
requireTokens("skills/brainstorming/SKILL.md", [
|
|
769
|
-
"docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md",
|
|
770
|
-
"Write design doc",
|
|
771
|
-
]);
|
|
772
|
-
|
|
773
|
-
requireTokens("skills/brainstorming/visual-companion.md", [
|
|
774
|
-
"session key",
|
|
775
|
-
"?key=",
|
|
776
|
-
"4 hours idle",
|
|
777
|
-
"--idle-timeout-minutes",
|
|
778
|
-
"same port",
|
|
779
|
-
]);
|
|
780
|
-
|
|
781
|
-
requireTokens("skills/brainstorming/scripts/server.cjs", [
|
|
782
|
-
"BRAINSTORM_TOKEN",
|
|
783
|
-
"BRAINSTORM_TOKEN_FILE",
|
|
784
|
-
"timingSafeEqualStr",
|
|
785
|
-
"Cache-Control",
|
|
786
|
-
"X-Frame-Options",
|
|
787
|
-
"Default 4 hours",
|
|
788
|
-
]);
|
|
789
|
-
|
|
790
|
-
requireTokens("skills/brainstorming/scripts/start-server.sh", [
|
|
791
|
-
"--idle-timeout-minutes",
|
|
792
|
-
"BRAINSTORM_TOKEN_FILE",
|
|
793
|
-
"umask 077",
|
|
794
|
-
".last-token",
|
|
795
|
-
]);
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
function checkForbiddenCommandDrift() {
|
|
799
|
-
const patterns = [
|
|
800
|
-
[/\/docs\b/, "removed /docs command reference"],
|
|
801
|
-
[/\/instinct-export\b/, "removed /instinct-export command reference"],
|
|
802
|
-
[/\/instinct-import\b/, "removed /instinct-import command reference"],
|
|
803
|
-
[/--decay\b/, "deprecated decay flag"],
|
|
804
|
-
[/decay-confidence/, "deprecated decay-confidence script"],
|
|
805
|
-
[/置信度降低 0\.02/, "automatic confidence decay"],
|
|
806
|
-
[/超过.*天.*删除/, "time-based instinct deletion"],
|
|
807
|
-
[/--max-age\b/, "time-based prune flag"],
|
|
808
|
-
[/清理过期/, "expired-instinct cleanup wording"],
|
|
809
|
-
];
|
|
810
|
-
|
|
811
|
-
for (const file of managedFiles()) {
|
|
812
|
-
if ([
|
|
813
|
-
"scripts/verify-harness.js",
|
|
814
|
-
"scripts/install.ps1",
|
|
815
|
-
"scripts/install.sh",
|
|
816
|
-
].includes(file)) continue;
|
|
817
|
-
if (!/\.(md|json|js|ps1|sh)$/.test(file)) continue;
|
|
818
|
-
|
|
819
|
-
const body = read(file);
|
|
820
|
-
const lines = body.split(/\r?\n/);
|
|
821
|
-
for (const [pattern, label] of patterns) {
|
|
822
|
-
lines.forEach((line, index) => {
|
|
823
|
-
if (pattern.test(line)) {
|
|
824
|
-
fail(`${file}:${index + 1} contains ${label}: ${line.trim()}`);
|
|
825
|
-
}
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
function checkScriptLayout() {
|
|
832
|
-
for (const legacyPath of [
|
|
833
|
-
"scripts/hooks/run-with-flags.js",
|
|
834
|
-
"scripts/hooks/commit-quality.js",
|
|
835
|
-
"scripts/hooks/session-start.js",
|
|
836
|
-
"scripts/hooks/session-end.js",
|
|
837
|
-
"scripts/lib/hook-flags.js",
|
|
838
|
-
"scripts/lib/utils.js",
|
|
839
|
-
"scripts/learning/utils.js",
|
|
840
|
-
"hooks/review-confidence.js",
|
|
841
|
-
"hooks/session-start.js",
|
|
842
|
-
"hooks/session-end.js",
|
|
843
|
-
"hooks/evaluate-session.js",
|
|
844
|
-
"hooks/pre-compact.js",
|
|
845
|
-
"hooks/runtime/session-utils.js",
|
|
846
|
-
]) {
|
|
847
|
-
if (exists(legacyPath)) {
|
|
848
|
-
fail(`${legacyPath} should not exist after script layout cleanup`);
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
|
|
852
|
-
for (const requiredPath of [
|
|
853
|
-
"hooks/runtime/run-with-flags.js",
|
|
854
|
-
"hooks/runtime/hook-flags.js",
|
|
855
|
-
"hooks/commit-quality.js",
|
|
856
|
-
"hooks/check-console-log.js",
|
|
857
|
-
"hooks/check-code-size.js",
|
|
858
|
-
"scripts/learning/review-confidence.js",
|
|
859
|
-
"scripts/learning/project-utils.js",
|
|
860
|
-
"scripts/learning/projects.js",
|
|
861
|
-
"scripts/learning/promote.js",
|
|
862
|
-
"scripts/learning/migrate-homunculus.js",
|
|
863
|
-
]) {
|
|
864
|
-
if (!exists(requiredPath)) {
|
|
865
|
-
fail(`${requiredPath} is missing after script layout cleanup`);
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
|
|
869
|
-
requireTokens("settings.json", [
|
|
870
|
-
"hooks/runtime/run-with-flags.js",
|
|
871
|
-
"hooks/check-console-log.js",
|
|
872
|
-
"hooks/check-code-size.js",
|
|
873
|
-
"hooks/commit-quality.js",
|
|
874
|
-
"skills/continuous-learning-v2/hooks/observe-v2.js",
|
|
875
|
-
]);
|
|
876
|
-
|
|
877
|
-
requireTokens("scripts/install.ps1", [
|
|
878
|
-
"Remove-ObsoleteWorkflowPaths",
|
|
879
|
-
"scripts\\hooks\\run-with-flags.js",
|
|
880
|
-
"hooks\\review-confidence.js",
|
|
881
|
-
]);
|
|
882
|
-
|
|
883
|
-
requireTokens("scripts/install.sh", [
|
|
884
|
-
"remove_obsolete_workflow_paths",
|
|
885
|
-
"scripts/hooks/run-with-flags.js",
|
|
886
|
-
"hooks/review-confidence.js",
|
|
887
|
-
]);
|
|
888
|
-
|
|
889
|
-
for (const file of managedFiles()) {
|
|
890
|
-
if ([
|
|
891
|
-
"scripts/verify-harness.js",
|
|
892
|
-
"scripts/install.ps1",
|
|
893
|
-
"scripts/install.sh",
|
|
894
|
-
].includes(file)) continue;
|
|
895
|
-
if (!/\.(md|json|js|ps1|sh)$/.test(file)) continue;
|
|
896
|
-
|
|
897
|
-
const body = read(file);
|
|
898
|
-
for (const forbidden of [
|
|
899
|
-
"scripts/hooks/run-with-flags.js",
|
|
900
|
-
"scripts/lib/hook-flags.js",
|
|
901
|
-
"hooks/review-confidence.js",
|
|
902
|
-
"hooks/session-start.js",
|
|
903
|
-
"hooks/session-end.js",
|
|
904
|
-
"hooks/evaluate-session.js",
|
|
905
|
-
"hooks/pre-compact.js",
|
|
906
|
-
"hooks/runtime/session-utils.js",
|
|
907
|
-
]) {
|
|
908
|
-
if (body.includes(forbidden)) {
|
|
909
|
-
fail(`${file} references legacy path ${forbidden}`);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
|
|
915
|
-
function checkContinuousLearningV21() {
|
|
916
|
-
requireTokens("skills/continuous-learning-v2/config.json", [
|
|
917
|
-
'"version": "2.1"',
|
|
918
|
-
'"data_root": "~/.local/share/ecc-homunculus"',
|
|
919
|
-
'"project_scoped": true',
|
|
920
|
-
'"promotion_min_confidence": 0.7',
|
|
921
|
-
]);
|
|
922
|
-
|
|
923
|
-
requireTokens("skills/continuous-learning-v2/SKILL.md", [
|
|
924
|
-
"Continuous Learning v2.1",
|
|
925
|
-
"projects/<project-id>/",
|
|
926
|
-
"observations.jsonl",
|
|
927
|
-
"/projects",
|
|
928
|
-
"/promote --dry-run",
|
|
929
|
-
"migrate-homunculus.js --dry-run",
|
|
930
|
-
"observer.enabled",
|
|
931
|
-
]);
|
|
932
|
-
|
|
933
|
-
requireTokens("skills/continuous-learning-v2/hooks/observe-v2.js", [
|
|
934
|
-
"registerProject",
|
|
935
|
-
"projects",
|
|
936
|
-
"observations.jsonl",
|
|
937
|
-
]);
|
|
938
|
-
|
|
939
|
-
requireTokens("scripts/learning/review-confidence.js", [
|
|
940
|
-
"--scope <范围>",
|
|
941
|
-
"project",
|
|
942
|
-
"global",
|
|
943
|
-
"legacy",
|
|
944
|
-
]);
|
|
945
|
-
|
|
946
|
-
requireTokens("commands/projects.md", [
|
|
947
|
-
"scripts/learning/projects.js",
|
|
948
|
-
"--register-current",
|
|
949
|
-
]);
|
|
950
|
-
|
|
951
|
-
requireTokens("commands/promote.md", [
|
|
952
|
-
"scripts/learning/promote.js",
|
|
953
|
-
"--dry-run",
|
|
954
|
-
"--apply",
|
|
955
|
-
]);
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
function checkObserveV2() {
|
|
959
|
-
const hook = rel("skills/continuous-learning-v2/hooks/observe-v2.js");
|
|
960
|
-
const config = rel("skills/continuous-learning-v2/config.json");
|
|
961
|
-
if (fs.existsSync(rel("hooks/observe.js"))) {
|
|
962
|
-
fail("legacy hooks/observe.js should not exist; use observe-v2 only");
|
|
963
|
-
}
|
|
964
|
-
if (!fs.existsSync(hook)) return fail("observe-v2.js is missing");
|
|
965
|
-
if (!fs.existsSync(config))
|
|
966
|
-
return fail("continuous-learning-v2 config is missing");
|
|
967
|
-
|
|
968
|
-
const tempHome = rel(".tmp-verify-harness");
|
|
969
|
-
const tempConfigDir = path.join(
|
|
970
|
-
tempHome,
|
|
971
|
-
".claude",
|
|
972
|
-
"skills",
|
|
973
|
-
"continuous-learning-v2",
|
|
974
|
-
);
|
|
975
|
-
const observationsPath = path.join(
|
|
976
|
-
tempHome,
|
|
977
|
-
".claude",
|
|
978
|
-
"homunculus",
|
|
979
|
-
"observations.jsonl",
|
|
980
|
-
);
|
|
981
|
-
|
|
982
|
-
fs.rmSync(tempHome, { recursive: true, force: true });
|
|
983
|
-
fs.mkdirSync(tempConfigDir, { recursive: true });
|
|
984
|
-
|
|
985
|
-
const cfg = JSON.parse(fs.readFileSync(config, "utf8"));
|
|
986
|
-
cfg.observation = cfg.observation || {};
|
|
987
|
-
cfg.observation.enabled = true;
|
|
988
|
-
cfg.observation.store_path = observationsPath;
|
|
989
|
-
fs.writeFileSync(
|
|
990
|
-
path.join(tempConfigDir, "config.json"),
|
|
991
|
-
JSON.stringify(cfg, null, 2),
|
|
992
|
-
);
|
|
993
|
-
|
|
994
|
-
const input = JSON.stringify({
|
|
995
|
-
tool: "Edit",
|
|
996
|
-
cwd: root,
|
|
997
|
-
tool_input: { file_path: "README.md" },
|
|
998
|
-
session_id: "verify-harness",
|
|
999
|
-
});
|
|
1000
|
-
|
|
1001
|
-
const result = spawnSync(process.execPath, [hook, "post"], {
|
|
1002
|
-
cwd: root,
|
|
1003
|
-
input,
|
|
1004
|
-
encoding: "utf8",
|
|
1005
|
-
env: {
|
|
1006
|
-
...process.env,
|
|
1007
|
-
HOME: tempHome,
|
|
1008
|
-
USERPROFILE: tempHome,
|
|
1009
|
-
},
|
|
1010
|
-
timeout: 10000,
|
|
1011
|
-
});
|
|
1012
|
-
|
|
1013
|
-
if (result.error)
|
|
1014
|
-
fail(`observe-v2 smoke test failed: ${result.error.message}`);
|
|
1015
|
-
if (result.status !== 0)
|
|
1016
|
-
fail(`observe-v2 exited ${result.status}: ${result.stderr}`);
|
|
1017
|
-
if (!fs.existsSync(observationsPath)) {
|
|
1018
|
-
fail("observe-v2 did not write observations.jsonl");
|
|
1019
|
-
} else {
|
|
1020
|
-
const firstLine = fs
|
|
1021
|
-
.readFileSync(observationsPath, "utf8")
|
|
1022
|
-
.split(/\r?\n/)[0];
|
|
1023
|
-
try {
|
|
1024
|
-
const event = JSON.parse(firstLine);
|
|
1025
|
-
if (event.tool !== "Edit" || event.event !== "tool_complete") {
|
|
1026
|
-
fail("observe-v2 wrote unexpected observation payload");
|
|
1027
|
-
}
|
|
1028
|
-
} catch (err) {
|
|
1029
|
-
fail(`observe-v2 wrote invalid JSON: ${err.message}`);
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
|
-
fs.rmSync(tempHome, { recursive: true, force: true });
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
function checkGitDiffWhitespace() {
|
|
1037
|
-
const isRepo = spawnSync("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
1038
|
-
cwd: root,
|
|
1039
|
-
encoding: "utf8",
|
|
1040
|
-
timeout: 30000,
|
|
1041
|
-
});
|
|
1042
|
-
|
|
1043
|
-
if (isRepo.status !== 0) {
|
|
1044
|
-
return;
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
const result = spawnSync("git", ["diff", "--check"], {
|
|
1048
|
-
cwd: root,
|
|
1049
|
-
encoding: "utf8",
|
|
1050
|
-
timeout: 30000,
|
|
1051
|
-
});
|
|
1052
|
-
|
|
1053
|
-
if (result.status !== 0) {
|
|
1054
|
-
fail(`git diff --check failed:\n${result.stdout}${result.stderr}`);
|
|
1055
|
-
} else if (result.stderr.trim()) {
|
|
1056
|
-
warn(result.stderr.trim());
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
5
|
+
const { createHarnessContext } = require("./verify/core");
|
|
6
|
+
const { runMetadataChecks } = require("./verify/metadata-checks");
|
|
7
|
+
const { runRepositoryChecks } = require("./verify/repository-checks");
|
|
8
|
+
const { runWorkflowChecks } = require("./verify/workflow-checks");
|
|
9
|
+
const { runRuntimeChecks } = require("./verify/runtime-checks");
|
|
1059
10
|
|
|
1060
11
|
function main() {
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
checkRouterTargets();
|
|
1069
|
-
checkNpmPackageSurface();
|
|
1070
|
-
checkSkillLinks();
|
|
1071
|
-
checkRuleLoadingPolicy();
|
|
1072
|
-
checkSuperpowersDevLoop();
|
|
1073
|
-
checkForbiddenCommandDrift();
|
|
1074
|
-
checkScriptLayout();
|
|
1075
|
-
checkContinuousLearningV21();
|
|
1076
|
-
checkObserveV2();
|
|
1077
|
-
checkGitDiffWhitespace();
|
|
12
|
+
const root = path.resolve(__dirname, "..");
|
|
13
|
+
const context = createHarnessContext(root);
|
|
14
|
+
|
|
15
|
+
runMetadataChecks(context);
|
|
16
|
+
runRepositoryChecks(context);
|
|
17
|
+
runWorkflowChecks(context);
|
|
18
|
+
runRuntimeChecks(context);
|
|
1078
19
|
|
|
1079
|
-
if (warnings.length > 0) {
|
|
20
|
+
if (context.warnings.length > 0) {
|
|
1080
21
|
console.error("Warnings:");
|
|
1081
|
-
warnings.forEach((item) => console.error(`- ${item}`));
|
|
22
|
+
context.warnings.forEach((item) => console.error(`- ${item}`));
|
|
1082
23
|
}
|
|
1083
24
|
|
|
1084
|
-
if (errors.length > 0) {
|
|
25
|
+
if (context.errors.length > 0) {
|
|
1085
26
|
console.error("Harness verification failed:");
|
|
1086
|
-
errors.forEach((item) => console.error(`- ${item}`));
|
|
27
|
+
context.errors.forEach((item) => console.error(`- ${item}`));
|
|
1087
28
|
process.exit(1);
|
|
1088
29
|
}
|
|
1089
30
|
|