claude-everything-workflow 0.2.11 → 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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/docs/plugins.md +3 -2
- package/evals/routing-scenarios.json +9 -0
- 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/install-antigravity.js +63 -19
- package/scripts/install-rules.js +27 -7
- package/scripts/install.ps1 +21 -24
- package/scripts/install.sh +2 -1
- 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 +212 -5
- package/scripts/verify/metadata-checks.js +4 -1
- package/scripts/verify/runtime-checks.js +57 -2
- package/scripts/verify/workflow-checks.js +5 -1
- package/settings.json +1 -6
- 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
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Antigravity PreToolUse Hook 适配器
|
|
6
|
+
*
|
|
7
|
+
* 读取 Antigravity camelCase stdin JSON,将含 git commit 的 run_command 调用
|
|
8
|
+
* 转发给 hooks/commit-quality.js,并输出符合 hooks.json 契约的 JSON 决策。
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const path = require("node:path");
|
|
12
|
+
const { spawnSync } = require("node:child_process");
|
|
13
|
+
const { isHookEnabled } = require("./hook-flags");
|
|
14
|
+
|
|
15
|
+
const HOOK_ID = "pre:bash:commit-quality";
|
|
16
|
+
const PROFILES = "standard,strict";
|
|
17
|
+
|
|
18
|
+
function isValidDirString(value) {
|
|
19
|
+
return typeof value === "string" && value.trim().length > 0 && !value.includes("\0");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function resolveWorkDir(payload) {
|
|
23
|
+
const workspacePaths = Array.isArray(payload?.workspacePaths) ? payload.workspacePaths : [];
|
|
24
|
+
const workspaceRoot = workspacePaths.find(isValidDirString);
|
|
25
|
+
const baseCwd = isValidDirString(payload?.cwd)
|
|
26
|
+
? payload.cwd
|
|
27
|
+
: workspaceRoot || process.cwd();
|
|
28
|
+
|
|
29
|
+
const rawToolCwd = payload?.toolCall?.args?.Cwd;
|
|
30
|
+
if (rawToolCwd !== undefined && rawToolCwd !== null) {
|
|
31
|
+
if (typeof rawToolCwd !== "string" || rawToolCwd.includes("\0")) {
|
|
32
|
+
return { valid: false };
|
|
33
|
+
}
|
|
34
|
+
if (rawToolCwd.trim()) {
|
|
35
|
+
const resolved = path.isAbsolute(rawToolCwd)
|
|
36
|
+
? rawToolCwd
|
|
37
|
+
: path.resolve(baseCwd, rawToolCwd);
|
|
38
|
+
return { valid: true, cwd: resolved };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return { valid: true, cwd: baseCwd };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function run(raw) {
|
|
46
|
+
if (!isHookEnabled(HOOK_ID, { profiles: PROFILES })) {
|
|
47
|
+
return { decision: "allow" };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let payload;
|
|
51
|
+
try {
|
|
52
|
+
payload = JSON.parse(raw);
|
|
53
|
+
} catch {
|
|
54
|
+
return { decision: "allow" };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const toolName = payload?.toolCall?.name;
|
|
58
|
+
const commandLine = payload?.toolCall?.args?.CommandLine;
|
|
59
|
+
if (toolName !== "run_command" || typeof commandLine !== "string" || !commandLine.trim()) {
|
|
60
|
+
return { decision: "allow" };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (!/\bcommit\b/i.test(commandLine)) {
|
|
64
|
+
return { decision: "allow" };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const workDir = resolveWorkDir(payload);
|
|
68
|
+
if (!workDir.valid) {
|
|
69
|
+
return { decision: "deny", reason: "Invalid run_command working directory." };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const commitQualityPath = path.resolve(__dirname, "..", "commit-quality.js");
|
|
73
|
+
const result = spawnSync(process.execPath, [commitQualityPath], {
|
|
74
|
+
input: JSON.stringify({ tool_input: { command: commandLine } }),
|
|
75
|
+
cwd: workDir.cwd,
|
|
76
|
+
encoding: "utf8",
|
|
77
|
+
timeout: 8000,
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (result.error || (result.status !== 0 && result.status !== 2)) {
|
|
81
|
+
return {
|
|
82
|
+
decision: "deny",
|
|
83
|
+
reason: "Could not run the commit check in the requested working directory.",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const reason = (result.stderr || "").trim();
|
|
87
|
+
if (result.status === 2) {
|
|
88
|
+
return {
|
|
89
|
+
decision: "deny",
|
|
90
|
+
reason: reason || "Commit blocked by cew-commit-quality hook.",
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return reason ? { decision: "allow", reason } : { decision: "allow" };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
module.exports = { run };
|
|
98
|
+
|
|
99
|
+
if (require.main === module) {
|
|
100
|
+
let raw = "";
|
|
101
|
+
process.stdin.setEncoding("utf8");
|
|
102
|
+
process.stdin.on("data", (chunk) => {
|
|
103
|
+
raw += chunk;
|
|
104
|
+
});
|
|
105
|
+
process.stdin.on("end", () => {
|
|
106
|
+
try {
|
|
107
|
+
process.stdout.write(`${JSON.stringify(run(raw))}\n`);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
110
|
+
process.stdout.write(
|
|
111
|
+
`${JSON.stringify({ decision: "allow", reason: `cew-commit-quality hook error: ${message}` })}\n`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
process.exit(0);
|
|
115
|
+
});
|
|
116
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-everything-workflow",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Claude Code and
|
|
3
|
+
"version": "0.2.12",
|
|
4
|
+
"description": "Claude Code, Codex, and Antigravity harness with rules, skills, agents, hooks, and verification gates.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
7
7
|
"codex",
|
|
8
|
+
"antigravity",
|
|
8
9
|
"agents",
|
|
9
10
|
"harness",
|
|
10
11
|
"skills"
|
|
@@ -23,6 +24,7 @@
|
|
|
23
24
|
"test:install-rules": "node scripts/verify/install-rules.test.js",
|
|
24
25
|
"test:learning": "node --test scripts/verify/learning.test.js",
|
|
25
26
|
"test:plugins": "node --test scripts/verify/plugin-distribution.test.js",
|
|
27
|
+
"test:hooks": "node --test scripts/verify/commit-quality.test.js",
|
|
26
28
|
"eval:scenarios": "node scripts/eval-scenarios.js",
|
|
27
29
|
"verify:upstream": "node scripts/verify-upstream-capability-map.js",
|
|
28
30
|
"pack:dry-run": "npm pack --dry-run"
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
## 代码与安全禁止 (CRITICAL)
|
|
25
25
|
|
|
26
|
-
- 调试残留、类型抑制和耦合问题按目标项目标准检查;不得为掩盖真实错误添加抑制或绕过检查。`hooks/check-
|
|
26
|
+
- 调试残留、类型抑制和耦合问题按目标项目标准检查;不得为掩盖真实错误添加抑制或绕过检查。`hooks/check-edited-file.js` 对 `console.log`、`debugger`、`@ts-ignore`、`@ts-nocheck` 和 `any` 的提示属于兼容性警告,需结合真实用途判断。
|
|
27
27
|
- 禁止硬编码密钥、API key、token、secret 或密码(改用环境变量)、SQL 字符串拼接(改用参数化)、未校验外部输入、明文密码(改用 hash)、绕过验证或质量门 Hook,以及提交调试代码。
|
|
28
28
|
- 危险操作必须在沙箱或等价隔离环境中执行;安全敏感改动提交前按风险检查 SQL 注入、XSS、敏感信息泄露和依赖漏洞。发现违规时立即指出问题、解释原因并提供修复方案。
|
package/rules/common/hooks.md
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
- 摘要字段以 `rules/common/context-hygiene.md` 为唯一来源;不按轮数机械总结,不保存完整 transcript,不覆盖用户规则和决策;敏感内容只记录风险和证据位置,不持久化原值。
|
|
12
12
|
- `ECC_HOOK_PROFILE` 支持 `minimal`、默认 `standard` 和 `strict`;`ECC_DISABLED_HOOKS` 禁用指定 Hook ID。
|
|
13
|
-
-
|
|
14
|
-
- `check-
|
|
13
|
+
- `standard`、`strict` 默认启用提交检查:疑似密钥命中时阻止提交,提交格式与调试代码仅警告;`minimal` 不启用此 Hook。它不替代目标项目的安全检查与质量门。
|
|
14
|
+
- `check-edited-file`(Hook ID `post:edit:quality`,仍兼容单独禁用 `post:edit:console-log` 与 `post:edit:code-size`)是兼容性提示,不替代目标项目 lint 或类型规则;项目已有等价检查
|
|
15
15
|
或约定不适用时,可用 `ECC_DISABLED_HOOKS` 关闭相应提示,不能借此绕过项目质量门。
|
|
16
16
|
|
|
17
17
|
## 权限
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
const fs = require("fs");
|
|
5
5
|
const path = require("path");
|
|
6
|
+
const { createHash } = require("node:crypto");
|
|
6
7
|
|
|
7
8
|
function writeLine(message) {
|
|
8
9
|
process.stdout.write(`${message}\n`);
|
|
@@ -45,7 +46,15 @@ function validateManifest(manifest) {
|
|
|
45
46
|
throw new Error(`Invalid retired skill entry: ${skill}`);
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
const agents = manifest.retired_agent_hashes === undefined ? {} : manifest.retired_agent_hashes;
|
|
50
|
+
if (!agents || typeof agents !== "object" || Array.isArray(agents)) throw new Error("Invalid retired agent manifest");
|
|
51
|
+
for (const [name, hashes] of Object.entries(agents)) {
|
|
52
|
+
if (!/^[a-z0-9-]+\.md$/.test(name) || !Array.isArray(hashes) || hashes.length === 0 ||
|
|
53
|
+
!hashes.every((hash) => typeof hash === "string" && /^[a-f0-9]{64}$/.test(hash))) {
|
|
54
|
+
throw new Error(`Invalid retired agent entry: ${name}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return { skills: entries, agents: Object.entries(agents) };
|
|
49
58
|
}
|
|
50
59
|
|
|
51
60
|
function lstatIfExists(target) {
|
|
@@ -168,6 +177,29 @@ function cleanupSkill({ installRoot, skill, knownFiles, dryRun }) {
|
|
|
168
177
|
}
|
|
169
178
|
}
|
|
170
179
|
|
|
180
|
+
function cleanupRetiredAgents(installRoot, agents, dryRun) {
|
|
181
|
+
const directory = path.join(installRoot, "agents");
|
|
182
|
+
if (lstatIfExists(installRoot)?.isSymbolicLink() || !lstatIfExists(directory)?.isDirectory()) return;
|
|
183
|
+
for (const [name, hashes] of agents) {
|
|
184
|
+
const target = path.join(directory, name);
|
|
185
|
+
const stat = lstatIfExists(target);
|
|
186
|
+
if (!stat) continue;
|
|
187
|
+
if (stat.isSymbolicLink()) {
|
|
188
|
+
writeLine(`Preserving symlinked retired agent: ${target}`);
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (!stat.isFile()) continue;
|
|
192
|
+
// SHA-256 of LF text, including the distinct files generated for Antigravity.
|
|
193
|
+
const text = fs.readFileSync(target, "utf8").replace(/\r\n/g, "\n");
|
|
194
|
+
if (!hashes.includes(createHash("sha256").update(text).digest("hex"))) {
|
|
195
|
+
writeLine(`Preserving customized retired agent: ${target}`);
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
writeLine(`${dryRun ? "[dry-run] " : ""}Remove retired agent: ${target}`);
|
|
199
|
+
if (!dryRun) fs.rmSync(target, { force: true });
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
171
203
|
function main(argv = process.argv.slice(2)) {
|
|
172
204
|
const dryRun = argv.includes("--dry-run");
|
|
173
205
|
const validateOnly = argv.includes("--validate");
|
|
@@ -184,10 +216,11 @@ function main(argv = process.argv.slice(2)) {
|
|
|
184
216
|
|
|
185
217
|
const manifestPath = path.join(__dirname, "retired-skill-files.json");
|
|
186
218
|
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
187
|
-
const
|
|
219
|
+
const retired = validateManifest(manifest);
|
|
188
220
|
if (validateOnly) return 0;
|
|
189
221
|
|
|
190
222
|
const installRoot = path.resolve(positional[0]);
|
|
223
|
+
cleanupRetiredAgents(installRoot, retired.agents, dryRun);
|
|
191
224
|
const skillsRoot = path.join(installRoot, "skills");
|
|
192
225
|
const skillsRootStat = lstatIfExists(skillsRoot);
|
|
193
226
|
if (skillsRootStat?.isSymbolicLink()) {
|
|
@@ -198,7 +231,7 @@ function main(argv = process.argv.slice(2)) {
|
|
|
198
231
|
throw new Error(`Expected skills directory: ${skillsRoot}`);
|
|
199
232
|
}
|
|
200
233
|
|
|
201
|
-
for (const [skill, knownFiles] of
|
|
234
|
+
for (const [skill, knownFiles] of retired.skills) {
|
|
202
235
|
cleanupSkill({ installRoot, skill, knownFiles, dryRun });
|
|
203
236
|
}
|
|
204
237
|
return 0;
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const path = require("node:path");
|
|
6
|
-
const crypto = require("node:crypto");
|
|
7
6
|
const { spawnSync } = require("node:child_process");
|
|
8
7
|
const {
|
|
9
8
|
BACKUP_ROOT_NAME,
|
|
@@ -11,6 +10,7 @@ const {
|
|
|
11
10
|
defaultBackupId,
|
|
12
11
|
finalizeBackups,
|
|
13
12
|
installRules,
|
|
13
|
+
replaceFile,
|
|
14
14
|
validateBackupId,
|
|
15
15
|
validateRuleTargets,
|
|
16
16
|
} = require("./install-rules");
|
|
@@ -221,6 +221,41 @@ function buildPluginManifest(sourceRoot) {
|
|
|
221
221
|
return JSON.stringify(manifest, null, 2) + "\n";
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
function buildHooksConfig() {
|
|
225
|
+
return (
|
|
226
|
+
JSON.stringify(
|
|
227
|
+
{
|
|
228
|
+
"cew-commit-quality": {
|
|
229
|
+
PreToolUse: [
|
|
230
|
+
{
|
|
231
|
+
matcher: "run_command",
|
|
232
|
+
hooks: [
|
|
233
|
+
{
|
|
234
|
+
type: "command",
|
|
235
|
+
command: "node ./hooks/runtime/antigravity-pre-tool.js",
|
|
236
|
+
timeout: 15,
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
null,
|
|
244
|
+
2,
|
|
245
|
+
) + "\n"
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function rewriteAntigravityReferences(relative, text) {
|
|
250
|
+
let updated = text
|
|
251
|
+
.replace(/`commands\/(pr|verify|to-spec|learn)\.md`/g, (_, cmd) => `\`${PLUGIN_HOME_REF}/skills/${cmd}/SKILL.md\``)
|
|
252
|
+
.replace(/`commands\/code-review\.md`/g, `\`${PLUGIN_HOME_REF}/skills/code-review/SKILL.md\``);
|
|
253
|
+
if (relative === "skills/continuous-learning-v2/SKILL.md") {
|
|
254
|
+
updated = updated.replace(/`commands\/`/g, `\`${PLUGIN_HOME_REF}/skills/learn/SKILL.md\``);
|
|
255
|
+
}
|
|
256
|
+
return updated;
|
|
257
|
+
}
|
|
258
|
+
|
|
224
259
|
function writeManagedFile({ pluginRoot, relative, content, mode, backupId, dryRun, log }) {
|
|
225
260
|
const target = checkedPath(pluginRoot, relative);
|
|
226
261
|
const next = Buffer.isBuffer(content) ? content : Buffer.from(content, "utf8");
|
|
@@ -233,27 +268,13 @@ function writeManagedFile({ pluginRoot, relative, content, mode, backupId, dryRu
|
|
|
233
268
|
const backup = checkedPath(pluginRoot, path.posix.join(BACKUP_ROOT_NAME, backupId, relative));
|
|
234
269
|
log(`${dryRun ? "[dry-run] " : ""}备份文件: ${backup}`);
|
|
235
270
|
if (!dryRun) {
|
|
236
|
-
|
|
237
|
-
fs.copyFileSync(target, backup);
|
|
271
|
+
replaceFile(backup, previous, existingStat.mode);
|
|
238
272
|
}
|
|
239
273
|
}
|
|
240
274
|
}
|
|
241
275
|
if (!dryRun) {
|
|
242
276
|
const writableMode = mode !== undefined ? (mode & 0o777) | 0o200 : undefined;
|
|
243
|
-
|
|
244
|
-
const temp = `${target}.tmp-${crypto.randomUUID()}`;
|
|
245
|
-
try {
|
|
246
|
-
fs.writeFileSync(temp, next, {
|
|
247
|
-
flag: "wx",
|
|
248
|
-
...(writableMode !== undefined ? { mode: writableMode } : {}),
|
|
249
|
-
});
|
|
250
|
-
if (process.platform !== "win32" && writableMode !== undefined) {
|
|
251
|
-
fs.chmodSync(temp, writableMode);
|
|
252
|
-
}
|
|
253
|
-
fs.renameSync(temp, target);
|
|
254
|
-
} finally {
|
|
255
|
-
fs.rmSync(temp, { force: true });
|
|
256
|
-
}
|
|
277
|
+
replaceFile(target, next, writableMode ?? existingStat?.mode ?? 0o644);
|
|
257
278
|
} else {
|
|
258
279
|
log(`[dry-run] 写入文件: ${target}`);
|
|
259
280
|
}
|
|
@@ -371,17 +392,27 @@ function installAntigravity({
|
|
|
371
392
|
path.join(sourceRoot, "scripts/learning"),
|
|
372
393
|
"scripts/learning",
|
|
373
394
|
);
|
|
395
|
+
const hookFiles = [
|
|
396
|
+
"hooks/commit-quality.js",
|
|
397
|
+
"hooks/runtime/hook-flags.js",
|
|
398
|
+
"hooks/runtime/antigravity-pre-tool.js",
|
|
399
|
+
].map((relPath) => {
|
|
400
|
+
const srcPath = path.join(sourceRoot, relPath);
|
|
401
|
+
return { srcPath, relPath, mode: fs.statSync(srcPath).mode & 0o777 };
|
|
402
|
+
});
|
|
374
403
|
const commandSkills = buildCommandSkills(sourceRoot);
|
|
375
404
|
const agentFiles = buildAgentFiles(sourceRoot);
|
|
376
405
|
|
|
377
406
|
const managedPaths = [
|
|
378
407
|
BACKUP_ROOT_NAME,
|
|
379
408
|
"plugin.json",
|
|
409
|
+
"hooks.json",
|
|
380
410
|
"rules/AGENTS.md",
|
|
381
411
|
"harness/manifest.json",
|
|
382
412
|
...refFiles.map((item) => item.relPath),
|
|
383
413
|
...skillFiles.map((item) => item.relPath),
|
|
384
414
|
...learningFiles.map((item) => item.relPath),
|
|
415
|
+
...hookFiles.map((item) => item.relPath),
|
|
385
416
|
...commandSkills.map((item) => item.relative),
|
|
386
417
|
...agentFiles.map((item) => item.relative),
|
|
387
418
|
];
|
|
@@ -405,6 +436,14 @@ function installAntigravity({
|
|
|
405
436
|
dryRun,
|
|
406
437
|
log,
|
|
407
438
|
});
|
|
439
|
+
writeManagedFile({
|
|
440
|
+
pluginRoot,
|
|
441
|
+
relative: "hooks.json",
|
|
442
|
+
content: buildHooksConfig(),
|
|
443
|
+
backupId,
|
|
444
|
+
dryRun,
|
|
445
|
+
log,
|
|
446
|
+
});
|
|
408
447
|
writeManagedFile({
|
|
409
448
|
pluginRoot,
|
|
410
449
|
relative: "rules/AGENTS.md",
|
|
@@ -421,11 +460,15 @@ function installAntigravity({
|
|
|
421
460
|
log,
|
|
422
461
|
});
|
|
423
462
|
|
|
424
|
-
for (const item of [...refFiles, ...skillFiles, ...learningFiles]) {
|
|
463
|
+
for (const item of [...refFiles, ...skillFiles, ...learningFiles, ...hookFiles]) {
|
|
464
|
+
let content = fs.readFileSync(item.srcPath);
|
|
465
|
+
if (item.relPath.startsWith("skills/") && item.relPath.endsWith(".md")) {
|
|
466
|
+
content = rewriteAntigravityReferences(item.relPath, content.toString("utf8"));
|
|
467
|
+
}
|
|
425
468
|
writeManagedFile({
|
|
426
469
|
pluginRoot,
|
|
427
470
|
relative: item.relPath,
|
|
428
|
-
content
|
|
471
|
+
content,
|
|
429
472
|
mode: item.mode,
|
|
430
473
|
dryRun,
|
|
431
474
|
log,
|
|
@@ -448,6 +491,7 @@ function installAntigravity({
|
|
|
448
491
|
backupId,
|
|
449
492
|
dryRun,
|
|
450
493
|
log,
|
|
494
|
+
transformContent: rewriteAntigravityReferences,
|
|
451
495
|
});
|
|
452
496
|
|
|
453
497
|
runRetiredSkillCleanup(sourceRoot, pluginRoot, dryRun, log);
|
package/scripts/install-rules.js
CHANGED
|
@@ -73,9 +73,17 @@ function replaceFile(file, content, mode = 0o600) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
function copyRule({ source, root, relative, backupId, dryRun, log, merged }) {
|
|
76
|
+
function copyRule({ source, root, relative, backupId, dryRun, log, merged, transformContent }) {
|
|
77
77
|
const target = checkedPath(root, relative);
|
|
78
|
-
|
|
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
|
+
}
|
|
79
87
|
const exists = fs.existsSync(target);
|
|
80
88
|
if (exists) {
|
|
81
89
|
const previous = fs.readFileSync(target);
|
|
@@ -114,13 +122,16 @@ function mergeRuleText(local, base, incoming) {
|
|
|
114
122
|
}
|
|
115
123
|
|
|
116
124
|
function installMergedImplementationRule(options, knownHashes, hostLabel) {
|
|
117
|
-
const { source, root, relative, dryRun, log } = options;
|
|
125
|
+
const { source, root, relative, dryRun, log, transformContent } = options;
|
|
118
126
|
const target = checkedPath(root, relative);
|
|
119
127
|
const base = checkedPath(root, IMPLEMENTATION_RULE_BASE);
|
|
120
128
|
const incoming = checkedPath(root, IMPLEMENTATION_RULE_INCOMING);
|
|
121
129
|
const previous = fs.existsSync(base) ? fs.readFileSync(base) : null;
|
|
122
130
|
const local = fs.existsSync(target) ? fs.readFileSync(target) : null;
|
|
123
|
-
const
|
|
131
|
+
const rawNext = fs.readFileSync(source);
|
|
132
|
+
const next = transformContent
|
|
133
|
+
? Buffer.from(transformContent(relative, rawNext.toString("utf8")), "utf8")
|
|
134
|
+
: rawNext;
|
|
124
135
|
const localHash = local && digest(local);
|
|
125
136
|
const pristine = !local || localHash === digest(next) ||
|
|
126
137
|
(previous ? localHash === digest(previous) : knownHashes.includes(localHash));
|
|
@@ -331,7 +342,15 @@ function validateRuleTargets({ sourceRoot, installRoot, host }) {
|
|
|
331
342
|
return { policy, root, rulesRoot, relatives };
|
|
332
343
|
}
|
|
333
344
|
|
|
334
|
-
function installRules({
|
|
345
|
+
function installRules({
|
|
346
|
+
sourceRoot,
|
|
347
|
+
installRoot,
|
|
348
|
+
host,
|
|
349
|
+
backupId = defaultBackupId(),
|
|
350
|
+
dryRun = false,
|
|
351
|
+
log = console.log,
|
|
352
|
+
transformContent,
|
|
353
|
+
}) {
|
|
335
354
|
validateBackupId(backupId);
|
|
336
355
|
const { policy, root, rulesRoot, relatives } = validateRuleTargets({ sourceRoot, installRoot, host });
|
|
337
356
|
const legacy = JSON.parse(fs.readFileSync(path.join(sourceRoot, "scripts/legacy-common-rule-hashes.json"), "utf8"));
|
|
@@ -339,7 +358,7 @@ function installRules({ sourceRoot, installRoot, host, backupId = defaultBackupI
|
|
|
339
358
|
const source = path.join(rulesRoot, relative);
|
|
340
359
|
if (policy.mergedRule && relative === "02-implementation.md") {
|
|
341
360
|
installMergedImplementationRule(
|
|
342
|
-
{ source, root, relative: policy.mergedRule.relative, backupId, dryRun, log },
|
|
361
|
+
{ source, root, relative: policy.mergedRule.relative, backupId, dryRun, log, transformContent },
|
|
343
362
|
legacy.files[relative] || [],
|
|
344
363
|
policy.mergedRule.hostLabel,
|
|
345
364
|
);
|
|
@@ -350,7 +369,7 @@ function installRules({ sourceRoot, installRoot, host, backupId = defaultBackupI
|
|
|
350
369
|
continue;
|
|
351
370
|
}
|
|
352
371
|
const targetDir = policy.dirFor(relative);
|
|
353
|
-
copyRule({ source, root, relative: `${targetDir}/${relative}`, backupId, dryRun, log });
|
|
372
|
+
copyRule({ source, root, relative: `${targetDir}/${relative}`, backupId, dryRun, log, transformContent });
|
|
354
373
|
if (policy.retireColdFromRules && targetDir === "references/rules") {
|
|
355
374
|
retireRule({
|
|
356
375
|
source, root, relative: `rules/${relative}`,
|
|
@@ -370,6 +389,7 @@ module.exports = {
|
|
|
370
389
|
BACKUP_ROOT_NAME,
|
|
371
390
|
checkedPath,
|
|
372
391
|
defaultBackupId,
|
|
392
|
+
replaceFile,
|
|
373
393
|
validateBackupId,
|
|
374
394
|
validateRuleTargets,
|
|
375
395
|
installRules,
|
package/scripts/install.ps1
CHANGED
|
@@ -45,6 +45,22 @@ function Invoke-InstallCommand {
|
|
|
45
45
|
& $Action
|
|
46
46
|
}
|
|
47
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
|
+
|
|
48
64
|
function Backup-IfChanged {
|
|
49
65
|
param(
|
|
50
66
|
[string]$Source,
|
|
@@ -56,9 +72,9 @@ function Backup-IfChanged {
|
|
|
56
72
|
return
|
|
57
73
|
}
|
|
58
74
|
|
|
59
|
-
$sourceHash = Get-
|
|
60
|
-
$destHash = Get-
|
|
61
|
-
if ($sourceHash
|
|
75
|
+
$sourceHash = Get-Sha256Hex -LiteralPath $Source
|
|
76
|
+
$destHash = Get-Sha256Hex -LiteralPath $Destination
|
|
77
|
+
if ($sourceHash -eq $destHash) {
|
|
62
78
|
return
|
|
63
79
|
}
|
|
64
80
|
|
|
@@ -182,7 +198,8 @@ function Remove-PackageOnlyPaths {
|
|
|
182
198
|
"scripts\verify\skill-invocation.test.js",
|
|
183
199
|
"scripts\verify\install-rules.test.js",
|
|
184
200
|
"scripts\verify\learning.test.js",
|
|
185
|
-
"scripts\verify\plugin-distribution.test.js"
|
|
201
|
+
"scripts\verify\plugin-distribution.test.js",
|
|
202
|
+
"scripts\verify\commit-quality.test.js"
|
|
186
203
|
)
|
|
187
204
|
|
|
188
205
|
foreach ($relative in $packageOnlyFiles) {
|
|
@@ -404,26 +421,6 @@ if ($InstallAntigravity) {
|
|
|
404
421
|
|
|
405
422
|
Test-RetiredSkillManifest
|
|
406
423
|
|
|
407
|
-
function Resolve-AntigravityInstall {
|
|
408
|
-
if (-not $script:InstallAntigravity -or $ExplicitAntigravity) {
|
|
409
|
-
return
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
$geminiDir = Join-Path $HomeDir ".gemini"
|
|
413
|
-
$item = Get-Item -LiteralPath $geminiDir -Force -ErrorAction SilentlyContinue
|
|
414
|
-
if ($null -eq $item) {
|
|
415
|
-
Write-Host "Skipping Antigravity plugin sync ($geminiDir not found; use -AntigravityOnly to install)."
|
|
416
|
-
$script:InstallAntigravity = $false
|
|
417
|
-
return
|
|
418
|
-
}
|
|
419
|
-
if (($item.Attributes -band [IO.FileAttributes]::ReparsePoint) -or (-not $item.PSIsContainer)) {
|
|
420
|
-
Write-Host "Skipping Antigravity plugin sync ($geminiDir is not a regular directory; use -AntigravityOnly to inspect)."
|
|
421
|
-
$script:InstallAntigravity = $false
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
Resolve-AntigravityInstall
|
|
426
|
-
|
|
427
424
|
if ($InstallClaude) {
|
|
428
425
|
Install-ClaudeWorkflow
|
|
429
426
|
}
|
package/scripts/install.sh
CHANGED
|
@@ -193,7 +193,8 @@ remove_package_only_paths() {
|
|
|
193
193
|
"scripts/verify/skill-invocation.test.js" \
|
|
194
194
|
"scripts/verify/install-rules.test.js" \
|
|
195
195
|
"scripts/verify/learning.test.js" \
|
|
196
|
-
"scripts/verify/plugin-distribution.test.js"
|
|
196
|
+
"scripts/verify/plugin-distribution.test.js" \
|
|
197
|
+
"scripts/verify/commit-quality.test.js"
|
|
197
198
|
do
|
|
198
199
|
if [ -f "$dest/$file" ]; then
|
|
199
200
|
run rm -f "$dest/$file"
|
|
@@ -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",
|