claude-everything-workflow 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/AGENTS.md +11 -18
- package/agents/e2e-runner.md +1 -1
- package/evals/routing-scenarios.json +253 -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 +106 -0
- package/scripts/install-rules.js +186 -17
- package/scripts/install.ps1 +42 -15
- package/scripts/install.sh +31 -12
- package/scripts/legacy-common-rule-hashes.json +4 -0
- package/scripts/retired-skill-files.json +7 -0
- package/scripts/verify/install-rules.test.js +80 -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 +84 -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-rules.js
CHANGED
|
@@ -5,11 +5,26 @@ const fs = require("node:fs");
|
|
|
5
5
|
const path = require("node:path");
|
|
6
6
|
const crypto = require("node:crypto");
|
|
7
7
|
|
|
8
|
+
const BACKUP_ROOT_NAME = ".cew-backups";
|
|
9
|
+
const LEGACY_TOP_LEVEL_BAK = /^(?:CLAUDE\.md|AGENTS\.md|settings\.json)\.bak\..+$/;
|
|
10
|
+
const LEGACY_RULE_BAK = /\.md\.bak\..+$/;
|
|
11
|
+
|
|
8
12
|
const digest = (content) => crypto.createHash("sha256")
|
|
9
13
|
.update(content.toString("utf8").replace(/\r\n/g, "\n")).digest("hex");
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
const
|
|
15
|
+
function defaultBackupId() {
|
|
16
|
+
const d = new Date();
|
|
17
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
18
|
+
return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Top-level rules stay in Claude's auto-loaded rules/; common/* loads on demand from references/rules/.
|
|
22
|
+
const claudeResidentRules = new Set(["01-base.md", "02-implementation.md", "05-git-workflow.md"]);
|
|
23
|
+
const retiredTopLevelRules = [
|
|
24
|
+
"07-forbidden.md",
|
|
25
|
+
"08-specialty-rules-index.md",
|
|
26
|
+
"09-first-principles-adversarial-testing.md",
|
|
27
|
+
];
|
|
13
28
|
|
|
14
29
|
// Check the root and every descendant before touching a managed file; do not follow links.
|
|
15
30
|
function checkedPath(root, relative) {
|
|
@@ -30,15 +45,18 @@ function checkedPath(root, relative) {
|
|
|
30
45
|
return target;
|
|
31
46
|
}
|
|
32
47
|
|
|
33
|
-
function copyRule({ source, root, relative, dryRun, log }) {
|
|
48
|
+
function copyRule({ source, root, relative, backupId, dryRun, log }) {
|
|
34
49
|
const target = checkedPath(root, relative);
|
|
35
50
|
const content = fs.readFileSync(source);
|
|
36
51
|
if (fs.existsSync(target)) {
|
|
37
52
|
const previous = fs.readFileSync(target);
|
|
38
53
|
if (content.equals(previous)) return;
|
|
39
|
-
const backup = checkedPath(root,
|
|
54
|
+
const backup = checkedPath(root, path.posix.join(BACKUP_ROOT_NAME, backupId, relative));
|
|
40
55
|
log(`${dryRun ? "[dry-run] " : ""}备份规则: ${backup}`);
|
|
41
|
-
if (!dryRun
|
|
56
|
+
if (!dryRun) {
|
|
57
|
+
fs.mkdirSync(path.dirname(backup), { recursive: true });
|
|
58
|
+
fs.copyFileSync(target, backup);
|
|
59
|
+
}
|
|
42
60
|
}
|
|
43
61
|
log(`${dryRun ? "[dry-run] " : ""}安装规则: ${target}`);
|
|
44
62
|
if (!dryRun) {
|
|
@@ -47,11 +65,39 @@ function copyRule({ source, root, relative, dryRun, log }) {
|
|
|
47
65
|
}
|
|
48
66
|
}
|
|
49
67
|
|
|
68
|
+
function installPromotedRule({ source, root, relative, knownHashes, backupId, dryRun, log }) {
|
|
69
|
+
const oldPath = checkedPath(root, `references/rules/${relative}`);
|
|
70
|
+
const destination = `rules/${relative}`;
|
|
71
|
+
const resident = checkedPath(root, destination);
|
|
72
|
+
const distributed = new Set([...knownHashes, digest(fs.readFileSync(source))]);
|
|
73
|
+
const personalContent = (file) => {
|
|
74
|
+
if (!fs.existsSync(file)) return null;
|
|
75
|
+
const content = fs.readFileSync(file);
|
|
76
|
+
return distributed.has(digest(content)) ? null : content;
|
|
77
|
+
};
|
|
78
|
+
const residentPolicy = personalContent(resident);
|
|
79
|
+
const oldPolicy = personalContent(oldPath);
|
|
80
|
+
if (residentPolicy) {
|
|
81
|
+
log(`保留常驻个人规则: ${resident}`);
|
|
82
|
+
if (oldPolicy && !residentPolicy.equals(oldPolicy)) {
|
|
83
|
+
log(`保留内容不同的个人参考副本: ${oldPath}`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
copyRule({ source: oldPolicy ? oldPath : source, root, relative: destination, backupId, dryRun, log });
|
|
88
|
+
}
|
|
89
|
+
if (fs.existsSync(oldPath)) {
|
|
90
|
+
log(`${dryRun ? "[dry-run] " : ""}移除已迁入常驻目录的规则: ${oldPath}`);
|
|
91
|
+
if (!dryRun) fs.unlinkSync(oldPath);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
50
95
|
function retireRule({ source, root, relative, knownHashes, dryRun, log }) {
|
|
51
96
|
const target = checkedPath(root, relative);
|
|
52
97
|
if (!fs.existsSync(target)) return;
|
|
53
98
|
const hash = digest(fs.readFileSync(target));
|
|
54
|
-
|
|
99
|
+
const matchesSource = source && fs.existsSync(source) && hash === digest(fs.readFileSync(source));
|
|
100
|
+
if (!matchesSource && !knownHashes.includes(hash)) {
|
|
55
101
|
log(`保留个人修改,仍可能自动加载: ${target}`);
|
|
56
102
|
return;
|
|
57
103
|
}
|
|
@@ -59,7 +105,70 @@ function retireRule({ source, root, relative, knownHashes, dryRun, log }) {
|
|
|
59
105
|
if (!dryRun) fs.unlinkSync(target);
|
|
60
106
|
}
|
|
61
107
|
|
|
62
|
-
function
|
|
108
|
+
function archiveLegacyBackups(root, relDir, pattern, recursive, dryRun, log) {
|
|
109
|
+
const dir = checkedPath(root, relDir);
|
|
110
|
+
if (!fs.existsSync(dir)) return;
|
|
111
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
112
|
+
if (entry.isSymbolicLink()) continue;
|
|
113
|
+
const childRel = relDir === "." ? entry.name : path.posix.join(relDir, entry.name);
|
|
114
|
+
if (entry.isDirectory()) {
|
|
115
|
+
if (recursive) archiveLegacyBackups(root, childRel, pattern, true, dryRun, log);
|
|
116
|
+
} else if (entry.isFile() && pattern.test(entry.name)) {
|
|
117
|
+
const target = checkedPath(root, childRel);
|
|
118
|
+
const archive = checkedPath(root, path.join(BACKUP_ROOT_NAME, "legacy", childRel));
|
|
119
|
+
log(`${dryRun ? "[dry-run] " : ""}归档历史备份: ${target}`);
|
|
120
|
+
if (dryRun) continue;
|
|
121
|
+
fs.mkdirSync(path.dirname(archive), { recursive: true });
|
|
122
|
+
try {
|
|
123
|
+
fs.copyFileSync(target, archive, fs.constants.COPYFILE_EXCL);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
if (error.code !== "EEXIST") throw error;
|
|
126
|
+
if (!fs.readFileSync(target).equals(fs.readFileSync(archive))) continue;
|
|
127
|
+
}
|
|
128
|
+
fs.unlinkSync(target);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Snapshots are sparse. Only retire a file after seeing a newer backup of the same path.
|
|
134
|
+
function pruneSupersededFiles(snapshot, relative, seen, dryRun, log) {
|
|
135
|
+
const dir = checkedPath(snapshot, relative);
|
|
136
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
137
|
+
const child = path.join(relative, entry.name);
|
|
138
|
+
if (entry.isDirectory()) {
|
|
139
|
+
pruneSupersededFiles(snapshot, child, seen, dryRun, log);
|
|
140
|
+
} else if (entry.isFile()) {
|
|
141
|
+
if (seen.has(child)) {
|
|
142
|
+
const file = checkedPath(snapshot, child);
|
|
143
|
+
log(`${dryRun ? "[dry-run] " : ""}清理已有较新副本的备份: ${file}`);
|
|
144
|
+
if (!dryRun) fs.unlinkSync(file);
|
|
145
|
+
}
|
|
146
|
+
seen.add(child);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (!dryRun && fs.readdirSync(dir).length === 0) fs.rmdirSync(dir);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function finalizeBackups({ installRoot, dryRun = false, log = console.log }) {
|
|
153
|
+
const root = path.resolve(installRoot);
|
|
154
|
+
if (!fs.existsSync(root)) return;
|
|
155
|
+
archiveLegacyBackups(root, ".", LEGACY_TOP_LEVEL_BAK, false, dryRun, log);
|
|
156
|
+
archiveLegacyBackups(root, "rules", LEGACY_RULE_BAK, true, dryRun, log);
|
|
157
|
+
archiveLegacyBackups(root, "references/rules", LEGACY_RULE_BAK, true, dryRun, log);
|
|
158
|
+
|
|
159
|
+
const backupRoot = checkedPath(root, BACKUP_ROOT_NAME);
|
|
160
|
+
if (!fs.existsSync(backupRoot)) return;
|
|
161
|
+
const snapshots = fs.readdirSync(backupRoot, { withFileTypes: true })
|
|
162
|
+
.filter((entry) => entry.isDirectory() && /^\d{14}$/.test(entry.name))
|
|
163
|
+
.map((entry) => entry.name)
|
|
164
|
+
.sort().reverse();
|
|
165
|
+
const seen = new Set();
|
|
166
|
+
for (const snapshot of snapshots) {
|
|
167
|
+
pruneSupersededFiles(checkedPath(backupRoot, snapshot), "", seen, dryRun, log);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function installRules({ sourceRoot, installRoot, host, backupId = defaultBackupId(), dryRun = false, log = console.log }) {
|
|
63
172
|
if (!["claude-code", "codex"].includes(host)) throw new Error(`Invalid host: ${host}`);
|
|
64
173
|
const root = path.resolve(installRoot);
|
|
65
174
|
const rulesRoot = path.join(sourceRoot, "rules");
|
|
@@ -71,32 +180,92 @@ function installRules({ sourceRoot, installRoot, host, dryRun = false, log = con
|
|
|
71
180
|
.filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
|
|
72
181
|
.map((entry) => `common/${entry.name}`);
|
|
73
182
|
const installedOnDemand = (relative) => host === "claude-code" && !claudeResidentRules.has(relative);
|
|
183
|
+
const promoted = (relative) => host === "claude-code" && relative === "02-implementation.md";
|
|
74
184
|
// Validate all managed destinations before the first write, including upgrade cleanup paths.
|
|
185
|
+
checkedPath(root, BACKUP_ROOT_NAME);
|
|
75
186
|
for (const relative of [...files, ...commonFiles]) {
|
|
76
187
|
checkedPath(root, `rules/${relative}`);
|
|
77
|
-
if (installedOnDemand(relative)) {
|
|
188
|
+
if (installedOnDemand(relative) || promoted(relative)) {
|
|
78
189
|
checkedPath(root, `references/rules/${relative}`);
|
|
79
190
|
}
|
|
80
191
|
}
|
|
192
|
+
for (const retired of retiredTopLevelRules) {
|
|
193
|
+
checkedPath(root, `rules/${retired}`);
|
|
194
|
+
if (host === "claude-code") checkedPath(root, `references/rules/${retired}`);
|
|
195
|
+
}
|
|
81
196
|
for (const relative of [...files, ...commonFiles]) {
|
|
82
197
|
const source = path.join(rulesRoot, relative);
|
|
198
|
+
if (promoted(relative)) {
|
|
199
|
+
installPromotedRule({ source, root, relative, knownHashes: legacy.files[relative] || [], backupId, dryRun, log });
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
83
202
|
const cold = installedOnDemand(relative);
|
|
84
|
-
copyRule({ source, root, relative: `${cold ? "references/rules" : "rules"}/${relative}`, dryRun, log });
|
|
85
|
-
if (cold)
|
|
86
|
-
|
|
203
|
+
copyRule({ source, root, relative: `${cold ? "references/rules" : "rules"}/${relative}`, backupId, dryRun, log });
|
|
204
|
+
if (cold) {
|
|
205
|
+
retireRule({
|
|
206
|
+
source, root, relative: `rules/${relative}`,
|
|
207
|
+
knownHashes: legacy.files[relative] || [], dryRun, log,
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
for (const retired of retiredTopLevelRules) {
|
|
212
|
+
const knownHashes = legacy.files[retired] || [];
|
|
213
|
+
retireRule({ source: null, root, relative: `rules/${retired}`, knownHashes, dryRun, log });
|
|
214
|
+
if (host === "claude-code") {
|
|
215
|
+
retireRule({ source: null, root, relative: `references/rules/${retired}`, knownHashes, dryRun, log });
|
|
216
|
+
}
|
|
87
217
|
}
|
|
88
218
|
}
|
|
89
219
|
|
|
90
|
-
module.exports = { installRules };
|
|
220
|
+
module.exports = { BACKUP_ROOT_NAME, installRules, finalizeBackups };
|
|
221
|
+
|
|
222
|
+
function parseCli(argv) {
|
|
223
|
+
let dryRun = false;
|
|
224
|
+
let backupId;
|
|
225
|
+
let finalize = false;
|
|
226
|
+
const positional = [];
|
|
227
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
228
|
+
const arg = argv[i];
|
|
229
|
+
if (arg === "--dry-run") {
|
|
230
|
+
dryRun = true;
|
|
231
|
+
} else if (arg === "--finalize-backups") {
|
|
232
|
+
finalize = true;
|
|
233
|
+
} else if (arg === "--backup-id") {
|
|
234
|
+
backupId = argv[++i];
|
|
235
|
+
if (!backupId || backupId.includes("/") || backupId.includes("\\") || backupId.includes("..")) {
|
|
236
|
+
throw new Error("Invalid --backup-id");
|
|
237
|
+
}
|
|
238
|
+
} else if (arg.startsWith("-")) {
|
|
239
|
+
throw new Error(`Unknown option: ${arg}`);
|
|
240
|
+
} else {
|
|
241
|
+
positional.push(arg);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return { dryRun, backupId, finalize, positional };
|
|
245
|
+
}
|
|
91
246
|
|
|
92
247
|
if (require.main === module) {
|
|
93
|
-
const [host, installRoot, ...options] = process.argv.slice(2);
|
|
94
248
|
try {
|
|
95
|
-
|
|
96
|
-
|
|
249
|
+
const { dryRun, backupId, finalize, positional } = parseCli(process.argv.slice(2));
|
|
250
|
+
if (finalize) {
|
|
251
|
+
const [installRoot] = positional;
|
|
252
|
+
if (!installRoot || positional.length !== 1) {
|
|
253
|
+
throw new Error("Usage: install-rules.js --finalize-backups <install-root> [--backup-id <id>] [--dry-run]");
|
|
254
|
+
}
|
|
255
|
+
finalizeBackups({ installRoot, backupId, dryRun });
|
|
256
|
+
} else {
|
|
257
|
+
const [host, installRoot] = positional;
|
|
258
|
+
if (!host || !installRoot || positional.length !== 2) {
|
|
259
|
+
throw new Error("Usage: install-rules.js <claude-code|codex> <install-root> [--backup-id <id>] [--dry-run]");
|
|
260
|
+
}
|
|
261
|
+
installRules({
|
|
262
|
+
sourceRoot: path.resolve(__dirname, ".."),
|
|
263
|
+
installRoot,
|
|
264
|
+
host,
|
|
265
|
+
backupId: backupId || defaultBackupId(),
|
|
266
|
+
dryRun,
|
|
267
|
+
});
|
|
97
268
|
}
|
|
98
|
-
installRules({ sourceRoot: path.resolve(__dirname, ".."), installRoot, host,
|
|
99
|
-
dryRun: options.includes("--dry-run") });
|
|
100
269
|
} catch (error) {
|
|
101
270
|
process.stderr.write(`${error.message}\n`);
|
|
102
271
|
process.exitCode = 1;
|
package/scripts/install.ps1
CHANGED
|
@@ -22,6 +22,7 @@ if (-not $HomeDir) {
|
|
|
22
22
|
|
|
23
23
|
$InstallClaude = -not $CodexOnly
|
|
24
24
|
$InstallCodex = -not $ClaudeOnly
|
|
25
|
+
$BackupId = Get-Date -Format 'yyyyMMddHHmmss'
|
|
25
26
|
|
|
26
27
|
function Invoke-InstallCommand {
|
|
27
28
|
param(
|
|
@@ -40,7 +41,8 @@ function Invoke-InstallCommand {
|
|
|
40
41
|
function Backup-IfChanged {
|
|
41
42
|
param(
|
|
42
43
|
[string]$Source,
|
|
43
|
-
[string]$Destination
|
|
44
|
+
[string]$Destination,
|
|
45
|
+
[string]$InstallRoot
|
|
44
46
|
)
|
|
45
47
|
|
|
46
48
|
if (-not (Test-Path -LiteralPath $Destination)) {
|
|
@@ -53,8 +55,19 @@ function Backup-IfChanged {
|
|
|
53
55
|
return
|
|
54
56
|
}
|
|
55
57
|
|
|
56
|
-
$
|
|
58
|
+
$backupRoot = Join-Path $InstallRoot ".cew-backups"
|
|
59
|
+
$existingBackupRoot = Get-Item -LiteralPath $backupRoot -Force -ErrorAction SilentlyContinue
|
|
60
|
+
if ($null -ne $existingBackupRoot -and ($existingBackupRoot.Attributes -band [IO.FileAttributes]::ReparsePoint)) {
|
|
61
|
+
throw "Refusing symlinked backup directory: $backupRoot"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
$relative = [IO.Path]::GetFileName($Destination)
|
|
65
|
+
$backupDir = Join-Path $backupRoot $BackupId
|
|
66
|
+
$backup = Join-Path $backupDir $relative
|
|
57
67
|
Write-Host "Backup: $Destination -> $backup"
|
|
68
|
+
Invoke-InstallCommand `
|
|
69
|
+
-Description "New-Item -ItemType Directory '$backupDir'" `
|
|
70
|
+
-Action { New-Item -ItemType Directory -Path $backupDir -Force | Out-Null }
|
|
58
71
|
Invoke-InstallCommand `
|
|
59
72
|
-Description "Copy-Item '$Destination' '$backup'" `
|
|
60
73
|
-Action { Copy-Item -LiteralPath $Destination -Destination $backup -Force }
|
|
@@ -63,10 +76,11 @@ function Backup-IfChanged {
|
|
|
63
76
|
function Copy-ConfigFile {
|
|
64
77
|
param(
|
|
65
78
|
[string]$Source,
|
|
66
|
-
[string]$Destination
|
|
79
|
+
[string]$Destination,
|
|
80
|
+
[string]$InstallRoot
|
|
67
81
|
)
|
|
68
82
|
|
|
69
|
-
Backup-IfChanged -Source $Source -Destination $Destination
|
|
83
|
+
Backup-IfChanged -Source $Source -Destination $Destination -InstallRoot $InstallRoot
|
|
70
84
|
Invoke-InstallCommand `
|
|
71
85
|
-Description "Copy-Item '$Source' '$Destination'" `
|
|
72
86
|
-Action { Copy-Item -LiteralPath $Source -Destination $Destination -Force }
|
|
@@ -75,10 +89,11 @@ function Copy-ConfigFile {
|
|
|
75
89
|
function Copy-ClaudeSettings {
|
|
76
90
|
param(
|
|
77
91
|
[string]$Source,
|
|
78
|
-
[string]$Destination
|
|
92
|
+
[string]$Destination,
|
|
93
|
+
[string]$InstallRoot
|
|
79
94
|
)
|
|
80
95
|
|
|
81
|
-
Backup-IfChanged -Source $Source -Destination $Destination
|
|
96
|
+
Backup-IfChanged -Source $Source -Destination $Destination -InstallRoot $InstallRoot
|
|
82
97
|
|
|
83
98
|
if ($DryRun) {
|
|
84
99
|
Write-Host "[dry-run] Merge '$Source' into '$Destination' preserving existing user hooks, env and mcpServers"
|
|
@@ -145,19 +160,18 @@ function Remove-PackageOnlyPaths {
|
|
|
145
160
|
"scripts\install.ps1",
|
|
146
161
|
"scripts\install-rules.js",
|
|
147
162
|
"scripts\legacy-common-rule-hashes.json",
|
|
163
|
+
"scripts\eval-scenarios.js",
|
|
148
164
|
"scripts\verify-harness.js",
|
|
149
165
|
"scripts\verify\core.js",
|
|
150
|
-
"scripts\verify\grilling-spec-gate-checks.js",
|
|
151
166
|
"scripts\verify\metadata-checks.js",
|
|
152
167
|
"scripts\verify\repository-checks.js",
|
|
153
168
|
"scripts\verify\runtime-checks.js",
|
|
154
169
|
"scripts\verify\workflow-checks.js",
|
|
155
|
-
"scripts\verify\
|
|
156
|
-
"scripts\verify\
|
|
170
|
+
"scripts\verify\scenario-checks.js",
|
|
171
|
+
"scripts\verify\scenario-checks.test.js",
|
|
157
172
|
"scripts\verify\skill-manifest-checks.js",
|
|
158
173
|
"scripts\verify\skill-manifest-checks.test.js",
|
|
159
174
|
"scripts\verify\skill-invocation.test.js",
|
|
160
|
-
"scripts\verify\continuation-checks.test.js",
|
|
161
175
|
"scripts\verify\install-rules.test.js",
|
|
162
176
|
"scripts\verify\learning.test.js",
|
|
163
177
|
"scripts\verify\plugin-distribution.test.js"
|
|
@@ -284,14 +298,15 @@ function Install-ClaudeWorkflow {
|
|
|
284
298
|
-Action { New-Item -ItemType Directory -Path $dest -Force | Out-Null }
|
|
285
299
|
|
|
286
300
|
Remove-ObsoleteWorkflowPaths -Destination $dest
|
|
287
|
-
Copy-ConfigFile -Source (Join-Path $RootDir "CLAUDE.md") -Destination (Join-Path $dest "CLAUDE.md")
|
|
288
|
-
Copy-ConfigFile -Source (Join-Path $RootDir "AGENTS.md") -Destination (Join-Path $dest "AGENTS.md")
|
|
301
|
+
Copy-ConfigFile -Source (Join-Path $RootDir "CLAUDE.md") -Destination (Join-Path $dest "CLAUDE.md") -InstallRoot $dest
|
|
302
|
+
Copy-ConfigFile -Source (Join-Path $RootDir "AGENTS.md") -Destination (Join-Path $dest "AGENTS.md") -InstallRoot $dest
|
|
289
303
|
$settingsPath = Join-Path $dest "settings.json"
|
|
290
|
-
Copy-ClaudeSettings -Source (Join-Path $RootDir "settings.json") -Destination $settingsPath
|
|
304
|
+
Copy-ClaudeSettings -Source (Join-Path $RootDir "settings.json") -Destination $settingsPath -InstallRoot $dest
|
|
291
305
|
Install-SharedDirs -Destination $dest
|
|
292
306
|
Install-WorkflowRules -Destination $dest -HostName "claude-code"
|
|
293
307
|
Remove-RetiredSkills -Destination $dest
|
|
294
308
|
Remove-PackageOnlyPaths -Destination $dest
|
|
309
|
+
Complete-WorkflowBackups -Destination $dest
|
|
295
310
|
}
|
|
296
311
|
|
|
297
312
|
function Install-CodexWorkflow {
|
|
@@ -303,17 +318,18 @@ function Install-CodexWorkflow {
|
|
|
303
318
|
-Action { New-Item -ItemType Directory -Path $dest -Force | Out-Null }
|
|
304
319
|
|
|
305
320
|
Remove-ObsoleteWorkflowPaths -Destination $dest
|
|
306
|
-
Copy-ConfigFile -Source (Join-Path $RootDir "AGENTS.md") -Destination (Join-Path $dest "AGENTS.md")
|
|
321
|
+
Copy-ConfigFile -Source (Join-Path $RootDir "AGENTS.md") -Destination (Join-Path $dest "AGENTS.md") -InstallRoot $dest
|
|
307
322
|
Install-SharedDirs -Destination $dest
|
|
308
323
|
Install-WorkflowRules -Destination $dest -HostName "codex"
|
|
309
324
|
Remove-RetiredSkills -Destination $dest
|
|
310
325
|
Remove-PackageOnlyPaths -Destination $dest
|
|
326
|
+
Complete-WorkflowBackups -Destination $dest
|
|
311
327
|
}
|
|
312
328
|
|
|
313
329
|
function Install-WorkflowRules {
|
|
314
330
|
param([string]$Destination, [string]$HostName)
|
|
315
331
|
|
|
316
|
-
$ruleArgs = @((Join-Path $RootDir "scripts\install-rules.js"), $HostName, $Destination)
|
|
332
|
+
$ruleArgs = @((Join-Path $RootDir "scripts\install-rules.js"), $HostName, $Destination, "--backup-id", $BackupId)
|
|
317
333
|
if ($DryRun) { $ruleArgs += "--dry-run" }
|
|
318
334
|
& node @ruleArgs
|
|
319
335
|
if ($LASTEXITCODE -ne 0) {
|
|
@@ -321,6 +337,17 @@ function Install-WorkflowRules {
|
|
|
321
337
|
}
|
|
322
338
|
}
|
|
323
339
|
|
|
340
|
+
function Complete-WorkflowBackups {
|
|
341
|
+
param([string]$Destination)
|
|
342
|
+
|
|
343
|
+
$backupArgs = @((Join-Path $RootDir "scripts\install-rules.js"), "--finalize-backups", $Destination, "--backup-id", $BackupId)
|
|
344
|
+
if ($DryRun) { $backupArgs += "--dry-run" }
|
|
345
|
+
& node @backupArgs
|
|
346
|
+
if ($LASTEXITCODE -ne 0) {
|
|
347
|
+
throw "Backup finalization failed with exit code $LASTEXITCODE"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
324
351
|
if ($InstallClaude) {
|
|
325
352
|
Test-InstallRoot -Destination (Join-Path $HomeDir ".claude")
|
|
326
353
|
}
|
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
|
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"700331676ad40d65acdeb469a67cf802cddff78ebf0861ec5e4427b5a3d23620"
|
|
9
9
|
],
|
|
10
10
|
"08-specialty-rules-index.md": [
|
|
11
|
+
"11d3be1b194abcf30517a416df1f337cb356fa9bc04604bcfb95274478012050",
|
|
11
12
|
"283aba947990fd768597546f3aab12f8754d4d91968d6d119c3f5828c6be40dd",
|
|
12
13
|
"3fe1bcb7bdbad9ff8b074a36afd96b96fdf0da21c483b842c4ce2042ca398999",
|
|
13
14
|
"70f531356fd1fbd11d62ea0b2b43be82c278e975b43335a8b3956c207a930ef1",
|
|
@@ -88,6 +89,9 @@
|
|
|
88
89
|
"c9f169a9720c038749d729f15cb110fe67d0f748fc7de73e301b3726509651ae",
|
|
89
90
|
"f10250dbc8a67c47b514defca1f97ce00cb2096aa9dada92ce410f308c9ffda5",
|
|
90
91
|
"f593217cd46431850e8f1c135c5e604cb71da7bd0c6614e8036d7bd7b0e9e92a"
|
|
92
|
+
],
|
|
93
|
+
"07-forbidden.md": [
|
|
94
|
+
"925a8a1e3df9a734522d570f967912ca7b6f69a83aceb8499bda3e292dcd16a5"
|
|
91
95
|
]
|
|
92
96
|
}
|
|
93
97
|
}
|