claude-everything-workflow 0.2.3 → 0.2.5

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 (62) hide show
  1. package/.agents/plugins/marketplace.json +12 -0
  2. package/.claude-plugin/hooks.json +33 -0
  3. package/.claude-plugin/marketplace.json +12 -0
  4. package/.claude-plugin/plugin.json +10 -0
  5. package/.codex-plugin/plugin.json +20 -0
  6. package/AGENTS.md +11 -17
  7. package/README.md +107 -404
  8. package/README.zh-CN.md +158 -0
  9. package/agents/database-reviewer.md +0 -3
  10. package/commands/pr.md +2 -2
  11. package/docs/plugins.md +91 -0
  12. package/harness/manifest.json +8 -44
  13. package/hooks/check-code-size.js +1 -1
  14. package/package.json +8 -1
  15. package/references/git-worktrees.md +29 -0
  16. package/rules/02-implementation.md +27 -0
  17. package/rules/05-git-workflow.md +4 -1
  18. package/rules/08-specialty-rules-index.md +1 -1
  19. package/rules/09-first-principles-adversarial-testing.md +1 -2
  20. package/rules/common/agent-orchestration.md +1 -1
  21. package/rules/common/context-hygiene.md +2 -0
  22. package/rules/common/skills-learning.md +1 -1
  23. package/rules/common/testing.md +7 -0
  24. package/scripts/install.ps1 +3 -1
  25. package/scripts/install.sh +3 -1
  26. package/scripts/retired-skill-files.json +9 -0
  27. package/scripts/verify/continuation-checks.test.js +101 -0
  28. package/scripts/verify/core.js +1 -0
  29. package/scripts/verify/grilling-spec-gate-checks.js +37 -6
  30. package/scripts/verify/install-rules.test.js +11 -2
  31. package/scripts/verify/metadata-checks.js +65 -26
  32. package/scripts/verify/plugin-distribution.test.js +40 -0
  33. package/scripts/verify/repository-checks.js +7 -22
  34. package/scripts/verify/skill-invocation.test.js +3 -2
  35. package/scripts/verify/skill-manifest-checks.js +1 -1
  36. package/scripts/verify/skill-manifest-checks.test.js +12 -0
  37. package/scripts/verify/workflow-checks.js +3 -69
  38. package/skills/README.md +3 -6
  39. package/skills/continuous-learning-v2/SKILL.md +4 -2
  40. package/skills/domain-modeling/SKILL.md +6 -4
  41. package/skills/feature-acceptance/SKILL.md +6 -2
  42. package/skills/grilling/SKILL.md +3 -2
  43. package/skills/handoff/agents/openai.yaml +3 -0
  44. package/skills/implement/SKILL.md +3 -3
  45. package/skills/improve-codebase-architecture/agents/openai.yaml +3 -0
  46. package/skills/spec-gate/SKILL.md +12 -22
  47. package/skills/spec-gate/references/spec-template.md +23 -0
  48. package/skills/subagent-driven-development/SKILL.md +1 -1
  49. package/skills/systematic-debugging/SKILL.md +37 -5
  50. package/skills/systematic-debugging/references/debugging-methods.md +30 -0
  51. package/skills/systematic-debugging/references/diagnostic-scenarios.md +28 -0
  52. package/skills/triage/agents/openai.yaml +3 -0
  53. package/skills/using-superpowers/SKILL.md +9 -5
  54. package/skills/using-superpowers/references/process-outcomes.md +10 -7
  55. package/references/agents/database-reviewer.md +0 -657
  56. package/rules/02-code-size.md +0 -7
  57. package/rules/03-architecture.md +0 -12
  58. package/rules/04-error-handling.md +0 -5
  59. package/rules/06-comments.md +0 -4
  60. package/skills/iterative-retrieval/SKILL.md +0 -84
  61. package/skills/using-git-worktrees/SKILL.md +0 -67
  62. package/skills/verification-before-completion/SKILL.md +0 -78
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+
3
+ const assert = require("node:assert/strict");
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
+ const { createHarnessContext } = require("./core");
7
+ const { runGrillingSpecGateChecks } = require("./grilling-spec-gate-checks");
8
+
9
+ const root = path.resolve(__dirname, "../..");
10
+ const domain = "skills/domain-modeling/SKILL.md";
11
+ const outcomes = "skills/using-superpowers/references/process-outcomes.md";
12
+ const spec = "skills/spec-gate/SKILL.md";
13
+ const read = (file) => fs.readFileSync(path.join(root, file), "utf8");
14
+
15
+ // Inject regressions in memory so tests exercise the real gates without changing the working tree.
16
+ function verify(overrides = {}) {
17
+ const context = createHarnessContext(root);
18
+ context.read = (file) => overrides[file] ?? read(file);
19
+ context.requireTokens = (file, tokens) => {
20
+ if (!context.exists(file)) return context.fail(`${file} is missing`);
21
+ for (const token of tokens) {
22
+ if (!context.read(file).includes(token)) context.fail(`${file} should include ${token}`);
23
+ }
24
+ };
25
+ runGrillingSpecGateChecks(context);
26
+ return context.errors;
27
+ }
28
+
29
+ assert.deepEqual(verify(), []);
30
+
31
+ const regressions = [
32
+ {
33
+ name: "maintenance changes a confirmed decision without approval",
34
+ file: domain,
35
+ body: read(domain).replace(/changes to\s+confirmed decisions, and\s*/, ""),
36
+ error: /should include changes to/,
37
+ },
38
+ {
39
+ name: "per-term approval despite maintenance authorization",
40
+ file: domain,
41
+ body: read(domain) + "\nWhen a term becomes stable, show the exact glossary change and obtain write approval before\nupdating it inline.\n",
42
+ error: /not require per-term approval/,
43
+ },
44
+ {
45
+ name: "maintenance without initial authorization",
46
+ file: domain,
47
+ body: read(domain).replace("If maintenance is not yet authorized, obtain approval before writing", "Write immediately"),
48
+ error: /should include If maintenance is not yet authorized/,
49
+ },
50
+ {
51
+ name: "maintenance expands into new scope",
52
+ file: domain,
53
+ body: read(domain).replace("New paths or scope", "Any document"),
54
+ error: /should include New paths or scope/,
55
+ },
56
+ {
57
+ name: "permission required just to clarify",
58
+ file: outcomes,
59
+ body: read(outcomes) + "\nOnly an explicit choice to continue starts a new grilling session.\n",
60
+ error: /not request permission to clarify/,
61
+ },
62
+ {
63
+ name: "clarification continues without an answer",
64
+ file: outcomes,
65
+ body: read(outcomes).replace("Wait for the user's answer", "Continue without the user's answer"),
66
+ error: /should include Wait for the user's answer/,
67
+ },
68
+ {
69
+ name: "blocked Spec stops the router's clarification",
70
+ file: outcomes,
71
+ body: read(outcomes).replace(
72
+ "Preserve the confirmed decisions and evidence; do not draft through an unresolved decision.",
73
+ "Stop without drafting, guessing, or invoking another Skill.",
74
+ ),
75
+ error: /not request permission to clarify/,
76
+ },
77
+ {
78
+ name: "clarification ignores the user's stop request",
79
+ file: outcomes,
80
+ body: read(outcomes).replace("If the user pauses or ends the task, stop.", ""),
81
+ error: /should include If the user pauses or ends the task, stop/,
82
+ },
83
+ {
84
+ name: "clarification expands authorization to external actions",
85
+ file: outcomes,
86
+ body: read(outcomes).replace(/A new scope or external action still requires its own\s+authorization;/, ""),
87
+ error: /should include A new scope or external action still requires its own/,
88
+ },
89
+ {
90
+ name: "implementation without Spec approval",
91
+ file: spec,
92
+ body: read(spec).replace("the user has explicitly approved it", "the agent considers it ready"),
93
+ error: /should include the user has explicitly approved it/,
94
+ },
95
+ ];
96
+
97
+ for (const scenario of regressions) {
98
+ assert.match(verify({ [scenario.file]: scenario.body }).join("\n"), scenario.error, scenario.name);
99
+ }
100
+
101
+ console.log(`Continuation contract tests passed (current documents and ${regressions.length} regressions).`);
@@ -5,6 +5,7 @@ const path = require("path");
5
5
 
6
6
  const MANAGED_ROOTS = [
7
7
  "README.md",
8
+ "README.zh-CN.md",
8
9
  "AGENTS.md",
9
10
  "CLAUDE.md",
10
11
  "settings.json",
@@ -44,10 +44,10 @@ const ROUTING_SCENARIOS = [
44
44
  }],
45
45
  },
46
46
  {
47
- name: "user explicitly continues after blocking",
47
+ name: "authorized task continues after focused clarification",
48
48
  checks: [{
49
49
  file: PROCESS_OUTCOMES,
50
- tokens: ["new grilling session", "new Spec Gate", "do not resume the old call stack"],
50
+ tokens: ["grilling inline", "Wait for the user's answer", "new Spec Gate", "do not resume the old call stack"],
51
51
  }],
52
52
  },
53
53
  {
@@ -117,6 +117,7 @@ function checkSpecGateContract({ exists, read, fail, requireTokens }) {
117
117
  "Local-only artifact policy",
118
118
  "Do not stage or commit it.",
119
119
  "Spec Gate contract conflict",
120
+ "the user has explicitly approved it",
120
121
  ]);
121
122
  if (!exists(file)) return;
122
123
 
@@ -143,7 +144,13 @@ function checkRouterContract({ exists, read, fail, requireTokens }) {
143
144
  requireTokens(PROCESS_OUTCOMES, [
144
145
  "BLOCKED_BY_UNRESOLVED_DECISION",
145
146
  "decision map",
146
- "new grilling session",
147
+ "grilling inline",
148
+ "do not ask whether to continue clarification",
149
+ "Wait for the user's answer",
150
+ "Silence is not a decision or approval.",
151
+ "If the user pauses or ends the task, stop.",
152
+ "A new scope or external action still requires its own",
153
+ "authorization; clarification does not expand the original request.",
147
154
  "new Spec Gate",
148
155
  "do not resume the old call stack",
149
156
  "spec-gate",
@@ -151,15 +158,22 @@ function checkRouterContract({ exists, read, fail, requireTokens }) {
151
158
  if (!exists(file) || !exists(PROCESS_OUTCOMES)) return;
152
159
 
153
160
  const body = read(PROCESS_OUTCOMES);
154
- if (/BLOCKED_BY_UNRESOLVED_DECISION[\s\S]{0,240}(?:automatically|auto).*grilling/i.test(body)) {
155
- fail("Router must stop on Spec Gate blocking instead of automatically invoking grilling");
161
+ for (const staleGate of [
162
+ "Only an explicit choice to continue",
163
+ "Let the user choose to continue clarification",
164
+ "Stop without drafting, guessing, or invoking another Skill.",
165
+ "is terminal for the current call chain",
166
+ ]) {
167
+ if (body.includes(staleGate)) {
168
+ fail("Router must ask the missing decision within the authorized task, not request permission to clarify");
169
+ }
156
170
  }
157
171
  for (const scenario of ROUTING_SCENARIOS) {
158
172
  for (const check of scenario.checks) requireTokens(check.file, check.tokens);
159
173
  }
160
174
  }
161
175
 
162
- function checkSupportingSkills({ requireTokens }) {
176
+ function checkSupportingSkills({ exists, read, fail, requireTokens }) {
163
177
  requireTokens("skills/grilling/SKILL.md", [
164
178
  "Route context:",
165
179
  "Risk classification:",
@@ -172,7 +186,24 @@ function checkSupportingSkills({ requireTokens }) {
172
186
  "lifecycle",
173
187
  "CONTEXT.md",
174
188
  "approved Spec",
189
+ "Reuse existing maintenance authorization",
190
+ "within the approved paths and scope",
191
+ "If maintenance is not yet authorized, obtain approval before writing",
192
+ "New paths or scope",
175
193
  ]);
194
+ const domain = "skills/domain-modeling/SKILL.md";
195
+ if (exists(domain)) {
196
+ const body = read(domain).replace(/\s+/g, " ");
197
+ if (body.includes("When a term becomes stable, show the exact glossary change and obtain write approval before")) {
198
+ fail("Domain documentation must reuse in-scope maintenance authorization, not require per-term approval");
199
+ }
200
+ for (const constraint of [
201
+ "changes to confirmed decisions",
202
+ "unresolved consequential decisions require approval before the affected edit.",
203
+ ]) {
204
+ if (!body.includes(constraint)) fail(`${domain} should include ${constraint}`);
205
+ }
206
+ }
176
207
  requireTokens("skills/visual-companion/SKILL.md", [
177
208
  "user consent",
178
209
  "grilling owns the decision loop",
@@ -66,10 +66,13 @@ function checkInstallerEntrypoint() {
66
66
  // Seed an older installation to exercise retirement and policy replacement through the real CLI.
67
67
  for (const host of [".claude", ".codex"]) {
68
68
  const skills = path.join(profile, host, "skills");
69
- for (const retired of ["research", "wayfinder", "find-skills", "project-context"]) {
69
+ for (const retired of ["research", "wayfinder", "find-skills", "project-context", "iterative-retrieval", "using-git-worktrees", "verification-before-completion"]) {
70
70
  fs.mkdirSync(path.join(skills, retired), { recursive: true });
71
71
  const known = {
72
72
  research: ["SKILL.md"],
73
+ "iterative-retrieval": ["SKILL.md"],
74
+ "using-git-worktrees": ["SKILL.md"],
75
+ "verification-before-completion": ["SKILL.md"],
73
76
  wayfinder: ["SKILL.md", "agents/openai.yaml"],
74
77
  "find-skills": ["SKILL.md", "agents/openai.yaml", "references/skills-cli.md"],
75
78
  "project-context": ["SKILL.md", "agents/openai.yaml", "references/project-context-template.md"],
@@ -93,7 +96,9 @@ function checkInstallerEntrypoint() {
93
96
  read(path.join(sourceRoot, "rules/common/testing.md")));
94
97
  assert.match(read(path.join(profile, ".claude/CLAUDE.md")), /^@AGENTS\.md$/m);
95
98
  for (const host of [".claude", ".codex"]) {
96
- for (const retired of ["research", "wayfinder", "find-skills", "project-context"]) {
99
+ assert.equal(read(path.join(profile, host, "references/git-worktrees.md")),
100
+ read(path.join(sourceRoot, "references/git-worktrees.md")));
101
+ for (const retired of ["research", "wayfinder", "find-skills", "project-context", "iterative-retrieval", "using-git-worktrees", "verification-before-completion"]) {
97
102
  assert.equal(fs.existsSync(path.join(profile, host, "skills", retired, "SKILL.md")), false);
98
103
  const remaining = fs.readdirSync(path.join(profile, host, "skills", retired));
99
104
  assert.deepEqual(remaining, ["personal-notes.md"]);
@@ -101,6 +106,10 @@ function checkInstallerEntrypoint() {
101
106
  }
102
107
  assert.equal(fs.existsSync(path.join(profile, host, "skills/wayfinder/agents")), false);
103
108
  assert.equal(fs.existsSync(path.join(profile, host, "scripts/install-rules.js")), false);
109
+ assert.equal(fs.existsSync(path.join(profile, host, "scripts/verify/continuation-checks.test.js")), false,
110
+ "安装不应保留仅供包内验证的续接测试");
111
+ assert.equal(fs.existsSync(path.join(profile, host, "scripts/verify/plugin-distribution.test.js")), false,
112
+ "安装不应保留仅供包内验证的插件分发测试");
104
113
  assert.match(read(path.join(profile, host, "skills/handoff/agents/openai.yaml")),
105
114
  /allow_implicit_invocation: true/);
106
115
  }
@@ -29,7 +29,9 @@ const PACKAGE_ONLY_PATHS = [
29
29
  "scripts/verify/skill-manifest-checks.js",
30
30
  "scripts/verify/skill-manifest-checks.test.js",
31
31
  "scripts/verify/skill-invocation.test.js",
32
+ "scripts/verify/continuation-checks.test.js",
32
33
  "scripts/verify/install-rules.test.js",
34
+ "scripts/verify/plugin-distribution.test.js",
33
35
  ];
34
36
 
35
37
  function bindContext(context) {
@@ -101,9 +103,9 @@ function checkReadmeTreePaths() {
101
103
  if (!exists("README.md")) return;
102
104
 
103
105
  const body = read("README.md");
104
- const treeMatch = body.match(/## 目录结构[\s\S]*?```([\s\S]*?)```/);
106
+ const treeMatch = body.match(/## Repository structure[\s\S]*?```([\s\S]*?)```/);
105
107
  if (!treeMatch) {
106
- fail("README.md should include a directory tree under ## 目录结构");
108
+ fail("README.md should include a directory tree under ## Repository structure");
107
109
  return;
108
110
  }
109
111
 
@@ -220,10 +222,6 @@ function checkInstallerSurface(ps, sh) {
220
222
  }
221
223
 
222
224
  function checkInstallRuntimePolicy() {
223
- requireTokens("README.md", [
224
- "Codex 安装共享 Workflow 材料,不默认消费 Claude Code `settings.json`",
225
- "Codex 安装同一套 `hooks/` 脚本材料,但不会因为安装本仓文件而自动启用 Claude Code hooks",
226
- ]);
227
225
 
228
226
  requireTokens("scripts/install.ps1", [
229
227
  "Copy-ClaudeSettings",
@@ -341,7 +339,7 @@ function runCommand(command, args, { allowFailure = false, ...options } = {}) {
341
339
  return result;
342
340
  }
343
341
 
344
- function releaseScenario({ exactPublished = false, publishFails = false, tagAt }) {
342
+ function releaseScenario({ exactPublished = false, publishFails = false, lookupFails = false, tagAt }) {
345
343
  const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "cew-release-"));
346
344
  const repository = path.join(tempRoot, "repository");
347
345
  const remote = path.join(tempRoot, "remote.git");
@@ -377,9 +375,15 @@ function releaseScenario({ exactPublished = false, publishFails = false, tagAt }
377
375
  const currentCommit = git(["-C", repository, "rev-parse", "HEAD"]).stdout.trim();
378
376
  git(["-C", repository, "remote", "add", "origin", remote]);
379
377
 
378
+ let taggedCommit = "";
380
379
  if (tagAt) {
381
- const target = tagAt === "current" ? currentCommit : firstCommit;
382
- git(["-C", repository, "tag", "-a", "v0.2.2", target, "-m", "test tag"]);
380
+ taggedCommit = tagAt === "current" ? currentCommit : firstCommit;
381
+ if (tagAt === "unrelated") {
382
+ taggedCommit = git([
383
+ "-C", repository, "commit-tree", `${currentCommit}^{tree}`, "-m", "unrelated release",
384
+ ]).stdout.trim();
385
+ }
386
+ git(["-C", repository, "tag", "-a", "v0.2.2", taggedCommit, "-m", "test tag"]);
383
387
  git(["-C", repository, "push", "origin", "v0.2.2"]);
384
388
  }
385
389
 
@@ -390,6 +394,10 @@ function releaseScenario({ exactPublished = false, publishFails = false, tagAt }
390
394
  const args = process.argv.slice(2);
391
395
  fs.appendFileSync(process.env.NPM_CALL_LOG, JSON.stringify(args) + "\\n");
392
396
  if (args[0] === "view" && args[1].includes("@0.2.2")) {
397
+ if (process.env.LOOKUP_FAILS === "true") {
398
+ process.stderr.write("npm error code E503\\n");
399
+ process.exit(1);
400
+ }
393
401
  if (process.env.EXACT_PUBLISHED === "true") {
394
402
  process.stdout.write("0.2.2\\n");
395
403
  process.exit(0);
@@ -426,6 +434,7 @@ process.exit(2);
426
434
  GITHUB_SHA: currentCommit,
427
435
  NPM_CALL_LOG: npmLog,
428
436
  PUBLISH_FAILS: String(publishFails),
437
+ LOOKUP_FAILS: String(lookupFails),
429
438
  },
430
439
  },
431
440
  );
@@ -445,6 +454,7 @@ process.exit(2);
445
454
  calls,
446
455
  currentCommit,
447
456
  firstCommit,
457
+ taggedCommit,
448
458
  localTag: localTag.status === 0 ? localTag.stdout.trim() : "",
449
459
  remoteTag: remoteTag.status === 0 ? remoteTag.stdout.trim() : "",
450
460
  result,
@@ -496,6 +506,16 @@ function checkReleaseRecoveryBehavior() {
496
506
  fail("release script must publish when the correct tag already exists");
497
507
  }
498
508
 
509
+ const publishedBeforeCurrent = releaseScenario({ exactPublished: true, tagAt: "previous" });
510
+ if (
511
+ publishedBeforeCurrent.result.status !== 0 ||
512
+ publishedBeforeCurrent.calls.some(([command]) => command === "publish") ||
513
+ publishedBeforeCurrent.localTag !== publishedBeforeCurrent.firstCommit ||
514
+ publishedBeforeCurrent.remoteTag !== publishedBeforeCurrent.firstCommit
515
+ ) {
516
+ fail("release script must skip a published version tagged at an ancestor without moving its tag");
517
+ }
518
+
499
519
  const mismatchedTag = releaseScenario({ tagAt: "previous" });
500
520
  if (
501
521
  mismatchedTag.result.status === 0 ||
@@ -504,6 +524,37 @@ function checkReleaseRecoveryBehavior() {
504
524
  ) {
505
525
  fail("release script must reject a tag that points to another commit");
506
526
  }
527
+
528
+ const alreadyReleased = releaseScenario({ exactPublished: true, tagAt: "current" });
529
+ if (
530
+ alreadyReleased.result.status !== 0 ||
531
+ alreadyReleased.calls.some(([command]) => command === "publish") ||
532
+ alreadyReleased.localTag !== alreadyReleased.currentCommit ||
533
+ alreadyReleased.remoteTag !== alreadyReleased.currentCommit
534
+ ) {
535
+ fail("release script must keep a completed release unchanged on retry");
536
+ }
537
+
538
+ const unrelatedTag = releaseScenario({ exactPublished: true, tagAt: "unrelated" });
539
+ if (
540
+ unrelatedTag.result.status === 0 ||
541
+ unrelatedTag.calls.some(([command]) => command === "publish") ||
542
+ unrelatedTag.localTag !== unrelatedTag.taggedCommit ||
543
+ unrelatedTag.remoteTag !== unrelatedTag.taggedCommit
544
+ ) {
545
+ fail("release script must reject a published version tagged outside the current history");
546
+ }
547
+
548
+ const failedLookup = releaseScenario({ exactPublished: true, lookupFails: true, tagAt: "previous" });
549
+ if (
550
+ failedLookup.result.status === 0 ||
551
+ !failedLookup.result.stderr.includes("E503") ||
552
+ failedLookup.calls.some(([command]) => command === "publish") ||
553
+ failedLookup.localTag !== failedLookup.firstCommit ||
554
+ failedLookup.remoteTag !== failedLookup.firstCommit
555
+ ) {
556
+ fail("release script must fail a registry lookup error without publishing or moving its tag");
557
+ }
507
558
  }
508
559
 
509
560
  function checkGitHubWorkflows() {
@@ -550,13 +601,6 @@ function checkGitHubWorkflows() {
550
601
  }
551
602
  checkReleaseRecoveryBehavior();
552
603
 
553
- requireTokens("README.md", [
554
- "npm 发布",
555
- "版本号通过 PR",
556
- "ci.yml",
557
- "受信任的发布商",
558
- "npm 发布成功后才创建",
559
- ]);
560
604
  }
561
605
 
562
606
  function checkLearningPathPolicy() {
@@ -595,10 +639,6 @@ function checkLearningPathPolicy() {
595
639
  }
596
640
  }
597
641
 
598
- requireTokens("README.md", [
599
- "skills/learn/<category>/",
600
- "观察、候选和迁移来源",
601
- ]);
602
642
  requireTokens("commands/learn.md", [
603
643
  "/learn eval",
604
644
  "/learn evolve",
@@ -648,12 +688,6 @@ function checkSkillCategoryIndex() {
648
688
  }
649
689
  }
650
690
 
651
- requireTokens("README.md", [
652
- "Skill 分类索引",
653
- "物理目录保持平铺以兼容发现",
654
- "只有学习产物使用物理分类目录 `skills/learn/<category>/`",
655
- ]);
656
-
657
691
  requireTokens("rules/common/skills-learning.md", [
658
692
  "正式 skill 目录保持 `skills/<skill-name>/SKILL.md` 平铺结构",
659
693
  "分类维护在 `skills/README.md`",
@@ -707,6 +741,9 @@ function checkNpmPackageSurface() {
707
741
  ]);
708
742
 
709
743
  const packageFiles = JSON.parse(read("package.json")).files ?? [];
744
+ if (!packageFiles.includes("README.zh-CN.md")) {
745
+ fail("package.json should publish README.zh-CN.md so the language link works in the package");
746
+ }
710
747
  const publishesHomunculus = packageFiles.some((file) => {
711
748
  const normalized = file.replace(/\\/g, "/").replace(/^\.\//, "");
712
749
  return normalized === "homunculus" || normalized.startsWith("homunculus/");
@@ -733,6 +770,8 @@ function checkNpmPackageSurface() {
733
770
 
734
771
  function runMetadataChecks(context) {
735
772
  bindContext(context);
773
+ requireTokens("README.md", ["[简体中文](README.zh-CN.md)", "(LICENSE)"]);
774
+ requireTokens("README.zh-CN.md", ["[English](README.md)", "(LICENSE)"]);
736
775
  checkCommands();
737
776
  checkReadmeTreePaths();
738
777
  checkInstallRuntimePolicy();
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ const assert = require("node:assert/strict");
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
+ const test = require("node:test");
7
+
8
+ const root = path.resolve(__dirname, "../..");
9
+ const readJson = (relative) => JSON.parse(fs.readFileSync(path.join(root, relative), "utf8"));
10
+
11
+ test("both marketplaces resolve to the same self-contained, versioned workflow package", () => {
12
+ const pkg = readJson("package.json");
13
+ const claude = readJson(".claude-plugin/plugin.json");
14
+ const codex = readJson(".codex-plugin/plugin.json");
15
+ for (const manifest of [claude, codex]) {
16
+ assert.equal(manifest.name, pkg.name);
17
+ assert.equal(manifest.version, pkg.version, "bump package and both plugin versions together");
18
+ }
19
+ const markets = [readJson(".claude-plugin/marketplace.json"), readJson(".agents/plugins/marketplace.json")];
20
+ for (const market of markets) {
21
+ assert.equal(market.name, "cew");
22
+ assert.equal(market.plugins.length, 1);
23
+ assert.equal(market.plugins[0].name, pkg.name);
24
+ const source = market.plugins[0].source;
25
+ assert.equal(path.resolve(root, typeof source === "string" ? source : source.path), root);
26
+ }
27
+ assert.ok(fs.existsSync(path.join(root, codex.skills, "using-superpowers/SKILL.md")));
28
+ assert.ok(!("hooks" in codex), "Claude hook events must not be advertised as Codex hooks");
29
+ const hooks = readJson(claude.hooks).hooks;
30
+ for (const groups of Object.values(hooks)) {
31
+ for (const group of groups) {
32
+ for (const hook of group.hooks) {
33
+ assert.ok(hook.command.includes("${CLAUDE_PLUGIN_ROOT}"));
34
+ assert.ok(!hook.command.includes("$HOME"));
35
+ const entry = hook.command.match(/\$\{CLAUDE_PLUGIN_ROOT\}\/([^\"]+)"/)[1];
36
+ assert.ok(fs.existsSync(path.join(root, entry)), entry);
37
+ }
38
+ }
39
+ }
40
+ });
@@ -23,7 +23,7 @@ function checkRouterAndAgentLinks() {
23
23
  "skills/grilling/SKILL.md",
24
24
  "spec-gate",
25
25
  "skills/systematic-debugging/SKILL.md",
26
- "skills/verification-before-completion/SKILL.md",
26
+ "rules/common/testing.md",
27
27
  "User instructions",
28
28
  ]);
29
29
 
@@ -220,10 +220,6 @@ function checkCodeReviewContracts() {
220
220
  "NOT RUN",
221
221
  ]);
222
222
 
223
- requireTokens("README.md", [
224
- "固定基点下按风险选择自审、独立或双轴审查",
225
- ]);
226
-
227
223
  requireTokens("skills/implement/references/ticket-delivery.md", [
228
224
  "pre-ticket base",
229
225
  "ticket as the Spec source",
@@ -248,7 +244,6 @@ function checkTrackerDeliveryLifecycle() {
248
244
 
249
245
  requireTokens("skills/implement/SKILL.md", [
250
246
  "rules/05-git-workflow.md",
251
- "skills/using-git-worktrees/SKILL.md",
252
247
  "clean baseline",
253
248
  "pre-delivery base",
254
249
  "不覆盖 commit、push 或创建 PR",
@@ -291,28 +286,18 @@ function checkTrackerDeliveryLifecycle() {
291
286
  }
292
287
 
293
288
  function checkExecutionSupportSkills() {
294
- requireTokens("skills/using-git-worktrees/SKILL.md", [
289
+ requireTokens("references/git-worktrees.md", [
295
290
  "git worktree add",
296
291
  "git worktree remove",
297
292
  "rules/05-git-workflow.md",
298
- "including a single-file feature",
293
+ "git status --short",
299
294
  ]);
300
295
 
301
- requireTokens("skills/verification-before-completion/SKILL.md", [
302
- "fresh verification evidence",
296
+ requireTokens("rules/common/testing.md", [
297
+ "本轮",
303
298
  "skills/systematic-debugging/SKILL.md",
304
- "skipped checks",
305
- "remaining risk",
306
- ]);
307
-
308
- requireTokens("skills/iterative-retrieval/SKILL.md", [
309
- "Dispatch",
310
- "Evaluate",
311
- "Refine",
312
- "最多跑 3 轮",
313
- "回传格式",
314
- "事实、证据和盲点缺口",
315
- "skills/using-superpowers/SKILL.md",
299
+ "未运行",
300
+ "剩余风险",
316
301
  ]);
317
302
 
318
303
  requireTokens("skills/feature-acceptance/SKILL.md", [
@@ -80,7 +80,8 @@ for (const name of ["handoff", "improve-codebase-architecture", "triage"]) {
80
80
  const policy = YAML.parse(fs.readFileSync(path.join(root, "skills", name, "agents/openai.yaml"), "utf8"));
81
81
  assert.equal(policy.policy.allow_implicit_invocation, true, name);
82
82
  }
83
- for (const name of ["research", "wayfinder", "find-skills", "project-context"]) {
83
+ for (const name of ["research", "wayfinder", "find-skills", "project-context", "iterative-retrieval", "using-git-worktrees", "verification-before-completion"]) {
84
84
  assert.equal(manifest.skills.some((skill) => skill.name === name), false);
85
+ assert.equal(fs.existsSync(path.join(root, "skills", name, "SKILL.md")), false, name);
85
86
  }
86
- console.log("Skill invocation tests passed (33 host-gate scenarios, three natural-language entries, four retired skills).");
87
+ console.log("Skill invocation tests passed (33 host-gate scenarios, three natural-language entries, seven retired skills).");
@@ -151,7 +151,7 @@ function validateManifest(manifest, { exists, skillPaths, read = () => "" }) {
151
151
  if (!safeOwnerPath) errors.push(`unsafe ownership owner: ${entry.id}`);
152
152
  const ownerPathExists = safeOwnerPath && exists(entry.owner);
153
153
  if (!ownerPathExists) errors.push(`owner path does not exist: ${entry.owner}`);
154
- if (!declaredPaths.has(entry.owner)) errors.push(`ownership owner must be a registered Skill: ${entry.id} -> ${entry.owner}`);
154
+ if (!declaredPaths.has(entry.owner) && !(safeOwnerPath && /^rules\/(?:common\/)?[a-z0-9-]+\.md$/.test(entry.owner))) errors.push(`ownership owner must be a registered Skill or rule: ${entry.id} -> ${entry.owner}`);
155
155
  if (!Array.isArray(entry.surfaces) || entry.surfaces.length === 0) errors.push(`ownership surfaces must be non-empty: ${entry.id}`);
156
156
  for (const surface of entry.surfaces || []) {
157
157
  if (!isSafeRelativePath(surface)) errors.push(`unsafe ownership surface: ${entry.id} -> ${surface}`);
@@ -34,6 +34,18 @@ function run() {
34
34
  read: () => "---\nname: demo-skill\ndescription: demo\n---\n",
35
35
  }), []);
36
36
 
37
+ for (const owner of ["rules/05-git-workflow.md", "rules/common/testing.md", "README.md", "skills/unregistered/SKILL.md", "rules/../README.md"]) {
38
+ const ruleOwned = structuredClone(valid);
39
+ ruleOwned.ownership[0].owner = owner;
40
+ const errors = validateManifest(ruleOwned, {
41
+ exists: (file) => [owner, "AGENTS.md", "skills/demo-skill/SKILL.md"].includes(file),
42
+ skillPaths: ["skills/demo-skill/SKILL.md"],
43
+ read: () => "---\nname: demo-skill\ndescription: demo\n---\n",
44
+ });
45
+ if (owner === "rules/05-git-workflow.md" || owner === "rules/common/testing.md") assert.deepStrictEqual(errors, []);
46
+ else assert(errors.length > 0, `must reject non-rule owner: ${owner}`);
47
+ }
48
+
37
49
  const longDescription = structuredClone(valid);
38
50
  assert.match(validateManifest(longDescription, {
39
51
  exists: (file) => file === "skills/demo-skill/SKILL.md" || file === "AGENTS.md",