claude-everything-workflow 0.2.13 → 0.2.14
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 +1 -1
- package/docs/plugins.md +1 -1
- package/harness/manifest.json +36 -18
- package/package.json +1 -1
- package/rules/common/performance.md +3 -1
- package/scripts/install-antigravity.js +234 -17
- package/scripts/verify/install-rules.test.js +123 -2
- package/scripts/verify/skill-invocation.test.js +4 -0
- package/scripts/verify/skill-manifest-checks.js +1 -1
- package/scripts/verify/skill-manifest-checks.test.js +53 -0
- package/scripts/verify/workflow-checks.js +85 -1
- package/skills/spec-gate/SKILL.md +1 -1
- package/skills/using-superpowers/SKILL.md +1 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-everything-workflow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "Evidence-based engineering workflows: implement, debug, review and verify.",
|
|
5
5
|
"author": { "name": "xu91102" },
|
|
6
6
|
"homepage": "https://github.com/xu91102/claude-everything-Workflow",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-everything-workflow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.14",
|
|
4
4
|
"description": "Evidence-based engineering workflows: implement, debug, review and verify.",
|
|
5
5
|
"author": { "name": "xu91102" },
|
|
6
6
|
"homepage": "https://github.com/xu91102/claude-everything-Workflow",
|
package/AGENTS.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
## 工程入口与核心红线
|
|
13
13
|
|
|
14
|
-
- 工程交付(实现、修复、测试、审查)先进入 `using-superpowers
|
|
14
|
+
- 工程交付(实现、修复、测试、审查)先进入 `using-superpowers` 判断路径;若请求已明确命中单一专职 Skill(如排障、审查、解决冲突、验收、PR/验证),可直接读取该 Skill,不必先绕道读路由。需要多份 Skill 或规则时同一轮并发读取。
|
|
15
15
|
- 禁止硬编码密钥/token/密码、SQL 拼接、未校验外部输入、明文密码、绕过验证或质量门 Hook,以及提交调试残留、依赖目录或敏感配置。
|
|
16
16
|
- 需要复用用户已登录的 Chrome 做交互式验证时,按 `rules/common/testing.md` 的“浏览器验证”执行;不要新开浏览器验证登录态页面。
|
|
17
17
|
|
package/docs/plugins.md
CHANGED
|
@@ -68,7 +68,7 @@ npx claude-everything-workflow install --antigravity-only
|
|
|
68
68
|
- `plugin.json`:原生插件清单(版本与 `package.json` 保持一致)。
|
|
69
69
|
- `hooks.json` & `hooks/`:注册 Antigravity 原生 `PreToolUse`(`run_command`)提交密钥与质量拦截钩子,沿用 `ECC_HOOK_PROFILE`、`ECC_DISABLED_HOOKS` 控制;不自动启用 Claude Code 专用编辑/观察 hooks。
|
|
70
70
|
- `rules/AGENTS.md`:唯一的常驻入口规则,指引按需读取 `references/rules/` 下的基础规则与 `common/` 专项规则。
|
|
71
|
-
- `skills
|
|
71
|
+
- `skills/`:同步对外工作流技能,并把独立命令(`pr`、`verify`、`learn`)转换为原生技能;`explicit-only` 内部技能(如 `implement`)与由 `learn` 承接的 `continuous-learning-v2` 放在 `references/skills/` 按需读取,`to-spec` 直接复用 `spec-gate`,以减少每轮常驻前缀体积;升级时安全清理旧版重复路径并保留个人文件。
|
|
72
72
|
- `references/rules/02-implementation.md`:采用与 Codex 相同的 Git 三方合并机制,升级时保留个人修改。
|
|
73
73
|
|
|
74
74
|
若本机存在旧版 `~/.gemini/AGENTS.md`,安装器不会自动删除,仅在输出中提示手动确认。
|
package/harness/manifest.json
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"version": "0.1.1",
|
|
10
10
|
"compatibility": [
|
|
11
11
|
"claude-code",
|
|
12
|
-
"codex"
|
|
12
|
+
"codex",
|
|
13
|
+
"antigravity"
|
|
13
14
|
],
|
|
14
15
|
"allowedTools": null,
|
|
15
16
|
"invocation": "implicit"
|
|
@@ -21,7 +22,8 @@
|
|
|
21
22
|
"version": "0.1.1",
|
|
22
23
|
"compatibility": [
|
|
23
24
|
"claude-code",
|
|
24
|
-
"codex"
|
|
25
|
+
"codex",
|
|
26
|
+
"antigravity"
|
|
25
27
|
],
|
|
26
28
|
"allowedTools": null,
|
|
27
29
|
"invocation": "implicit"
|
|
@@ -33,7 +35,8 @@
|
|
|
33
35
|
"version": "2.1.0",
|
|
34
36
|
"compatibility": [
|
|
35
37
|
"claude-code",
|
|
36
|
-
"codex"
|
|
38
|
+
"codex",
|
|
39
|
+
"antigravity"
|
|
37
40
|
],
|
|
38
41
|
"allowedTools": null,
|
|
39
42
|
"invocation": "implicit"
|
|
@@ -45,7 +48,8 @@
|
|
|
45
48
|
"version": "0.1.2",
|
|
46
49
|
"compatibility": [
|
|
47
50
|
"claude-code",
|
|
48
|
-
"codex"
|
|
51
|
+
"codex",
|
|
52
|
+
"antigravity"
|
|
49
53
|
],
|
|
50
54
|
"allowedTools": null,
|
|
51
55
|
"invocation": "implicit"
|
|
@@ -57,7 +61,8 @@
|
|
|
57
61
|
"version": "0.1.2",
|
|
58
62
|
"compatibility": [
|
|
59
63
|
"claude-code",
|
|
60
|
-
"codex"
|
|
64
|
+
"codex",
|
|
65
|
+
"antigravity"
|
|
61
66
|
],
|
|
62
67
|
"allowedTools": null,
|
|
63
68
|
"invocation": "implicit"
|
|
@@ -69,7 +74,8 @@
|
|
|
69
74
|
"version": "0.1.1",
|
|
70
75
|
"compatibility": [
|
|
71
76
|
"claude-code",
|
|
72
|
-
"codex"
|
|
77
|
+
"codex",
|
|
78
|
+
"antigravity"
|
|
73
79
|
],
|
|
74
80
|
"allowedTools": null,
|
|
75
81
|
"invocation": "implicit"
|
|
@@ -81,7 +87,8 @@
|
|
|
81
87
|
"version": "0.1.1",
|
|
82
88
|
"compatibility": [
|
|
83
89
|
"claude-code",
|
|
84
|
-
"codex"
|
|
90
|
+
"codex",
|
|
91
|
+
"antigravity"
|
|
85
92
|
],
|
|
86
93
|
"allowedTools": null,
|
|
87
94
|
"invocation": "implicit"
|
|
@@ -93,7 +100,8 @@
|
|
|
93
100
|
"version": "0.1.1",
|
|
94
101
|
"compatibility": [
|
|
95
102
|
"claude-code",
|
|
96
|
-
"codex"
|
|
103
|
+
"codex",
|
|
104
|
+
"antigravity"
|
|
97
105
|
],
|
|
98
106
|
"allowedTools": null,
|
|
99
107
|
"invocation": "explicit-only"
|
|
@@ -105,7 +113,8 @@
|
|
|
105
113
|
"version": "0.1.1",
|
|
106
114
|
"compatibility": [
|
|
107
115
|
"claude-code",
|
|
108
|
-
"codex"
|
|
116
|
+
"codex",
|
|
117
|
+
"antigravity"
|
|
109
118
|
],
|
|
110
119
|
"allowedTools": null,
|
|
111
120
|
"invocation": "implicit"
|
|
@@ -117,7 +126,8 @@
|
|
|
117
126
|
"version": "0.1.1",
|
|
118
127
|
"compatibility": [
|
|
119
128
|
"claude-code",
|
|
120
|
-
"codex"
|
|
129
|
+
"codex",
|
|
130
|
+
"antigravity"
|
|
121
131
|
],
|
|
122
132
|
"allowedTools": null,
|
|
123
133
|
"invocation": "implicit"
|
|
@@ -129,7 +139,8 @@
|
|
|
129
139
|
"version": "0.1.0",
|
|
130
140
|
"compatibility": [
|
|
131
141
|
"claude-code",
|
|
132
|
-
"codex"
|
|
142
|
+
"codex",
|
|
143
|
+
"antigravity"
|
|
133
144
|
],
|
|
134
145
|
"allowedTools": null,
|
|
135
146
|
"invocation": "implicit"
|
|
@@ -141,7 +152,8 @@
|
|
|
141
152
|
"version": "0.1.1",
|
|
142
153
|
"compatibility": [
|
|
143
154
|
"claude-code",
|
|
144
|
-
"codex"
|
|
155
|
+
"codex",
|
|
156
|
+
"antigravity"
|
|
145
157
|
],
|
|
146
158
|
"allowedTools": null,
|
|
147
159
|
"invocation": "implicit"
|
|
@@ -153,7 +165,8 @@
|
|
|
153
165
|
"version": "0.1.1",
|
|
154
166
|
"compatibility": [
|
|
155
167
|
"claude-code",
|
|
156
|
-
"codex"
|
|
168
|
+
"codex",
|
|
169
|
+
"antigravity"
|
|
157
170
|
],
|
|
158
171
|
"allowedTools": null,
|
|
159
172
|
"invocation": "implicit"
|
|
@@ -165,7 +178,8 @@
|
|
|
165
178
|
"version": "0.1.1",
|
|
166
179
|
"compatibility": [
|
|
167
180
|
"claude-code",
|
|
168
|
-
"codex"
|
|
181
|
+
"codex",
|
|
182
|
+
"antigravity"
|
|
169
183
|
],
|
|
170
184
|
"allowedTools": null,
|
|
171
185
|
"invocation": "implicit"
|
|
@@ -177,7 +191,8 @@
|
|
|
177
191
|
"version": "0.1.0",
|
|
178
192
|
"compatibility": [
|
|
179
193
|
"claude-code",
|
|
180
|
-
"codex"
|
|
194
|
+
"codex",
|
|
195
|
+
"antigravity"
|
|
181
196
|
],
|
|
182
197
|
"allowedTools": null,
|
|
183
198
|
"invocation": "implicit"
|
|
@@ -189,7 +204,8 @@
|
|
|
189
204
|
"version": "0.1.1",
|
|
190
205
|
"compatibility": [
|
|
191
206
|
"claude-code",
|
|
192
|
-
"codex"
|
|
207
|
+
"codex",
|
|
208
|
+
"antigravity"
|
|
193
209
|
],
|
|
194
210
|
"allowedTools": null,
|
|
195
211
|
"invocation": "implicit"
|
|
@@ -201,7 +217,8 @@
|
|
|
201
217
|
"version": "0.1.3",
|
|
202
218
|
"compatibility": [
|
|
203
219
|
"claude-code",
|
|
204
|
-
"codex"
|
|
220
|
+
"codex",
|
|
221
|
+
"antigravity"
|
|
205
222
|
],
|
|
206
223
|
"allowedTools": null,
|
|
207
224
|
"invocation": "implicit"
|
|
@@ -213,7 +230,8 @@
|
|
|
213
230
|
"version": "0.1.1",
|
|
214
231
|
"compatibility": [
|
|
215
232
|
"claude-code",
|
|
216
|
-
"codex"
|
|
233
|
+
"codex",
|
|
234
|
+
"antigravity"
|
|
217
235
|
],
|
|
218
236
|
"allowedTools": null,
|
|
219
237
|
"invocation": "implicit"
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# 性能与上下文成本
|
|
2
2
|
|
|
3
|
-
-
|
|
3
|
+
- 在会话起点或独立子代理边界选择能可靠完成任务的最低成本模型与推理档位;长会话中途避免来回切换模型或思考档位,以免前缀缓存(Prompt Cache)失效。
|
|
4
4
|
- 默认 MCP 必须高频通用且明显优于 CLI/API;同时启用少于 10 个 MCP、活跃工具少于 80 个。
|
|
5
|
+
- 保持前缀稳定与只追加:不在任务中途开关插件/MCP 或频繁改写常驻规则;独立读取与检索尽量同轮并发执行,缩短步间停顿以留在缓存热窗口内。
|
|
6
|
+
- 长停顿后回到大上下文会话或阶段切换时,优先先压缩(/compact)或新开会话再继续,避免冷上下文全量重算;重型检索和日志排查交给子代理,压低主会话重算基数。
|
|
5
7
|
- 研究、调试或里程碑完成并准备切换阶段时压缩;依赖近期细节、关键决策未整理或风险未确认时不压缩。
|
|
6
8
|
- 压缩保留目标、进度、关键文件/接口/决策、风险、阻塞、下一步和待验证假设;压缩后确认这些信息仍可恢复。
|
|
7
9
|
- 多 Agent 的选择以 `rules/common/agent-orchestration.md` 为唯一来源;性能评估只计算额外上下文、工具和回传成本。
|
|
@@ -18,6 +18,8 @@ const {
|
|
|
18
18
|
const PLUGIN_NAME = "claude-everything-workflow";
|
|
19
19
|
const PLUGIN_SUBPATH = path.posix.join(".gemini/config/plugins", PLUGIN_NAME);
|
|
20
20
|
const PLUGIN_HOME_REF = `~/.gemini/config/plugins/${PLUGIN_NAME}`;
|
|
21
|
+
const ANTIGRAVITY_SKIP_COMMAND_SKILLS = new Set(["to-spec"]);
|
|
22
|
+
const ANTIGRAVITY_RELOCATED_SKILL_OVERRIDES = new Set(["continuous-learning-v2"]);
|
|
21
23
|
|
|
22
24
|
function lstatIfExists(target) {
|
|
23
25
|
try {
|
|
@@ -201,16 +203,52 @@ function buildHooksConfig() {
|
|
|
201
203
|
);
|
|
202
204
|
}
|
|
203
205
|
|
|
204
|
-
function
|
|
206
|
+
function escapeRegExp(value) {
|
|
207
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function rewriteAntigravityReferences(
|
|
211
|
+
relative,
|
|
212
|
+
text,
|
|
213
|
+
relocatedSkillNames = [...ANTIGRAVITY_RELOCATED_SKILL_OVERRIDES, "implement"],
|
|
214
|
+
) {
|
|
205
215
|
let updated = text
|
|
206
|
-
.replace(
|
|
207
|
-
|
|
208
|
-
|
|
216
|
+
.replace(
|
|
217
|
+
/`commands\/(pr|verify|learn)\.md`/g,
|
|
218
|
+
(_, cmd) => `\`${PLUGIN_HOME_REF}/skills/${cmd}/SKILL.md\``,
|
|
219
|
+
)
|
|
220
|
+
.replace(
|
|
221
|
+
/`commands\/to-spec\.md`/g,
|
|
222
|
+
`\`${PLUGIN_HOME_REF}/skills/spec-gate/SKILL.md\``,
|
|
223
|
+
)
|
|
224
|
+
.replace(
|
|
225
|
+
/`commands\/code-review\.md`/g,
|
|
226
|
+
`\`${PLUGIN_HOME_REF}/skills/code-review/SKILL.md\``,
|
|
227
|
+
);
|
|
228
|
+
const relocatedAlternation = [...new Set(relocatedSkillNames)].map(escapeRegExp).join("|");
|
|
229
|
+
if (relocatedAlternation) {
|
|
230
|
+
const relocatedPattern = new RegExp(
|
|
231
|
+
`(?<![A-Za-z0-9_./-])skills\\/(${relocatedAlternation})\\/([A-Za-z0-9_/-]+(?:\\.[A-Za-z0-9_-]+)*)`,
|
|
232
|
+
"g",
|
|
233
|
+
);
|
|
234
|
+
updated = updated.replace(
|
|
235
|
+
relocatedPattern,
|
|
236
|
+
(_, skill, rest) => `${PLUGIN_HOME_REF}/references/skills/${skill}/${rest}`,
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
if (relative === "references/skills/continuous-learning-v2/SKILL.md") {
|
|
209
240
|
updated = updated.replace(/`commands\/`/g, `\`${PLUGIN_HOME_REF}/skills/learn/SKILL.md\``);
|
|
210
241
|
}
|
|
211
242
|
return updated;
|
|
212
243
|
}
|
|
213
244
|
|
|
245
|
+
function rewriteRelocatedSkillScript(text) {
|
|
246
|
+
return text.replace(
|
|
247
|
+
/require\(\s*(['"])(\.\.\/(?:(?:\.\.\/)+)scripts\/[^'"]+)\1\s*\)/g,
|
|
248
|
+
(_, quote, target) => `require(${quote}../${target}${quote})`,
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
214
252
|
function writeManagedFile({ pluginRoot, relative, content, mode, backupId, dryRun, log }) {
|
|
215
253
|
const target = checkedPath(pluginRoot, relative);
|
|
216
254
|
const next = Buffer.isBuffer(content) ? content : Buffer.from(content, "utf8");
|
|
@@ -253,13 +291,21 @@ function collectDirectoryFiles(sourceDir, relativePrefix = "") {
|
|
|
253
291
|
return entries;
|
|
254
292
|
}
|
|
255
293
|
|
|
256
|
-
function buildCommandSkills(
|
|
294
|
+
function buildCommandSkills(
|
|
295
|
+
sourceRoot,
|
|
296
|
+
skippedCommandSkills = ANTIGRAVITY_SKIP_COMMAND_SKILLS,
|
|
297
|
+
relocatedSkillNames = [...ANTIGRAVITY_RELOCATED_SKILL_OVERRIDES, "implement"],
|
|
298
|
+
) {
|
|
257
299
|
const commandsDir = path.join(sourceRoot, "commands");
|
|
258
300
|
if (!fs.existsSync(commandsDir)) return [];
|
|
259
301
|
const generated = [];
|
|
260
|
-
|
|
302
|
+
const entries = fs
|
|
303
|
+
.readdirSync(commandsDir, { withFileTypes: true })
|
|
304
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
305
|
+
for (const entry of entries) {
|
|
261
306
|
if (!entry.isFile() || !entry.name.endsWith(".md")) continue;
|
|
262
307
|
const cmdName = entry.name.slice(0, -3);
|
|
308
|
+
if (skippedCommandSkills.has(cmdName)) continue;
|
|
263
309
|
if (fs.existsSync(path.join(sourceRoot, "skills", cmdName, "SKILL.md"))) {
|
|
264
310
|
continue;
|
|
265
311
|
}
|
|
@@ -268,15 +314,152 @@ function buildCommandSkills(sourceRoot) {
|
|
|
268
314
|
if (!data || typeof data.description !== "string" || !data.description.trim()) {
|
|
269
315
|
throw new Error(`commands/${entry.name} missing frontmatter description`);
|
|
270
316
|
}
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
317
|
+
const relative = path.posix.join("skills", cmdName, "SKILL.md");
|
|
318
|
+
const updatedBody = rewriteAntigravityReferences(
|
|
319
|
+
relative,
|
|
320
|
+
body.replace(/\$ARGUMENTS/g, "用户本次请求的内容和参数").replace(/^\n+/, ""),
|
|
321
|
+
relocatedSkillNames,
|
|
322
|
+
);
|
|
323
|
+
const description = data.description.trim();
|
|
324
|
+
const content = `---\nname: ${cmdName}\ndescription: ${JSON.stringify(description)}\n---\n\n${updatedBody}`;
|
|
325
|
+
generated.push({ name: cmdName, description, relative, content });
|
|
276
326
|
}
|
|
277
327
|
return generated;
|
|
278
328
|
}
|
|
279
329
|
|
|
330
|
+
function resolveAntigravitySkillPlan(sourceRoot) {
|
|
331
|
+
const relocatedSkillNames = new Set(ANTIGRAVITY_RELOCATED_SKILL_OVERRIDES);
|
|
332
|
+
const manifestPath = path.join(sourceRoot, "harness/manifest.json");
|
|
333
|
+
if (fs.existsSync(manifestPath)) {
|
|
334
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
335
|
+
for (const skill of manifest.skills || []) {
|
|
336
|
+
if (skill?.invocation === "explicit-only" && skill?.name) {
|
|
337
|
+
relocatedSkillNames.add(skill.name);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
const skippedCommandSkills = new Set(ANTIGRAVITY_SKIP_COMMAND_SKILLS);
|
|
342
|
+
const exposedSkills = [];
|
|
343
|
+
const skillsDir = path.join(sourceRoot, "skills");
|
|
344
|
+
if (fs.existsSync(skillsDir)) {
|
|
345
|
+
const entries = fs
|
|
346
|
+
.readdirSync(skillsDir, { withFileTypes: true })
|
|
347
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
348
|
+
for (const entry of entries) {
|
|
349
|
+
if (!entry.isDirectory() || entry.name === "learn" || relocatedSkillNames.has(entry.name)) {
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
const skillFile = path.join(skillsDir, entry.name, "SKILL.md");
|
|
353
|
+
if (!fs.existsSync(skillFile)) continue;
|
|
354
|
+
const { data } = parseFrontmatter(fs.readFileSync(skillFile, "utf8"));
|
|
355
|
+
exposedSkills.push({
|
|
356
|
+
name: String(data?.name || entry.name).trim(),
|
|
357
|
+
description: String(data?.description || "").trim(),
|
|
358
|
+
source: "skill",
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
for (const cmdSkill of buildCommandSkills(sourceRoot, skippedCommandSkills, relocatedSkillNames)) {
|
|
363
|
+
exposedSkills.push({
|
|
364
|
+
name: cmdSkill.name,
|
|
365
|
+
description: cmdSkill.description,
|
|
366
|
+
source: "command",
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
return { relocatedSkillNames, skippedCommandSkills, exposedSkills };
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function hasSymlinkParent(root, target) {
|
|
373
|
+
let cursor = path.dirname(target);
|
|
374
|
+
while (cursor.startsWith(`${root}${path.sep}`)) {
|
|
375
|
+
if (lstatIfExists(cursor)?.isSymbolicLink()) return true;
|
|
376
|
+
cursor = path.dirname(cursor);
|
|
377
|
+
}
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function cleanupRelocatedAntigravitySkills({
|
|
382
|
+
pluginRoot,
|
|
383
|
+
sourceRoot,
|
|
384
|
+
relocatedSkillNames,
|
|
385
|
+
skippedCommandSkills,
|
|
386
|
+
dryRun,
|
|
387
|
+
log,
|
|
388
|
+
}) {
|
|
389
|
+
const skillsRoot = path.join(pluginRoot, "skills");
|
|
390
|
+
const skillsRootStat = lstatIfExists(skillsRoot);
|
|
391
|
+
if (!skillsRootStat) return;
|
|
392
|
+
if (skillsRootStat.isSymbolicLink() || !skillsRootStat.isDirectory()) {
|
|
393
|
+
log(`保留异常或符号链接 skills 目录: ${skillsRoot}`);
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const cleanupTargets = [];
|
|
398
|
+
for (const name of relocatedSkillNames) {
|
|
399
|
+
const known = collectDirectoryFiles(path.join(sourceRoot, "skills", name)).map((item) => item.relPath);
|
|
400
|
+
cleanupTargets.push([name, known.length > 0 ? known : ["SKILL.md"]]);
|
|
401
|
+
}
|
|
402
|
+
for (const name of skippedCommandSkills) {
|
|
403
|
+
cleanupTargets.push([name, ["SKILL.md"]]);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
for (const [skillName, knownFiles] of cleanupTargets) {
|
|
407
|
+
const skillRoot = path.join(skillsRoot, skillName);
|
|
408
|
+
const rootStat = lstatIfExists(skillRoot);
|
|
409
|
+
if (!rootStat) continue;
|
|
410
|
+
if (rootStat.isSymbolicLink()) {
|
|
411
|
+
log(`保留符号链接旧技能目录: ${skillRoot}`);
|
|
412
|
+
continue;
|
|
413
|
+
}
|
|
414
|
+
if (!rootStat.isDirectory()) continue;
|
|
415
|
+
|
|
416
|
+
const directories = new Set([skillRoot]);
|
|
417
|
+
for (const rel of knownFiles) {
|
|
418
|
+
const target = path.join(skillRoot, rel);
|
|
419
|
+
if (hasSymlinkParent(skillRoot, target)) {
|
|
420
|
+
log(`保留经过符号链接的旧技能文件: ${target}`);
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
let cursor = path.dirname(target);
|
|
424
|
+
while (cursor.startsWith(`${skillRoot}${path.sep}`)) {
|
|
425
|
+
directories.add(cursor);
|
|
426
|
+
cursor = path.dirname(cursor);
|
|
427
|
+
}
|
|
428
|
+
const stat = lstatIfExists(target);
|
|
429
|
+
if (!stat) continue;
|
|
430
|
+
if (stat.isSymbolicLink() || !stat.isFile()) {
|
|
431
|
+
log(`保留符号链接或非文件旧技能路径: ${target}`);
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
log(`${dryRun ? "[dry-run] " : ""}清理已迁移技能文件: ${target}`);
|
|
435
|
+
if (!dryRun) {
|
|
436
|
+
if (process.platform === "win32" && !(stat.mode & 0o200)) {
|
|
437
|
+
fs.chmodSync(target, stat.mode | 0o200);
|
|
438
|
+
}
|
|
439
|
+
fs.unlinkSync(target);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
if (!dryRun) {
|
|
444
|
+
for (const dir of [...directories].sort((a, b) => b.length - a.length)) {
|
|
445
|
+
if (dir !== skillRoot && hasSymlinkParent(skillRoot, dir)) continue;
|
|
446
|
+
const dirStat = lstatIfExists(dir);
|
|
447
|
+
if (
|
|
448
|
+
dirStat &&
|
|
449
|
+
!dirStat.isSymbolicLink() &&
|
|
450
|
+
dirStat.isDirectory() &&
|
|
451
|
+
fs.readdirSync(dir).length === 0
|
|
452
|
+
) {
|
|
453
|
+
fs.rmdirSync(dir);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (lstatIfExists(skillRoot)) {
|
|
457
|
+
log(`保留已迁移技能目录中的个人文件: ${skillRoot}`);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
280
463
|
function runRetiredSkillCleanup(sourceRoot, pluginRoot, dryRun, log) {
|
|
281
464
|
const script = path.join(sourceRoot, "scripts/cleanup-retired-skills.js");
|
|
282
465
|
const args = [script, pluginRoot];
|
|
@@ -303,9 +486,15 @@ function installAntigravity({
|
|
|
303
486
|
const pluginRoot = assertNoSymlinkAncestors(homeDir);
|
|
304
487
|
log(`${dryRun ? "[dry-run] " : ""}Installing Antigravity plugin to ${pluginRoot}`);
|
|
305
488
|
|
|
489
|
+
const { relocatedSkillNames, skippedCommandSkills } = resolveAntigravitySkillPlan(sourceRoot);
|
|
306
490
|
const refFiles = collectDirectoryFiles(path.join(sourceRoot, "references"), "references");
|
|
307
491
|
const skillFiles = collectDirectoryFiles(path.join(sourceRoot, "skills"), "skills")
|
|
308
|
-
.filter((item) => item.relPath !== "skills/README.md")
|
|
492
|
+
.filter((item) => item.relPath !== "skills/README.md")
|
|
493
|
+
.map((item) => {
|
|
494
|
+
const skillName = item.relPath.split("/")[1];
|
|
495
|
+
if (!relocatedSkillNames.has(skillName)) return item;
|
|
496
|
+
return { ...item, relPath: path.posix.join("references", item.relPath) };
|
|
497
|
+
});
|
|
309
498
|
const learningFiles = collectDirectoryFiles(
|
|
310
499
|
path.join(sourceRoot, "scripts/learning"),
|
|
311
500
|
"scripts/learning",
|
|
@@ -318,7 +507,11 @@ function installAntigravity({
|
|
|
318
507
|
const srcPath = path.join(sourceRoot, relPath);
|
|
319
508
|
return { srcPath, relPath, mode: fs.statSync(srcPath).mode & 0o777 };
|
|
320
509
|
});
|
|
321
|
-
const commandSkills = buildCommandSkills(
|
|
510
|
+
const commandSkills = buildCommandSkills(
|
|
511
|
+
sourceRoot,
|
|
512
|
+
skippedCommandSkills,
|
|
513
|
+
relocatedSkillNames,
|
|
514
|
+
);
|
|
322
515
|
|
|
323
516
|
const managedPaths = [
|
|
324
517
|
BACKUP_ROOT_NAME,
|
|
@@ -376,10 +569,21 @@ function installAntigravity({
|
|
|
376
569
|
log,
|
|
377
570
|
});
|
|
378
571
|
|
|
572
|
+
const transformForHost = (relative, text) =>
|
|
573
|
+
rewriteAntigravityReferences(relative, text, relocatedSkillNames);
|
|
574
|
+
|
|
379
575
|
for (const item of [...refFiles, ...skillFiles, ...learningFiles, ...hookFiles]) {
|
|
380
576
|
let content = fs.readFileSync(item.srcPath);
|
|
381
|
-
if (
|
|
382
|
-
|
|
577
|
+
if (
|
|
578
|
+
(item.relPath.startsWith("skills/") || item.relPath.startsWith("references/skills/")) &&
|
|
579
|
+
item.relPath.endsWith(".md")
|
|
580
|
+
) {
|
|
581
|
+
content = transformForHost(item.relPath, content.toString("utf8"));
|
|
582
|
+
} else if (
|
|
583
|
+
item.relPath.startsWith("references/skills/") &&
|
|
584
|
+
/\.(?:c|m)?js$/.test(item.relPath)
|
|
585
|
+
) {
|
|
586
|
+
content = rewriteRelocatedSkillScript(content.toString("utf8"));
|
|
383
587
|
}
|
|
384
588
|
writeManagedFile({
|
|
385
589
|
pluginRoot,
|
|
@@ -407,9 +611,17 @@ function installAntigravity({
|
|
|
407
611
|
backupId,
|
|
408
612
|
dryRun,
|
|
409
613
|
log,
|
|
410
|
-
transformContent:
|
|
614
|
+
transformContent: transformForHost,
|
|
411
615
|
});
|
|
412
616
|
|
|
617
|
+
cleanupRelocatedAntigravitySkills({
|
|
618
|
+
pluginRoot,
|
|
619
|
+
sourceRoot,
|
|
620
|
+
relocatedSkillNames,
|
|
621
|
+
skippedCommandSkills,
|
|
622
|
+
dryRun,
|
|
623
|
+
log,
|
|
624
|
+
});
|
|
413
625
|
runRetiredSkillCleanup(sourceRoot, pluginRoot, dryRun, log);
|
|
414
626
|
finalizeBackups({ installRoot: pluginRoot, dryRun, log });
|
|
415
627
|
|
|
@@ -421,7 +633,12 @@ function installAntigravity({
|
|
|
421
633
|
return pluginRoot;
|
|
422
634
|
}
|
|
423
635
|
|
|
424
|
-
module.exports = {
|
|
636
|
+
module.exports = {
|
|
637
|
+
PLUGIN_SUBPATH,
|
|
638
|
+
installAntigravity,
|
|
639
|
+
parseFrontmatter,
|
|
640
|
+
resolveAntigravitySkillPlan,
|
|
641
|
+
};
|
|
425
642
|
|
|
426
643
|
function parseCli(argv) {
|
|
427
644
|
let dryRun = false;
|
|
@@ -664,13 +664,83 @@ function checkInstallerEntrypoint() {
|
|
|
664
664
|
assert.equal(fs.existsSync(path.join(agRoot, "skills/README.md")), false);
|
|
665
665
|
const agSkills = fs.readdirSync(path.join(agRoot, "skills"), { withFileTypes: true })
|
|
666
666
|
.filter((entry) => entry.isDirectory());
|
|
667
|
-
assert.equal(agSkills.length,
|
|
667
|
+
assert.equal(agSkills.length, 19);
|
|
668
|
+
for (const relocated of ["implement", "to-spec", "continuous-learning-v2"]) {
|
|
669
|
+
assert.equal(
|
|
670
|
+
fs.existsSync(path.join(agRoot, "skills", relocated)),
|
|
671
|
+
false,
|
|
672
|
+
`Antigravity must not expose redundant top-level skills/${relocated}`,
|
|
673
|
+
);
|
|
674
|
+
}
|
|
675
|
+
for (const relRef of [
|
|
676
|
+
"references/skills/implement/SKILL.md",
|
|
677
|
+
"references/skills/implement/references/ticket-delivery.md",
|
|
678
|
+
"references/skills/implement/references/parallel-delivery.md",
|
|
679
|
+
"references/skills/continuous-learning-v2/SKILL.md",
|
|
680
|
+
"references/skills/continuous-learning-v2/hooks/observe-v2.js",
|
|
681
|
+
]) {
|
|
682
|
+
assert.equal(fs.existsSync(path.join(agRoot, relRef)), true, `missing relocated file: ${relRef}`);
|
|
683
|
+
}
|
|
684
|
+
// Relocated observe-v2.js resolves scripts/learning/project-utils cleanly in default and enabled modes.
|
|
685
|
+
{
|
|
686
|
+
const relocatedObserve = path.join(agRoot, "references/skills/continuous-learning-v2/hooks/observe-v2.js");
|
|
687
|
+
const disabledHome = path.join(tempRoot, "ag-observe-disabled");
|
|
688
|
+
fs.mkdirSync(disabledHome, { recursive: true });
|
|
689
|
+
const disabledRes = spawnSync(process.execPath, [relocatedObserve, "post"], {
|
|
690
|
+
cwd: agRoot,
|
|
691
|
+
env: { ...process.env, HOME: disabledHome, USERPROFILE: disabledHome },
|
|
692
|
+
input: "{}",
|
|
693
|
+
encoding: "utf8",
|
|
694
|
+
timeout: 10000,
|
|
695
|
+
});
|
|
696
|
+
assert.ifError(disabledRes.error);
|
|
697
|
+
assert.equal(disabledRes.status, 0, disabledRes.stderr);
|
|
698
|
+
assert.equal(disabledRes.stderr, "");
|
|
699
|
+
|
|
700
|
+
const enabledHome = path.join(tempRoot, "ag-observe-enabled");
|
|
701
|
+
const cfgDir = path.join(enabledHome, ".claude/skills/continuous-learning-v2");
|
|
702
|
+
const obsPath = path.join(enabledHome, ".claude/homunculus/observations.jsonl");
|
|
703
|
+
fs.mkdirSync(cfgDir, { recursive: true });
|
|
704
|
+
const baseCfg = JSON.parse(read(path.join(sourceRoot, "skills/continuous-learning-v2/config.json")));
|
|
705
|
+
baseCfg.observation = {
|
|
706
|
+
...baseCfg.observation,
|
|
707
|
+
enabled: true,
|
|
708
|
+
store_path: "~/.claude/homunculus/observations.jsonl",
|
|
709
|
+
};
|
|
710
|
+
fs.writeFileSync(path.join(cfgDir, "config.json"), JSON.stringify(baseCfg, null, 2));
|
|
711
|
+
|
|
712
|
+
const enabledRes = spawnSync(process.execPath, [relocatedObserve, "post"], {
|
|
713
|
+
cwd: agRoot,
|
|
714
|
+
env: { ...process.env, HOME: enabledHome, USERPROFILE: enabledHome },
|
|
715
|
+
input: JSON.stringify({ tool: "Edit", cwd: sourceRoot, tool_input: { file_path: "README.md" } }),
|
|
716
|
+
encoding: "utf8",
|
|
717
|
+
timeout: 10000,
|
|
718
|
+
});
|
|
719
|
+
assert.ifError(enabledRes.error);
|
|
720
|
+
assert.equal(enabledRes.status, 0, enabledRes.stderr);
|
|
721
|
+
assert.equal(enabledRes.stderr, "");
|
|
722
|
+
const firstRecord = JSON.parse(read(obsPath).trim().split(/\r?\n/)[0]);
|
|
723
|
+
assert.equal(firstRecord.tool, "Edit");
|
|
724
|
+
assert.equal(firstRecord.event, "tool_complete");
|
|
725
|
+
}
|
|
668
726
|
for (const dir of agSkills) {
|
|
669
727
|
const skillMd = read(path.join(agRoot, "skills", dir.name, "SKILL.md"));
|
|
670
728
|
assert.match(skillMd, new RegExp(`^---\\nname: ${dir.name}\\ndescription: .+`, "m"));
|
|
671
729
|
}
|
|
672
730
|
assert.doesNotMatch(read(path.join(agRoot, "skills/pr/SKILL.md")), /\$ARGUMENTS/);
|
|
673
731
|
assert.doesNotMatch(read(path.join(agRoot, "skills/learn/SKILL.md")), /\$ARGUMENTS/);
|
|
732
|
+
assert.match(
|
|
733
|
+
read(path.join(agRoot, "skills/using-superpowers/SKILL.md")),
|
|
734
|
+
/read-reference ~\/\.gemini\/config\/plugins\/claude-everything-workflow\/references\/skills\/implement\/SKILL\.md/,
|
|
735
|
+
);
|
|
736
|
+
assert.match(
|
|
737
|
+
read(path.join(agRoot, "skills/learn/SKILL.md")),
|
|
738
|
+
/~\/\.gemini\/config\/plugins\/claude-everything-workflow\/references\/skills\/continuous-learning-v2\/SKILL\.md/,
|
|
739
|
+
);
|
|
740
|
+
assert.match(
|
|
741
|
+
read(path.join(agRoot, "references/rules/common/agent-orchestration.md")),
|
|
742
|
+
/plugins\/claude-everything-workflow\/references\/skills\/implement\/references\/parallel-delivery\.md/,
|
|
743
|
+
);
|
|
674
744
|
assert.equal(fs.existsSync(path.join(agRoot, "agents")), false,
|
|
675
745
|
"Antigravity plugin must not install retired agents directory");
|
|
676
746
|
assert.equal(fs.existsSync(path.join(agRoot, "references/agents")), false,
|
|
@@ -703,7 +773,11 @@ function checkInstallerEntrypoint() {
|
|
|
703
773
|
read(path.join(agRoot, "references/rules/05-git-workflow.md")),
|
|
704
774
|
/~\/\.gemini\/config\/plugins\/claude-everything-workflow\/skills\/pr\/SKILL\.md/,
|
|
705
775
|
);
|
|
706
|
-
assert.doesNotMatch(read(path.join(agRoot, "skills/continuous-learning-v2/SKILL.md")), /`commands\/`/);
|
|
776
|
+
assert.doesNotMatch(read(path.join(agRoot, "references/skills/continuous-learning-v2/SKILL.md")), /`commands\/`/);
|
|
777
|
+
assert.match(
|
|
778
|
+
read(path.join(agRoot, "references/skills/continuous-learning-v2/SKILL.md")),
|
|
779
|
+
/~\/\.gemini\/config\/plugins\/claude-everything-workflow\/skills\/learn\/SKILL\.md/,
|
|
780
|
+
);
|
|
707
781
|
|
|
708
782
|
// Re-running Antigravity install with unchanged files must not create a spurious backup.
|
|
709
783
|
const agBackups = path.join(agRoot, BACKUP_ROOT_NAME);
|
|
@@ -955,6 +1029,53 @@ function checkAntigravityEdgeCases() {
|
|
|
955
1029
|
true,
|
|
956
1030
|
);
|
|
957
1031
|
}
|
|
1032
|
+
|
|
1033
|
+
// 7. Upgrade cleanup removes legacy top-level relocated/skipped skills safely.
|
|
1034
|
+
{
|
|
1035
|
+
const upgradeHome = path.join(tempRoot, "ag-relocate-upgrade-home");
|
|
1036
|
+
const upgradePlugin = path.join(upgradeHome, ".gemini/config/plugins/claude-everything-workflow");
|
|
1037
|
+
const outsideTarget = path.join(tempRoot, "ag-outside-tospec");
|
|
1038
|
+
fs.mkdirSync(outsideTarget, { recursive: true });
|
|
1039
|
+
fs.writeFileSync(path.join(outsideTarget, "SKILL.md"), "Outside content must stay\n");
|
|
1040
|
+
|
|
1041
|
+
const legacyImplement = path.join(upgradePlugin, "skills/implement");
|
|
1042
|
+
const legacyClv2 = path.join(upgradePlugin, "skills/continuous-learning-v2");
|
|
1043
|
+
fs.mkdirSync(path.join(legacyImplement, "references"), { recursive: true });
|
|
1044
|
+
fs.mkdirSync(path.join(legacyClv2, "hooks"), { recursive: true });
|
|
1045
|
+
fs.writeFileSync(path.join(legacyImplement, "SKILL.md"), "Old implement\n");
|
|
1046
|
+
fs.writeFileSync(path.join(legacyImplement, "references/ticket-delivery.md"), "Old ref\n");
|
|
1047
|
+
fs.writeFileSync(path.join(legacyImplement, "personal-notes.md"), "Keep personal notes\n");
|
|
1048
|
+
fs.writeFileSync(path.join(legacyClv2, "SKILL.md"), "Old clv2\n");
|
|
1049
|
+
fs.writeFileSync(path.join(legacyClv2, "hooks/observe-v2.js"), "Old hook\n");
|
|
1050
|
+
fs.symlinkSync(
|
|
1051
|
+
outsideTarget,
|
|
1052
|
+
path.join(upgradePlugin, "skills/to-spec"),
|
|
1053
|
+
process.platform === "win32" ? "junction" : "dir",
|
|
1054
|
+
);
|
|
1055
|
+
|
|
1056
|
+
installAntigravity({ sourceRoot, homeDir: upgradeHome, dryRun: true, log: () => {} });
|
|
1057
|
+
assert.equal(fs.existsSync(path.join(legacyImplement, "SKILL.md")), true, "dry-run must not delete legacy files");
|
|
1058
|
+
assert.equal(fs.existsSync(path.join(legacyClv2, "SKILL.md")), true, "dry-run must not delete legacy clv2");
|
|
1059
|
+
|
|
1060
|
+
installAntigravity({ sourceRoot, homeDir: upgradeHome, log: () => {} });
|
|
1061
|
+
assert.equal(fs.existsSync(path.join(legacyImplement, "SKILL.md")), false);
|
|
1062
|
+
assert.equal(fs.existsSync(path.join(legacyImplement, "references/ticket-delivery.md")), false);
|
|
1063
|
+
assert.equal(read(path.join(legacyImplement, "personal-notes.md")), "Keep personal notes\n");
|
|
1064
|
+
assert.equal(fs.existsSync(legacyClv2), false);
|
|
1065
|
+
assert.equal(read(path.join(outsideTarget, "SKILL.md")), "Outside content must stay\n");
|
|
1066
|
+
assert.equal(fs.lstatSync(path.join(upgradePlugin, "skills/to-spec")).isSymbolicLink(), true);
|
|
1067
|
+
|
|
1068
|
+
// Non-symlink legacy skills/to-spec/SKILL.md is also removed on upgrade.
|
|
1069
|
+
const toSpecHome = path.join(tempRoot, "ag-tospec-upgrade-home");
|
|
1070
|
+
const legacyToSpec = path.join(
|
|
1071
|
+
toSpecHome,
|
|
1072
|
+
".gemini/config/plugins/claude-everything-workflow/skills/to-spec",
|
|
1073
|
+
);
|
|
1074
|
+
fs.mkdirSync(legacyToSpec, { recursive: true });
|
|
1075
|
+
fs.writeFileSync(path.join(legacyToSpec, "SKILL.md"), "Old to-spec\n");
|
|
1076
|
+
installAntigravity({ sourceRoot, homeDir: toSpecHome, log: () => {} });
|
|
1077
|
+
assert.equal(fs.existsSync(legacyToSpec), false);
|
|
1078
|
+
}
|
|
958
1079
|
}
|
|
959
1080
|
|
|
960
1081
|
try {
|
|
@@ -21,10 +21,14 @@ function validate(compatibility, invocation, claudeFlag, policy) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const both = ["claude-code", "codex"];
|
|
24
|
+
const allHosts = ["claude-code", "codex", "antigravity"];
|
|
24
25
|
const disabledPolicy = "policy:\n allow_implicit_invocation: false\n";
|
|
25
26
|
assert.match(validate(both, "explicit-only", true), /codex.*disable implicit invocation/i);
|
|
26
27
|
assert.match(validate(both, "explicit-only", false, disabledPolicy), /claude-code.*disable implicit invocation/i);
|
|
27
28
|
assert.equal(validate(both, "explicit-only", true, disabledPolicy), "");
|
|
29
|
+
assert.equal(validate(allHosts, "explicit-only", true, disabledPolicy), "");
|
|
30
|
+
assert.equal(validate(allHosts, "implicit", false), "");
|
|
31
|
+
assert.equal(validate(["antigravity"], "explicit-only", false), "");
|
|
28
32
|
assert.equal(validate(["claude-code"], "explicit-only", true), "");
|
|
29
33
|
assert.equal(validate(["codex"], "explicit-only", false, disabledPolicy), "");
|
|
30
34
|
assert.match(validate(["codex"], "explicit-only", false,
|
|
@@ -10,7 +10,7 @@ const MAX_SKILL_TOKENS = 5000;
|
|
|
10
10
|
const MAX_DESCRIPTION_CHARS = 128;
|
|
11
11
|
const NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
12
12
|
const VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
13
|
-
const COMPATIBILITIES = new Set(["claude-code", "codex"]);
|
|
13
|
+
const COMPATIBILITIES = new Set(["claude-code", "codex", "antigravity"]);
|
|
14
14
|
|
|
15
15
|
function isSafeRelativePath(value) {
|
|
16
16
|
return typeof value === "string" && value.length > 0 &&
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const assert = require("assert");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { createHarnessContext } = require("./core");
|
|
4
6
|
const { validateManifest } = require("./skill-manifest-checks");
|
|
7
|
+
const { checkResidentContextBudget } = require("./workflow-checks");
|
|
5
8
|
|
|
6
9
|
function run() {
|
|
7
10
|
const valid = {
|
|
@@ -129,6 +132,56 @@ function run() {
|
|
|
129
132
|
read: () => "---\nname: demo-skill\ndescription: demo\nversion: 2.0.0\n---\n",
|
|
130
133
|
}).join("\n"), /version does not match frontmatter/);
|
|
131
134
|
|
|
135
|
+
const antigravityValid = structuredClone(valid);
|
|
136
|
+
antigravityValid.skills[0].compatibility = ["claude-code", "codex", "antigravity"];
|
|
137
|
+
assert.deepStrictEqual(validateManifest(antigravityValid, {
|
|
138
|
+
exists: (file) => file === "skills/demo-skill/SKILL.md" || file === "AGENTS.md",
|
|
139
|
+
skillPaths: ["skills/demo-skill/SKILL.md"],
|
|
140
|
+
read: () => "---\nname: demo-skill\ndescription: demo\n---\n",
|
|
141
|
+
}), []);
|
|
142
|
+
|
|
143
|
+
// Resident context budget check passes on repository and rejects over-budget fixtures.
|
|
144
|
+
const repoRoot = path.resolve(__dirname, "../..");
|
|
145
|
+
const repoCtx = createHarnessContext(repoRoot);
|
|
146
|
+
checkResidentContextBudget(repoCtx);
|
|
147
|
+
assert.deepStrictEqual(repoCtx.errors, []);
|
|
148
|
+
|
|
149
|
+
const overBudgetErrors = [];
|
|
150
|
+
checkResidentContextBudget(
|
|
151
|
+
{
|
|
152
|
+
root: repoRoot,
|
|
153
|
+
exists: (file) => file === "AGENTS.md" || file === "harness/manifest.json" || file === "skills/a/SKILL.md",
|
|
154
|
+
read: (file) => {
|
|
155
|
+
if (file === "AGENTS.md") return "x".repeat(200);
|
|
156
|
+
if (file === "harness/manifest.json") {
|
|
157
|
+
return JSON.stringify({
|
|
158
|
+
skills: [{ name: "a", path: "skills/a/SKILL.md", invocation: "implicit" }],
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return `---\nname: a\ndescription: ${"y".repeat(60)}\n---\n`;
|
|
162
|
+
},
|
|
163
|
+
fail: (msg) => overBudgetErrors.push(msg),
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
maxAgentsChars: 100,
|
|
167
|
+
maxClaudeResidentRulesChars: 150,
|
|
168
|
+
maxImplicitSkillMetadataChars: 50,
|
|
169
|
+
maxAntigravitySkills: 5,
|
|
170
|
+
maxAntigravitySkillMetadataChars: 50,
|
|
171
|
+
},
|
|
172
|
+
() => ({
|
|
173
|
+
exposedSkills: Array.from({ length: 6 }, (_, i) => ({
|
|
174
|
+
name: `skill-${i}`,
|
|
175
|
+
description: "desc".repeat(10),
|
|
176
|
+
})),
|
|
177
|
+
}),
|
|
178
|
+
);
|
|
179
|
+
assert.match(overBudgetErrors.join("\n"), /AGENTS\.md exceeds resident budget/);
|
|
180
|
+
assert.match(overBudgetErrors.join("\n"), /Claude resident rules exceed budget/);
|
|
181
|
+
assert.match(overBudgetErrors.join("\n"), /Implicit skill metadata exceeds budget/);
|
|
182
|
+
assert.match(overBudgetErrors.join("\n"), /Antigravity exposed skills exceed budget/);
|
|
183
|
+
assert.match(overBudgetErrors.join("\n"), /Antigravity skill metadata exceeds budget/);
|
|
184
|
+
|
|
132
185
|
console.log("skill manifest checks tests passed");
|
|
133
186
|
}
|
|
134
187
|
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const fs = require("fs");
|
|
4
|
+
const { parseFrontmatter } = require("./skill-manifest-checks");
|
|
5
|
+
const { resolveAntigravitySkillPlan } = require("../install-antigravity");
|
|
4
6
|
|
|
5
7
|
const ROUTER_PATH = "skills/using-superpowers/SKILL.md";
|
|
6
8
|
const MAX_ROUTER_LINES = 50;
|
|
9
|
+
const RESIDENT_CONTEXT_BUDGETS = {
|
|
10
|
+
maxAgentsChars: 1800,
|
|
11
|
+
maxClaudeResidentRulesChars: 5200,
|
|
12
|
+
maxImplicitSkillMetadataChars: 2200,
|
|
13
|
+
maxAntigravitySkills: 19,
|
|
14
|
+
maxAntigravitySkillMetadataChars: 2100,
|
|
15
|
+
};
|
|
7
16
|
const EXPECTED_TOP_LEVEL_RULES = [
|
|
8
17
|
"01-base.md",
|
|
9
18
|
"02-implementation.md",
|
|
@@ -116,12 +125,87 @@ function checkVisualCompanionSecurity({ requireTokens }) {
|
|
|
116
125
|
]);
|
|
117
126
|
}
|
|
118
127
|
|
|
128
|
+
function checkResidentContextBudget(
|
|
129
|
+
{ root, exists, read, fail },
|
|
130
|
+
budgets = RESIDENT_CONTEXT_BUDGETS,
|
|
131
|
+
planResolver = resolveAntigravitySkillPlan,
|
|
132
|
+
) {
|
|
133
|
+
if (exists("AGENTS.md")) {
|
|
134
|
+
const agentsChars = read("AGENTS.md").length;
|
|
135
|
+
if (agentsChars > budgets.maxAgentsChars) {
|
|
136
|
+
fail(`AGENTS.md exceeds resident budget (${agentsChars} > ${budgets.maxAgentsChars} chars)`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const claudeResidentFiles = [
|
|
141
|
+
"AGENTS.md",
|
|
142
|
+
"CLAUDE.md",
|
|
143
|
+
"rules/01-base.md",
|
|
144
|
+
"rules/02-implementation.md",
|
|
145
|
+
"rules/05-git-workflow.md",
|
|
146
|
+
];
|
|
147
|
+
const claudeResidentChars = claudeResidentFiles
|
|
148
|
+
.filter((file) => exists(file))
|
|
149
|
+
.reduce((sum, file) => sum + read(file).length, 0);
|
|
150
|
+
if (claudeResidentChars > budgets.maxClaudeResidentRulesChars) {
|
|
151
|
+
fail(
|
|
152
|
+
`Claude resident rules exceed budget (${claudeResidentChars} > ${budgets.maxClaudeResidentRulesChars} chars)`,
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (exists("harness/manifest.json")) {
|
|
157
|
+
let manifest;
|
|
158
|
+
try {
|
|
159
|
+
manifest = JSON.parse(read("harness/manifest.json"));
|
|
160
|
+
} catch {
|
|
161
|
+
manifest = null;
|
|
162
|
+
}
|
|
163
|
+
if (Array.isArray(manifest?.skills)) {
|
|
164
|
+
let implicitChars = 0;
|
|
165
|
+
for (const skill of manifest.skills) {
|
|
166
|
+
if (skill?.invocation !== "implicit" || !skill?.path || !exists(skill.path)) continue;
|
|
167
|
+
try {
|
|
168
|
+
const fm = parseFrontmatter(read(skill.path));
|
|
169
|
+
implicitChars += String(skill.name || "").length + String(fm?.description || "").trim().length;
|
|
170
|
+
} catch {
|
|
171
|
+
// Invalid YAML is reported by skill-manifest-checks.
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (implicitChars > budgets.maxImplicitSkillMetadataChars) {
|
|
175
|
+
fail(
|
|
176
|
+
`Implicit skill metadata exceeds budget (${implicitChars} > ${budgets.maxImplicitSkillMetadataChars} chars)`,
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (root) {
|
|
183
|
+
const plan = planResolver(root);
|
|
184
|
+
if (plan.exposedSkills.length > budgets.maxAntigravitySkills) {
|
|
185
|
+
fail(
|
|
186
|
+
`Antigravity exposed skills exceed budget (${plan.exposedSkills.length} > ${budgets.maxAntigravitySkills})`,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
const agMetadataChars = plan.exposedSkills.reduce(
|
|
190
|
+
(sum, skill) => sum + skill.name.length + skill.description.length,
|
|
191
|
+
0,
|
|
192
|
+
);
|
|
193
|
+
if (agMetadataChars > budgets.maxAntigravitySkillMetadataChars) {
|
|
194
|
+
fail(
|
|
195
|
+
`Antigravity skill metadata exceeds budget (` +
|
|
196
|
+
`${agMetadataChars} > ${budgets.maxAntigravitySkillMetadataChars} chars)`,
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
119
202
|
function runWorkflowChecks(context) {
|
|
120
203
|
checkRouterBudget(context);
|
|
121
204
|
checkTopLevelRules(context);
|
|
122
205
|
checkMergedSkillReferences(context);
|
|
123
206
|
checkRetiredReferences(context);
|
|
124
207
|
checkVisualCompanionSecurity(context);
|
|
208
|
+
checkResidentContextBudget(context);
|
|
125
209
|
}
|
|
126
210
|
|
|
127
|
-
module.exports = { runWorkflowChecks };
|
|
211
|
+
module.exports = { runWorkflowChecks, checkResidentContextBudget, RESIDENT_CONTEXT_BUDGETS };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: spec-gate
|
|
3
|
-
description: Create and self-review a formal Spec for explicit or costly-to-reverse work; wait for approval.
|
|
3
|
+
description: Create and self-review a formal Spec (/to-spec) for explicit or costly-to-reverse work; wait for approval.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Spec Gate
|
|
@@ -13,6 +13,7 @@ description: Route engineering delivery and explicitly requested engineering wor
|
|
|
13
13
|
- 选最短适用路径,只读当前阶段需要的 Skill,不预加载整条链路;简短说明选择后即执行。
|
|
14
14
|
- 显式请求某一专职能力(如 `grilling`、`feature-acceptance`、`handoff`、`triage`、`prototype`、`improve-codebase-architecture`、`resolving-merge-conflicts`、`test-driven-development`、`code-review`)时,宿主按各 Skill 的 `description` 直接匹配,不再逐条在路由表重复列出。
|
|
15
15
|
- 复杂度本身不触发额外门禁;`handoff`、`triage`、`improve-codebase-architecture` 仅在用户明确请求时使用。
|
|
16
|
+
- 需要多份规则或引用时同一轮并发读取,避免分轮串行拉长冷启动;低风险极小改动(1–2 文件、明确验收且无高风险边界)可直接按 `rules/01-base.md` 与 `rules/common/testing.md` 实施,仍须完成独立审查与验证。
|
|
16
17
|
|
|
17
18
|
## 三条交付通道
|
|
18
19
|
|