claude-everything-workflow 0.2.2 → 0.2.3

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 (77) hide show
  1. package/AGENTS.md +6 -5
  2. package/CLAUDE.md +1 -5
  3. package/README.md +57 -27
  4. package/agents/e2e-runner.md +8 -141
  5. package/commands/code-review.md +9 -30
  6. package/commands/pr.md +1 -6
  7. package/commands/verify.md +7 -11
  8. package/harness/manifest.json +346 -0
  9. package/package.json +7 -2
  10. package/rules/01-base.md +9 -26
  11. package/rules/02-code-size.md +5 -9
  12. package/rules/03-architecture.md +8 -22
  13. package/rules/04-error-handling.md +4 -5
  14. package/rules/05-git-workflow.md +4 -3
  15. package/rules/06-comments.md +3 -9
  16. package/rules/07-forbidden.md +4 -3
  17. package/rules/common/agent-orchestration.md +1 -3
  18. package/rules/common/hooks.md +2 -0
  19. package/rules/common/pr-automation.md +1 -1
  20. package/rules/common/skills-learning.md +1 -1
  21. package/rules/common/testing.md +3 -2
  22. package/scripts/install-rules.js +100 -0
  23. package/scripts/install.ps1 +27 -3
  24. package/scripts/install.sh +24 -2
  25. package/scripts/legacy-common-rule-hashes.json +78 -0
  26. package/scripts/retired-skill-files.json +17 -0
  27. package/scripts/upstream-capability-map.json +14 -9
  28. package/scripts/verify/grilling-spec-gate-checks.js +11 -5
  29. package/scripts/verify/install-rules.test.js +156 -0
  30. package/scripts/verify/metadata-checks.js +26 -3
  31. package/scripts/verify/repository-checks.js +35 -61
  32. package/scripts/verify/skill-invocation.test.js +86 -0
  33. package/scripts/verify/skill-manifest-checks.js +197 -0
  34. package/scripts/verify/skill-manifest-checks.test.js +123 -0
  35. package/scripts/verify/workflow-checks.js +26 -82
  36. package/scripts/verify-harness.js +2 -0
  37. package/scripts/verify-upstream-capability-map.js +2 -1
  38. package/skills/README.md +9 -10
  39. package/skills/code-review/SKILL.md +54 -41
  40. package/skills/codebase-design/SKILL.md +1 -1
  41. package/skills/continuous-learning-v2/SKILL.md +1 -1
  42. package/skills/domain-modeling/SKILL.md +3 -2
  43. package/skills/e2e-testing/SKILL.md +20 -310
  44. package/skills/e2e-testing/references/playwright-patterns.md +324 -0
  45. package/skills/feature-acceptance/SKILL.md +1 -1
  46. package/skills/grilling/SKILL.md +1 -1
  47. package/skills/handoff/SKILL.md +3 -4
  48. package/skills/handoff/agents/openai.yaml +2 -0
  49. package/skills/implement/SKILL.md +32 -81
  50. package/skills/implement/references/ticket-delivery.md +43 -0
  51. package/skills/improve-codebase-architecture/SKILL.md +1 -2
  52. package/skills/improve-codebase-architecture/agents/openai.yaml +2 -0
  53. package/skills/iterative-retrieval/SKILL.md +1 -1
  54. package/skills/prototype/SKILL.md +1 -1
  55. package/skills/resolving-merge-conflicts/SKILL.md +1 -1
  56. package/skills/spec-gate/SKILL.md +1 -1
  57. package/skills/subagent-driven-development/SKILL.md +2 -2
  58. package/skills/systematic-debugging/SKILL.md +9 -3
  59. package/skills/test-driven-development/SKILL.md +6 -2
  60. package/skills/to-tickets/SKILL.md +5 -3
  61. package/skills/triage/SKILL.md +4 -4
  62. package/skills/triage/agents/openai.yaml +2 -0
  63. package/skills/using-git-worktrees/SKILL.md +8 -5
  64. package/skills/using-superpowers/SKILL.md +27 -94
  65. package/skills/using-superpowers/references/process-outcomes.md +41 -0
  66. package/skills/verification-before-completion/SKILL.md +5 -4
  67. package/skills/visual-companion/SKILL.md +1 -1
  68. package/agents/architect.md +0 -59
  69. package/agents/code-reviewer.md +0 -28
  70. package/agents/planner.md +0 -40
  71. package/agents/tdd-guide.md +0 -101
  72. package/skills/find-skills/SKILL.md +0 -142
  73. package/skills/project-context/SKILL.md +0 -94
  74. package/skills/project-context/agents/openai.yaml +0 -6
  75. package/skills/project-context/references/project-context-template.md +0 -61
  76. package/skills/research/SKILL.md +0 -48
  77. package/skills/wayfinder/SKILL.md +0 -57
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
+ const crypto = require("node:crypto");
7
+
8
+ const digest = (content) => crypto.createHash("sha256")
9
+ .update(content.toString("utf8").replace(/\r\n/g, "\n")).digest("hex");
10
+
11
+ // Check the root and every descendant before touching a managed file; do not follow links.
12
+ function checkedPath(root, relative) {
13
+ const target = path.resolve(root, relative);
14
+ if (target !== root && !target.startsWith(root + path.sep)) {
15
+ throw new Error(`Path escapes install root: ${relative}`);
16
+ }
17
+ let cursor = target;
18
+ for (;;) {
19
+ try {
20
+ if (fs.lstatSync(cursor).isSymbolicLink()) throw new Error(`Refusing symlink: ${cursor}`);
21
+ } catch (error) {
22
+ if (error.code !== "ENOENT") throw error;
23
+ }
24
+ if (cursor === root) break;
25
+ cursor = path.dirname(cursor);
26
+ }
27
+ return target;
28
+ }
29
+
30
+ function copyRule({ source, root, relative, dryRun, log }) {
31
+ const target = checkedPath(root, relative);
32
+ const content = fs.readFileSync(source);
33
+ if (fs.existsSync(target)) {
34
+ const previous = fs.readFileSync(target);
35
+ if (content.equals(previous)) return;
36
+ const backup = checkedPath(root, relative + ".bak." + digest(previous));
37
+ log(`${dryRun ? "[dry-run] " : ""}备份规则: ${backup}`);
38
+ if (!dryRun && !fs.existsSync(backup)) fs.copyFileSync(target, backup, fs.constants.COPYFILE_EXCL);
39
+ }
40
+ log(`${dryRun ? "[dry-run] " : ""}安装规则: ${target}`);
41
+ if (!dryRun) {
42
+ fs.mkdirSync(path.dirname(target), { recursive: true });
43
+ fs.copyFileSync(source, target);
44
+ }
45
+ }
46
+
47
+ function retireCommon({ source, root, relative, knownHashes, dryRun, log }) {
48
+ const target = checkedPath(root, relative);
49
+ if (!fs.existsSync(target)) return;
50
+ const hash = digest(fs.readFileSync(target));
51
+ if (hash !== digest(fs.readFileSync(source)) && !knownHashes.includes(hash)) {
52
+ log(`保留个人修改,仍可能自动加载: ${target}`);
53
+ return;
54
+ }
55
+ log(`${dryRun ? "[dry-run] " : ""}移除已迁移的分发规则: ${target}`);
56
+ if (!dryRun) fs.unlinkSync(target);
57
+ }
58
+
59
+ function installRules({ sourceRoot, installRoot, host, dryRun = false, log = console.log }) {
60
+ if (!["claude-code", "codex"].includes(host)) throw new Error(`Invalid host: ${host}`);
61
+ const root = path.resolve(installRoot);
62
+ const rulesRoot = path.join(sourceRoot, "rules");
63
+ const legacy = JSON.parse(fs.readFileSync(path.join(sourceRoot, "scripts/legacy-common-rule-hashes.json"), "utf8"));
64
+ const files = fs.readdirSync(rulesRoot, { withFileTypes: true })
65
+ .filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
66
+ .map((entry) => entry.name);
67
+ const commonFiles = fs.readdirSync(path.join(rulesRoot, "common"), { withFileTypes: true })
68
+ .filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
69
+ .map((entry) => `common/${entry.name}`);
70
+ // Validate all managed destinations before the first write, including upgrade cleanup paths.
71
+ for (const relative of [...files, ...commonFiles]) {
72
+ checkedPath(root, `rules/${relative}`);
73
+ if (host === "claude-code" && relative.startsWith("common/")) {
74
+ checkedPath(root, `references/rules/${relative}`);
75
+ }
76
+ }
77
+ for (const relative of [...files, ...commonFiles]) {
78
+ const source = path.join(rulesRoot, relative);
79
+ const cold = host === "claude-code" && relative.startsWith("common/");
80
+ copyRule({ source, root, relative: `${cold ? "references/rules" : "rules"}/${relative}`, dryRun, log });
81
+ if (cold) retireCommon({ source, root, relative: `rules/${relative}`,
82
+ knownHashes: legacy.files[relative] || [], dryRun, log });
83
+ }
84
+ }
85
+
86
+ module.exports = { installRules };
87
+
88
+ if (require.main === module) {
89
+ const [host, installRoot, ...options] = process.argv.slice(2);
90
+ try {
91
+ if (!installRoot || options.some((option) => option !== "--dry-run")) {
92
+ throw new Error("Usage: install-rules.js <claude-code|codex> <install-root> [--dry-run]");
93
+ }
94
+ installRules({ sourceRoot: path.resolve(__dirname, ".."), installRoot, host,
95
+ dryRun: options.includes("--dry-run") });
96
+ } catch (error) {
97
+ process.stderr.write(`${error.message}\n`);
98
+ process.exitCode = 1;
99
+ }
100
+ }
@@ -137,6 +137,11 @@ function Copy-DirectoryMerge {
137
137
  }
138
138
 
139
139
  $destDir = Join-Path $DestinationRoot $Name
140
+ $existingDest = Get-Item -LiteralPath $destDir -Force -ErrorAction SilentlyContinue
141
+ if ($null -ne $existingDest -and ($existingDest.Attributes -band [IO.FileAttributes]::ReparsePoint)) {
142
+ throw "Refusing to merge into symlinked destination: $destDir"
143
+ }
144
+
140
145
  Invoke-InstallCommand `
141
146
  -Description "New-Item -ItemType Directory '$destDir'" `
142
147
  -Action { New-Item -ItemType Directory -Path $destDir -Force | Out-Null }
@@ -150,13 +155,13 @@ function Install-SharedDirs {
150
155
  param([string]$Destination)
151
156
 
152
157
  $dirs = @(
153
- "rules",
154
158
  "agents",
155
159
  "commands",
156
160
  "scripts",
157
161
  "hooks",
158
162
  "skills",
159
- "references"
163
+ "references",
164
+ "harness"
160
165
  )
161
166
 
162
167
  foreach ($dir in $dirs) {
@@ -170,6 +175,8 @@ function Remove-PackageOnlyPaths {
170
175
  $packageOnlyFiles = @(
171
176
  "scripts\install.sh",
172
177
  "scripts\install.ps1",
178
+ "scripts\install-rules.js",
179
+ "scripts\legacy-common-rule-hashes.json",
173
180
  "scripts\verify-harness.js",
174
181
  "scripts\verify\core.js",
175
182
  "scripts\verify\grilling-spec-gate-checks.js",
@@ -178,7 +185,11 @@ function Remove-PackageOnlyPaths {
178
185
  "scripts\verify\runtime-checks.js",
179
186
  "scripts\verify\workflow-checks.js",
180
187
  "scripts\verify\workflow-ownership-fixtures.js",
181
- "scripts\verify\workflow-ownership.js"
188
+ "scripts\verify\workflow-ownership.js",
189
+ "scripts\verify\skill-manifest-checks.js",
190
+ "scripts\verify\skill-manifest-checks.test.js",
191
+ "scripts\verify\skill-invocation.test.js",
192
+ "scripts\verify\install-rules.test.js"
182
193
  )
183
194
 
184
195
  foreach ($relative in $packageOnlyFiles) {
@@ -299,6 +310,7 @@ function Install-ClaudeWorkflow {
299
310
  Copy-ClaudeSettings -Source (Join-Path $RootDir "settings.json") -Destination $settingsPath
300
311
  Convert-ClaudeSettingsHookPaths -SettingsPath $settingsPath
301
312
  Install-SharedDirs -Destination $dest
313
+ Install-WorkflowRules -Destination $dest -HostName "claude-code"
302
314
  Remove-RetiredSkills -Destination $dest
303
315
  Remove-PackageOnlyPaths -Destination $dest
304
316
  }
@@ -314,10 +326,22 @@ function Install-CodexWorkflow {
314
326
  Remove-ObsoleteWorkflowPaths -Destination $dest
315
327
  Copy-ConfigFile -Source (Join-Path $RootDir "AGENTS.md") -Destination (Join-Path $dest "AGENTS.md")
316
328
  Install-SharedDirs -Destination $dest
329
+ Install-WorkflowRules -Destination $dest -HostName "codex"
317
330
  Remove-RetiredSkills -Destination $dest
318
331
  Remove-PackageOnlyPaths -Destination $dest
319
332
  }
320
333
 
334
+ function Install-WorkflowRules {
335
+ param([string]$Destination, [string]$HostName)
336
+
337
+ $ruleArgs = @((Join-Path $RootDir "scripts\install-rules.js"), $HostName, $Destination)
338
+ if ($DryRun) { $ruleArgs += "--dry-run" }
339
+ & node @ruleArgs
340
+ if ($LASTEXITCODE -ne 0) {
341
+ throw "Rule installation failed with exit code $LASTEXITCODE"
342
+ }
343
+ }
344
+
321
345
  Test-RetiredSkillManifest
322
346
 
323
347
  if ($InstallClaude) {
@@ -103,6 +103,11 @@ copy_dir() {
103
103
  return
104
104
  fi
105
105
 
106
+ if [ -L "$dest_root/$name" ]; then
107
+ echo "Refusing to merge into symlinked destination: $dest_root/$name" >&2
108
+ exit 1
109
+ fi
110
+
106
111
  run mkdir -p "$dest_root/$name"
107
112
  run rsync -a "$ROOT_DIR/$name/" "$dest_root/$name/"
108
113
  }
@@ -121,13 +126,13 @@ require_rsync() {
121
126
  install_shared_dirs() {
122
127
  local dest="$1"
123
128
 
124
- copy_dir rules "$dest"
125
129
  copy_dir agents "$dest"
126
130
  copy_dir commands "$dest"
127
131
  copy_dir scripts "$dest"
128
132
  copy_dir hooks "$dest"
129
133
  copy_dir skills "$dest"
130
134
  copy_dir references "$dest"
135
+ copy_dir harness "$dest"
131
136
  }
132
137
 
133
138
  remove_package_only_paths() {
@@ -136,6 +141,8 @@ remove_package_only_paths() {
136
141
  for file in \
137
142
  "scripts/install.sh" \
138
143
  "scripts/install.ps1" \
144
+ "scripts/install-rules.js" \
145
+ "scripts/legacy-common-rule-hashes.json" \
139
146
  "scripts/verify-harness.js" \
140
147
  "scripts/verify/core.js" \
141
148
  "scripts/verify/grilling-spec-gate-checks.js" \
@@ -144,7 +151,11 @@ remove_package_only_paths() {
144
151
  "scripts/verify/runtime-checks.js" \
145
152
  "scripts/verify/workflow-checks.js" \
146
153
  "scripts/verify/workflow-ownership-fixtures.js" \
147
- "scripts/verify/workflow-ownership.js"
154
+ "scripts/verify/workflow-ownership.js" \
155
+ "scripts/verify/skill-manifest-checks.js" \
156
+ "scripts/verify/skill-manifest-checks.test.js" \
157
+ "scripts/verify/skill-invocation.test.js" \
158
+ "scripts/verify/install-rules.test.js"
148
159
  do
149
160
  if [ -f "$dest/$file" ]; then
150
161
  run rm -f "$dest/$file"
@@ -229,6 +240,7 @@ install_claude() {
229
240
  copy_file "$ROOT_DIR/AGENTS.md" "$dest/AGENTS.md"
230
241
  copy_claude_settings "$ROOT_DIR/settings.json" "$dest/settings.json"
231
242
  install_shared_dirs "$dest"
243
+ install_workflow_rules claude-code "$dest"
232
244
  cleanup_retired_skills "$dest"
233
245
  remove_package_only_paths "$dest"
234
246
  }
@@ -241,10 +253,20 @@ install_codex() {
241
253
  remove_obsolete_workflow_paths "$dest"
242
254
  copy_file "$ROOT_DIR/AGENTS.md" "$dest/AGENTS.md"
243
255
  install_shared_dirs "$dest"
256
+ install_workflow_rules codex "$dest"
244
257
  cleanup_retired_skills "$dest"
245
258
  remove_package_only_paths "$dest"
246
259
  }
247
260
 
261
+ install_workflow_rules() {
262
+ local host_name="$1"
263
+ local dest="$2"
264
+ # Bash <4.4 treats empty arrays as unset under set -u.
265
+ local options=("$ROOT_DIR/scripts/install-rules.js" "$host_name" "$dest")
266
+ if [ "$DRY_RUN" -eq 1 ]; then options+=(--dry-run); fi
267
+ node "${options[@]}"
268
+ }
269
+
248
270
  validate_retired_skill_manifest
249
271
  require_rsync
250
272
 
@@ -0,0 +1,78 @@
1
+ {
2
+ "version": 1,
3
+ "algorithm": "sha256-lf",
4
+ "source": "origin/main history through a4f938bc70f3f85e4dcfad4d2534f522b823ea20",
5
+ "files": {
6
+ "common/agent-orchestration.md": [
7
+ "0518525f093f91b60dbae5259e0f228686687abdd65787b880f59e286c2e546c",
8
+ "3b5095839ff85adefb7324518526be65c473770df9124d190137ba05721ca6bf",
9
+ "3fb0846a2c57b833c12195610bab569e295981e2d2b6b33aa72660220be8131f",
10
+ "4840d178f06f4bdd9b67de8acb5bf4cc00b456f7dd5245db0cc5831c20b0587e",
11
+ "93a4101d3f6bb15dd8274a6064ae30c1bff43174a89384ce87a767e40b88805f",
12
+ "96bd24c0db02977e924a4d8c99e1cd9fc7ec0c43dd63e8de2fefd423cf795a5e"
13
+ ],
14
+ "common/context-hygiene.md": [
15
+ "0e98ade57a4739e99f0f9651b2e01507241849ba6f8dcdb676755694b4347a39",
16
+ "366c50d792cac5339e90e23d727dff5e818b2797a904284f3aac809377ee9a0c",
17
+ "d6462e16f190e9d8b737f9fb57039606a637920ca681641b0bcf6dbaad671ea2",
18
+ "de9a23f664094629974ec24697a196822f33d4f222b70b821831089d4d761a6e"
19
+ ],
20
+ "common/harness-engineering.md": [
21
+ "591091ef8f64c8f00d4de9dd78e112bc22bc4dfe36ba44f738670df0c2b44254",
22
+ "9247631278f21f200dc9231ad6c9a2608824f8382acbe136721db042d1626ad4"
23
+ ],
24
+ "common/hooks.md": [
25
+ "2b55915316968a573e2b375c5031cfd48a6a4c7a09581157c341193382089484",
26
+ "2bffbf111b970a42b7e9d5d3a99b83754a9162256e60679a9d98bf1c5be0665d",
27
+ "581ed0a2b50d46b5bdda7ecf6fb8a629b825216175aa02b22248e985380baae7",
28
+ "617f99d48a1a0a4f32f9a716758b75eb487b35596805b34e98cae655f79f8546",
29
+ "650dd4aa9e5106b70373abc662cfe12e19553cec691c344ce54170efde2c60bb",
30
+ "66fd4b6eab8dbec27bd30772299b7caf4a42a4cd60a471a90a134481c169445b",
31
+ "8a2a13bc972dfd343a1304f96711e1741d452688f94a690554f3ff32646d4fd3",
32
+ "ada8e689f116257fbefa429d5b93b1cad911ea92aaf763e1bfabfb25365a152f",
33
+ "ca9cfc09bec1960ac305a32f18fbd9d617cf994feb40145fca6c57a05a4c2030"
34
+ ],
35
+ "common/performance.md": [
36
+ "451a91bf7f92e747785e56d2e669ef14bca344bcddd3fa8ee0c6b2daf9aa0036",
37
+ "5b50781c4dce9e088c407efadcc31f5f5e2e5c09e77a3b2c264293be383401c5",
38
+ "7e34a17eeb86a54ae64b503edbc7635d7e0b92d4f24fe450f564a5fd76fbd17a",
39
+ "8c30e5a5561d315078d4806cc883444936e708b8e13f1ca5713ab5596317f283",
40
+ "b1d3f415dd7dd13efe7ea8d71b0dc5fd14d12f544d63f7d37bd26d12b7f5c11d"
41
+ ],
42
+ "common/pr-automation.md": [
43
+ "09b5a378cca840be6ffb202bc7f6e99ff1229762850586cf0a83faaf059aee24",
44
+ "3f6e221582a74976bb6ca164bc837cb593312d755f5ac23f1d7f7f72104d16ab",
45
+ "4f93b7d10834be91dc89e4491577cd2436fc1dcc00c256c737f75504c41173e6",
46
+ "9088d7449714af985f3800664281b0392916d40699d9a0cf2a37ed8a07d2c1ba",
47
+ "9d88f5dce7f87ba89c2c326331e27585d3f570f65416846d81c716c3e1f3b716",
48
+ "f4f1fd2cd8e07d1539144a00c3d1210658ff575da5fe85fec83d7d554f21cba8"
49
+ ],
50
+ "common/skills-learning.md": [
51
+ "04b82c7073fbb44bb8f350124331ec0631849592d0593ea0809bfc6d5c759342",
52
+ "0a70fdfce1dc9047743e525e38a7831ab3597e64741e706a06ac19a609bb333e",
53
+ "1c9377592732cf9ed4ee4eff2bed1504b30ef1f184c81c7db1cf75ddae17b6cb",
54
+ "3d80e4cc9966ba884b2a26d75950662d85e17d0a8b0fdba759f14b9ff405cc57",
55
+ "3e36e738fd540a5809217ef45d6898362c0c75e5ba842c3f05637321cac4038b",
56
+ "4b23bcfda2a1c40373b575868e9194f1f299c864c453405871464efebfbf640a",
57
+ "64f8da14651bd5cd1e70329b3bbd06b9767def04d3a3ca2ae4bb437e3f57b5da",
58
+ "79435212d7749c6b0e12419a4af9725bf2c686bc796a5388d807c6f7e160526b",
59
+ "7ea69af97511eaaeea662bcdb4b3c87de131d0d9835ca8c07f9f3b26114d8963",
60
+ "8d10b1b3a51516f485f184b487c4fb186cd13a675d89d1aed140ae6c08ee9baf",
61
+ "abc3dae7fe2a7801e130b8d4ab6e56fd27110ceceb715c987de2ccee2900ad81",
62
+ "b31acc0a27cc35f2e1441fb27b7033ff206f94892a990b588dd155814182f399",
63
+ "e54cd3640e4d8e858e384161b710c9cd7ccb1fa7bdeb612b5ca1d5855a5a4d8f"
64
+ ],
65
+ "common/testing.md": [
66
+ "5e8226b3bb360f107b68e99ead86799f3b3180635ab2c114dd32021feecbe4c9",
67
+ "660ec721b0a9d2a8b8c7806039454f6e30e509c57c2329b3f705627b81ed06f3",
68
+ "6cd550064aee456c58d2424c38f7c63f90afe8f89114bfc3ccfb1c4dd07ccfc6",
69
+ "73ae212aa8a6ebc55e044690b804b2c76d6c218dfd60a2557bd33fe884744787",
70
+ "9aa0e17f5c6d37157e059f39723dbc8b2e7e2a9efb46c609d5388ed966245d4e",
71
+ "9bbd08807d4c0d28cf74f3fa5baeea37167f2b42fff36e75795cc66c77a46f6d",
72
+ "b10bb70a5c673bfbae1bde35b8879ffd88209e024efb1011c86bd7e65045ef7d",
73
+ "c9f169a9720c038749d729f15cb110fe67d0f748fc7de73e301b3726509651ae",
74
+ "f10250dbc8a67c47b514defca1f97ce00cb2096aa9dada92ce410f308c9ffda5",
75
+ "f593217cd46431850e8f1c135c5e604cb71da7bd0c6614e8036d7bd7b0e9e92a"
76
+ ]
77
+ }
78
+ }
@@ -32,6 +32,23 @@
32
32
  ],
33
33
  "executing-plans": [
34
34
  "SKILL.md"
35
+ ],
36
+ "research": [
37
+ "SKILL.md"
38
+ ],
39
+ "wayfinder": [
40
+ "SKILL.md",
41
+ "agents/openai.yaml"
42
+ ],
43
+ "find-skills": [
44
+ "SKILL.md",
45
+ "agents/openai.yaml",
46
+ "references/skills-cli.md"
47
+ ],
48
+ "project-context": [
49
+ "SKILL.md",
50
+ "agents/openai.yaml",
51
+ "references/project-context-template.md"
35
52
  ]
36
53
  }
37
54
  }
@@ -79,10 +79,11 @@
79
79
  },
80
80
  {
81
81
  "upstream": "research",
82
- "status": "covered",
82
+ "status": "adapted",
83
83
  "evidence": [
84
- "skills/research/SKILL.md"
85
- ]
84
+ "skills/using-superpowers/SKILL.md"
85
+ ],
86
+ "reason": "Engineering source lookup is handled directly with citations; the standalone report Skill is retired."
86
87
  },
87
88
  {
88
89
  "upstream": "resolving-merge-conflicts",
@@ -93,10 +94,12 @@
93
94
  },
94
95
  {
95
96
  "upstream": "setup-matt-pocock-skills",
96
- "status": "adapted",
97
+ "status": "excluded",
97
98
  "evidence": [
98
- "skills/project-context/SKILL.md"
99
- ]
99
+ "scripts/retired-skill-files.json",
100
+ "README.md"
101
+ ],
102
+ "reason": "The standalone project-context setup Skill is retired; existing project configuration remains supported."
100
103
  },
101
104
  {
102
105
  "upstream": "tdd",
@@ -129,10 +132,12 @@
129
132
  },
130
133
  {
131
134
  "upstream": "wayfinder",
132
- "status": "adapted",
135
+ "status": "excluded",
133
136
  "evidence": [
134
- "skills/wayfinder/SKILL.md"
135
- ]
137
+ "scripts/retired-skill-files.json",
138
+ "README.md"
139
+ ],
140
+ "reason": "Standalone multi-session decision mapping is intentionally removed from the engineering distribution."
136
141
  }
137
142
  ],
138
143
  "support_dependencies": [
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  const ACTIVE_BRAINSTORMING_REFERENCE = "skills/brainstorming/SKILL.md";
4
+ const PROCESS_OUTCOMES = "skills/using-superpowers/references/process-outcomes.md";
4
5
  const BRAINSTORMING_REFERENCE_ALLOWLIST = new Set([
5
6
  "README.md",
6
7
  "skills/using-superpowers/SKILL.md",
@@ -38,20 +39,20 @@ const ROUTING_SCENARIOS = [
38
39
  {
39
40
  name: "Spec Gate discovers an unresolved public contract",
40
41
  checks: [{
41
- file: "skills/using-superpowers/SKILL.md",
42
+ file: PROCESS_OUTCOMES,
42
43
  tokens: ["BLOCKED_BY_UNRESOLVED_DECISION", "decision map"],
43
44
  }],
44
45
  },
45
46
  {
46
47
  name: "user explicitly continues after blocking",
47
48
  checks: [{
48
- file: "skills/using-superpowers/SKILL.md",
49
+ file: PROCESS_OUTCOMES,
49
50
  tokens: ["new grilling session", "new Spec Gate", "do not resume the old call stack"],
50
51
  }],
51
52
  },
52
53
  {
53
54
  name: "unchanged confirmed decision blocks again",
54
- checks: [{ file: "skills/using-superpowers/SKILL.md", tokens: ["Spec Gate contract conflict"] }],
55
+ checks: [{ file: PROCESS_OUTCOMES, tokens: ["Spec Gate contract conflict"] }],
55
56
  },
56
57
  {
57
58
  name: "task only consumes established domain vocabulary",
@@ -135,6 +136,11 @@ function checkRouterContract({ exists, read, fail, requireTokens }) {
135
136
  const file = "skills/using-superpowers/SKILL.md";
136
137
  requireTokens(file, [
137
138
  "three lanes",
139
+ "[references/process-outcomes.md](references/process-outcomes.md)",
140
+ "Ordinary direct delivery does not load this reference",
141
+ "spec-gate",
142
+ ]);
143
+ requireTokens(PROCESS_OUTCOMES, [
138
144
  "BLOCKED_BY_UNRESOLVED_DECISION",
139
145
  "decision map",
140
146
  "new grilling session",
@@ -142,9 +148,9 @@ function checkRouterContract({ exists, read, fail, requireTokens }) {
142
148
  "do not resume the old call stack",
143
149
  "spec-gate",
144
150
  ]);
145
- if (!exists(file)) return;
151
+ if (!exists(file) || !exists(PROCESS_OUTCOMES)) return;
146
152
 
147
- const body = read(file);
153
+ const body = read(PROCESS_OUTCOMES);
148
154
  if (/BLOCKED_BY_UNRESOLVED_DECISION[\s\S]{0,240}(?:automatically|auto).*grilling/i.test(body)) {
149
155
  fail("Router must stop on Spec Gate blocking instead of automatically invoking grilling");
150
156
  }
@@ -0,0 +1,156 @@
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"]) {
70
+ fs.mkdirSync(path.join(skills, retired), { recursive: true });
71
+ const known = {
72
+ research: ["SKILL.md"],
73
+ wayfinder: ["SKILL.md", "agents/openai.yaml"],
74
+ "find-skills": ["SKILL.md", "agents/openai.yaml", "references/skills-cli.md"],
75
+ "project-context": ["SKILL.md", "agents/openai.yaml", "references/project-context-template.md"],
76
+ };
77
+ for (const file of known[retired]) {
78
+ const target = path.join(skills, retired, file);
79
+ fs.mkdirSync(path.dirname(target), { recursive: true });
80
+ fs.writeFileSync(target, "Old distributed content\n");
81
+ }
82
+ fs.writeFileSync(path.join(skills, retired, "personal-notes.md"), "Keep my notes\n");
83
+ }
84
+ fs.mkdirSync(path.join(skills, "handoff/agents"), { recursive: true });
85
+ fs.writeFileSync(path.join(skills, "handoff/agents/openai.yaml"),
86
+ "policy:\n allow_implicit_invocation: false\n");
87
+ }
88
+ run();
89
+ assert.equal(read(path.join(profile, ".claude/references/rules/common/testing.md")),
90
+ read(path.join(sourceRoot, "rules/common/testing.md")));
91
+ assert.equal(fs.existsSync(path.join(profile, ".claude/rules/common/testing.md")), false);
92
+ assert.equal(read(path.join(profile, ".codex/rules/common/testing.md")),
93
+ read(path.join(sourceRoot, "rules/common/testing.md")));
94
+ assert.match(read(path.join(profile, ".claude/CLAUDE.md")), /^@AGENTS\.md$/m);
95
+ for (const host of [".claude", ".codex"]) {
96
+ for (const retired of ["research", "wayfinder", "find-skills", "project-context"]) {
97
+ assert.equal(fs.existsSync(path.join(profile, host, "skills", retired, "SKILL.md")), false);
98
+ const remaining = fs.readdirSync(path.join(profile, host, "skills", retired));
99
+ assert.deepEqual(remaining, ["personal-notes.md"]);
100
+ assert.equal(read(path.join(profile, host, "skills", retired, "personal-notes.md")), "Keep my notes\n");
101
+ }
102
+ assert.equal(fs.existsSync(path.join(profile, host, "skills/wayfinder/agents")), false);
103
+ assert.equal(fs.existsSync(path.join(profile, host, "scripts/install-rules.js")), false);
104
+ assert.match(read(path.join(profile, host, "skills/handoff/agents/openai.yaml")),
105
+ /allow_implicit_invocation: true/);
106
+ }
107
+ }
108
+
109
+ try {
110
+ install("fresh");
111
+ const fresh = path.join(tempRoot, "fresh");
112
+ const common = fs.readdirSync(path.join(sourceRoot, "rules/common"));
113
+ assert.equal(common.length, 8);
114
+ for (const file of common) {
115
+ assert.equal(read(path.join(fresh, "references/rules/common", file)),
116
+ read(path.join(sourceRoot, "rules/common", file)));
117
+ assert.equal(fs.existsSync(path.join(fresh, "rules/common", file)), false);
118
+ }
119
+ assert.equal(read(path.join(fresh, "rules/07-forbidden.md")),
120
+ read(path.join(sourceRoot, "rules/07-forbidden.md")));
121
+
122
+ install("codex", "codex");
123
+ assert.equal(read(path.join(tempRoot, "codex/rules/common/testing.md")),
124
+ read(path.join(sourceRoot, "rules/common/testing.md")));
125
+ install("preview", "claude-code", true);
126
+ assert.equal(fs.existsSync(path.join(tempRoot, "preview")), false);
127
+
128
+ const upgrade = path.join(tempRoot, "upgrade");
129
+ fs.mkdirSync(path.join(upgrade, "rules/common"), { recursive: true });
130
+ fs.copyFileSync(path.join(sourceRoot, "rules/common/testing.md"),
131
+ path.join(upgrade, "rules/common/testing.md"));
132
+ fs.writeFileSync(path.join(upgrade, "rules/common/hooks.md"), "Personal hook policy\n");
133
+ fs.writeFileSync(path.join(upgrade, "rules/common/personal.md"), "Keep my rules\n");
134
+ install("upgrade");
135
+ assert.equal(fs.existsSync(path.join(upgrade, "rules/common/testing.md")), false);
136
+ assert.equal(read(path.join(upgrade, "rules/common/hooks.md")), "Personal hook policy\n");
137
+ assert.equal(read(path.join(upgrade, "rules/common/personal.md")), "Keep my rules\n");
138
+ assert.ok(messages.some((message) => /保留.*hooks\.md/.test(message)));
139
+ install("upgrade");
140
+ assert.equal(read(path.join(upgrade, "rules/common/hooks.md")), "Personal hook policy\n");
141
+
142
+ const outside = path.join(tempRoot, "outside");
143
+ fs.mkdirSync(outside);
144
+ const linked = path.join(tempRoot, "linked");
145
+ fs.mkdirSync(linked);
146
+ fs.symlinkSync(outside, path.join(linked, "references"), process.platform === "win32" ? "junction" : "dir");
147
+ assert.throws(() => install("linked"), /symlink/i);
148
+ assert.deepEqual(fs.readdirSync(outside), []);
149
+ assert.throws(() => install("invalid", "unknown"), /host/i);
150
+ checkLegacyMigration();
151
+ checkInstallerEntrypoint();
152
+ console.log("Rule installation tests passed (migration, backups, custom rules, symlink safety, both hosts, installer dry-run and execution).");
153
+ } finally {
154
+ // Only remove the exact private directory returned by mkdtemp; never a caller-supplied path.
155
+ fs.rmSync(tempRoot, { recursive: true, force: true });
156
+ }