claude-everything-workflow 0.2.2 → 0.2.4

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 (92) 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 +13 -18
  7. package/CLAUDE.md +1 -5
  8. package/README.md +101 -368
  9. package/README.zh-CN.md +158 -0
  10. package/agents/database-reviewer.md +0 -3
  11. package/agents/e2e-runner.md +8 -141
  12. package/commands/code-review.md +9 -30
  13. package/commands/pr.md +1 -6
  14. package/commands/verify.md +7 -11
  15. package/docs/plugins.md +91 -0
  16. package/harness/manifest.json +310 -0
  17. package/package.json +14 -2
  18. package/references/git-worktrees.md +29 -0
  19. package/rules/01-base.md +9 -26
  20. package/rules/02-code-size.md +5 -9
  21. package/rules/03-architecture.md +8 -22
  22. package/rules/04-error-handling.md +4 -5
  23. package/rules/05-git-workflow.md +6 -3
  24. package/rules/06-comments.md +3 -9
  25. package/rules/07-forbidden.md +4 -3
  26. package/rules/common/agent-orchestration.md +2 -4
  27. package/rules/common/context-hygiene.md +2 -0
  28. package/rules/common/hooks.md +2 -0
  29. package/rules/common/pr-automation.md +1 -1
  30. package/rules/common/skills-learning.md +2 -2
  31. package/rules/common/testing.md +10 -2
  32. package/scripts/install-rules.js +100 -0
  33. package/scripts/install.ps1 +29 -3
  34. package/scripts/install.sh +26 -2
  35. package/scripts/legacy-common-rule-hashes.json +78 -0
  36. package/scripts/retired-skill-files.json +26 -0
  37. package/scripts/upstream-capability-map.json +14 -9
  38. package/scripts/verify/continuation-checks.test.js +101 -0
  39. package/scripts/verify/core.js +1 -0
  40. package/scripts/verify/grilling-spec-gate-checks.js +48 -11
  41. package/scripts/verify/install-rules.test.js +165 -0
  42. package/scripts/verify/metadata-checks.js +35 -26
  43. package/scripts/verify/plugin-distribution.test.js +40 -0
  44. package/scripts/verify/repository-checks.js +39 -80
  45. package/scripts/verify/skill-invocation.test.js +87 -0
  46. package/scripts/verify/skill-manifest-checks.js +197 -0
  47. package/scripts/verify/skill-manifest-checks.test.js +135 -0
  48. package/scripts/verify/workflow-checks.js +28 -150
  49. package/scripts/verify-harness.js +2 -0
  50. package/scripts/verify-upstream-capability-map.js +2 -1
  51. package/skills/README.md +11 -15
  52. package/skills/code-review/SKILL.md +54 -41
  53. package/skills/codebase-design/SKILL.md +1 -1
  54. package/skills/continuous-learning-v2/SKILL.md +4 -2
  55. package/skills/domain-modeling/SKILL.md +9 -6
  56. package/skills/e2e-testing/SKILL.md +20 -310
  57. package/skills/e2e-testing/references/playwright-patterns.md +324 -0
  58. package/skills/feature-acceptance/SKILL.md +6 -2
  59. package/skills/grilling/SKILL.md +4 -3
  60. package/skills/handoff/SKILL.md +3 -4
  61. package/skills/handoff/agents/openai.yaml +5 -0
  62. package/skills/implement/SKILL.md +32 -81
  63. package/skills/implement/references/ticket-delivery.md +43 -0
  64. package/skills/improve-codebase-architecture/SKILL.md +1 -2
  65. package/skills/improve-codebase-architecture/agents/openai.yaml +5 -0
  66. package/skills/prototype/SKILL.md +1 -1
  67. package/skills/resolving-merge-conflicts/SKILL.md +1 -1
  68. package/skills/spec-gate/SKILL.md +4 -2
  69. package/skills/subagent-driven-development/SKILL.md +3 -3
  70. package/skills/systematic-debugging/SKILL.md +41 -3
  71. package/skills/systematic-debugging/references/diagnostic-scenarios.md +28 -0
  72. package/skills/test-driven-development/SKILL.md +6 -2
  73. package/skills/to-tickets/SKILL.md +5 -3
  74. package/skills/triage/SKILL.md +4 -4
  75. package/skills/triage/agents/openai.yaml +5 -0
  76. package/skills/using-superpowers/SKILL.md +33 -96
  77. package/skills/using-superpowers/references/process-outcomes.md +44 -0
  78. package/skills/visual-companion/SKILL.md +1 -1
  79. package/agents/architect.md +0 -59
  80. package/agents/code-reviewer.md +0 -28
  81. package/agents/planner.md +0 -40
  82. package/agents/tdd-guide.md +0 -101
  83. package/references/agents/database-reviewer.md +0 -657
  84. package/skills/find-skills/SKILL.md +0 -142
  85. package/skills/iterative-retrieval/SKILL.md +0 -84
  86. package/skills/project-context/SKILL.md +0 -94
  87. package/skills/project-context/agents/openai.yaml +0 -6
  88. package/skills/project-context/references/project-context-template.md +0 -61
  89. package/skills/research/SKILL.md +0 -48
  90. package/skills/using-git-worktrees/SKILL.md +0 -64
  91. package/skills/verification-before-completion/SKILL.md +0 -77
  92. package/skills/wayfinder/SKILL.md +0 -57
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+
3
+ const assert = require("node:assert/strict");
4
+ const fs = require("node:fs");
5
+ const os = require("node:os");
6
+ const path = require("node:path");
7
+ const crypto = require("node:crypto");
8
+ const { spawnSync } = require("node:child_process");
9
+ const { installRules } = require("../install-rules");
10
+
11
+ const sourceRoot = path.resolve(__dirname, "../..");
12
+ const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "cew-rules-"));
13
+ const read = (file) => fs.readFileSync(file, "utf8").replace(/\r\n/g, "\n");
14
+ const messages = [];
15
+ const install = (name, host = "claude-code", dryRun = false) => installRules({
16
+ sourceRoot, installRoot: path.join(tempRoot, name), host, dryRun,
17
+ log: (message) => messages.push(message),
18
+ });
19
+
20
+ function checkLegacyMigration() {
21
+ const fixture = path.join(tempRoot, "legacy-source");
22
+ fs.mkdirSync(path.join(fixture, "rules/common"), { recursive: true });
23
+ fs.mkdirSync(path.join(fixture, "scripts"));
24
+ fs.writeFileSync(path.join(fixture, "rules/common/testing.md"), "Current distribution\n");
25
+ const previous = "Previous distribution\n";
26
+ const hash = crypto.createHash("sha256").update(previous).digest("hex");
27
+ fs.writeFileSync(path.join(fixture, "scripts/legacy-common-rule-hashes.json"),
28
+ JSON.stringify({ files: { "common/testing.md": [hash] } }));
29
+ const target = path.join(tempRoot, "legacy-target");
30
+ fs.mkdirSync(path.join(target, "rules/common"), { recursive: true });
31
+ fs.writeFileSync(path.join(target, "rules/common/testing.md"), previous.replace(/\n/g, "\r\n"));
32
+ const options = { sourceRoot: fixture, installRoot: target, host: "claude-code", log: () => {} };
33
+ installRules({ ...options, dryRun: true });
34
+ assert.equal(read(path.join(target, "rules/common/testing.md")), previous);
35
+ assert.equal(fs.existsSync(path.join(target, "references")), false);
36
+ installRules(options);
37
+ assert.equal(fs.existsSync(path.join(target, "rules/common/testing.md")), false);
38
+ assert.equal(read(path.join(target, "references/rules/common/testing.md")), "Current distribution\n");
39
+
40
+ const cold = path.join(target, "references/rules/common/testing.md");
41
+ fs.writeFileSync(cold, previous);
42
+ installRules(options);
43
+ assert.equal(read(cold), "Current distribution\n");
44
+ assert.equal(read(cold + ".bak." + hash), previous);
45
+ }
46
+
47
+ function checkInstallerEntrypoint() {
48
+ const profile = path.join(tempRoot, "installer-profile");
49
+ const windows = process.platform === "win32";
50
+ const executable = windows ? "powershell.exe" : (process.env.CEW_TEST_BASH || "bash");
51
+ const args = windows
52
+ ? ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", path.join(sourceRoot, "scripts/install.ps1")]
53
+ : [path.join(sourceRoot, "scripts/install.sh")];
54
+ // The child gets a disposable profile; never update this process's home or the user's installation.
55
+ const env = { ...process.env, USERPROFILE: profile, HOME: profile };
56
+ const run = (extra = []) => {
57
+ const result = spawnSync(executable, [...args, ...extra], {
58
+ cwd: sourceRoot, env, encoding: "utf8", timeout: 60000, maxBuffer: 8 * 1024 * 1024,
59
+ });
60
+ assert.ifError(result.error);
61
+ assert.equal(result.status, 0, result.stdout + result.stderr);
62
+ };
63
+ run([windows ? "-DryRun" : "--dry-run"]);
64
+ assert.equal(fs.existsSync(path.join(profile, ".claude")), false);
65
+ assert.equal(fs.existsSync(path.join(profile, ".codex")), false);
66
+ // Seed an older installation to exercise retirement and policy replacement through the real CLI.
67
+ for (const host of [".claude", ".codex"]) {
68
+ const skills = path.join(profile, host, "skills");
69
+ for (const retired of ["research", "wayfinder", "find-skills", "project-context", "iterative-retrieval", "using-git-worktrees", "verification-before-completion"]) {
70
+ fs.mkdirSync(path.join(skills, retired), { recursive: true });
71
+ const known = {
72
+ research: ["SKILL.md"],
73
+ "iterative-retrieval": ["SKILL.md"],
74
+ "using-git-worktrees": ["SKILL.md"],
75
+ "verification-before-completion": ["SKILL.md"],
76
+ wayfinder: ["SKILL.md", "agents/openai.yaml"],
77
+ "find-skills": ["SKILL.md", "agents/openai.yaml", "references/skills-cli.md"],
78
+ "project-context": ["SKILL.md", "agents/openai.yaml", "references/project-context-template.md"],
79
+ };
80
+ for (const file of known[retired]) {
81
+ const target = path.join(skills, retired, file);
82
+ fs.mkdirSync(path.dirname(target), { recursive: true });
83
+ fs.writeFileSync(target, "Old distributed content\n");
84
+ }
85
+ fs.writeFileSync(path.join(skills, retired, "personal-notes.md"), "Keep my notes\n");
86
+ }
87
+ fs.mkdirSync(path.join(skills, "handoff/agents"), { recursive: true });
88
+ fs.writeFileSync(path.join(skills, "handoff/agents/openai.yaml"),
89
+ "policy:\n allow_implicit_invocation: false\n");
90
+ }
91
+ run();
92
+ assert.equal(read(path.join(profile, ".claude/references/rules/common/testing.md")),
93
+ read(path.join(sourceRoot, "rules/common/testing.md")));
94
+ assert.equal(fs.existsSync(path.join(profile, ".claude/rules/common/testing.md")), false);
95
+ assert.equal(read(path.join(profile, ".codex/rules/common/testing.md")),
96
+ read(path.join(sourceRoot, "rules/common/testing.md")));
97
+ assert.match(read(path.join(profile, ".claude/CLAUDE.md")), /^@AGENTS\.md$/m);
98
+ for (const host of [".claude", ".codex"]) {
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"]) {
102
+ assert.equal(fs.existsSync(path.join(profile, host, "skills", retired, "SKILL.md")), false);
103
+ const remaining = fs.readdirSync(path.join(profile, host, "skills", retired));
104
+ assert.deepEqual(remaining, ["personal-notes.md"]);
105
+ assert.equal(read(path.join(profile, host, "skills", retired, "personal-notes.md")), "Keep my notes\n");
106
+ }
107
+ assert.equal(fs.existsSync(path.join(profile, host, "skills/wayfinder/agents")), false);
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
+ "安装不应保留仅供包内验证的插件分发测试");
113
+ assert.match(read(path.join(profile, host, "skills/handoff/agents/openai.yaml")),
114
+ /allow_implicit_invocation: true/);
115
+ }
116
+ }
117
+
118
+ try {
119
+ install("fresh");
120
+ const fresh = path.join(tempRoot, "fresh");
121
+ const common = fs.readdirSync(path.join(sourceRoot, "rules/common"));
122
+ assert.equal(common.length, 8);
123
+ for (const file of common) {
124
+ assert.equal(read(path.join(fresh, "references/rules/common", file)),
125
+ read(path.join(sourceRoot, "rules/common", file)));
126
+ assert.equal(fs.existsSync(path.join(fresh, "rules/common", file)), false);
127
+ }
128
+ assert.equal(read(path.join(fresh, "rules/07-forbidden.md")),
129
+ read(path.join(sourceRoot, "rules/07-forbidden.md")));
130
+
131
+ install("codex", "codex");
132
+ assert.equal(read(path.join(tempRoot, "codex/rules/common/testing.md")),
133
+ read(path.join(sourceRoot, "rules/common/testing.md")));
134
+ install("preview", "claude-code", true);
135
+ assert.equal(fs.existsSync(path.join(tempRoot, "preview")), false);
136
+
137
+ const upgrade = path.join(tempRoot, "upgrade");
138
+ fs.mkdirSync(path.join(upgrade, "rules/common"), { recursive: true });
139
+ fs.copyFileSync(path.join(sourceRoot, "rules/common/testing.md"),
140
+ path.join(upgrade, "rules/common/testing.md"));
141
+ fs.writeFileSync(path.join(upgrade, "rules/common/hooks.md"), "Personal hook policy\n");
142
+ fs.writeFileSync(path.join(upgrade, "rules/common/personal.md"), "Keep my rules\n");
143
+ install("upgrade");
144
+ assert.equal(fs.existsSync(path.join(upgrade, "rules/common/testing.md")), false);
145
+ assert.equal(read(path.join(upgrade, "rules/common/hooks.md")), "Personal hook policy\n");
146
+ assert.equal(read(path.join(upgrade, "rules/common/personal.md")), "Keep my rules\n");
147
+ assert.ok(messages.some((message) => /保留.*hooks\.md/.test(message)));
148
+ install("upgrade");
149
+ assert.equal(read(path.join(upgrade, "rules/common/hooks.md")), "Personal hook policy\n");
150
+
151
+ const outside = path.join(tempRoot, "outside");
152
+ fs.mkdirSync(outside);
153
+ const linked = path.join(tempRoot, "linked");
154
+ fs.mkdirSync(linked);
155
+ fs.symlinkSync(outside, path.join(linked, "references"), process.platform === "win32" ? "junction" : "dir");
156
+ assert.throws(() => install("linked"), /symlink/i);
157
+ assert.deepEqual(fs.readdirSync(outside), []);
158
+ assert.throws(() => install("invalid", "unknown"), /host/i);
159
+ checkLegacyMigration();
160
+ checkInstallerEntrypoint();
161
+ console.log("Rule installation tests passed (migration, backups, custom rules, symlink safety, both hosts, installer dry-run and execution).");
162
+ } finally {
163
+ // Only remove the exact private directory returned by mkdtemp; never a caller-supplied path.
164
+ fs.rmSync(tempRoot, { recursive: true, force: true });
165
+ }
@@ -15,6 +15,8 @@ let requireTokens;
15
15
  const PACKAGE_ONLY_PATHS = [
16
16
  "scripts/install.sh",
17
17
  "scripts/install.ps1",
18
+ "scripts/install-rules.js",
19
+ "scripts/legacy-common-rule-hashes.json",
18
20
  "scripts/verify-harness.js",
19
21
  "scripts/verify/core.js",
20
22
  "scripts/verify/grilling-spec-gate-checks.js",
@@ -24,6 +26,12 @@ const PACKAGE_ONLY_PATHS = [
24
26
  "scripts/verify/workflow-checks.js",
25
27
  "scripts/verify/workflow-ownership-fixtures.js",
26
28
  "scripts/verify/workflow-ownership.js",
29
+ "scripts/verify/skill-manifest-checks.js",
30
+ "scripts/verify/skill-manifest-checks.test.js",
31
+ "scripts/verify/skill-invocation.test.js",
32
+ "scripts/verify/continuation-checks.test.js",
33
+ "scripts/verify/install-rules.test.js",
34
+ "scripts/verify/plugin-distribution.test.js",
27
35
  ];
28
36
 
29
37
  function bindContext(context) {
@@ -95,9 +103,9 @@ function checkReadmeTreePaths() {
95
103
  if (!exists("README.md")) return;
96
104
 
97
105
  const body = read("README.md");
98
- const treeMatch = body.match(/## 目录结构[\s\S]*?```([\s\S]*?)```/);
106
+ const treeMatch = body.match(/## Repository structure[\s\S]*?```([\s\S]*?)```/);
99
107
  if (!treeMatch) {
100
- fail("README.md should include a directory tree under ## 目录结构");
108
+ fail("README.md should include a directory tree under ## Repository structure");
101
109
  return;
102
110
  }
103
111
 
@@ -123,6 +131,8 @@ function checkReadmeTreePaths() {
123
131
 
124
132
  const pathInTree = stack.join("/").replace(/\\/g, "/");
125
133
  if (ignored.has(pathInTree)) continue;
134
+ if (!exists(".git") && !exists(".github") &&
135
+ (pathInTree === ".github" || pathInTree.startsWith(".github/"))) continue;
126
136
 
127
137
  if (!exists(pathInTree)) {
128
138
  fail(`README directory tree lists missing path: ${pathInTree}`);
@@ -157,13 +167,13 @@ function checkPackageOnlyLists(ps, sh) {
157
167
 
158
168
  function checkInstallerSurface(ps, sh) {
159
169
  const sharedDirs = [
160
- "rules",
161
170
  "agents",
162
171
  "commands",
163
172
  "scripts",
164
173
  "hooks",
165
174
  "skills",
166
175
  "references",
176
+ "harness",
167
177
  ];
168
178
  for (const dir of sharedDirs) {
169
179
  if (!ps.includes(`"${dir}"`)) {
@@ -173,6 +183,15 @@ function checkInstallerSurface(ps, sh) {
173
183
  fail(`scripts/install.sh shared dirs should include ${dir}`);
174
184
  }
175
185
  }
186
+ for (const host of ["claude-code", "codex"]) {
187
+ if (!ps.includes(`Install-WorkflowRules -Destination $dest -HostName "${host}"`) ||
188
+ !sh.includes(`install_workflow_rules ${host} "$dest"`)) {
189
+ fail(`installers must route ${host} rules through the host adapter`);
190
+ }
191
+ }
192
+ if (sh.includes('copy_dir rules "$dest"') || /\$dirs\s*=\s*@\([^)]*"rules"/s.test(ps)) {
193
+ fail("installers must not copy cold common rules into the shared automatic rules directory");
194
+ }
176
195
  if (ps.includes('"homunculus"')) {
177
196
  fail("scripts/install.ps1 should not install removed homunculus directory");
178
197
  }
@@ -203,10 +222,6 @@ function checkInstallerSurface(ps, sh) {
203
222
  }
204
223
 
205
224
  function checkInstallRuntimePolicy() {
206
- requireTokens("README.md", [
207
- "Codex 安装共享 Workflow 材料,不默认消费 Claude Code `settings.json`",
208
- "Codex 安装同一套 `hooks/` 脚本材料,但不会因为安装本仓文件而自动启用 Claude Code hooks",
209
- ]);
210
225
 
211
226
  requireTokens("scripts/install.ps1", [
212
227
  "Copy-ClaudeSettings",
@@ -490,6 +505,13 @@ function checkReleaseRecoveryBehavior() {
490
505
  }
491
506
 
492
507
  function checkGitHubWorkflows() {
508
+ // npm packages omit repository-only CI files; a checkout must still retain them.
509
+ if (!exists(".github/workflows/ci.yml")) {
510
+ if (exists(".git") || exists(".github")) {
511
+ fail("repository CI is missing: .github/workflows/ci.yml");
512
+ }
513
+ return;
514
+ }
493
515
  const ci = read(".github/workflows/ci.yml");
494
516
 
495
517
  requireTokens(".github/workflows/ci.yml", [
@@ -498,7 +520,7 @@ function checkGitHubWorkflows() {
498
520
  "npm run verify",
499
521
  "npm run pack:dry-run",
500
522
  "publish:",
501
- "needs: verify",
523
+ "needs: [verify, test-macos-installer]",
502
524
  "id-token: write",
503
525
  "node-version: 22.14.0",
504
526
  "package-manager-cache: false",
@@ -526,13 +548,6 @@ function checkGitHubWorkflows() {
526
548
  }
527
549
  checkReleaseRecoveryBehavior();
528
550
 
529
- requireTokens("README.md", [
530
- "npm 发布",
531
- "版本号通过 PR",
532
- "ci.yml",
533
- "受信任的发布商",
534
- "npm 发布成功后才创建",
535
- ]);
536
551
  }
537
552
 
538
553
  function checkLearningPathPolicy() {
@@ -571,10 +586,6 @@ function checkLearningPathPolicy() {
571
586
  }
572
587
  }
573
588
 
574
- requireTokens("README.md", [
575
- "skills/learn/<category>/",
576
- "观察、候选和迁移来源",
577
- ]);
578
589
  requireTokens("commands/learn.md", [
579
590
  "/learn eval",
580
591
  "/learn evolve",
@@ -594,7 +605,6 @@ function checkSkillCategoryIndex() {
594
605
  "Process / 门禁",
595
606
  "Engineering / 开发实践",
596
607
  "Harness / 上下文与编排",
597
- "Meta / Skill 管理",
598
608
  "Learn / 学习沉淀",
599
609
  ]);
600
610
 
@@ -625,12 +635,6 @@ function checkSkillCategoryIndex() {
625
635
  }
626
636
  }
627
637
 
628
- requireTokens("README.md", [
629
- "Skill 分类索引",
630
- "物理目录保持平铺以兼容发现",
631
- "只有学习产物使用物理分类目录 `skills/learn/<category>/`",
632
- ]);
633
-
634
638
  requireTokens("rules/common/skills-learning.md", [
635
639
  "正式 skill 目录保持 `skills/<skill-name>/SKILL.md` 平铺结构",
636
640
  "分类维护在 `skills/README.md`",
@@ -684,6 +688,9 @@ function checkNpmPackageSurface() {
684
688
  ]);
685
689
 
686
690
  const packageFiles = JSON.parse(read("package.json")).files ?? [];
691
+ if (!packageFiles.includes("README.zh-CN.md")) {
692
+ fail("package.json should publish README.zh-CN.md so the language link works in the package");
693
+ }
687
694
  const publishesHomunculus = packageFiles.some((file) => {
688
695
  const normalized = file.replace(/\\/g, "/").replace(/^\.\//, "");
689
696
  return normalized === "homunculus" || normalized.startsWith("homunculus/");
@@ -710,6 +717,8 @@ function checkNpmPackageSurface() {
710
717
 
711
718
  function runMetadataChecks(context) {
712
719
  bindContext(context);
720
+ requireTokens("README.md", ["[简体中文](README.zh-CN.md)", "(LICENSE)"]);
721
+ requireTokens("README.zh-CN.md", ["[English](README.md)", "(LICENSE)"]);
713
722
  checkCommands();
714
723
  checkReadmeTreePaths();
715
724
  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
+ });
@@ -18,19 +18,17 @@ function checkRouterAndAgentLinks() {
18
18
  "independent frontier tickets with no overlapping write surface?",
19
19
  "skills/subagent-driven-development/SKILL.md",
20
20
  "skill discovery or install request?",
21
- "find-skills",
22
21
  "external skill learning or edit?",
23
22
  "process skills before implementation skills",
24
23
  "skills/grilling/SKILL.md",
25
24
  "spec-gate",
26
25
  "skills/systematic-debugging/SKILL.md",
27
- "skills/verification-before-completion/SKILL.md",
26
+ "rules/common/testing.md",
28
27
  "User instructions",
29
28
  ]);
30
29
 
31
30
  const expected = [
32
31
  ["agents/e2e-runner.md", "skills/e2e-testing/SKILL.md"],
33
- ["agents/tdd-guide.md", "skills/test-driven-development/SKILL.md"],
34
32
  ];
35
33
 
36
34
  for (const [agent, skill] of expected) {
@@ -41,7 +39,7 @@ function checkRouterAndAgentLinks() {
41
39
  }
42
40
  }
43
41
 
44
- for (const agent of ["agents/harness-optimizer.md", "agents/planner.md"]) {
42
+ for (const agent of ["agents/harness-optimizer.md"]) {
45
43
  if (!exists(agent)) {
46
44
  fail(`${agent} is missing`);
47
45
  continue;
@@ -64,8 +62,6 @@ function checkTicketFirstDelivery() {
64
62
  }
65
63
  }
66
64
 
67
- requireTokens("agents/planner.md", ["to-tickets", "ticket", "不写文件路径"]);
68
-
69
65
  requireTokens("skills/to-tickets/SKILL.md", [
70
66
  "tracer bullet",
71
67
  "blocking edges",
@@ -75,12 +71,15 @@ function checkTicketFirstDelivery() {
75
71
  "Do not publish before approval",
76
72
  ]);
77
73
  requireTokens("skills/implement/SKILL.md", [
78
- "一个 fresh context",
79
74
  "test-driven-development",
80
- "ticket as the Spec source",
81
- "`/code-review --worktree <pre-ticket-base> --spec <ticket>`",
82
75
  "direct-scope contract",
83
76
  "无 ticket 范围不得 claim 或写入任何 tracker",
77
+ "[references/ticket-delivery.md](references/ticket-delivery.md)",
78
+ ]);
79
+ requireTokens("skills/implement/references/ticket-delivery.md", [
80
+ "一个 fresh context",
81
+ "ticket as the Spec source",
82
+ "`/code-review --worktree <pre-ticket-base> --spec <ticket>`",
84
83
  ]);
85
84
  requireTokens("skills/subagent-driven-development/SKILL.md", [
86
85
  "frontier ticket",
@@ -221,60 +220,21 @@ function checkCodeReviewContracts() {
221
220
  "NOT RUN",
222
221
  ]);
223
222
 
224
- requireTokens("agents/code-reviewer.md", [
225
- "skills/code-review/SKILL.md",
226
- "## Standards",
227
- "## Spec",
228
- "two isolated review contexts",
229
- ]);
230
-
231
- requireTokens("README.md", [
232
- "固定基点下并行执行隔离的 Standards 轴与 Spec 轴审查",
233
- ]);
234
-
235
- requireTokens("skills/implement/SKILL.md", [
223
+ requireTokens("skills/implement/references/ticket-delivery.md", [
236
224
  "pre-ticket base",
237
225
  "ticket as the Spec source",
238
226
  ]);
239
227
  }
240
228
 
241
229
  function checkProjectContextContracts() {
242
- requireTokens("skills/project-context/SKILL.md", [
243
- "Only when the user explicitly asks",
244
- "docs/agent-workflow/project-context.md",
245
- "CONFIGURED",
246
- "Do not create an empty `CONTEXT.md`",
247
- "references/project-context-template.md",
248
- "bug",
249
- "enhancement",
250
- ]);
251
- requireTokens("skills/project-context/references/project-context-template.md", [
252
- "`bug`",
253
- "`enhancement`",
254
- "Claim",
255
- "Progress",
256
- "Resolve",
257
- ]);
258
-
259
- requireTokens("skills/project-context/agents/openai.yaml", [
260
- "display_name",
261
- "default_prompt",
262
- "allow_implicit_invocation: false",
263
- ]);
264
-
265
- requireTokens("skills/domain-modeling/SKILL.md", [
266
- "docs/agent-workflow/project-context.md",
267
- ]);
268
-
269
- requireTokens("skills/using-superpowers/SKILL.md", [
270
- "explicit project-context setup request?",
271
- "project-context",
272
- ]);
273
-
274
- requireTokens("README.md", [
275
- "直接请求配置 project context",
276
- "project-context",
277
- ]);
230
+ for (const name of ["find-skills", "project-context"]) {
231
+ if (exists(`skills/${name}/SKILL.md`)) fail(`${name} Skill must be retired`);
232
+ }
233
+ for (const file of ["skills/to-tickets/SKILL.md", "skills/triage/SKILL.md", "skills/domain-modeling/SKILL.md"]) {
234
+ requireTokens(file, ["docs/agent-workflow/project-context.md"]);
235
+ }
236
+ requireTokens("skills/to-tickets/SKILL.md", ["does not block drafting", "Before publication"]);
237
+ requireTokens("skills/triage/SKILL.md", ["does not block read-only assessment", "before external changes"]);
278
238
  }
279
239
 
280
240
  function checkTrackerDeliveryLifecycle() {
@@ -283,13 +243,20 @@ function checkTrackerDeliveryLifecycle() {
283
243
  "[RESOLVE → REFRESH_FRONTIER] → FINISH_DELIVERY";
284
244
 
285
245
  requireTokens("skills/implement/SKILL.md", [
246
+ "rules/05-git-workflow.md",
247
+ "clean baseline",
248
+ "pre-delivery base",
249
+ "不覆盖 commit、push 或创建 PR",
250
+ "无 ticket 范围不得 claim 或写入任何 tracker",
251
+ ]);
252
+ requireTokens("rules/05-git-workflow.md", [
253
+ "开发新功能必须使用独立 `git worktree` 和任务分支",
254
+ "单文件新功能也不例外",
255
+ ]);
256
+ requireTokens("skills/implement/references/ticket-delivery.md", [
286
257
  "## State Machine",
287
258
  deliveryLifecycle,
288
- "无 ticket 的 direct scope 或 approved Spec scope 跳过 CLAIM、RESOLVE",
289
259
  "docs/agent-workflow/project-context.md",
290
- "skills/using-git-worktrees/SKILL.md",
291
- "除只读分析和单文件修改外,所有代码、配置、Harness 改动必须先创建独立" +
292
- " `git worktree` 和任务分支",
293
260
  "clean baseline",
294
261
  "pre-ticket base",
295
262
  "一个 fresh context",
@@ -305,13 +272,11 @@ function checkTrackerDeliveryLifecycle() {
305
272
  "frontier 为空但仍有 open tickets",
306
273
  "BLOCKED_GRAPH",
307
274
  "open ticket count = 0",
308
- "全分支双轴 review",
275
+ "全分支相称 review",
309
276
  "`/verify pre-pr`",
310
277
  "`/pr` 或 keep",
311
278
  "可重新选择串行 `implement` 或安全 SDD",
312
- "不覆盖 commit、push 或创建 PR",
313
279
  "不得自动关闭外部 Issue",
314
- "无 ticket 范围不得 claim 或写入任何 tracker",
315
280
  ]);
316
281
 
317
282
  requireTokens("commands/pr.md", [
@@ -321,27 +286,18 @@ function checkTrackerDeliveryLifecycle() {
321
286
  }
322
287
 
323
288
  function checkExecutionSupportSkills() {
324
- requireTokens("skills/using-git-worktrees/SKILL.md", [
289
+ requireTokens("references/git-worktrees.md", [
325
290
  "git worktree add",
326
291
  "git worktree remove",
327
- "Do not create a worktree for simple single-file edits",
292
+ "rules/05-git-workflow.md",
293
+ "git status --short",
328
294
  ]);
329
295
 
330
- requireTokens("skills/verification-before-completion/SKILL.md", [
331
- "fresh verification evidence",
296
+ requireTokens("rules/common/testing.md", [
297
+ "本轮",
332
298
  "skills/systematic-debugging/SKILL.md",
333
- "skipped checks",
334
- "remaining risk",
335
- ]);
336
-
337
- requireTokens("skills/iterative-retrieval/SKILL.md", [
338
- "Dispatch",
339
- "Evaluate",
340
- "Refine",
341
- "最多跑 3 轮",
342
- "回传格式",
343
- "事实、证据和盲点缺口",
344
- "skills/using-superpowers/SKILL.md",
299
+ "未运行",
300
+ "剩余风险",
345
301
  ]);
346
302
 
347
303
  requireTokens("skills/feature-acceptance/SKILL.md", [
@@ -395,6 +351,9 @@ function checkRuleLoadingPolicy() {
395
351
  if (!agentsBody.includes("~/.claude/rules/")) {
396
352
  fail("AGENTS.md should mention Claude Code user-level rules fallback");
397
353
  }
354
+ if (!agentsBody.includes("~/.claude/references/rules/common/")) {
355
+ fail("AGENTS.md should resolve Claude common rules from the cold reference directory");
356
+ }
398
357
  if (!agentsBody.includes("不能把项目规则目录缺失等同于") || !agentsBody.includes("无规则")) {
399
358
  fail("AGENTS.md should forbid treating a missing project rules directory as no rules");
400
359
  }