claude-everything-workflow 0.2.10 → 0.2.12
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/hooks.json +1 -6
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/AGENTS.md +1 -1
- package/README.md +10 -6
- package/README.zh-CN.md +11 -7
- package/bin/claude-everything-workflow.js +16 -4
- package/commands/code-review.md +4 -4
- package/docs/plugins.md +21 -2
- package/evals/routing-scenarios.json +11 -2
- package/hooks/check-code-size.js +4 -126
- package/hooks/check-console-log.js +4 -79
- package/hooks/check-edited-file.js +139 -0
- package/hooks/commit-quality.js +1029 -72
- package/hooks/runtime/antigravity-pre-tool.js +116 -0
- package/package.json +4 -2
- package/rules/02-implementation.md +1 -1
- package/rules/common/hooks.md +2 -2
- package/scripts/cleanup-retired-skills.js +36 -3
- package/scripts/eval-scenarios.js +46 -14
- package/scripts/install-antigravity.js +545 -0
- package/scripts/install-rules.js +145 -49
- package/scripts/install.ps1 +76 -8
- package/scripts/install.sh +74 -21
- package/scripts/merge-claude-settings.cjs +14 -2
- package/scripts/retired-skill-files.json +12 -0
- package/scripts/verify/commit-quality.test.js +481 -0
- package/scripts/verify/install-rules.test.js +499 -10
- package/scripts/verify/metadata-checks.js +27 -1
- package/scripts/verify/runtime-checks.js +57 -2
- package/scripts/verify/scenario-checks.test.js +39 -10
- package/scripts/verify/workflow-checks.js +5 -1
- package/settings.json +1 -6
- package/skills/README.md +1 -1
- package/skills/code-review/SKILL.md +15 -21
- package/skills/implement/SKILL.md +2 -2
- package/skills/systematic-debugging/SKILL.md +7 -4
- package/skills/systematic-debugging/references/diagnostic-scenarios.md +7 -0
- package/agents/harness-optimizer.md +0 -93
package/scripts/install-rules.js
CHANGED
|
@@ -7,8 +7,8 @@ const crypto = require("node:crypto");
|
|
|
7
7
|
const os = require("node:os");
|
|
8
8
|
const { spawnSync } = require("node:child_process");
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const IMPLEMENTATION_RULE_BASE = ".cew-rule-state/02-implementation.base.md";
|
|
11
|
+
const IMPLEMENTATION_RULE_INCOMING = ".cew-rule-state/02-implementation.incoming.md";
|
|
12
12
|
|
|
13
13
|
const BACKUP_ROOT_NAME = ".cew-backups";
|
|
14
14
|
const LEGACY_TOP_LEVEL_BAK = /^(?:CLAUDE\.md|AGENTS\.md|settings\.json)\.bak\..+$/;
|
|
@@ -54,31 +54,49 @@ function replaceFile(file, content, mode = 0o600) {
|
|
|
54
54
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
55
55
|
const temp = file + ".tmp-" + crypto.randomUUID();
|
|
56
56
|
try {
|
|
57
|
-
fs.writeFileSync(temp, content, { flag: "wx", mode });
|
|
58
|
-
|
|
57
|
+
fs.writeFileSync(temp, content, { flag: "wx", mode: (mode & 0o777) | 0o200 });
|
|
58
|
+
if (process.umask() & 0o200) {
|
|
59
|
+
fs.chmodSync(temp, (fs.statSync(temp).mode & 0o777) | 0o200);
|
|
60
|
+
}
|
|
61
|
+
// Windows refuses to replace a target left read-only by an older installer.
|
|
62
|
+
const priorMode = process.platform === "win32" && fs.existsSync(file) ? fs.statSync(file).mode : null;
|
|
63
|
+
const readOnly = priorMode !== null && !(priorMode & 0o200);
|
|
64
|
+
if (readOnly) fs.chmodSync(file, priorMode | 0o200);
|
|
65
|
+
try {
|
|
66
|
+
fs.renameSync(temp, file);
|
|
67
|
+
} catch (error) {
|
|
68
|
+
if (readOnly) fs.chmodSync(file, priorMode);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
59
71
|
} finally {
|
|
60
72
|
fs.rmSync(temp, { force: true });
|
|
61
73
|
}
|
|
62
74
|
}
|
|
63
75
|
|
|
64
|
-
function copyRule({ source, root, relative, backupId, dryRun, log, merged }) {
|
|
76
|
+
function copyRule({ source, root, relative, backupId, dryRun, log, merged, transformContent }) {
|
|
65
77
|
const target = checkedPath(root, relative);
|
|
66
|
-
|
|
67
|
-
if (
|
|
78
|
+
let content;
|
|
79
|
+
if (merged) {
|
|
80
|
+
content = merged;
|
|
81
|
+
} else {
|
|
82
|
+
const raw = fs.readFileSync(source);
|
|
83
|
+
content = transformContent
|
|
84
|
+
? Buffer.from(transformContent(relative, raw.toString("utf8")), "utf8")
|
|
85
|
+
: raw;
|
|
86
|
+
}
|
|
87
|
+
const exists = fs.existsSync(target);
|
|
88
|
+
if (exists) {
|
|
68
89
|
const previous = fs.readFileSync(target);
|
|
69
90
|
if (content.equals(previous)) return;
|
|
70
91
|
const backup = checkedPath(root, path.posix.join(BACKUP_ROOT_NAME, backupId, relative));
|
|
71
92
|
log(`${dryRun ? "[dry-run] " : ""}备份规则: ${backup}`);
|
|
72
93
|
if (!dryRun) {
|
|
73
|
-
|
|
74
|
-
fs.copyFileSync(target, backup);
|
|
94
|
+
replaceFile(backup, previous, fs.statSync(target).mode);
|
|
75
95
|
}
|
|
76
96
|
}
|
|
77
97
|
log(`${dryRun ? "[dry-run] " : ""}安装规则: ${target}`);
|
|
78
98
|
if (!dryRun) {
|
|
79
|
-
fs.
|
|
80
|
-
if (merged) replaceFile(target, merged, fs.statSync(target).mode);
|
|
81
|
-
else fs.copyFileSync(source, target);
|
|
99
|
+
replaceFile(target, content, fs.statSync(exists ? target : source).mode);
|
|
82
100
|
}
|
|
83
101
|
}
|
|
84
102
|
|
|
@@ -103,14 +121,17 @@ function mergeRuleText(local, base, incoming) {
|
|
|
103
121
|
}
|
|
104
122
|
}
|
|
105
123
|
|
|
106
|
-
function
|
|
107
|
-
const { source, root, relative, dryRun, log } = options;
|
|
124
|
+
function installMergedImplementationRule(options, knownHashes, hostLabel) {
|
|
125
|
+
const { source, root, relative, dryRun, log, transformContent } = options;
|
|
108
126
|
const target = checkedPath(root, relative);
|
|
109
|
-
const base = checkedPath(root,
|
|
110
|
-
const incoming = checkedPath(root,
|
|
127
|
+
const base = checkedPath(root, IMPLEMENTATION_RULE_BASE);
|
|
128
|
+
const incoming = checkedPath(root, IMPLEMENTATION_RULE_INCOMING);
|
|
111
129
|
const previous = fs.existsSync(base) ? fs.readFileSync(base) : null;
|
|
112
130
|
const local = fs.existsSync(target) ? fs.readFileSync(target) : null;
|
|
113
|
-
const
|
|
131
|
+
const rawNext = fs.readFileSync(source);
|
|
132
|
+
const next = transformContent
|
|
133
|
+
? Buffer.from(transformContent(relative, rawNext.toString("utf8")), "utf8")
|
|
134
|
+
: rawNext;
|
|
114
135
|
const localHash = local && digest(local);
|
|
115
136
|
const pristine = !local || localHash === digest(next) ||
|
|
116
137
|
(previous ? localHash === digest(previous) : knownHashes.includes(localHash));
|
|
@@ -126,7 +147,7 @@ function installCodexImplementationRule(options, knownHashes) {
|
|
|
126
147
|
}
|
|
127
148
|
copyRule({ ...options, merged });
|
|
128
149
|
} else {
|
|
129
|
-
log(`保留
|
|
150
|
+
log(`保留 ${hostLabel} 个人实现规则: ${target}`);
|
|
130
151
|
}
|
|
131
152
|
if (!dryRun) {
|
|
132
153
|
if (!previous || !previous.equals(next)) replaceFile(base, next);
|
|
@@ -237,49 +258,119 @@ function finalizeBackups({ installRoot, dryRun = false, log = console.log }) {
|
|
|
237
258
|
}
|
|
238
259
|
}
|
|
239
260
|
|
|
240
|
-
function
|
|
241
|
-
if (
|
|
242
|
-
|
|
261
|
+
function validateBackupId(backupId) {
|
|
262
|
+
if (
|
|
263
|
+
!backupId ||
|
|
264
|
+
backupId === "." ||
|
|
265
|
+
backupId.includes("/") ||
|
|
266
|
+
backupId.includes("\\") ||
|
|
267
|
+
backupId.includes("..")
|
|
268
|
+
) {
|
|
269
|
+
throw new Error("Invalid --backup-id");
|
|
270
|
+
}
|
|
271
|
+
return backupId;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function getHostRulePolicy(host) {
|
|
275
|
+
if (host === "claude-code") {
|
|
276
|
+
return {
|
|
277
|
+
dirFor: (relative) => (claudeResidentRules.has(relative) ? "rules" : "references/rules"),
|
|
278
|
+
mergedRule: null,
|
|
279
|
+
promotedRule: "02-implementation.md",
|
|
280
|
+
retireColdFromRules: true,
|
|
281
|
+
retiredDirs: ["rules", "references/rules"],
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
if (host === "codex") {
|
|
285
|
+
return {
|
|
286
|
+
dirFor: () => "rules",
|
|
287
|
+
mergedRule: { relative: "rules/02-implementation.md", hostLabel: "Codex" },
|
|
288
|
+
promotedRule: null,
|
|
289
|
+
retireColdFromRules: false,
|
|
290
|
+
retiredDirs: ["rules"],
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
if (host === "antigravity") {
|
|
294
|
+
return {
|
|
295
|
+
dirFor: () => "references/rules",
|
|
296
|
+
mergedRule: { relative: "references/rules/02-implementation.md", hostLabel: "Antigravity" },
|
|
297
|
+
promotedRule: null,
|
|
298
|
+
retireColdFromRules: false,
|
|
299
|
+
retiredDirs: ["references/rules"],
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
throw new Error(`Invalid host: ${host}`);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function collectRuleSources(sourceRoot) {
|
|
243
306
|
const rulesRoot = path.join(sourceRoot, "rules");
|
|
244
|
-
const legacy = JSON.parse(fs.readFileSync(path.join(sourceRoot, "scripts/legacy-common-rule-hashes.json"), "utf8"));
|
|
245
307
|
const files = fs.readdirSync(rulesRoot, { withFileTypes: true })
|
|
246
308
|
.filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
|
|
247
309
|
.map((entry) => entry.name);
|
|
248
310
|
const commonFiles = fs.readdirSync(path.join(rulesRoot, "common"), { withFileTypes: true })
|
|
249
311
|
.filter((entry) => entry.isFile() && entry.name.endsWith(".md"))
|
|
250
312
|
.map((entry) => `common/${entry.name}`);
|
|
251
|
-
|
|
252
|
-
|
|
313
|
+
return { rulesRoot, relatives: [...files, ...commonFiles] };
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function validateRuleTargets({ sourceRoot, installRoot, host }) {
|
|
317
|
+
const policy = getHostRulePolicy(host);
|
|
318
|
+
const root = path.resolve(installRoot);
|
|
319
|
+
const { rulesRoot, relatives } = collectRuleSources(sourceRoot);
|
|
253
320
|
// Validate all managed destinations before the first write, including upgrade cleanup paths.
|
|
254
321
|
checkedPath(root, BACKUP_ROOT_NAME);
|
|
255
|
-
if (
|
|
256
|
-
checkedPath(root,
|
|
257
|
-
checkedPath(root,
|
|
322
|
+
if (policy.mergedRule) {
|
|
323
|
+
checkedPath(root, IMPLEMENTATION_RULE_BASE);
|
|
324
|
+
checkedPath(root, IMPLEMENTATION_RULE_INCOMING);
|
|
258
325
|
}
|
|
259
|
-
for (const relative of
|
|
260
|
-
|
|
261
|
-
|
|
326
|
+
for (const relative of relatives) {
|
|
327
|
+
const targetDir = policy.dirFor(relative);
|
|
328
|
+
checkedPath(root, `${targetDir}/${relative}`);
|
|
329
|
+
if (policy.retireColdFromRules && targetDir === "references/rules") {
|
|
330
|
+
checkedPath(root, `rules/${relative}`);
|
|
331
|
+
}
|
|
332
|
+
if (policy.promotedRule === relative) {
|
|
333
|
+
checkedPath(root, `rules/${relative}`);
|
|
262
334
|
checkedPath(root, `references/rules/${relative}`);
|
|
263
335
|
}
|
|
264
336
|
}
|
|
265
337
|
for (const retired of retiredTopLevelRules) {
|
|
266
|
-
|
|
267
|
-
|
|
338
|
+
for (const dir of policy.retiredDirs) {
|
|
339
|
+
checkedPath(root, `${dir}/${retired}`);
|
|
340
|
+
}
|
|
268
341
|
}
|
|
269
|
-
|
|
342
|
+
return { policy, root, rulesRoot, relatives };
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function installRules({
|
|
346
|
+
sourceRoot,
|
|
347
|
+
installRoot,
|
|
348
|
+
host,
|
|
349
|
+
backupId = defaultBackupId(),
|
|
350
|
+
dryRun = false,
|
|
351
|
+
log = console.log,
|
|
352
|
+
transformContent,
|
|
353
|
+
}) {
|
|
354
|
+
validateBackupId(backupId);
|
|
355
|
+
const { policy, root, rulesRoot, relatives } = validateRuleTargets({ sourceRoot, installRoot, host });
|
|
356
|
+
const legacy = JSON.parse(fs.readFileSync(path.join(sourceRoot, "scripts/legacy-common-rule-hashes.json"), "utf8"));
|
|
357
|
+
for (const relative of relatives) {
|
|
270
358
|
const source = path.join(rulesRoot, relative);
|
|
271
|
-
if (
|
|
272
|
-
|
|
273
|
-
|
|
359
|
+
if (policy.mergedRule && relative === "02-implementation.md") {
|
|
360
|
+
installMergedImplementationRule(
|
|
361
|
+
{ source, root, relative: policy.mergedRule.relative, backupId, dryRun, log, transformContent },
|
|
362
|
+
legacy.files[relative] || [],
|
|
363
|
+
policy.mergedRule.hostLabel,
|
|
364
|
+
);
|
|
274
365
|
continue;
|
|
275
366
|
}
|
|
276
|
-
if (
|
|
367
|
+
if (policy.promotedRule === relative) {
|
|
277
368
|
installPromotedRule({ source, root, relative, knownHashes: legacy.files[relative] || [], backupId, dryRun, log });
|
|
278
369
|
continue;
|
|
279
370
|
}
|
|
280
|
-
const
|
|
281
|
-
copyRule({ source, root, relative: `${
|
|
282
|
-
if (
|
|
371
|
+
const targetDir = policy.dirFor(relative);
|
|
372
|
+
copyRule({ source, root, relative: `${targetDir}/${relative}`, backupId, dryRun, log, transformContent });
|
|
373
|
+
if (policy.retireColdFromRules && targetDir === "references/rules") {
|
|
283
374
|
retireRule({
|
|
284
375
|
source, root, relative: `rules/${relative}`,
|
|
285
376
|
knownHashes: legacy.files[relative] || [], dryRun, log,
|
|
@@ -288,14 +379,22 @@ function installRules({ sourceRoot, installRoot, host, backupId = defaultBackupI
|
|
|
288
379
|
}
|
|
289
380
|
for (const retired of retiredTopLevelRules) {
|
|
290
381
|
const knownHashes = legacy.files[retired] || [];
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
retireRule({ source: null, root, relative: `references/rules/${retired}`, knownHashes, dryRun, log });
|
|
382
|
+
for (const dir of policy.retiredDirs) {
|
|
383
|
+
retireRule({ source: null, root, relative: `${dir}/${retired}`, knownHashes, dryRun, log });
|
|
294
384
|
}
|
|
295
385
|
}
|
|
296
386
|
}
|
|
297
387
|
|
|
298
|
-
module.exports = {
|
|
388
|
+
module.exports = {
|
|
389
|
+
BACKUP_ROOT_NAME,
|
|
390
|
+
checkedPath,
|
|
391
|
+
defaultBackupId,
|
|
392
|
+
replaceFile,
|
|
393
|
+
validateBackupId,
|
|
394
|
+
validateRuleTargets,
|
|
395
|
+
installRules,
|
|
396
|
+
finalizeBackups,
|
|
397
|
+
};
|
|
299
398
|
|
|
300
399
|
function parseCli(argv) {
|
|
301
400
|
let dryRun = false;
|
|
@@ -309,10 +408,7 @@ function parseCli(argv) {
|
|
|
309
408
|
} else if (arg === "--finalize-backups") {
|
|
310
409
|
finalize = true;
|
|
311
410
|
} else if (arg === "--backup-id") {
|
|
312
|
-
backupId = argv[++i];
|
|
313
|
-
if (!backupId || backupId.includes("/") || backupId.includes("\\") || backupId.includes("..")) {
|
|
314
|
-
throw new Error("Invalid --backup-id");
|
|
315
|
-
}
|
|
411
|
+
backupId = validateBackupId(argv[++i]);
|
|
316
412
|
} else if (arg.startsWith("-")) {
|
|
317
413
|
throw new Error(`Unknown option: ${arg}`);
|
|
318
414
|
} else {
|
|
@@ -334,7 +430,7 @@ if (require.main === module) {
|
|
|
334
430
|
} else {
|
|
335
431
|
const [host, installRoot] = positional;
|
|
336
432
|
if (!host || !installRoot || positional.length !== 2) {
|
|
337
|
-
throw new Error("Usage: install-rules.js <claude-code|codex> <install-root> [--backup-id <id>] [--dry-run]");
|
|
433
|
+
throw new Error("Usage: install-rules.js <claude-code|codex|antigravity> <install-root> [--backup-id <id>] [--dry-run]");
|
|
338
434
|
}
|
|
339
435
|
installRules({
|
|
340
436
|
sourceRoot: path.resolve(__dirname, ".."),
|
package/scripts/install.ps1
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
param(
|
|
2
2
|
[switch]$ClaudeOnly,
|
|
3
3
|
[switch]$CodexOnly,
|
|
4
|
+
[switch]$AntigravityOnly,
|
|
4
5
|
[switch]$DryRun
|
|
5
6
|
)
|
|
6
7
|
|
|
@@ -9,8 +10,12 @@ $ErrorActionPreference = "Stop"
|
|
|
9
10
|
if ($args.Count -gt 0) {
|
|
10
11
|
throw "Unknown option: $($args[0])"
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
$selectedOnly = @()
|
|
14
|
+
if ($ClaudeOnly) { $selectedOnly += "-ClaudeOnly" }
|
|
15
|
+
if ($CodexOnly) { $selectedOnly += "-CodexOnly" }
|
|
16
|
+
if ($AntigravityOnly) { $selectedOnly += "-AntigravityOnly" }
|
|
17
|
+
if ($selectedOnly.Count -gt 1) {
|
|
18
|
+
throw "$($selectedOnly -join ' and ') cannot be used together"
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
$RootDir = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
|
@@ -20,8 +25,10 @@ if (-not $HomeDir) {
|
|
|
20
25
|
throw "USERPROFILE or HOME is required"
|
|
21
26
|
}
|
|
22
27
|
|
|
23
|
-
$InstallClaude = -
|
|
24
|
-
$InstallCodex = -
|
|
28
|
+
$InstallClaude = ($selectedOnly.Count -eq 0) -or [bool]$ClaudeOnly
|
|
29
|
+
$InstallCodex = ($selectedOnly.Count -eq 0) -or [bool]$CodexOnly
|
|
30
|
+
$InstallAntigravity = ($selectedOnly.Count -eq 0) -or [bool]$AntigravityOnly
|
|
31
|
+
$ExplicitAntigravity = [bool]$AntigravityOnly
|
|
25
32
|
$BackupId = Get-Date -Format 'yyyyMMddHHmmss'
|
|
26
33
|
|
|
27
34
|
function Invoke-InstallCommand {
|
|
@@ -38,6 +45,22 @@ function Invoke-InstallCommand {
|
|
|
38
45
|
& $Action
|
|
39
46
|
}
|
|
40
47
|
|
|
48
|
+
function Get-Sha256Hex {
|
|
49
|
+
param([string]$LiteralPath)
|
|
50
|
+
|
|
51
|
+
$resolvedPath = (Resolve-Path -LiteralPath $LiteralPath).ProviderPath
|
|
52
|
+
$sha256 = [System.Security.Cryptography.SHA256]::Create()
|
|
53
|
+
$stream = $null
|
|
54
|
+
try {
|
|
55
|
+
$stream = [System.IO.File]::OpenRead($resolvedPath)
|
|
56
|
+
$bytes = $sha256.ComputeHash($stream)
|
|
57
|
+
return ([BitConverter]::ToString($bytes) -replace '-', '')
|
|
58
|
+
} finally {
|
|
59
|
+
if ($null -ne $stream) { $stream.Dispose() }
|
|
60
|
+
$sha256.Dispose()
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
41
64
|
function Backup-IfChanged {
|
|
42
65
|
param(
|
|
43
66
|
[string]$Source,
|
|
@@ -49,9 +72,9 @@ function Backup-IfChanged {
|
|
|
49
72
|
return
|
|
50
73
|
}
|
|
51
74
|
|
|
52
|
-
$sourceHash = Get-
|
|
53
|
-
$destHash = Get-
|
|
54
|
-
if ($sourceHash
|
|
75
|
+
$sourceHash = Get-Sha256Hex -LiteralPath $Source
|
|
76
|
+
$destHash = Get-Sha256Hex -LiteralPath $Destination
|
|
77
|
+
if ($sourceHash -eq $destHash) {
|
|
55
78
|
return
|
|
56
79
|
}
|
|
57
80
|
|
|
@@ -159,6 +182,7 @@ function Remove-PackageOnlyPaths {
|
|
|
159
182
|
"scripts\install.sh",
|
|
160
183
|
"scripts\install.ps1",
|
|
161
184
|
"scripts\install-rules.js",
|
|
185
|
+
"scripts\install-antigravity.js",
|
|
162
186
|
"scripts\legacy-common-rule-hashes.json",
|
|
163
187
|
"scripts\eval-scenarios.js",
|
|
164
188
|
"scripts\verify-harness.js",
|
|
@@ -174,7 +198,8 @@ function Remove-PackageOnlyPaths {
|
|
|
174
198
|
"scripts\verify\skill-invocation.test.js",
|
|
175
199
|
"scripts\verify\install-rules.test.js",
|
|
176
200
|
"scripts\verify\learning.test.js",
|
|
177
|
-
"scripts\verify\plugin-distribution.test.js"
|
|
201
|
+
"scripts\verify\plugin-distribution.test.js",
|
|
202
|
+
"scripts\verify\commit-quality.test.js"
|
|
178
203
|
)
|
|
179
204
|
|
|
180
205
|
foreach ($relative in $packageOnlyFiles) {
|
|
@@ -326,6 +351,22 @@ function Install-CodexWorkflow {
|
|
|
326
351
|
Complete-WorkflowBackups -Destination $dest
|
|
327
352
|
}
|
|
328
353
|
|
|
354
|
+
function Test-AntigravityInstallRoot {
|
|
355
|
+
Test-InstallRoot -Destination (Join-Path $HomeDir ".gemini")
|
|
356
|
+
Test-InstallRoot -Destination (Join-Path $HomeDir ".gemini\config")
|
|
357
|
+
Test-InstallRoot -Destination (Join-Path $HomeDir ".gemini\config\plugins")
|
|
358
|
+
Test-InstallRoot -Destination (Join-Path $HomeDir ".gemini\config\plugins\claude-everything-workflow")
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
function Install-AntigravityWorkflow {
|
|
362
|
+
$antigravityArgs = @((Join-Path $RootDir "scripts\install-antigravity.js"), $HomeDir, "--backup-id", $BackupId)
|
|
363
|
+
if ($DryRun) { $antigravityArgs += "--dry-run" }
|
|
364
|
+
& node @antigravityArgs
|
|
365
|
+
if ($LASTEXITCODE -ne 0) {
|
|
366
|
+
throw "Antigravity plugin installation failed with exit code $LASTEXITCODE"
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
329
370
|
function Install-WorkflowRules {
|
|
330
371
|
param([string]$Destination, [string]$HostName)
|
|
331
372
|
|
|
@@ -348,12 +389,35 @@ function Complete-WorkflowBackups {
|
|
|
348
389
|
}
|
|
349
390
|
}
|
|
350
391
|
|
|
392
|
+
function Resolve-AntigravityInstall {
|
|
393
|
+
if (-not $script:InstallAntigravity -or $ExplicitAntigravity) {
|
|
394
|
+
return
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
$geminiDir = Join-Path $HomeDir ".gemini"
|
|
398
|
+
$item = Get-Item -LiteralPath $geminiDir -Force -ErrorAction SilentlyContinue
|
|
399
|
+
if ($null -eq $item) {
|
|
400
|
+
Write-Host "Skipping Antigravity plugin sync ($geminiDir not found; use -AntigravityOnly to install)."
|
|
401
|
+
$script:InstallAntigravity = $false
|
|
402
|
+
return
|
|
403
|
+
}
|
|
404
|
+
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -or (-not $item.PSIsContainer)) {
|
|
405
|
+
Write-Host "Skipping Antigravity plugin sync ($geminiDir is not a regular directory; use -AntigravityOnly to inspect)."
|
|
406
|
+
$script:InstallAntigravity = $false
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
Resolve-AntigravityInstall
|
|
411
|
+
|
|
351
412
|
if ($InstallClaude) {
|
|
352
413
|
Test-InstallRoot -Destination (Join-Path $HomeDir ".claude")
|
|
353
414
|
}
|
|
354
415
|
if ($InstallCodex) {
|
|
355
416
|
Test-InstallRoot -Destination (Join-Path $HomeDir ".codex")
|
|
356
417
|
}
|
|
418
|
+
if ($InstallAntigravity) {
|
|
419
|
+
Test-AntigravityInstallRoot
|
|
420
|
+
}
|
|
357
421
|
|
|
358
422
|
Test-RetiredSkillManifest
|
|
359
423
|
|
|
@@ -365,4 +429,8 @@ if ($InstallCodex) {
|
|
|
365
429
|
Install-CodexWorkflow
|
|
366
430
|
}
|
|
367
431
|
|
|
432
|
+
if ($InstallAntigravity) {
|
|
433
|
+
Install-AntigravityWorkflow
|
|
434
|
+
}
|
|
435
|
+
|
|
368
436
|
Write-Host "Install complete."
|
package/scripts/install.sh
CHANGED
|
@@ -6,6 +6,9 @@ HOME_DIR="${HOME:?HOME is required}"
|
|
|
6
6
|
|
|
7
7
|
INSTALL_CLAUDE=1
|
|
8
8
|
INSTALL_CODEX=1
|
|
9
|
+
INSTALL_ANTIGRAVITY=1
|
|
10
|
+
EXPLICIT_ANTIGRAVITY=0
|
|
11
|
+
SELECTED_ONLY=""
|
|
9
12
|
DRY_RUN=0
|
|
10
13
|
SHOW_HELP=0
|
|
11
14
|
BACKUP_ID="$(date +%Y%m%d%H%M%S)"
|
|
@@ -15,30 +18,38 @@ usage() {
|
|
|
15
18
|
Usage: scripts/install.sh [options]
|
|
16
19
|
|
|
17
20
|
Options:
|
|
18
|
-
--claude-only
|
|
19
|
-
--codex-only
|
|
20
|
-
--
|
|
21
|
-
-
|
|
21
|
+
--claude-only Only install to ~/.claude
|
|
22
|
+
--codex-only Only install to ~/.codex
|
|
23
|
+
--antigravity-only Only install Antigravity plugin to ~/.gemini/config/plugins/claude-everything-workflow
|
|
24
|
+
--dry-run Print operations without writing files
|
|
25
|
+
-h, --help Show this help
|
|
22
26
|
EOF
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
set_only_host() {
|
|
30
|
+
local flag="$1"
|
|
31
|
+
if [ -n "$SELECTED_ONLY" ] && [ "$SELECTED_ONLY" != "$flag" ]; then
|
|
32
|
+
echo "$SELECTED_ONLY and $flag cannot be used together" >&2
|
|
33
|
+
exit 1
|
|
34
|
+
fi
|
|
35
|
+
SELECTED_ONLY="$flag"
|
|
36
|
+
INSTALL_CLAUDE=0
|
|
37
|
+
INSTALL_CODEX=0
|
|
38
|
+
INSTALL_ANTIGRAVITY=0
|
|
39
|
+
case "$flag" in
|
|
40
|
+
--claude-only) INSTALL_CLAUDE=1 ;;
|
|
41
|
+
--codex-only) INSTALL_CODEX=1 ;;
|
|
42
|
+
--antigravity-only)
|
|
43
|
+
INSTALL_ANTIGRAVITY=1
|
|
44
|
+
EXPLICIT_ANTIGRAVITY=1
|
|
45
|
+
;;
|
|
46
|
+
esac
|
|
47
|
+
}
|
|
48
|
+
|
|
25
49
|
while [ "$#" -gt 0 ]; do
|
|
26
50
|
case "$1" in
|
|
27
|
-
--claude-only)
|
|
28
|
-
|
|
29
|
-
echo "--claude-only and --codex-only cannot be used together" >&2
|
|
30
|
-
exit 1
|
|
31
|
-
fi
|
|
32
|
-
INSTALL_CLAUDE=1
|
|
33
|
-
INSTALL_CODEX=0
|
|
34
|
-
;;
|
|
35
|
-
--codex-only)
|
|
36
|
-
if [ "$INSTALL_CODEX" -eq 0 ]; then
|
|
37
|
-
echo "--claude-only and --codex-only cannot be used together" >&2
|
|
38
|
-
exit 1
|
|
39
|
-
fi
|
|
40
|
-
INSTALL_CLAUDE=0
|
|
41
|
-
INSTALL_CODEX=1
|
|
51
|
+
--claude-only|--codex-only|--antigravity-only)
|
|
52
|
+
set_only_host "$1"
|
|
42
53
|
;;
|
|
43
54
|
--dry-run)
|
|
44
55
|
DRY_RUN=1
|
|
@@ -166,6 +177,7 @@ remove_package_only_paths() {
|
|
|
166
177
|
"scripts/install.sh" \
|
|
167
178
|
"scripts/install.ps1" \
|
|
168
179
|
"scripts/install-rules.js" \
|
|
180
|
+
"scripts/install-antigravity.js" \
|
|
169
181
|
"scripts/legacy-common-rule-hashes.json" \
|
|
170
182
|
"scripts/eval-scenarios.js" \
|
|
171
183
|
"scripts/verify-harness.js" \
|
|
@@ -181,7 +193,8 @@ remove_package_only_paths() {
|
|
|
181
193
|
"scripts/verify/skill-invocation.test.js" \
|
|
182
194
|
"scripts/verify/install-rules.test.js" \
|
|
183
195
|
"scripts/verify/learning.test.js" \
|
|
184
|
-
"scripts/verify/plugin-distribution.test.js"
|
|
196
|
+
"scripts/verify/plugin-distribution.test.js" \
|
|
197
|
+
"scripts/verify/commit-quality.test.js"
|
|
185
198
|
do
|
|
186
199
|
if [ -f "$dest/$file" ]; then
|
|
187
200
|
run rm -f "$dest/$file"
|
|
@@ -293,6 +306,19 @@ install_codex() {
|
|
|
293
306
|
finalize_backups "$dest"
|
|
294
307
|
}
|
|
295
308
|
|
|
309
|
+
install_antigravity() {
|
|
310
|
+
local options=("$ROOT_DIR/scripts/install-antigravity.js" "$HOME_DIR" "--backup-id" "$BACKUP_ID")
|
|
311
|
+
if [ "$DRY_RUN" -eq 1 ]; then options+=(--dry-run); fi
|
|
312
|
+
node "${options[@]}"
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
check_antigravity_root() {
|
|
316
|
+
check_install_root "$HOME_DIR/.gemini"
|
|
317
|
+
check_install_root "$HOME_DIR/.gemini/config"
|
|
318
|
+
check_install_root "$HOME_DIR/.gemini/config/plugins"
|
|
319
|
+
check_install_root "$HOME_DIR/.gemini/config/plugins/claude-everything-workflow"
|
|
320
|
+
}
|
|
321
|
+
|
|
296
322
|
install_workflow_rules() {
|
|
297
323
|
local host_name="$1"
|
|
298
324
|
local dest="$2"
|
|
@@ -309,15 +335,38 @@ finalize_backups() {
|
|
|
309
335
|
node "${options[@]}"
|
|
310
336
|
}
|
|
311
337
|
|
|
338
|
+
resolve_antigravity_install() {
|
|
339
|
+
if [ "$INSTALL_ANTIGRAVITY" -eq 0 ] || [ "$EXPLICIT_ANTIGRAVITY" -eq 1 ]; then
|
|
340
|
+
return
|
|
341
|
+
fi
|
|
342
|
+
|
|
343
|
+
local gemini_dir="$HOME_DIR/.gemini"
|
|
344
|
+
if [ -L "$gemini_dir" ]; then
|
|
345
|
+
echo "Skipping Antigravity plugin sync ($gemini_dir is a symlink; use --antigravity-only to inspect)."
|
|
346
|
+
INSTALL_ANTIGRAVITY=0
|
|
347
|
+
return
|
|
348
|
+
fi
|
|
349
|
+
if [ ! -d "$gemini_dir" ]; then
|
|
350
|
+
echo "Skipping Antigravity plugin sync ($gemini_dir not found; use --antigravity-only to install)."
|
|
351
|
+
INSTALL_ANTIGRAVITY=0
|
|
352
|
+
fi
|
|
353
|
+
}
|
|
354
|
+
|
|
312
355
|
validate_retired_skill_manifest
|
|
356
|
+
resolve_antigravity_install
|
|
313
357
|
if [ "$INSTALL_CLAUDE" -eq 1 ]; then
|
|
314
358
|
check_install_root "$HOME_DIR/.claude"
|
|
315
359
|
fi
|
|
316
360
|
if [ "$INSTALL_CODEX" -eq 1 ]; then
|
|
317
361
|
check_install_root "$HOME_DIR/.codex"
|
|
318
362
|
fi
|
|
363
|
+
if [ "$INSTALL_ANTIGRAVITY" -eq 1 ]; then
|
|
364
|
+
check_antigravity_root
|
|
365
|
+
fi
|
|
319
366
|
|
|
320
|
-
|
|
367
|
+
if [ "$INSTALL_CLAUDE" -eq 1 ] || [ "$INSTALL_CODEX" -eq 1 ]; then
|
|
368
|
+
require_rsync
|
|
369
|
+
fi
|
|
321
370
|
|
|
322
371
|
if [ "$INSTALL_CLAUDE" -eq 1 ]; then
|
|
323
372
|
install_claude
|
|
@@ -327,4 +376,8 @@ if [ "$INSTALL_CODEX" -eq 1 ]; then
|
|
|
327
376
|
install_codex
|
|
328
377
|
fi
|
|
329
378
|
|
|
379
|
+
if [ "$INSTALL_ANTIGRAVITY" -eq 1 ]; then
|
|
380
|
+
install_antigravity
|
|
381
|
+
fi
|
|
382
|
+
|
|
330
383
|
echo "Install complete."
|
|
@@ -53,6 +53,7 @@ function hookCommand(hook, installRoot) {
|
|
|
53
53
|
script: installedPath(executable, installRoot),
|
|
54
54
|
id: match[4],
|
|
55
55
|
target: relativeLegacyRunner ? target : installedPath(target, installRoot),
|
|
56
|
+
arguments: hook.command.slice(match[0].length).trim(),
|
|
56
57
|
relativeLegacyRunner,
|
|
57
58
|
};
|
|
58
59
|
}
|
|
@@ -65,7 +66,7 @@ function validateHookGroups(events) {
|
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
function mergeHookGroups(current, incoming, installRoot, windowsPaths) {
|
|
69
|
+
function mergeHookGroups(current, incoming, installRoot, windowsPaths, event) {
|
|
69
70
|
const managedTargets = new Map();
|
|
70
71
|
const managedGroups = incoming.map((group) => {
|
|
71
72
|
const hooks = group.hooks.filter((hook) => {
|
|
@@ -82,7 +83,17 @@ function mergeHookGroups(current, incoming, installRoot, windowsPaths) {
|
|
|
82
83
|
const userGroups = current.map((group) => ({
|
|
83
84
|
...group,
|
|
84
85
|
hooks: group.hooks.filter((hook) => {
|
|
85
|
-
const { script, id, target, relativeLegacyRunner } = hookCommand(hook, installRoot);
|
|
86
|
+
const { script, id, target, relativeLegacyRunner, arguments: args } = hookCommand(hook, installRoot);
|
|
87
|
+
if (event === "PostToolUse" &&
|
|
88
|
+
(group.matcher === "Edit|Write|MultiEdit" || group.matcher === "Edit") &&
|
|
89
|
+
script === RUNNER &&
|
|
90
|
+
((id === "post:edit:console-log" && target === "hooks/check-console-log.js") ||
|
|
91
|
+
(id === "post:edit:code-size" && target === "hooks/check-code-size.js")) &&
|
|
92
|
+
args === "standard,strict" && hook.timeout === 5 &&
|
|
93
|
+
Object.keys(hook).every((key) => ["type", "command", "timeout"].includes(key)) &&
|
|
94
|
+
Object.keys(group).every((key) => ["matcher", "hooks"].includes(key))) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
86
97
|
if (LEGACY_HOOK_PATTERNS.includes(script)) return false;
|
|
87
98
|
if (!relativeLegacyRunner && script !== RUNNER) return true;
|
|
88
99
|
if (LEGACY_WRAPPED_TARGETS.get(id)?.includes(target)) return false;
|
|
@@ -103,6 +114,7 @@ function mergeSettings(source, existing, { installRoot = path.join(os.homedir(),
|
|
|
103
114
|
Object.hasOwn(incoming, event) ? incoming[event] : [],
|
|
104
115
|
installRoot,
|
|
105
116
|
windowsPaths,
|
|
117
|
+
event,
|
|
106
118
|
)])
|
|
107
119
|
.filter(([, groups]) => groups.length > 0));
|
|
108
120
|
return {
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 1,
|
|
3
|
+
"retired_agent_hashes": {
|
|
4
|
+
"harness-optimizer.md": [
|
|
5
|
+
"c5f8f99db42e5c63ebc2398dc426a37e283a653233e25193a1496a6ea3c8fa12",
|
|
6
|
+
"4530b8ff3cf3c1afa20732d3cad0f531ad15205865ee98feefdd2a3c2134a895",
|
|
7
|
+
"f14036aea8ff12806a0c5afb4fac12478471ebee50f6a13405f5c873b46f962a",
|
|
8
|
+
"5830fb4ad09823b9ae2d4e4821764782be4022bc9cd40aeeb20a6082abd662e1",
|
|
9
|
+
"c3ac215be413b024ec10475dbbb18d13f5618583c8ad5c9dd20d2cc99c0b6fe3",
|
|
10
|
+
"ec8b8873829b7dcd07b4bcac2ea9538b24b6417ce23b4a55da41646928a2bfd8",
|
|
11
|
+
"b83d828efde126a994efafc850cbb628999086383b5ceb8da207ab405680dcc9",
|
|
12
|
+
"63f8d6dfbd74b09548761d1e99d805850543769a664c9345293264862d062ebf"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
3
15
|
"retired_skills": {
|
|
4
16
|
"brainstorming": [
|
|
5
17
|
"SKILL.md",
|