claude-everything-workflow 0.2.8 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/AGENTS.md +11 -18
- package/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/agents/e2e-runner.md +1 -1
- package/evals/routing-scenarios.json +252 -0
- package/harness/manifest.json +2 -28
- package/hooks/check-console-log.js +2 -2
- package/package.json +4 -2
- package/rules/01-base.md +2 -2
- package/rules/02-implementation.md +7 -6
- package/rules/05-git-workflow.md +4 -6
- package/rules/common/agent-orchestration.md +1 -1
- package/rules/common/pr-automation.md +1 -1
- package/rules/common/testing.md +2 -2
- package/scripts/eval-scenarios.js +108 -0
- package/scripts/install-rules.js +266 -19
- package/scripts/install.ps1 +42 -15
- package/scripts/install.sh +31 -12
- package/scripts/legacy-common-rule-hashes.json +6 -1
- package/scripts/retired-skill-files.json +7 -0
- package/scripts/verify/install-rules.test.js +158 -24
- package/scripts/verify/metadata-checks.js +7 -8
- package/scripts/verify/repository-checks.js +44 -368
- package/scripts/verify/scenario-checks.js +108 -0
- package/scripts/verify/scenario-checks.test.js +97 -0
- package/scripts/verify/workflow-checks.js +85 -586
- package/scripts/verify-harness.js +2 -0
- package/skills/README.md +2 -4
- package/skills/feature-acceptance/SKILL.md +8 -8
- package/skills/{e2e-testing/SKILL.md → feature-acceptance/references/e2e-testing.md} +3 -9
- package/skills/implement/SKILL.md +2 -0
- package/skills/{subagent-driven-development/SKILL.md → implement/references/parallel-delivery.md} +7 -9
- package/skills/implement/references/ticket-delivery.md +1 -1
- package/skills/using-superpowers/SKILL.md +24 -103
- package/rules/07-forbidden.md +0 -20
- package/rules/08-specialty-rules-index.md +0 -18
- package/rules/09-first-principles-adversarial-testing.md +0 -30
- package/scripts/verify/continuation-checks.test.js +0 -101
- package/scripts/verify/grilling-spec-gate-checks.js +0 -297
- package/scripts/verify/workflow-ownership-fixtures.js +0 -371
- package/scripts/verify/workflow-ownership.js +0 -780
- /package/skills/{e2e-testing → feature-acceptance}/references/playwright-patterns.md +0 -0
package/scripts/install.sh
CHANGED
|
@@ -8,6 +8,7 @@ INSTALL_CLAUDE=1
|
|
|
8
8
|
INSTALL_CODEX=1
|
|
9
9
|
DRY_RUN=0
|
|
10
10
|
SHOW_HELP=0
|
|
11
|
+
BACKUP_ID="$(date +%Y%m%d%H%M%S)"
|
|
11
12
|
|
|
12
13
|
usage() {
|
|
13
14
|
cat <<'EOF'
|
|
@@ -75,29 +76,39 @@ run() {
|
|
|
75
76
|
backup_if_changed() {
|
|
76
77
|
local src="$1"
|
|
77
78
|
local dest="$2"
|
|
79
|
+
local install_root="$3"
|
|
78
80
|
|
|
79
81
|
if [ ! -f "$dest" ] || cmp -s "$src" "$dest"; then
|
|
80
82
|
return
|
|
81
83
|
fi
|
|
82
84
|
|
|
83
|
-
|
|
85
|
+
if [ -L "$install_root/.cew-backups" ]; then
|
|
86
|
+
echo "Refusing symlinked backup directory: $install_root/.cew-backups" >&2
|
|
87
|
+
exit 1
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
local rel_name="${dest#"$install_root"/}"
|
|
91
|
+
local backup="$install_root/.cew-backups/$BACKUP_ID/$rel_name"
|
|
84
92
|
echo "Backup: $dest -> $backup"
|
|
93
|
+
run mkdir -p "$(dirname "$backup")"
|
|
85
94
|
run cp "$dest" "$backup"
|
|
86
95
|
}
|
|
87
96
|
|
|
88
97
|
copy_file() {
|
|
89
98
|
local src="$1"
|
|
90
99
|
local dest="$2"
|
|
100
|
+
local install_root="$3"
|
|
91
101
|
|
|
92
|
-
backup_if_changed "$src" "$dest"
|
|
102
|
+
backup_if_changed "$src" "$dest" "$install_root"
|
|
93
103
|
run cp "$src" "$dest"
|
|
94
104
|
}
|
|
95
105
|
|
|
96
106
|
copy_claude_settings() {
|
|
97
107
|
local src="$1"
|
|
98
108
|
local dest="$2"
|
|
109
|
+
local install_root="$3"
|
|
99
110
|
|
|
100
|
-
backup_if_changed "$src" "$dest"
|
|
111
|
+
backup_if_changed "$src" "$dest" "$install_root"
|
|
101
112
|
if [ "$DRY_RUN" -eq 1 ]; then
|
|
102
113
|
echo "[dry-run] merge '$src' into '$dest' preserving existing user hooks, env and mcpServers"
|
|
103
114
|
echo "[dry-run] purge legacy hook paths while merging Claude settings"
|
|
@@ -156,19 +167,18 @@ remove_package_only_paths() {
|
|
|
156
167
|
"scripts/install.ps1" \
|
|
157
168
|
"scripts/install-rules.js" \
|
|
158
169
|
"scripts/legacy-common-rule-hashes.json" \
|
|
170
|
+
"scripts/eval-scenarios.js" \
|
|
159
171
|
"scripts/verify-harness.js" \
|
|
160
172
|
"scripts/verify/core.js" \
|
|
161
|
-
"scripts/verify/grilling-spec-gate-checks.js" \
|
|
162
173
|
"scripts/verify/metadata-checks.js" \
|
|
163
174
|
"scripts/verify/repository-checks.js" \
|
|
164
175
|
"scripts/verify/runtime-checks.js" \
|
|
165
176
|
"scripts/verify/workflow-checks.js" \
|
|
166
|
-
"scripts/verify/
|
|
167
|
-
"scripts/verify/
|
|
177
|
+
"scripts/verify/scenario-checks.js" \
|
|
178
|
+
"scripts/verify/scenario-checks.test.js" \
|
|
168
179
|
"scripts/verify/skill-manifest-checks.js" \
|
|
169
180
|
"scripts/verify/skill-manifest-checks.test.js" \
|
|
170
181
|
"scripts/verify/skill-invocation.test.js" \
|
|
171
|
-
"scripts/verify/continuation-checks.test.js" \
|
|
172
182
|
"scripts/verify/install-rules.test.js" \
|
|
173
183
|
"scripts/verify/learning.test.js" \
|
|
174
184
|
"scripts/verify/plugin-distribution.test.js"
|
|
@@ -259,13 +269,14 @@ install_claude() {
|
|
|
259
269
|
echo "Installing Claude workflow to $dest"
|
|
260
270
|
run mkdir -p "$dest"
|
|
261
271
|
remove_obsolete_workflow_paths "$dest"
|
|
262
|
-
copy_file "$ROOT_DIR/CLAUDE.md" "$dest/CLAUDE.md"
|
|
263
|
-
copy_file "$ROOT_DIR/AGENTS.md" "$dest/AGENTS.md"
|
|
264
|
-
copy_claude_settings "$ROOT_DIR/settings.json" "$dest/settings.json"
|
|
272
|
+
copy_file "$ROOT_DIR/CLAUDE.md" "$dest/CLAUDE.md" "$dest"
|
|
273
|
+
copy_file "$ROOT_DIR/AGENTS.md" "$dest/AGENTS.md" "$dest"
|
|
274
|
+
copy_claude_settings "$ROOT_DIR/settings.json" "$dest/settings.json" "$dest"
|
|
265
275
|
install_shared_dirs "$dest"
|
|
266
276
|
install_workflow_rules claude-code "$dest"
|
|
267
277
|
cleanup_retired_skills "$dest"
|
|
268
278
|
remove_package_only_paths "$dest"
|
|
279
|
+
finalize_backups "$dest"
|
|
269
280
|
}
|
|
270
281
|
|
|
271
282
|
install_codex() {
|
|
@@ -274,18 +285,26 @@ install_codex() {
|
|
|
274
285
|
echo "Installing Codex workflow to $dest"
|
|
275
286
|
run mkdir -p "$dest"
|
|
276
287
|
remove_obsolete_workflow_paths "$dest"
|
|
277
|
-
copy_file "$ROOT_DIR/AGENTS.md" "$dest/AGENTS.md"
|
|
288
|
+
copy_file "$ROOT_DIR/AGENTS.md" "$dest/AGENTS.md" "$dest"
|
|
278
289
|
install_shared_dirs "$dest"
|
|
279
290
|
install_workflow_rules codex "$dest"
|
|
280
291
|
cleanup_retired_skills "$dest"
|
|
281
292
|
remove_package_only_paths "$dest"
|
|
293
|
+
finalize_backups "$dest"
|
|
282
294
|
}
|
|
283
295
|
|
|
284
296
|
install_workflow_rules() {
|
|
285
297
|
local host_name="$1"
|
|
286
298
|
local dest="$2"
|
|
287
299
|
# Bash <4.4 treats empty arrays as unset under set -u.
|
|
288
|
-
local options=("$ROOT_DIR/scripts/install-rules.js" "$host_name" "$dest")
|
|
300
|
+
local options=("$ROOT_DIR/scripts/install-rules.js" "$host_name" "$dest" "--backup-id" "$BACKUP_ID")
|
|
301
|
+
if [ "$DRY_RUN" -eq 1 ]; then options+=(--dry-run); fi
|
|
302
|
+
node "${options[@]}"
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
finalize_backups() {
|
|
306
|
+
local dest="$1"
|
|
307
|
+
local options=("$ROOT_DIR/scripts/install-rules.js" "--finalize-backups" "$dest" "--backup-id" "$BACKUP_ID")
|
|
289
308
|
if [ "$DRY_RUN" -eq 1 ]; then options+=(--dry-run); fi
|
|
290
309
|
node "${options[@]}"
|
|
291
310
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
3
|
"algorithm": "sha256-lf",
|
|
4
|
-
"source": "common/: origin/main history through a4f938bc70f3f85e4dcfad4d2534f522b823ea20; top-level rules: first-parent main history through 7326e4b",
|
|
4
|
+
"source": "common/: origin/main history through a4f938bc70f3f85e4dcfad4d2534f522b823ea20; top-level rules: first-parent main history through 7326e4b; 02-implementation.md also includes v0.2.9",
|
|
5
5
|
"files": {
|
|
6
6
|
"02-implementation.md": [
|
|
7
|
+
"4412acfbffdc9ac5823de7dd5fdd985297e4184260b4ccebbf7f633dae6090db",
|
|
7
8
|
"1bbe491d9b89e37a6a6d004e1b6e1ccd7478b94341e7b4c51ce8d01fad585c7f",
|
|
8
9
|
"700331676ad40d65acdeb469a67cf802cddff78ebf0861ec5e4427b5a3d23620"
|
|
9
10
|
],
|
|
10
11
|
"08-specialty-rules-index.md": [
|
|
12
|
+
"11d3be1b194abcf30517a416df1f337cb356fa9bc04604bcfb95274478012050",
|
|
11
13
|
"283aba947990fd768597546f3aab12f8754d4d91968d6d119c3f5828c6be40dd",
|
|
12
14
|
"3fe1bcb7bdbad9ff8b074a36afd96b96fdf0da21c483b842c4ce2042ca398999",
|
|
13
15
|
"70f531356fd1fbd11d62ea0b2b43be82c278e975b43335a8b3956c207a930ef1",
|
|
@@ -88,6 +90,9 @@
|
|
|
88
90
|
"c9f169a9720c038749d729f15cb110fe67d0f748fc7de73e301b3726509651ae",
|
|
89
91
|
"f10250dbc8a67c47b514defca1f97ce00cb2096aa9dada92ce410f308c9ffda5",
|
|
90
92
|
"f593217cd46431850e8f1c135c5e604cb71da7bd0c6614e8036d7bd7b0e9e92a"
|
|
93
|
+
],
|
|
94
|
+
"07-forbidden.md": [
|
|
95
|
+
"925a8a1e3df9a734522d570f967912ca7b6f69a83aceb8499bda3e292dcd16a5"
|
|
91
96
|
]
|
|
92
97
|
}
|
|
93
98
|
}
|
|
@@ -6,7 +6,7 @@ const os = require("node:os");
|
|
|
6
6
|
const path = require("node:path");
|
|
7
7
|
const crypto = require("node:crypto");
|
|
8
8
|
const { spawnSync } = require("node:child_process");
|
|
9
|
-
const { installRules } = require("../install-rules");
|
|
9
|
+
const { installRules, finalizeBackups, BACKUP_ROOT_NAME } = require("../install-rules");
|
|
10
10
|
|
|
11
11
|
const sourceRoot = path.resolve(__dirname, "../..");
|
|
12
12
|
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "cew-rules-"));
|
|
@@ -24,8 +24,9 @@ function checkLegacyMigration() {
|
|
|
24
24
|
fs.writeFileSync(path.join(fixture, "rules/common/testing.md"), "Current distribution\n");
|
|
25
25
|
const previous = "Previous distribution\n";
|
|
26
26
|
const hash = crypto.createHash("sha256").update(previous).digest("hex");
|
|
27
|
+
fs.writeFileSync(path.join(fixture, "rules/02-implementation.md"), "New resident distribution\n");
|
|
27
28
|
fs.writeFileSync(path.join(fixture, "scripts/legacy-common-rule-hashes.json"),
|
|
28
|
-
JSON.stringify({ files: { "common/testing.md": [hash] } }));
|
|
29
|
+
JSON.stringify({ files: { "common/testing.md": [hash], "02-implementation.md": [hash] } }));
|
|
29
30
|
const target = path.join(tempRoot, "legacy-target");
|
|
30
31
|
fs.mkdirSync(path.join(target, "rules/common"), { recursive: true });
|
|
31
32
|
fs.writeFileSync(path.join(target, "rules/common/testing.md"), previous.replace(/\n/g, "\r\n"));
|
|
@@ -37,11 +38,143 @@ function checkLegacyMigration() {
|
|
|
37
38
|
assert.equal(fs.existsSync(path.join(target, "rules/common/testing.md")), false);
|
|
38
39
|
assert.equal(read(path.join(target, "references/rules/common/testing.md")), "Current distribution\n");
|
|
39
40
|
|
|
41
|
+
const previousReference = path.join(target, "references/rules/02-implementation.md");
|
|
42
|
+
fs.writeFileSync(previousReference, previous.replace(/\n/g, "\r\n"));
|
|
43
|
+
fs.unlinkSync(path.join(target, "rules/02-implementation.md"));
|
|
40
44
|
const cold = path.join(target, "references/rules/common/testing.md");
|
|
41
45
|
fs.writeFileSync(cold, previous);
|
|
42
|
-
installRules(options);
|
|
46
|
+
installRules({ ...options, backupId: "20261125100000" });
|
|
43
47
|
assert.equal(read(cold), "Current distribution\n");
|
|
44
|
-
assert.equal(read(
|
|
48
|
+
assert.equal(read(path.join(target, "rules/02-implementation.md")), "New resident distribution\n");
|
|
49
|
+
assert.equal(fs.existsSync(previousReference), false);
|
|
50
|
+
assert.equal(
|
|
51
|
+
read(path.join(target, BACKUP_ROOT_NAME, "20261125100000/references/rules/common/testing.md")),
|
|
52
|
+
previous,
|
|
53
|
+
);
|
|
54
|
+
assert.equal(fs.existsSync(cold + ".bak." + hash), false);
|
|
55
|
+
|
|
56
|
+
// Legacy inline .bak.* files and older backup directories are cleaned on finalizeBackups.
|
|
57
|
+
fs.writeFileSync(path.join(target, "AGENTS.md.bak.20260101000000"), "old top backup\n");
|
|
58
|
+
fs.writeFileSync(path.join(target, "rules/01-base.md.bak.deadbeef"), "old rule backup\n");
|
|
59
|
+
fs.writeFileSync(cold + ".bak." + hash, previous);
|
|
60
|
+
const olderSnapshot = path.join(target, BACKUP_ROOT_NAME, "20261124000000");
|
|
61
|
+
fs.mkdirSync(path.join(olderSnapshot, "references/rules/common"), { recursive: true });
|
|
62
|
+
fs.writeFileSync(path.join(olderSnapshot, "references/rules/common/testing.md"), "Superseded backup\n");
|
|
63
|
+
fs.writeFileSync(path.join(target, BACKUP_ROOT_NAME, "20261124000000/AGENTS.md"), "older\n");
|
|
64
|
+
finalizeBackups({ installRoot: target, dryRun: true, log: () => {} });
|
|
65
|
+
assert.equal(read(path.join(olderSnapshot, "references/rules/common/testing.md")), "Superseded backup\n");
|
|
66
|
+
finalizeBackups({ installRoot: target, log: () => {} });
|
|
67
|
+
assert.equal(fs.existsSync(path.join(olderSnapshot, "references")), false);
|
|
68
|
+
assert.equal(read(path.join(target, BACKUP_ROOT_NAME, "20261125100000/references/rules/common/testing.md")), previous);
|
|
69
|
+
assert.equal(fs.existsSync(path.join(target, "AGENTS.md.bak.20260101000000")), false);
|
|
70
|
+
assert.equal(fs.existsSync(path.join(target, "rules/01-base.md.bak.deadbeef")), false);
|
|
71
|
+
assert.equal(fs.existsSync(cold + ".bak." + hash), false);
|
|
72
|
+
const backups = path.join(target, BACKUP_ROOT_NAME);
|
|
73
|
+
assert.equal(read(path.join(backups, "legacy/AGENTS.md.bak.20260101000000")), "old top backup\n");
|
|
74
|
+
assert.equal(read(path.join(backups, "legacy/rules/01-base.md.bak.deadbeef")), "old rule backup\n");
|
|
75
|
+
assert.equal(read(path.join(backups, "20261124000000/AGENTS.md")), "older\n",
|
|
76
|
+
"a later partial backup must preserve the only copy of each unchanged file");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function checkPromotedImplementationRule() {
|
|
80
|
+
const filename = "02-implementation.md";
|
|
81
|
+
const target = path.join(tempRoot, "promoted");
|
|
82
|
+
const cold = path.join(target, "references/rules", filename);
|
|
83
|
+
const resident = path.join(target, "rules", filename);
|
|
84
|
+
const custom = "My implementation policy\r\n";
|
|
85
|
+
fs.mkdirSync(path.dirname(cold), { recursive: true });
|
|
86
|
+
fs.writeFileSync(cold, custom);
|
|
87
|
+
install("promoted", "claude-code", true);
|
|
88
|
+
assert.equal(fs.existsSync(resident), false);
|
|
89
|
+
assert.equal(fs.readFileSync(cold, "utf8"), custom);
|
|
90
|
+
install("promoted");
|
|
91
|
+
assert.equal(fs.readFileSync(resident, "utf8"), custom, "promote personal rules byte-for-byte");
|
|
92
|
+
install("promoted");
|
|
93
|
+
assert.equal(fs.readFileSync(resident, "utf8"), custom, "preserve promoted rules on reinstall");
|
|
94
|
+
assert.equal(fs.existsSync(cold), false);
|
|
95
|
+
|
|
96
|
+
fs.writeFileSync(cold, "Separate personal reference\n");
|
|
97
|
+
install("promoted");
|
|
98
|
+
assert.equal(fs.readFileSync(resident, "utf8"), custom, "existing personal resident rules take priority");
|
|
99
|
+
assert.equal(read(cold), "Separate personal reference\n", "preserve conflicting personal copies");
|
|
100
|
+
|
|
101
|
+
fs.copyFileSync(path.join(sourceRoot, "rules", filename), resident);
|
|
102
|
+
install("promoted");
|
|
103
|
+
assert.equal(read(resident), "Separate personal reference\n", "repair a previously shadowed policy");
|
|
104
|
+
assert.equal(fs.existsSync(cold), false);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function checkCodexImplementationRuleUpgrades() {
|
|
108
|
+
const fixture = path.join(tempRoot, "codex-release");
|
|
109
|
+
const target = path.join(tempRoot, "codex-existing");
|
|
110
|
+
const filename = "02-implementation.md";
|
|
111
|
+
const source = path.join(fixture, "rules", filename);
|
|
112
|
+
const active = path.join(target, "rules", filename);
|
|
113
|
+
const old = "Original release\n";
|
|
114
|
+
const initial = "# Implementation\nScope: fix bugs.\n\n# Checks\nRun unit tests.\n";
|
|
115
|
+
const personal = initial.replace("fix bugs.", "fix bugs. Leave unrelated work alone.").replace(/\n/g, "\r\n");
|
|
116
|
+
const updated = initial.replace("unit tests", "unit and integration tests");
|
|
117
|
+
const base = path.join(target, ".cew-rule-state", "02-implementation.base.md");
|
|
118
|
+
const incoming = path.join(target, ".cew-rule-state", "02-implementation.incoming.md");
|
|
119
|
+
const run = (dryRun = false) => installRules({
|
|
120
|
+
sourceRoot: fixture, installRoot: target, host: "codex", dryRun, log: () => {},
|
|
121
|
+
});
|
|
122
|
+
fs.mkdirSync(path.dirname(active), { recursive: true });
|
|
123
|
+
fs.mkdirSync(path.join(fixture, "rules/common"), { recursive: true });
|
|
124
|
+
fs.mkdirSync(path.join(fixture, "scripts"));
|
|
125
|
+
const oldHash = crypto.createHash("sha256").update(old).digest("hex");
|
|
126
|
+
fs.writeFileSync(path.join(fixture, "scripts/legacy-common-rule-hashes.json"),
|
|
127
|
+
JSON.stringify({ files: { [filename]: [oldHash] } }));
|
|
128
|
+
fs.writeFileSync(source, initial);
|
|
129
|
+
fs.writeFileSync(active, personal);
|
|
130
|
+
run(true);
|
|
131
|
+
assert.deepEqual(fs.readdirSync(target), ["rules"], "dry-run leaves no installation state");
|
|
132
|
+
run();
|
|
133
|
+
run();
|
|
134
|
+
assert.equal(fs.readFileSync(active, "utf8"), personal, "customizations must stay in the active Codex rule");
|
|
135
|
+
|
|
136
|
+
fs.writeFileSync(source, updated);
|
|
137
|
+
run(true);
|
|
138
|
+
assert.equal(read(base), initial, "preview must not consume the upstream delta");
|
|
139
|
+
assert.equal(fs.readFileSync(active, "utf8"), personal);
|
|
140
|
+
run();
|
|
141
|
+
const merged = personal.replace("unit tests", "unit and integration tests");
|
|
142
|
+
assert.equal(fs.readFileSync(active, "utf8"), merged, "apply independent upstream edits and preserve CRLF");
|
|
143
|
+
run();
|
|
144
|
+
assert.equal(fs.readFileSync(active, "utf8"), merged, "a retry does not duplicate edits");
|
|
145
|
+
|
|
146
|
+
fs.writeFileSync(source, updated.replace("Scope: fix bugs.", "Scope: add features."));
|
|
147
|
+
run();
|
|
148
|
+
assert.equal(fs.readFileSync(active, "utf8"), merged, "overlapping edits leave the personal rule intact");
|
|
149
|
+
assert.equal(read(base), updated, "keep the last applied base for a retry");
|
|
150
|
+
assert.equal(read(incoming), read(source), "offer the conflicting distribution outside active rules");
|
|
151
|
+
run();
|
|
152
|
+
assert.equal(fs.readFileSync(active, "utf8"), merged);
|
|
153
|
+
|
|
154
|
+
// Apply a later non-conflicting release even if Git was unavailable on the first attempt.
|
|
155
|
+
const later = updated.replace("Run unit and integration tests.", "Run the release checks.");
|
|
156
|
+
fs.writeFileSync(source, later);
|
|
157
|
+
const originalPath = process.env.PATH;
|
|
158
|
+
try {
|
|
159
|
+
process.env.PATH = path.join(tempRoot, "no-git");
|
|
160
|
+
run();
|
|
161
|
+
} finally {
|
|
162
|
+
process.env.PATH = originalPath;
|
|
163
|
+
}
|
|
164
|
+
assert.equal(fs.readFileSync(active, "utf8"), merged, "missing Git preserves the usable rule");
|
|
165
|
+
assert.equal(read(base), updated);
|
|
166
|
+
assert.equal(read(incoming), later);
|
|
167
|
+
run();
|
|
168
|
+
assert.equal(read(active), later.replace("fix bugs.", "fix bugs. Leave unrelated work alone."));
|
|
169
|
+
assert.equal(read(base), later);
|
|
170
|
+
assert.equal(fs.existsSync(incoming), false);
|
|
171
|
+
|
|
172
|
+
const stockRoot = path.join(tempRoot, "codex-stock");
|
|
173
|
+
const stock = path.join(stockRoot, "rules", filename);
|
|
174
|
+
fs.mkdirSync(path.dirname(stock), { recursive: true });
|
|
175
|
+
fs.writeFileSync(stock, old.replace(/\n/g, "\r\n"));
|
|
176
|
+
installRules({ sourceRoot: fixture, installRoot: stockRoot, host: "codex", log: () => {} });
|
|
177
|
+
assert.equal(read(stock), read(source), "a known older distribution still upgrades");
|
|
45
178
|
}
|
|
46
179
|
|
|
47
180
|
function checkInstallerCliOptions() {
|
|
@@ -257,13 +390,24 @@ function checkInstallerEntrypoint() {
|
|
|
257
390
|
SessionStart: [{ ...unrelatedHook, hooks: [...unrelatedHook.hooks, retiredSession] }],
|
|
258
391
|
},
|
|
259
392
|
}));
|
|
393
|
+
fs.writeFileSync(path.join(profile, ".claude/AGENTS.md"), "My original instructions\n");
|
|
260
394
|
run();
|
|
395
|
+
// Give the first snapshot a distinct, earlier timestamp even on fast machines.
|
|
396
|
+
const backups = path.join(profile, ".claude", BACKUP_ROOT_NAME);
|
|
397
|
+
const [firstSnapshot] = fs.readdirSync(backups);
|
|
398
|
+
const earlier = "20000101000000";
|
|
399
|
+
fs.renameSync(path.join(backups, firstSnapshot), path.join(backups, earlier));
|
|
261
400
|
const installedSettings = JSON.parse(read(settingsPath).replace(/^\uFEFF/, ""));
|
|
262
401
|
assert.deepEqual(installedSettings.hooks.PostToolUse[0], userHookGroup);
|
|
263
402
|
assert.deepEqual(installedSettings.hooks.SessionStart, [unrelatedHook]);
|
|
264
403
|
assert.equal(installedSettings.hooks.PostToolUse.flatMap(({ hooks }) => hooks)
|
|
265
404
|
.filter(({ command }) => command?.includes("hooks/check-console-log.js")).length, 1);
|
|
405
|
+
const codexRule = path.join(profile, ".codex/rules/02-implementation.md");
|
|
406
|
+
const customizedRule = read(codexRule) + "\nKeep unrelated work separate.\n";
|
|
407
|
+
fs.writeFileSync(codexRule, customizedRule);
|
|
266
408
|
run();
|
|
409
|
+
assert.equal(read(codexRule), customizedRule, "the host installer must preserve the active Codex rule");
|
|
410
|
+
assert.equal(read(path.join(backups, earlier, "AGENTS.md")), "My original instructions\n");
|
|
267
411
|
assert.deepEqual(JSON.parse(read(settingsPath).replace(/^\uFEFF/, "")), installedSettings,
|
|
268
412
|
"reinstallation must preserve user hooks and add each managed hook only once");
|
|
269
413
|
assert.equal(read(path.join(profile, ".claude/references/rules/common/testing.md")),
|
|
@@ -286,8 +430,10 @@ function checkInstallerEntrypoint() {
|
|
|
286
430
|
}
|
|
287
431
|
assert.equal(fs.existsSync(path.join(profile, host, "skills/wayfinder/agents")), false);
|
|
288
432
|
assert.equal(fs.existsSync(path.join(profile, host, "scripts/install-rules.js")), false);
|
|
289
|
-
assert.equal(fs.existsSync(path.join(profile, host, "scripts/
|
|
290
|
-
"
|
|
433
|
+
assert.equal(fs.existsSync(path.join(profile, host, "scripts/eval-scenarios.js")), false,
|
|
434
|
+
"安装不应保留仅供包内评测的场景脚本");
|
|
435
|
+
assert.equal(fs.existsSync(path.join(profile, host, "scripts/verify/scenario-checks.test.js")), false,
|
|
436
|
+
"安装不应保留仅供包内验证的场景测试");
|
|
291
437
|
assert.equal(fs.existsSync(path.join(profile, host, "scripts/verify/plugin-distribution.test.js")), false,
|
|
292
438
|
"安装不应保留仅供包内验证的插件分发测试");
|
|
293
439
|
assert.equal(fs.existsSync(path.join(profile, host, "scripts/verify/learning.test.js")), false,
|
|
@@ -302,13 +448,10 @@ try {
|
|
|
302
448
|
const fresh = path.join(tempRoot, "fresh");
|
|
303
449
|
const common = fs.readdirSync(path.join(sourceRoot, "rules/common"));
|
|
304
450
|
assert.equal(common.length, 8);
|
|
305
|
-
const resident = ["01-base.md", "
|
|
306
|
-
const onDemand = [
|
|
307
|
-
"02-implementation.md", "08-specialty-rules-index.md", "09-first-principles-adversarial-testing.md",
|
|
308
|
-
];
|
|
451
|
+
const resident = ["01-base.md", "02-implementation.md", "05-git-workflow.md"];
|
|
309
452
|
assert.deepEqual(fs.readdirSync(path.join(fresh, "rules")).sort(), resident);
|
|
310
453
|
install("codex", "codex");
|
|
311
|
-
for (const file of [...resident, ...
|
|
454
|
+
for (const file of [...resident, ...common.map((name) => `common/${name}`)]) {
|
|
312
455
|
const source = read(path.join(sourceRoot, "rules", file));
|
|
313
456
|
const claudeDir = resident.includes(file) ? "rules" : "references/rules";
|
|
314
457
|
assert.equal(read(path.join(fresh, claudeDir, file)), source);
|
|
@@ -323,29 +466,18 @@ try {
|
|
|
323
466
|
path.join(upgrade, "rules/common/testing.md"));
|
|
324
467
|
fs.writeFileSync(path.join(upgrade, "rules/common/hooks.md"), "Personal hook policy\n");
|
|
325
468
|
fs.writeFileSync(path.join(upgrade, "rules/common/personal.md"), "Keep my rules\n");
|
|
326
|
-
|
|
327
|
-
fs.copyFileSync(path.join(sourceRoot, "rules", file), path.join(upgrade, "rules", file));
|
|
328
|
-
}
|
|
329
|
-
const customRule = "02-implementation.md";
|
|
330
|
-
const personal = path.join(upgrade, "rules", customRule);
|
|
331
|
-
fs.writeFileSync(personal, "Personal implementation rules\n");
|
|
469
|
+
fs.writeFileSync(path.join(upgrade, "rules/08-specialty-rules-index.md"), "Personal index\n");
|
|
332
470
|
install("upgrade", "claude-code", true);
|
|
333
471
|
assert.equal(fs.existsSync(path.join(upgrade, "references")), false);
|
|
334
|
-
for (const file of onDemand) assert.ok(fs.existsSync(path.join(upgrade, "rules", file)));
|
|
335
472
|
install("upgrade");
|
|
336
473
|
assert.equal(fs.existsSync(path.join(upgrade, "rules/common/testing.md")), false);
|
|
337
474
|
assert.equal(read(path.join(upgrade, "rules/common/hooks.md")), "Personal hook policy\n");
|
|
338
475
|
assert.equal(read(path.join(upgrade, "rules/common/personal.md")), "Keep my rules\n");
|
|
476
|
+
assert.equal(read(path.join(upgrade, "rules/08-specialty-rules-index.md")), "Personal index\n");
|
|
339
477
|
assert.ok(messages.some((message) => /保留.*hooks\.md/.test(message)));
|
|
340
478
|
install("upgrade");
|
|
341
479
|
assert.equal(read(path.join(upgrade, "rules/common/hooks.md")), "Personal hook policy\n");
|
|
342
480
|
|
|
343
|
-
assert.equal(read(personal), "Personal implementation rules\n");
|
|
344
|
-
for (const file of onDemand) {
|
|
345
|
-
assert.equal(fs.existsSync(path.join(upgrade, "rules", file)), file === customRule);
|
|
346
|
-
assert.equal(read(path.join(upgrade, "references/rules", file)), read(path.join(sourceRoot, "rules", file)));
|
|
347
|
-
}
|
|
348
|
-
|
|
349
481
|
const outside = path.join(tempRoot, "outside");
|
|
350
482
|
fs.mkdirSync(outside);
|
|
351
483
|
const linked = path.join(tempRoot, "linked");
|
|
@@ -355,6 +487,8 @@ try {
|
|
|
355
487
|
assert.deepEqual(fs.readdirSync(outside), []);
|
|
356
488
|
assert.throws(() => install("invalid", "unknown"), /host/i);
|
|
357
489
|
checkLegacyMigration();
|
|
490
|
+
checkPromotedImplementationRule();
|
|
491
|
+
checkCodexImplementationRuleUpgrades();
|
|
358
492
|
checkInstallerCliOptions();
|
|
359
493
|
checkBashHelpOptions();
|
|
360
494
|
checkInstallerLinkedRoots();
|
|
@@ -17,19 +17,18 @@ const PACKAGE_ONLY_PATHS = [
|
|
|
17
17
|
"scripts/install.ps1",
|
|
18
18
|
"scripts/install-rules.js",
|
|
19
19
|
"scripts/legacy-common-rule-hashes.json",
|
|
20
|
+
"scripts/eval-scenarios.js",
|
|
20
21
|
"scripts/verify-harness.js",
|
|
21
22
|
"scripts/verify/core.js",
|
|
22
|
-
"scripts/verify/grilling-spec-gate-checks.js",
|
|
23
23
|
"scripts/verify/metadata-checks.js",
|
|
24
24
|
"scripts/verify/repository-checks.js",
|
|
25
25
|
"scripts/verify/runtime-checks.js",
|
|
26
26
|
"scripts/verify/workflow-checks.js",
|
|
27
|
-
"scripts/verify/
|
|
28
|
-
"scripts/verify/
|
|
27
|
+
"scripts/verify/scenario-checks.js",
|
|
28
|
+
"scripts/verify/scenario-checks.test.js",
|
|
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",
|
|
33
32
|
"scripts/verify/install-rules.test.js",
|
|
34
33
|
"scripts/verify/learning.test.js",
|
|
35
34
|
"scripts/verify/plugin-distribution.test.js",
|
|
@@ -232,8 +231,8 @@ function checkInstallRuntimePolicy() {
|
|
|
232
231
|
"scripts\\install.ps1",
|
|
233
232
|
"scripts\\verify-harness.js",
|
|
234
233
|
"scripts\\verify",
|
|
235
|
-
"scripts\\verify\\
|
|
236
|
-
"scripts\\verify\\
|
|
234
|
+
"scripts\\verify\\scenario-checks.js",
|
|
235
|
+
"scripts\\verify\\scenario-checks.test.js",
|
|
237
236
|
]);
|
|
238
237
|
requireTokens("scripts/install.sh", [
|
|
239
238
|
"copy_claude_settings",
|
|
@@ -243,8 +242,8 @@ function checkInstallRuntimePolicy() {
|
|
|
243
242
|
"scripts/install.sh",
|
|
244
243
|
"scripts/verify-harness.js",
|
|
245
244
|
"scripts/verify",
|
|
246
|
-
"scripts/verify/
|
|
247
|
-
"scripts/verify/
|
|
245
|
+
"scripts/verify/scenario-checks.js",
|
|
246
|
+
"scripts/verify/scenario-checks.test.js",
|
|
248
247
|
]);
|
|
249
248
|
|
|
250
249
|
const ps = read("scripts/install.ps1");
|