claude-everything-workflow 0.2.8 → 0.2.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.
Files changed (42) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/AGENTS.md +11 -18
  4. package/agents/e2e-runner.md +1 -1
  5. package/evals/routing-scenarios.json +253 -0
  6. package/harness/manifest.json +2 -28
  7. package/hooks/check-console-log.js +2 -2
  8. package/package.json +4 -2
  9. package/rules/01-base.md +2 -2
  10. package/rules/02-implementation.md +7 -6
  11. package/rules/05-git-workflow.md +4 -6
  12. package/rules/common/agent-orchestration.md +1 -1
  13. package/rules/common/pr-automation.md +1 -1
  14. package/rules/common/testing.md +2 -2
  15. package/scripts/eval-scenarios.js +106 -0
  16. package/scripts/install-rules.js +186 -17
  17. package/scripts/install.ps1 +42 -15
  18. package/scripts/install.sh +31 -12
  19. package/scripts/legacy-common-rule-hashes.json +4 -0
  20. package/scripts/retired-skill-files.json +7 -0
  21. package/scripts/verify/install-rules.test.js +80 -24
  22. package/scripts/verify/metadata-checks.js +7 -8
  23. package/scripts/verify/repository-checks.js +44 -368
  24. package/scripts/verify/scenario-checks.js +108 -0
  25. package/scripts/verify/scenario-checks.test.js +84 -0
  26. package/scripts/verify/workflow-checks.js +85 -586
  27. package/scripts/verify-harness.js +2 -0
  28. package/skills/README.md +2 -4
  29. package/skills/feature-acceptance/SKILL.md +8 -8
  30. package/skills/{e2e-testing/SKILL.md → feature-acceptance/references/e2e-testing.md} +3 -9
  31. package/skills/implement/SKILL.md +2 -0
  32. package/skills/{subagent-driven-development/SKILL.md → implement/references/parallel-delivery.md} +7 -9
  33. package/skills/implement/references/ticket-delivery.md +1 -1
  34. package/skills/using-superpowers/SKILL.md +24 -103
  35. package/rules/07-forbidden.md +0 -20
  36. package/rules/08-specialty-rules-index.md +0 -18
  37. package/rules/09-first-principles-adversarial-testing.md +0 -30
  38. package/scripts/verify/continuation-checks.test.js +0 -101
  39. package/scripts/verify/grilling-spec-gate-checks.js +0 -297
  40. package/scripts/verify/workflow-ownership-fixtures.js +0 -371
  41. package/scripts/verify/workflow-ownership.js +0 -780
  42. /package/skills/{e2e-testing → feature-acceptance}/references/playwright-patterns.md +0 -0
@@ -1,618 +1,117 @@
1
1
  "use strict";
2
2
 
3
- const path = require("path");
4
- const { spawnSync } = require("child_process");
5
- const { runGrillingSpecGateChecks } = require("./grilling-spec-gate-checks");
6
- const { runWorkflowOwnershipChecks } = require("./workflow-ownership");
7
-
8
- let root;
9
- let exists;
10
- let read;
11
- let managedFiles;
12
- let fail;
13
- let requireTokens;
14
- let isVerifierImplementation;
15
-
16
- function bindContext(context) {
17
- ({
18
- root,
19
- exists,
20
- read,
21
- managedFiles,
22
- fail,
23
- requireTokens,
24
- isVerifierImplementation,
25
- } = context);
26
- }
27
-
28
- function checkSuperpowersDevLoop() {
29
-
30
- requireTokens("rules/01-base.md", [
31
- "# 执行原则",
32
- "先理解用户目标",
33
- "真实调用链",
34
- "复用项目现有入口",
35
- "标准库",
36
- "已安装依赖",
37
- "最小新增代码",
38
- "skills/using-superpowers/SKILL.md",
39
- ]);
40
-
41
- requireTokens("rules/common/skills-learning.md", [
42
- "skills/using-superpowers/SKILL.md",
43
- "路由权威来源",
44
- "rules/01-base.md",
45
- "rules/common/agent-orchestration.md",
46
- "不凭记忆执行 skill",
47
- ]);
48
-
49
- // Skill 正文契约在各自的专门检查中维护;这里仅验证跨文件的闭环入口。
50
- // 避免同一组流程词在多个检查点重复登记,允许 Skill 删除解释性文案。
51
-
52
- requireTokens("skills/test-driven-development/SKILL.md", [
53
- "## Red Test Gate",
54
- "失败测试",
55
- "替代验证",
56
- ]);
57
-
58
- requireTokens("commands/verify.md", [
59
- "Verify Gate",
60
- "已运行检查",
61
- "未运行检查",
62
- "是否可以进入 `/pr`",
63
- ]);
64
-
65
- requireTokens("commands/pr.md", [
66
- "PR Gate",
67
- "`/verify` 或等价验证结果",
68
- "先回到验证和修复阶段",
69
- ]);
70
- }
71
-
72
- function checkSpecVisualContracts() {
73
- requireTokens("skills/spec-gate/SKILL.md", [
74
- "docs/superpowers/specs/YYYY-MM-DD-<topic>-design.md",
75
- "Self-Review",
76
- ]);
77
-
78
- requireTokens("skills/visual-companion/references/guide.md", [
79
- "session key",
80
- "?key=",
81
- "4 hours idle",
82
- "--idle-timeout-minutes",
83
- "same port",
84
- ]);
85
-
86
- requireTokens("skills/visual-companion/scripts/server.cjs", [
87
- "BRAINSTORM_TOKEN",
88
- "BRAINSTORM_TOKEN_FILE",
89
- "Default 4 hours",
90
- ]);
91
-
92
- requireTokens("skills/visual-companion/scripts/server-utils.cjs", [
93
- "timingSafeEqualStr",
94
- "Cache-Control",
95
- "X-Frame-Options",
96
- ]);
97
-
98
- requireTokens("skills/visual-companion/scripts/start-server.sh", [
99
- "--idle-timeout-minutes",
100
- "BRAINSTORM_TOKEN_FILE",
101
- "umask 077",
102
- ".last-token",
103
- ]);
104
- }
105
-
106
- function checkSuperpowersArtifactPolicy() {
107
- requireTokens("rules/05-git-workflow.md", [
108
- "## Superpowers 本地工件",
109
- "Superpowers 生成的 Spec 和本地 tickets 仅用于本地工作流",
110
- "无论保存位置都不得暂存或提交",
111
- ]);
112
- const repoRoot = spawnSync("git", ["rev-parse", "--show-toplevel"], {
113
- cwd: root,
114
- encoding: "utf8",
115
- timeout: 30000,
116
- });
117
-
118
- if (
119
- repoRoot.status !== 0 ||
120
- path.resolve(repoRoot.stdout.trim()) !== path.resolve(root)
121
- ) {
3
+ const fs = require("fs");
4
+
5
+ const ROUTER_PATH = "skills/using-superpowers/SKILL.md";
6
+ const MAX_ROUTER_LINES = 50;
7
+ const EXPECTED_TOP_LEVEL_RULES = [
8
+ "01-base.md",
9
+ "02-implementation.md",
10
+ "05-git-workflow.md",
11
+ ];
12
+ const RETIRED_SKILL_PATHS = [
13
+ "skills/brainstorming/SKILL.md",
14
+ "skills/writing-plans/SKILL.md",
15
+ "skills/executing-plans/SKILL.md",
16
+ "skills/research/SKILL.md",
17
+ "skills/wayfinder/SKILL.md",
18
+ "skills/find-skills/SKILL.md",
19
+ "skills/project-context/SKILL.md",
20
+ "skills/iterative-retrieval/SKILL.md",
21
+ "skills/using-git-worktrees/SKILL.md",
22
+ "skills/verification-before-completion/SKILL.md",
23
+ "skills/subagent-driven-development/SKILL.md",
24
+ "skills/e2e-testing/SKILL.md",
25
+ ];
26
+ const RETIRED_RULE_PATHS = [
27
+ "rules/07-forbidden.md",
28
+ "rules/08-specialty-rules-index.md",
29
+ "rules/09-first-principles-adversarial-testing.md",
30
+ ];
31
+
32
+ function checkRouterBudget({ exists, read, fail }) {
33
+ if (!exists(ROUTER_PATH)) {
34
+ fail(`${ROUTER_PATH} is missing`);
122
35
  return;
123
36
  }
124
-
125
- requireTokens(".gitignore", ["/docs/superpowers/"]);
126
-
127
- const tracked = spawnSync("git", ["ls-files", "docs/superpowers"], {
128
- cwd: root,
129
- encoding: "utf8",
130
- timeout: 30000,
131
- });
132
-
133
- if (tracked.status !== 0) {
134
- fail(`unable to inspect tracked Superpowers artifacts: ${tracked.stderr}`);
135
- } else if (tracked.stdout.trim()) {
136
- fail(
137
- `docs/superpowers artifacts must not be tracked:\n${tracked.stdout.trim()}`,
138
- );
37
+ const body = read(ROUTER_PATH);
38
+ const lineCount = body.split(/\r?\n/).length - (body.endsWith("\n") ? 1 : 0);
39
+ if (lineCount > MAX_ROUTER_LINES) {
40
+ fail(`${ROUTER_PATH} exceeds ${MAX_ROUTER_LINES} lines (${lineCount})`);
139
41
  }
140
42
  }
141
43
 
142
- function checkGrillingCoreContracts() {
143
- requireTokens("skills/grilling/SKILL.md", [
144
- "one question per turn",
145
- "recommended answer",
146
- "reversal evidence",
147
- "shared understanding",
148
- "Do not ask for discoverable facts",
149
- "Inline uncertainty mode",
150
- "Explicit grilling session",
151
- "Route context:",
152
- "Risk classification:",
153
- "Resume target:",
154
- "Reversal evidence:",
155
- "return to `skills/using-superpowers/SKILL.md` for routing",
156
- "Existing Confirmed Handoff",
157
- "Do not re-ask them",
158
- "recorded reversal evidence appears",
159
- ]);
160
- requireTokens("skills/using-superpowers/SKILL.md", [
161
- "discoverable fact",
162
- "user-owned decision",
163
- "skills/grilling/SKILL.md",
164
- "shortest applicable path",
165
- "explicit formal Spec",
166
- "high-risk boundary",
167
- ]);
168
- }
169
-
170
- function checkRouteOrdering() {
171
- const router = read("skills/using-superpowers/SKILL.md");
172
- const inlineRoute = router.indexOf("unresolved user-owned decision?");
173
- const specRoute = router.indexOf("explicit formal Spec or high-risk boundary?");
174
- if (
175
- inlineRoute === -1 ||
176
- specRoute === -1 ||
177
- inlineRoute > specRoute
178
- ) {
179
- fail(
180
- "router should resolve a real user decision before entering formal Spec Gate",
181
- );
44
+ function checkTopLevelRules({ rel, exists, fail }) {
45
+ if (!exists("rules")) {
46
+ fail("rules directory is missing");
47
+ return;
182
48
  }
183
-
184
- const grillingContract = read("skills/grilling/SKILL.md");
185
- if (
186
- /^\s*(?:recommended )?next skill:/im.test(grillingContract) ||
187
- /^\s*推荐下一 skill:/m.test(grillingContract)
188
- ) {
49
+ const actual = fs
50
+ .readdirSync(rel("rules"), { withFileTypes: true })
51
+ .filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
52
+ .map((entry) => entry.name)
53
+ .sort();
54
+ if (JSON.stringify(actual) !== JSON.stringify(EXPECTED_TOP_LEVEL_RULES)) {
189
55
  fail(
190
- "skills/grilling/SKILL.md should return routing responsibility instead of recommending the next skill",
56
+ `rules/ top-level files must be exactly ${EXPECTED_TOP_LEVEL_RULES.join(", ")}; found: ${actual.join(", ")}`,
191
57
  );
192
58
  }
193
- }
194
-
195
- function checkWorkflowDocuments() {
196
- runWorkflowOwnershipChecks({ read, fail, managedFiles });
197
- requireTokens("skills/using-superpowers/SKILL.md", [
198
- "shortest applicable path",
199
- "File count, new features, and ordinary complexity affect",
200
- "verification intensity, not the lane",
201
- "A high-risk boundary",
202
- ]);
203
- requireTokens("rules/01-base.md", [
204
- "rules/common/testing.md",
205
- "skills/using-superpowers/SKILL.md",
206
- ]);
207
- requireTokens("rules/common/testing.md", [
208
- "隔离端口和环境变量",
209
- "等待 Web/API ready",
210
- ]);
211
- requireTokens("rules/common/context-hygiene.md", [
212
- "任何外部 mutation",
213
- "发送消息",
214
- "写入云文档",
215
- ]);
216
- requireTokens("rules/common/hooks.md", [
217
- "敏感内容只记录风险和证据位置",
218
- ]);
219
- requireTokens("rules/common/pr-automation.md", [
220
- "失败检查不得跳过",
221
- "Git/PR 操作按 `rules/05-git-workflow.md` 的授权边界执行",
222
- ]);
223
- for (const file of [
224
- "rules/common/context-hygiene.md",
225
- "rules/common/harness-engineering.md",
226
- "rules/common/performance.md",
227
- ]) {
228
- requireTokens(file, ["rules/common/agent-orchestration.md"]);
229
- }
230
- requireTokens("rules/common/skills-learning.md", [
231
- "路由权威来源",
232
- "不要因为多文件或普通复杂度加载完整 process skill 链",
233
- "rules/01-base.md",
234
- "rules/common/agent-orchestration.md",
235
- ]);
236
- }
237
-
238
- function checkComplexityRules() {
239
- const baseRules = read("rules/01-base.md");
240
- if (
241
- baseRules.includes(
242
- "复杂任务包括新功能、架构调整、多文件行为变化",
243
- )
244
- ) {
245
- fail(
246
- "rules/01-base.md should not classify new or multi-file behavior work as full-flow by default",
247
- );
59
+ if (!exists("rules/common")) {
60
+ fail("rules/common directory is missing");
248
61
  }
249
62
  }
250
63
 
251
- function checkGrillingWorkflow() {
252
- checkGrillingCoreContracts();
253
- checkRouteOrdering();
254
- checkWorkflowDocuments();
255
- checkComplexityRules();
256
- }
257
-
258
- function checkSuperpowersRoutingConsistency() {
259
- requireTokens("skills/using-superpowers/SKILL.md", [
260
- "explicit formal Spec",
261
- "high-risk boundary",
262
- "unresolved user-owned decision?",
263
- "skills/grilling/SKILL.md",
264
- ]);
265
- requireTokens("skills/spec-gate/SKILL.md", [
266
- "zero interview",
267
- "BLOCKED_BY_UNRESOLVED_DECISION",
268
- "Spec Gate contract conflict",
269
- ]);
270
-
271
- }
272
-
273
- function readCapabilityManifest(manifestPath) {
274
- if (!exists(manifestPath)) {
275
- fail(`${manifestPath} is missing`);
276
- return null;
277
- }
278
- try {
279
- return JSON.parse(read(manifestPath));
280
- } catch (error) {
281
- fail(`${manifestPath} is not valid JSON: ${error.message}`);
282
- return null;
283
- }
284
- }
285
-
286
- function checkCapabilityManifestHeader(manifest, manifestPath) {
287
- const valid =
288
- manifest.schema_version === 1 &&
289
- manifest.upstream?.repository === "https://github.com/mattpocock/skills" &&
290
- /^[0-9a-f]{40}$/.test(manifest.upstream?.commit || "") &&
291
- manifest.upstream?.baseline === "promoted-engineering";
292
- if (!valid) fail(`${manifestPath} has an invalid upstream contract`);
293
- }
294
-
295
- function checkCapabilityEntries(manifest, manifestPath) {
296
- const expected = [
297
- "ask-matt", "code-review", "codebase-design", "diagnosing-bugs",
298
- "domain-modeling", "grill-with-docs", "implement",
299
- "improve-codebase-architecture", "prototype", "research",
300
- "resolving-merge-conflicts", "setup-matt-pocock-skills", "tdd",
301
- "to-spec", "to-tickets", "triage", "wayfinder",
302
- ].sort();
303
- const capabilities = Array.isArray(manifest.capabilities)
304
- ? manifest.capabilities
305
- : [];
306
- const actual = capabilities.map((entry) => entry.upstream).sort();
307
- if (JSON.stringify(actual) !== JSON.stringify(expected)) {
308
- fail(`${manifestPath} must map all 17 promoted engineering capabilities`);
309
- }
310
- for (const entry of capabilities) {
311
- const excluded = ["wayfinder", "setup-matt-pocock-skills"].includes(entry.upstream) && entry.status === "excluded" &&
312
- typeof entry.reason === "string" && entry.reason.trim().length > 0;
313
- if (!excluded && !["covered", "adapted"].includes(entry.status)) {
314
- fail(`${entry.upstream} is not capability-equivalent: ${entry.status}`);
315
- }
316
- if (!Array.isArray(entry.evidence) || entry.evidence.length === 0) {
317
- fail(`${entry.upstream} has no local evidence files`);
318
- continue;
319
- }
320
- for (const file of entry.evidence) {
321
- if (!exists(file)) fail(`${entry.upstream} evidence is missing: ${file}`);
322
- }
323
- }
324
- }
325
-
326
- function checkCapabilitySupportDependencies(manifest, manifestPath) {
327
- const dependencies = Array.isArray(manifest.support_dependencies)
328
- ? manifest.support_dependencies
329
- : [];
330
- const handoff = dependencies.find((entry) => entry.upstream === "handoff");
331
- const valid =
332
- handoff?.source_group === "productivity" &&
333
- ["covered", "adapted"].includes(handoff.status) &&
334
- handoff.evidence?.includes("skills/handoff/SKILL.md") &&
335
- !handoff.evidence?.includes("commands/handoff.md");
336
- if (!valid) {
337
- fail(`${manifestPath} must map the engineering flow's handoff dependency`);
338
- }
339
- }
340
-
341
- function checkCapabilityRouting() {
342
- requireTokens("skills/using-superpowers/SKILL.md", [
343
- "explicit workflow advice?",
344
- "workflow advice mode",
345
- "explicit TDD request?",
346
- "explicit E2E or Playwright request?",
347
- "skills/e2e-testing/SKILL.md",
348
- "agents/e2e-runner.md",
349
- "explicit harness audit?",
350
- "agents/harness-optimizer.md",
351
- "Agent-selected Delivery Topology",
352
- "delivery request in defined scope?",
353
- "independent frontier tickets with no overlapping write surface?",
64
+ function checkMergedSkillReferences({ exists, fail }) {
65
+ const required = [
354
66
  "skills/implement/SKILL.md",
355
- "skills/subagent-driven-development/SKILL.md",
356
- "explicit prototype or runnable design question?",
357
- "skills/prototype/SKILL.md",
358
- "external engineering fact or documentation question?",
359
- "skills/to-tickets/SKILL.md",
360
- "merge or rebase conflict?",
361
- "skills/resolving-merge-conflicts/SKILL.md",
362
- "fresh session or prototype branch?",
363
- "skills/handoff/SKILL.md",
364
- ]);
365
-
366
- const router = read("skills/using-superpowers/SKILL.md");
367
- for (const staleGate of [
368
- "User-invoked Delivery Gates",
369
- "recommend `to-tickets`; wait for explicit invocation",
370
- "recommend `implement`; wait for explicit invocation",
371
- ]) {
372
- if (router.includes(staleGate)) {
373
- fail(`router must not retain the obsolete user-invoked delivery gate: ${staleGate}`);
374
- }
375
- }
376
-
377
- for (const deliverySkill of [
378
- "skills/to-tickets/SKILL.md",
379
- "skills/subagent-driven-development/SKILL.md",
380
- ]) {
381
- if (read(deliverySkill).includes("disable-model-invocation: true")) {
382
- fail(`${deliverySkill} must remain router-selectable for delivery topology`);
383
- }
384
- }
385
- }
386
-
387
- function checkCapabilityFiles() {
388
- for (const file of [
389
- "skills/codebase-design/SKILL.md",
390
- "skills/handoff/SKILL.md",
391
- "skills/implement/SKILL.md",
392
- "skills/improve-codebase-architecture/SKILL.md",
393
- "skills/prototype/SKILL.md",
394
- "skills/resolving-merge-conflicts/SKILL.md",
395
- "skills/to-tickets/SKILL.md",
396
- "skills/triage/SKILL.md",
397
- ]) {
398
- if (!exists(file)) fail(`${file} is missing`);
399
- }
400
-
401
- for (const file of [
402
- "commands/ask-workflow.md",
403
- "commands/e2e.md",
404
- "commands/evolve.md",
405
- "commands/grill.md",
406
- "commands/grill-with-docs.md",
407
- "commands/handoff.md",
408
- "commands/harness-audit.md",
409
- "commands/implement.md",
410
- "commands/improve-codebase-architecture.md",
411
- "commands/instinct-status.md",
412
- "commands/learn-eval.md",
413
- "commands/projects.md",
414
- "commands/promote.md",
415
- "commands/prune.md",
416
- "commands/setup-workflow.md",
417
- "commands/tdd.md",
418
- "commands/to-tickets.md",
419
- "commands/triage.md",
420
- "commands/wayfinder.md",
421
- ]) {
422
- if (exists(file)) fail(`${file} is a redundant Skill wrapper`);
423
- }
424
- }
425
-
426
- function checkDesignCapabilityContracts() {
427
- requireTokens("skills/codebase-design/SKILL.md", [
428
- "Module",
429
- "Interface",
430
- "Seam",
431
- "Adapter",
432
- "Leverage",
433
- "Locality",
434
- "deletion test",
435
- "interface as the test surface",
436
- ]);
437
- requireTokens("skills/improve-codebase-architecture/SKILL.md", [
438
- "skills/codebase-design/SKILL.md",
439
- "skills/visual-companion/SKILL.md",
440
- "explicit consent",
441
- "skills/grilling/SKILL.md",
442
- ]);
443
- requireTokens("skills/prototype/SKILL.md", [
444
- "Logic",
445
- "Visual",
446
- "throwaway",
447
- "one command to run",
448
- "Do not silently continue into production code",
449
- ]);
450
- requireTokens("skills/prototype/references/ui.md", [
451
- "runnable in-project UI prototype",
452
- "?variant=",
453
- "real read-only data",
454
- "production builds",
455
- "exact URLs",
456
- ]);
457
- }
458
-
459
- function checkDeliveryCapabilityContracts() {
460
- if (exists("skills/research/SKILL.md")) fail("standalone research Skill must be retired");
461
- const retired = JSON.parse(read("scripts/retired-skill-files.json"));
462
- if (!retired.retired_skills?.research?.includes("SKILL.md")) {
463
- fail("research retirement must clean up the installed entrypoint");
67
+ "skills/implement/references/ticket-delivery.md",
68
+ "skills/implement/references/parallel-delivery.md",
69
+ "skills/feature-acceptance/SKILL.md",
70
+ "skills/feature-acceptance/references/project-verification.md",
71
+ "skills/feature-acceptance/references/e2e-testing.md",
72
+ "skills/feature-acceptance/references/playwright-patterns.md",
73
+ "skills/using-superpowers/references/process-outcomes.md",
74
+ ];
75
+ for (const file of required) {
76
+ if (!exists(file)) fail(`required workflow file is missing: ${file}`);
464
77
  }
465
- requireTokens("skills/resolving-merge-conflicts/SKILL.md", [
466
- "primary sources",
467
- "one hunk at a time",
468
- "Do not abort",
469
- "Git authorization",
470
- ]);
471
- requireTokens("skills/to-tickets/SKILL.md", [
472
- "tracer bullet",
473
- "blocking edges",
474
- "vertical",
475
- "Do not publish before approval",
476
- "ready-for-agent",
477
- ]);
478
- requireTokens("skills/triage/SKILL.md", [
479
- "needs-triage",
480
- "needs-info",
481
- "ready-for-agent",
482
- "ready-for-human",
483
- "wontfix",
484
- "generated by AI during triage",
485
- "obtain confirmation",
486
- ]);
487
- requireTokens("skills/test-driven-development/SKILL.md", [
488
- "Public Seam",
489
- "测试和调用方应穿过同一个 seam",
490
- "固定事实",
491
- "真实系统边界",
492
- "tracer bullet",
493
- ]);
494
- requireTokens("skills/handoff/SKILL.md", [
495
- "temporary directory",
496
- "private subdirectory",
497
- "0700",
498
- "exclusive creation",
499
- "0600",
500
- "delete the handoff after consumption",
501
- "fresh session",
502
- "Suggested skills",
503
- "Do not duplicate",
504
- "Redact",
505
- "exact path",
506
- ]);
507
- }
508
-
509
- function checkUpstreamCapabilityParity() {
510
- const manifestPath = "scripts/upstream-capability-map.json";
511
- const manifest = readCapabilityManifest(manifestPath);
512
- if (!manifest) return;
513
- checkCapabilityManifestHeader(manifest, manifestPath);
514
- checkCapabilityEntries(manifest, manifestPath);
515
- checkCapabilitySupportDependencies(manifest, manifestPath);
516
- checkCapabilityRouting();
517
- checkCapabilityFiles();
518
- checkDesignCapabilityContracts();
519
- checkDeliveryCapabilityContracts();
520
78
  }
521
79
 
522
- function checkRemovedSkillReferences() {
523
- for (const skill of ["context-budget", "documentation-lookup"]) {
524
- for (const file of managedFiles()) {
525
- if (isVerifierImplementation(file)) continue;
526
- if (read(file).includes(skill)) {
527
- fail(`${file} still references removed skill ${skill}`);
528
- }
529
- }
530
- }
531
-
532
- const retiredSkills = [
533
- "iterative-retrieval",
534
- "using-git-worktrees",
535
- "verification-before-completion",
536
- "discover-unknowns-zh",
537
- "skill-creator",
538
- "writing-plans",
539
- "executing-plans",
540
- "wayfinder",
541
- ];
542
- const allowedRetirementFiles = new Set([
543
- "README.md",
80
+ function checkRetiredReferences({ managedFiles, isVerifierImplementation, read, fail }) {
81
+ const skipFiles = new Set([
82
+ "scripts/install.sh",
83
+ "scripts/install.ps1",
84
+ "scripts/install-rules.js",
544
85
  "scripts/retired-skill-files.json",
86
+ "scripts/legacy-common-rule-hashes.json",
545
87
  "scripts/upstream-capability-map.json",
546
- "scripts/upstream-capability-baseline.json",
547
88
  ]);
548
-
549
- for (const skill of retiredSkills) {
550
- if (exists(`skills/${skill}/SKILL.md`)) {
551
- fail(`skills/${skill} should be retired`);
552
- }
553
- for (const file of managedFiles()) {
554
- if (
555
- isVerifierImplementation(file) ||
556
- allowedRetirementFiles.has(file)
557
- ) {
558
- continue;
559
- }
560
- if (read(file).includes(skill)) {
561
- fail(`${file} still references retired skill ${skill}`);
89
+ for (const file of managedFiles()) {
90
+ if (isVerifierImplementation(file) || skipFiles.has(file)) continue;
91
+ if (!/\.(md|json|js|sh|ps1)$/.test(file)) continue;
92
+ const body = read(file);
93
+ for (const retired of [...RETIRED_SKILL_PATHS, ...RETIRED_RULE_PATHS]) {
94
+ if (body.includes(retired)) {
95
+ fail(`${file} references retired path: ${retired}`);
562
96
  }
563
97
  }
564
98
  }
565
-
566
- requireTokens("scripts/retired-skill-files.json", retiredSkills);
567
- requireTokens("rules/common/skills-learning.md", [
568
- "Skill 创建和更新遵循本规则",
569
- "开放生态中的 skill 查找和安装按用户明确请求使用宿主已有工具",
570
- ]);
571
99
  }
572
100
 
573
- function checkForbiddenCommandDrift() {
574
- const patterns = [
575
- [/\/docs\b/, "removed /docs command reference"],
576
- [/\/instinct-export\b/, "removed /instinct-export command reference"],
577
- [/\/instinct-import\b/, "removed /instinct-import command reference"],
578
- [/--decay\b/, "deprecated decay flag"],
579
- [/decay-confidence/, "deprecated decay-confidence script"],
580
- [/置信度降低 0\.02/, "automatic confidence decay"],
581
- [/超过.*天.*删除/, "time-based instinct deletion"],
582
- [/--max-age\b/, "time-based prune flag"],
583
- [/清理过期/, "expired-instinct cleanup wording"],
584
- ];
585
-
586
- for (const file of managedFiles()) {
587
- if (
588
- isVerifierImplementation(file) ||
589
- ["scripts/install.ps1", "scripts/install.sh"].includes(file)
590
- ) continue;
591
- if (!/\.(md|json|js|ps1|sh)$/.test(file)) continue;
592
-
593
- const body = read(file);
594
- const lines = body.split(/\r?\n/);
595
- for (const [pattern, label] of patterns) {
596
- lines.forEach((line, index) => {
597
- if (pattern.test(line)) {
598
- fail(`${file}:${index + 1} contains ${label}: ${line.trim()}`);
599
- }
600
- });
601
- }
602
- }
101
+ function checkVisualCompanionSecurity({ requireTokens }) {
102
+ requireTokens("skills/visual-companion/scripts/server.cjs", [
103
+ "127.0.0.1",
104
+ "isAuthorized(req)",
105
+ "isAllowedWebSocketOrigin(req)",
106
+ ]);
603
107
  }
604
108
 
605
109
  function runWorkflowChecks(context) {
606
- bindContext(context);
607
- checkSuperpowersDevLoop();
608
- checkSpecVisualContracts();
609
- checkSuperpowersArtifactPolicy();
610
- checkGrillingWorkflow();
611
- checkSuperpowersRoutingConsistency();
612
- checkUpstreamCapabilityParity();
613
- runGrillingSpecGateChecks(context);
614
- checkRemovedSkillReferences();
615
- checkForbiddenCommandDrift();
110
+ checkRouterBudget(context);
111
+ checkTopLevelRules(context);
112
+ checkMergedSkillReferences(context);
113
+ checkRetiredReferences(context);
114
+ checkVisualCompanionSecurity(context);
616
115
  }
617
116
 
618
117
  module.exports = { runWorkflowChecks };