claude-everything-workflow 0.2.2 → 0.2.3
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/AGENTS.md +6 -5
- package/CLAUDE.md +1 -5
- package/README.md +57 -27
- package/agents/e2e-runner.md +8 -141
- package/commands/code-review.md +9 -30
- package/commands/pr.md +1 -6
- package/commands/verify.md +7 -11
- package/harness/manifest.json +346 -0
- package/package.json +7 -2
- package/rules/01-base.md +9 -26
- package/rules/02-code-size.md +5 -9
- package/rules/03-architecture.md +8 -22
- package/rules/04-error-handling.md +4 -5
- package/rules/05-git-workflow.md +4 -3
- package/rules/06-comments.md +3 -9
- package/rules/07-forbidden.md +4 -3
- package/rules/common/agent-orchestration.md +1 -3
- package/rules/common/hooks.md +2 -0
- package/rules/common/pr-automation.md +1 -1
- package/rules/common/skills-learning.md +1 -1
- package/rules/common/testing.md +3 -2
- package/scripts/install-rules.js +100 -0
- package/scripts/install.ps1 +27 -3
- package/scripts/install.sh +24 -2
- package/scripts/legacy-common-rule-hashes.json +78 -0
- package/scripts/retired-skill-files.json +17 -0
- package/scripts/upstream-capability-map.json +14 -9
- package/scripts/verify/grilling-spec-gate-checks.js +11 -5
- package/scripts/verify/install-rules.test.js +156 -0
- package/scripts/verify/metadata-checks.js +26 -3
- package/scripts/verify/repository-checks.js +35 -61
- package/scripts/verify/skill-invocation.test.js +86 -0
- package/scripts/verify/skill-manifest-checks.js +197 -0
- package/scripts/verify/skill-manifest-checks.test.js +123 -0
- package/scripts/verify/workflow-checks.js +26 -82
- package/scripts/verify-harness.js +2 -0
- package/scripts/verify-upstream-capability-map.js +2 -1
- package/skills/README.md +9 -10
- package/skills/code-review/SKILL.md +54 -41
- package/skills/codebase-design/SKILL.md +1 -1
- package/skills/continuous-learning-v2/SKILL.md +1 -1
- package/skills/domain-modeling/SKILL.md +3 -2
- package/skills/e2e-testing/SKILL.md +20 -310
- package/skills/e2e-testing/references/playwright-patterns.md +324 -0
- package/skills/feature-acceptance/SKILL.md +1 -1
- package/skills/grilling/SKILL.md +1 -1
- package/skills/handoff/SKILL.md +3 -4
- package/skills/handoff/agents/openai.yaml +2 -0
- package/skills/implement/SKILL.md +32 -81
- package/skills/implement/references/ticket-delivery.md +43 -0
- package/skills/improve-codebase-architecture/SKILL.md +1 -2
- package/skills/improve-codebase-architecture/agents/openai.yaml +2 -0
- package/skills/iterative-retrieval/SKILL.md +1 -1
- package/skills/prototype/SKILL.md +1 -1
- package/skills/resolving-merge-conflicts/SKILL.md +1 -1
- package/skills/spec-gate/SKILL.md +1 -1
- package/skills/subagent-driven-development/SKILL.md +2 -2
- package/skills/systematic-debugging/SKILL.md +9 -3
- package/skills/test-driven-development/SKILL.md +6 -2
- package/skills/to-tickets/SKILL.md +5 -3
- package/skills/triage/SKILL.md +4 -4
- package/skills/triage/agents/openai.yaml +2 -0
- package/skills/using-git-worktrees/SKILL.md +8 -5
- package/skills/using-superpowers/SKILL.md +27 -94
- package/skills/using-superpowers/references/process-outcomes.md +41 -0
- package/skills/verification-before-completion/SKILL.md +5 -4
- package/skills/visual-companion/SKILL.md +1 -1
- package/agents/architect.md +0 -59
- package/agents/code-reviewer.md +0 -28
- package/agents/planner.md +0 -40
- package/agents/tdd-guide.md +0 -101
- package/skills/find-skills/SKILL.md +0 -142
- package/skills/project-context/SKILL.md +0 -94
- package/skills/project-context/agents/openai.yaml +0 -6
- package/skills/project-context/references/project-context-template.md +0 -61
- package/skills/research/SKILL.md +0 -48
- package/skills/wayfinder/SKILL.md +0 -57
|
@@ -15,6 +15,8 @@ let requireTokens;
|
|
|
15
15
|
const PACKAGE_ONLY_PATHS = [
|
|
16
16
|
"scripts/install.sh",
|
|
17
17
|
"scripts/install.ps1",
|
|
18
|
+
"scripts/install-rules.js",
|
|
19
|
+
"scripts/legacy-common-rule-hashes.json",
|
|
18
20
|
"scripts/verify-harness.js",
|
|
19
21
|
"scripts/verify/core.js",
|
|
20
22
|
"scripts/verify/grilling-spec-gate-checks.js",
|
|
@@ -24,6 +26,10 @@ const PACKAGE_ONLY_PATHS = [
|
|
|
24
26
|
"scripts/verify/workflow-checks.js",
|
|
25
27
|
"scripts/verify/workflow-ownership-fixtures.js",
|
|
26
28
|
"scripts/verify/workflow-ownership.js",
|
|
29
|
+
"scripts/verify/skill-manifest-checks.js",
|
|
30
|
+
"scripts/verify/skill-manifest-checks.test.js",
|
|
31
|
+
"scripts/verify/skill-invocation.test.js",
|
|
32
|
+
"scripts/verify/install-rules.test.js",
|
|
27
33
|
];
|
|
28
34
|
|
|
29
35
|
function bindContext(context) {
|
|
@@ -123,6 +129,8 @@ function checkReadmeTreePaths() {
|
|
|
123
129
|
|
|
124
130
|
const pathInTree = stack.join("/").replace(/\\/g, "/");
|
|
125
131
|
if (ignored.has(pathInTree)) continue;
|
|
132
|
+
if (!exists(".git") && !exists(".github") &&
|
|
133
|
+
(pathInTree === ".github" || pathInTree.startsWith(".github/"))) continue;
|
|
126
134
|
|
|
127
135
|
if (!exists(pathInTree)) {
|
|
128
136
|
fail(`README directory tree lists missing path: ${pathInTree}`);
|
|
@@ -157,13 +165,13 @@ function checkPackageOnlyLists(ps, sh) {
|
|
|
157
165
|
|
|
158
166
|
function checkInstallerSurface(ps, sh) {
|
|
159
167
|
const sharedDirs = [
|
|
160
|
-
"rules",
|
|
161
168
|
"agents",
|
|
162
169
|
"commands",
|
|
163
170
|
"scripts",
|
|
164
171
|
"hooks",
|
|
165
172
|
"skills",
|
|
166
173
|
"references",
|
|
174
|
+
"harness",
|
|
167
175
|
];
|
|
168
176
|
for (const dir of sharedDirs) {
|
|
169
177
|
if (!ps.includes(`"${dir}"`)) {
|
|
@@ -173,6 +181,15 @@ function checkInstallerSurface(ps, sh) {
|
|
|
173
181
|
fail(`scripts/install.sh shared dirs should include ${dir}`);
|
|
174
182
|
}
|
|
175
183
|
}
|
|
184
|
+
for (const host of ["claude-code", "codex"]) {
|
|
185
|
+
if (!ps.includes(`Install-WorkflowRules -Destination $dest -HostName "${host}"`) ||
|
|
186
|
+
!sh.includes(`install_workflow_rules ${host} "$dest"`)) {
|
|
187
|
+
fail(`installers must route ${host} rules through the host adapter`);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (sh.includes('copy_dir rules "$dest"') || /\$dirs\s*=\s*@\([^)]*"rules"/s.test(ps)) {
|
|
191
|
+
fail("installers must not copy cold common rules into the shared automatic rules directory");
|
|
192
|
+
}
|
|
176
193
|
if (ps.includes('"homunculus"')) {
|
|
177
194
|
fail("scripts/install.ps1 should not install removed homunculus directory");
|
|
178
195
|
}
|
|
@@ -490,6 +507,13 @@ function checkReleaseRecoveryBehavior() {
|
|
|
490
507
|
}
|
|
491
508
|
|
|
492
509
|
function checkGitHubWorkflows() {
|
|
510
|
+
// npm packages omit repository-only CI files; a checkout must still retain them.
|
|
511
|
+
if (!exists(".github/workflows/ci.yml")) {
|
|
512
|
+
if (exists(".git") || exists(".github")) {
|
|
513
|
+
fail("repository CI is missing: .github/workflows/ci.yml");
|
|
514
|
+
}
|
|
515
|
+
return;
|
|
516
|
+
}
|
|
493
517
|
const ci = read(".github/workflows/ci.yml");
|
|
494
518
|
|
|
495
519
|
requireTokens(".github/workflows/ci.yml", [
|
|
@@ -498,7 +522,7 @@ function checkGitHubWorkflows() {
|
|
|
498
522
|
"npm run verify",
|
|
499
523
|
"npm run pack:dry-run",
|
|
500
524
|
"publish:",
|
|
501
|
-
"needs: verify",
|
|
525
|
+
"needs: [verify, test-macos-installer]",
|
|
502
526
|
"id-token: write",
|
|
503
527
|
"node-version: 22.14.0",
|
|
504
528
|
"package-manager-cache: false",
|
|
@@ -594,7 +618,6 @@ function checkSkillCategoryIndex() {
|
|
|
594
618
|
"Process / 门禁",
|
|
595
619
|
"Engineering / 开发实践",
|
|
596
620
|
"Harness / 上下文与编排",
|
|
597
|
-
"Meta / Skill 管理",
|
|
598
621
|
"Learn / 学习沉淀",
|
|
599
622
|
]);
|
|
600
623
|
|
|
@@ -18,7 +18,6 @@ function checkRouterAndAgentLinks() {
|
|
|
18
18
|
"independent frontier tickets with no overlapping write surface?",
|
|
19
19
|
"skills/subagent-driven-development/SKILL.md",
|
|
20
20
|
"skill discovery or install request?",
|
|
21
|
-
"find-skills",
|
|
22
21
|
"external skill learning or edit?",
|
|
23
22
|
"process skills before implementation skills",
|
|
24
23
|
"skills/grilling/SKILL.md",
|
|
@@ -30,7 +29,6 @@ function checkRouterAndAgentLinks() {
|
|
|
30
29
|
|
|
31
30
|
const expected = [
|
|
32
31
|
["agents/e2e-runner.md", "skills/e2e-testing/SKILL.md"],
|
|
33
|
-
["agents/tdd-guide.md", "skills/test-driven-development/SKILL.md"],
|
|
34
32
|
];
|
|
35
33
|
|
|
36
34
|
for (const [agent, skill] of expected) {
|
|
@@ -41,7 +39,7 @@ function checkRouterAndAgentLinks() {
|
|
|
41
39
|
}
|
|
42
40
|
}
|
|
43
41
|
|
|
44
|
-
for (const agent of ["agents/harness-optimizer.md"
|
|
42
|
+
for (const agent of ["agents/harness-optimizer.md"]) {
|
|
45
43
|
if (!exists(agent)) {
|
|
46
44
|
fail(`${agent} is missing`);
|
|
47
45
|
continue;
|
|
@@ -64,8 +62,6 @@ function checkTicketFirstDelivery() {
|
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
64
|
|
|
67
|
-
requireTokens("agents/planner.md", ["to-tickets", "ticket", "不写文件路径"]);
|
|
68
|
-
|
|
69
65
|
requireTokens("skills/to-tickets/SKILL.md", [
|
|
70
66
|
"tracer bullet",
|
|
71
67
|
"blocking edges",
|
|
@@ -75,12 +71,15 @@ function checkTicketFirstDelivery() {
|
|
|
75
71
|
"Do not publish before approval",
|
|
76
72
|
]);
|
|
77
73
|
requireTokens("skills/implement/SKILL.md", [
|
|
78
|
-
"一个 fresh context",
|
|
79
74
|
"test-driven-development",
|
|
80
|
-
"ticket as the Spec source",
|
|
81
|
-
"`/code-review --worktree <pre-ticket-base> --spec <ticket>`",
|
|
82
75
|
"direct-scope contract",
|
|
83
76
|
"无 ticket 范围不得 claim 或写入任何 tracker",
|
|
77
|
+
"[references/ticket-delivery.md](references/ticket-delivery.md)",
|
|
78
|
+
]);
|
|
79
|
+
requireTokens("skills/implement/references/ticket-delivery.md", [
|
|
80
|
+
"一个 fresh context",
|
|
81
|
+
"ticket as the Spec source",
|
|
82
|
+
"`/code-review --worktree <pre-ticket-base> --spec <ticket>`",
|
|
84
83
|
]);
|
|
85
84
|
requireTokens("skills/subagent-driven-development/SKILL.md", [
|
|
86
85
|
"frontier ticket",
|
|
@@ -221,60 +220,25 @@ function checkCodeReviewContracts() {
|
|
|
221
220
|
"NOT RUN",
|
|
222
221
|
]);
|
|
223
222
|
|
|
224
|
-
requireTokens("agents/code-reviewer.md", [
|
|
225
|
-
"skills/code-review/SKILL.md",
|
|
226
|
-
"## Standards",
|
|
227
|
-
"## Spec",
|
|
228
|
-
"two isolated review contexts",
|
|
229
|
-
]);
|
|
230
|
-
|
|
231
223
|
requireTokens("README.md", [
|
|
232
|
-
"
|
|
224
|
+
"固定基点下按风险选择自审、独立或双轴审查",
|
|
233
225
|
]);
|
|
234
226
|
|
|
235
|
-
requireTokens("skills/implement/
|
|
227
|
+
requireTokens("skills/implement/references/ticket-delivery.md", [
|
|
236
228
|
"pre-ticket base",
|
|
237
229
|
"ticket as the Spec source",
|
|
238
230
|
]);
|
|
239
231
|
}
|
|
240
232
|
|
|
241
233
|
function checkProjectContextContracts() {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
"
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
]);
|
|
251
|
-
requireTokens("skills/project-context/references/project-context-template.md", [
|
|
252
|
-
"`bug`",
|
|
253
|
-
"`enhancement`",
|
|
254
|
-
"Claim",
|
|
255
|
-
"Progress",
|
|
256
|
-
"Resolve",
|
|
257
|
-
]);
|
|
258
|
-
|
|
259
|
-
requireTokens("skills/project-context/agents/openai.yaml", [
|
|
260
|
-
"display_name",
|
|
261
|
-
"default_prompt",
|
|
262
|
-
"allow_implicit_invocation: false",
|
|
263
|
-
]);
|
|
264
|
-
|
|
265
|
-
requireTokens("skills/domain-modeling/SKILL.md", [
|
|
266
|
-
"docs/agent-workflow/project-context.md",
|
|
267
|
-
]);
|
|
268
|
-
|
|
269
|
-
requireTokens("skills/using-superpowers/SKILL.md", [
|
|
270
|
-
"explicit project-context setup request?",
|
|
271
|
-
"project-context",
|
|
272
|
-
]);
|
|
273
|
-
|
|
274
|
-
requireTokens("README.md", [
|
|
275
|
-
"直接请求配置 project context",
|
|
276
|
-
"project-context",
|
|
277
|
-
]);
|
|
234
|
+
for (const name of ["find-skills", "project-context"]) {
|
|
235
|
+
if (exists(`skills/${name}/SKILL.md`)) fail(`${name} Skill must be retired`);
|
|
236
|
+
}
|
|
237
|
+
for (const file of ["skills/to-tickets/SKILL.md", "skills/triage/SKILL.md", "skills/domain-modeling/SKILL.md"]) {
|
|
238
|
+
requireTokens(file, ["docs/agent-workflow/project-context.md"]);
|
|
239
|
+
}
|
|
240
|
+
requireTokens("skills/to-tickets/SKILL.md", ["does not block drafting", "Before publication"]);
|
|
241
|
+
requireTokens("skills/triage/SKILL.md", ["does not block read-only assessment", "before external changes"]);
|
|
278
242
|
}
|
|
279
243
|
|
|
280
244
|
function checkTrackerDeliveryLifecycle() {
|
|
@@ -283,13 +247,21 @@ function checkTrackerDeliveryLifecycle() {
|
|
|
283
247
|
"[RESOLVE → REFRESH_FRONTIER] → FINISH_DELIVERY";
|
|
284
248
|
|
|
285
249
|
requireTokens("skills/implement/SKILL.md", [
|
|
250
|
+
"rules/05-git-workflow.md",
|
|
251
|
+
"skills/using-git-worktrees/SKILL.md",
|
|
252
|
+
"clean baseline",
|
|
253
|
+
"pre-delivery base",
|
|
254
|
+
"不覆盖 commit、push 或创建 PR",
|
|
255
|
+
"无 ticket 范围不得 claim 或写入任何 tracker",
|
|
256
|
+
]);
|
|
257
|
+
requireTokens("rules/05-git-workflow.md", [
|
|
258
|
+
"开发新功能必须使用独立 `git worktree` 和任务分支",
|
|
259
|
+
"单文件新功能也不例外",
|
|
260
|
+
]);
|
|
261
|
+
requireTokens("skills/implement/references/ticket-delivery.md", [
|
|
286
262
|
"## State Machine",
|
|
287
263
|
deliveryLifecycle,
|
|
288
|
-
"无 ticket 的 direct scope 或 approved Spec scope 跳过 CLAIM、RESOLVE",
|
|
289
264
|
"docs/agent-workflow/project-context.md",
|
|
290
|
-
"skills/using-git-worktrees/SKILL.md",
|
|
291
|
-
"除只读分析和单文件修改外,所有代码、配置、Harness 改动必须先创建独立" +
|
|
292
|
-
" `git worktree` 和任务分支",
|
|
293
265
|
"clean baseline",
|
|
294
266
|
"pre-ticket base",
|
|
295
267
|
"一个 fresh context",
|
|
@@ -305,13 +277,11 @@ function checkTrackerDeliveryLifecycle() {
|
|
|
305
277
|
"frontier 为空但仍有 open tickets",
|
|
306
278
|
"BLOCKED_GRAPH",
|
|
307
279
|
"open ticket count = 0",
|
|
308
|
-
"
|
|
280
|
+
"全分支相称 review",
|
|
309
281
|
"`/verify pre-pr`",
|
|
310
282
|
"`/pr` 或 keep",
|
|
311
283
|
"可重新选择串行 `implement` 或安全 SDD",
|
|
312
|
-
"不覆盖 commit、push 或创建 PR",
|
|
313
284
|
"不得自动关闭外部 Issue",
|
|
314
|
-
"无 ticket 范围不得 claim 或写入任何 tracker",
|
|
315
285
|
]);
|
|
316
286
|
|
|
317
287
|
requireTokens("commands/pr.md", [
|
|
@@ -324,7 +294,8 @@ function checkExecutionSupportSkills() {
|
|
|
324
294
|
requireTokens("skills/using-git-worktrees/SKILL.md", [
|
|
325
295
|
"git worktree add",
|
|
326
296
|
"git worktree remove",
|
|
327
|
-
"
|
|
297
|
+
"rules/05-git-workflow.md",
|
|
298
|
+
"including a single-file feature",
|
|
328
299
|
]);
|
|
329
300
|
|
|
330
301
|
requireTokens("skills/verification-before-completion/SKILL.md", [
|
|
@@ -395,6 +366,9 @@ function checkRuleLoadingPolicy() {
|
|
|
395
366
|
if (!agentsBody.includes("~/.claude/rules/")) {
|
|
396
367
|
fail("AGENTS.md should mention Claude Code user-level rules fallback");
|
|
397
368
|
}
|
|
369
|
+
if (!agentsBody.includes("~/.claude/references/rules/common/")) {
|
|
370
|
+
fail("AGENTS.md should resolve Claude common rules from the cold reference directory");
|
|
371
|
+
}
|
|
398
372
|
if (!agentsBody.includes("不能把项目规则目录缺失等同于") || !agentsBody.includes("无规则")) {
|
|
399
373
|
fail("AGENTS.md should forbid treating a missing project rules directory as no rules");
|
|
400
374
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const assert = require("node:assert/strict");
|
|
4
|
+
const { validateManifest, validateNativeRoutes } = require("./skill-manifest-checks");
|
|
5
|
+
|
|
6
|
+
function validate(compatibility, invocation, claudeFlag, policy) {
|
|
7
|
+
const skillPath = "skills/demo/SKILL.md";
|
|
8
|
+
const policyPath = "skills/demo/agents/openai.yaml";
|
|
9
|
+
const body = "---\nname: demo\ndescription: Invocation fixture\n" +
|
|
10
|
+
(typeof claudeFlag === "string" ? claudeFlag : claudeFlag ? "disable-model-invocation: true\n" : "") + "---\n";
|
|
11
|
+
return validateManifest({
|
|
12
|
+
schemaVersion: 1,
|
|
13
|
+
skills: [{ name: "demo", path: skillPath, owner: skillPath, version: "0.1.0",
|
|
14
|
+
compatibility, allowedTools: null, invocation }],
|
|
15
|
+
ownership: [],
|
|
16
|
+
}, {
|
|
17
|
+
exists: (file) => file === skillPath || (file === policyPath && policy !== undefined),
|
|
18
|
+
read: (file) => file === skillPath ? body : policy,
|
|
19
|
+
skillPaths: [skillPath],
|
|
20
|
+
}).join("\n");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const both = ["claude-code", "codex"];
|
|
24
|
+
const disabledPolicy = "policy:\n allow_implicit_invocation: false\n";
|
|
25
|
+
assert.match(validate(both, "explicit-only", true), /codex.*disable implicit invocation/i);
|
|
26
|
+
assert.match(validate(both, "explicit-only", false, disabledPolicy), /claude-code.*disable implicit invocation/i);
|
|
27
|
+
assert.equal(validate(both, "explicit-only", true, disabledPolicy), "");
|
|
28
|
+
assert.equal(validate(["claude-code"], "explicit-only", true), "");
|
|
29
|
+
assert.equal(validate(["codex"], "explicit-only", false, disabledPolicy), "");
|
|
30
|
+
assert.match(validate(["codex"], "explicit-only", false,
|
|
31
|
+
"interface:\n allow_implicit_invocation: false\n"), /codex.*disable implicit invocation/i);
|
|
32
|
+
assert.match(validate(both, "implicit", true), /conflicts with frontmatter/);
|
|
33
|
+
assert.match(validate(both, "implicit", false, disabledPolicy), /conflicts with policy/);
|
|
34
|
+
assert.equal(validate(both, "implicit", false), "");
|
|
35
|
+
assert.equal(validate(both, "explicit-only", true, disabledPolicy.replace(/\n/g, "\r\n")), "");
|
|
36
|
+
for (const policy of [
|
|
37
|
+
"policy: # native invocation policy\n allow_implicit_invocation: false\n",
|
|
38
|
+
"policy:\n allow_implicit_invocation: false\n",
|
|
39
|
+
"policy:\n\n # invocation gate\n allow_implicit_invocation: false\n",
|
|
40
|
+
"policy: { allow_implicit_invocation: false }\n",
|
|
41
|
+
"'policy':\n 'allow_implicit_invocation': false\n",
|
|
42
|
+
]) {
|
|
43
|
+
assert.match(validate(both, "implicit", false, policy), /conflicts with policy/);
|
|
44
|
+
assert.equal(validate(both, "explicit-only", true, policy), "");
|
|
45
|
+
}
|
|
46
|
+
for (const policy of [
|
|
47
|
+
"policy:\n allow_implicit_invocation: 'false'\n",
|
|
48
|
+
"policy:\n allow_implicit_invocation: false\n allow_implicit_invocation: true\n",
|
|
49
|
+
"policy: [\n",
|
|
50
|
+
]) {
|
|
51
|
+
assert.match(validate(both, "implicit", false, policy), /invalid.*yaml|must be.*boolean/i);
|
|
52
|
+
}
|
|
53
|
+
assert.equal(validate(both, "implicit", false,
|
|
54
|
+
"policy:\n nested:\n allow_implicit_invocation: false\n"), "");
|
|
55
|
+
for (const flag of [
|
|
56
|
+
"disable-model-invocation: true # user-only\n",
|
|
57
|
+
"'disable-model-invocation': true\n",
|
|
58
|
+
]) {
|
|
59
|
+
assert.match(validate(both, "implicit", flag), /conflicts with frontmatter/);
|
|
60
|
+
assert.equal(validate(both, "explicit-only", flag, disabledPolicy), "");
|
|
61
|
+
}
|
|
62
|
+
assert.match(validate(both, "implicit", "disable-model-invocation: 'true'\n"), /must be.*boolean/);
|
|
63
|
+
const routes = { skills: [{ name: "handoff", path: "skills/handoff/SKILL.md", invocation: "explicit-only" }] };
|
|
64
|
+
assert.match(validateNativeRoutes(routes, " -> fresh session? -> skills/handoff/SKILL.md\n").join("\n"), /native-entry/);
|
|
65
|
+
assert.match(validateNativeRoutes(routes, " -> fresh session? -> handoff\n").join("\n"), /native-entry/);
|
|
66
|
+
assert.deepEqual(validateNativeRoutes(routes, " -> fresh session? -> native-entry skills/handoff/SKILL.md\n"), []);
|
|
67
|
+
assert.deepEqual(validateNativeRoutes(routes, " -> delivery -> skills/implement/SKILL.md\n"), []);
|
|
68
|
+
// Natural-language requests must remain selectable on both hosts after an upgrade.
|
|
69
|
+
const fs = require("node:fs");
|
|
70
|
+
const path = require("node:path");
|
|
71
|
+
const YAML = require("yaml");
|
|
72
|
+
const root = path.resolve(__dirname, "../..");
|
|
73
|
+
const manifest = require("../../harness/manifest.json");
|
|
74
|
+
for (const name of ["handoff", "improve-codebase-architecture", "triage"]) {
|
|
75
|
+
const entry = manifest.skills.find((skill) => skill.name === name);
|
|
76
|
+
assert.equal(entry?.invocation, "implicit", name);
|
|
77
|
+
const body = fs.readFileSync(path.join(root, entry.path), "utf8");
|
|
78
|
+
const frontmatter = YAML.parse(body.match(/^---\r?\n([\s\S]*?)\r?\n---/)[1]);
|
|
79
|
+
assert.notEqual(frontmatter["disable-model-invocation"], true, name);
|
|
80
|
+
const policy = YAML.parse(fs.readFileSync(path.join(root, "skills", name, "agents/openai.yaml"), "utf8"));
|
|
81
|
+
assert.equal(policy.policy.allow_implicit_invocation, true, name);
|
|
82
|
+
}
|
|
83
|
+
for (const name of ["research", "wayfinder", "find-skills", "project-context"]) {
|
|
84
|
+
assert.equal(manifest.skills.some((skill) => skill.name === name), false);
|
|
85
|
+
}
|
|
86
|
+
console.log("Skill invocation tests passed (33 host-gate scenarios, three natural-language entries, four retired skills).");
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const YAML = require("yaml");
|
|
6
|
+
|
|
7
|
+
const MANIFEST_PATH = "harness/manifest.json";
|
|
8
|
+
const MAX_SKILL_LINES = 500;
|
|
9
|
+
const MAX_SKILL_TOKENS = 5000;
|
|
10
|
+
const MAX_DESCRIPTION_CHARS = 128;
|
|
11
|
+
const NAME_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
12
|
+
const VERSION_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
13
|
+
const COMPATIBILITIES = new Set(["claude-code", "codex"]);
|
|
14
|
+
|
|
15
|
+
function isSafeRelativePath(value) {
|
|
16
|
+
return typeof value === "string" && value.length > 0 &&
|
|
17
|
+
!path.isAbsolute(value) && !/^[A-Za-z]:[\\/]/.test(value) &&
|
|
18
|
+
!value.split(/[\\/]/).includes("..");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function parseFrontmatter(body) {
|
|
22
|
+
const match = body.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
23
|
+
if (!match) return null;
|
|
24
|
+
return parseMapping(match[1]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function parseMapping(body) {
|
|
28
|
+
const value = YAML.parse(body);
|
|
29
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
30
|
+
throw new Error("metadata must be a YAML mapping");
|
|
31
|
+
}
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function validateManifest(manifest, { exists, skillPaths, read = () => "" }) {
|
|
36
|
+
const errors = [];
|
|
37
|
+
if (!manifest || manifest.schemaVersion !== 1) errors.push("manifest schemaVersion must be 1");
|
|
38
|
+
if (!Array.isArray(manifest?.skills)) errors.push("manifest skills must be an array");
|
|
39
|
+
if (!Array.isArray(manifest?.ownership)) errors.push("manifest ownership must be an array");
|
|
40
|
+
if (!Array.isArray(manifest?.skills) || !Array.isArray(manifest?.ownership)) return errors;
|
|
41
|
+
|
|
42
|
+
const declaredPaths = new Set();
|
|
43
|
+
const declaredNames = new Set();
|
|
44
|
+
const skillOwners = new Set();
|
|
45
|
+
for (const skill of manifest.skills) {
|
|
46
|
+
if (!skill || typeof skill !== "object") {
|
|
47
|
+
errors.push("skill entry must be an object");
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
for (const key of ["name", "path", "owner", "version", "compatibility", "allowedTools", "invocation"]) {
|
|
51
|
+
if (!(key in skill)) errors.push(`skill ${skill.name || "<unknown>"} missing ${key}`);
|
|
52
|
+
}
|
|
53
|
+
if (!NAME_PATTERN.test(skill.name || "")) errors.push(`invalid skill name: ${skill.name || "<empty>"}`);
|
|
54
|
+
if (declaredNames.has(skill.name)) errors.push(`duplicate skill name: ${skill.name}`);
|
|
55
|
+
declaredNames.add(skill.name);
|
|
56
|
+
if (declaredPaths.has(skill.path)) errors.push(`duplicate skill path: ${skill.path}`);
|
|
57
|
+
declaredPaths.add(skill.path);
|
|
58
|
+
if (skillOwners.has(skill.owner)) errors.push(`duplicate skill owner: ${skill.owner}`);
|
|
59
|
+
skillOwners.add(skill.owner);
|
|
60
|
+
const safeSkillPath = isSafeRelativePath(skill.path);
|
|
61
|
+
const safeOwnerPath = isSafeRelativePath(skill.owner);
|
|
62
|
+
if (!safeSkillPath) errors.push(`unsafe skill path: ${skill.name}`);
|
|
63
|
+
if (!safeOwnerPath) errors.push(`unsafe skill owner: ${skill.name}`);
|
|
64
|
+
const skillPathExists = safeSkillPath && exists(skill.path);
|
|
65
|
+
const ownerPathExists = safeOwnerPath && exists(skill.owner);
|
|
66
|
+
if (!skillPaths.includes(skill.path)) errors.push(`manifest skill path is not a Skill: ${skill.path}`);
|
|
67
|
+
if (!skillPathExists) errors.push(`skill path does not exist: ${skill.path}`);
|
|
68
|
+
if (!ownerPathExists) errors.push(`owner path does not exist: ${skill.owner}`);
|
|
69
|
+
if (skill.owner !== skill.path) errors.push(`skill owner must equal Skill path: ${skill.name}`);
|
|
70
|
+
if (!VERSION_PATTERN.test(skill.version || "")) errors.push(`invalid skill version for ${skill.name}: ${skill.version}`);
|
|
71
|
+
if (!Array.isArray(skill.compatibility) || skill.compatibility.length === 0 || new Set(skill.compatibility).size !== skill.compatibility.length || skill.compatibility.some((item) => !COMPATIBILITIES.has(item))) errors.push(`invalid skill compatibility: ${skill.name}`);
|
|
72
|
+
if (!(["implicit", "explicit-only"].includes(skill.invocation))) errors.push(`invalid invocation for ${skill.name}: ${skill.invocation}`);
|
|
73
|
+
if (skill.allowedTools !== null && (!Array.isArray(skill.allowedTools) || skill.allowedTools.some((item) => typeof item !== "string"))) errors.push(`allowedTools must be null or an array of strings: ${skill.name}`);
|
|
74
|
+
if (skillPathExists) {
|
|
75
|
+
const body = read(skill.path);
|
|
76
|
+
let frontmatter;
|
|
77
|
+
try {
|
|
78
|
+
frontmatter = parseFrontmatter(body);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
errors.push(`invalid frontmatter YAML: ${skill.path}: ${error.message}`);
|
|
81
|
+
}
|
|
82
|
+
if (!frontmatter) errors.push(`Skill is missing frontmatter: ${skill.path}`);
|
|
83
|
+
else if (frontmatter.name !== skill.name) errors.push(`manifest name does not match frontmatter: ${skill.path}`);
|
|
84
|
+
const description = String(frontmatter?.description || "").trim();
|
|
85
|
+
if (frontmatter && !description) errors.push(`Skill description is empty: ${skill.path}`);
|
|
86
|
+
if (description.length > MAX_DESCRIPTION_CHARS) errors.push(`Skill description exceeds ${MAX_DESCRIPTION_CHARS} characters: ${skill.path}`);
|
|
87
|
+
if (frontmatter?.version && frontmatter.version !== skill.version) errors.push(`manifest version does not match frontmatter: ${skill.path}`);
|
|
88
|
+
const skillDir = path.posix.dirname(skill.path);
|
|
89
|
+
const policyPath = `${skillDir}/agents/openai.yaml`;
|
|
90
|
+
let disallowsImplicit = false;
|
|
91
|
+
const claudeFlag = frontmatter?.["disable-model-invocation"];
|
|
92
|
+
if (claudeFlag !== undefined && typeof claudeFlag !== "boolean") {
|
|
93
|
+
errors.push(`disable-model-invocation must be a boolean: ${skill.path}`);
|
|
94
|
+
}
|
|
95
|
+
const frontmatterDisablesImplicit = claudeFlag === true;
|
|
96
|
+
if (exists(policyPath)) {
|
|
97
|
+
try {
|
|
98
|
+
const policy = parseMapping(read(policyPath)).policy;
|
|
99
|
+
if (policy != null && (typeof policy !== "object" || Array.isArray(policy))) {
|
|
100
|
+
throw new Error("policy must be a YAML mapping");
|
|
101
|
+
}
|
|
102
|
+
const codexFlag = policy?.allow_implicit_invocation;
|
|
103
|
+
if (codexFlag !== undefined && typeof codexFlag !== "boolean") {
|
|
104
|
+
errors.push(`allow_implicit_invocation must be a boolean: ${policyPath}`);
|
|
105
|
+
}
|
|
106
|
+
disallowsImplicit = codexFlag === false;
|
|
107
|
+
} catch (error) {
|
|
108
|
+
errors.push(`invalid policy YAML: ${policyPath}: ${error.message}`);
|
|
109
|
+
}
|
|
110
|
+
if (disallowsImplicit && skill.invocation !== "explicit-only") errors.push(`manifest invocation conflicts with policy: ${skill.name}`);
|
|
111
|
+
}
|
|
112
|
+
if (frontmatterDisablesImplicit && skill.invocation !== "explicit-only") {
|
|
113
|
+
errors.push(`manifest invocation conflicts with frontmatter: ${skill.name}`);
|
|
114
|
+
}
|
|
115
|
+
if (skill.invocation === "explicit-only") {
|
|
116
|
+
const hosts = Array.isArray(skill.compatibility) ? skill.compatibility : [];
|
|
117
|
+
if (hosts.includes("claude-code") && !frontmatterDisablesImplicit) {
|
|
118
|
+
errors.push(`claude-code explicit-only Skill must disable implicit invocation in frontmatter: ${skill.path}`);
|
|
119
|
+
}
|
|
120
|
+
if (hosts.includes("codex") && !disallowsImplicit) {
|
|
121
|
+
errors.push(`codex explicit-only Skill must disable implicit invocation in agents/openai.yaml policy: ${skill.path}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const lineCount = body.split(/\r?\n/).length - (body.endsWith("\n") ? 1 : 0);
|
|
125
|
+
const tokenCount = Math.ceil(body.length / 4);
|
|
126
|
+
if (lineCount > MAX_SKILL_LINES) errors.push(`Skill exceeds ${MAX_SKILL_LINES} lines: ${skill.path} (${lineCount})`);
|
|
127
|
+
if (tokenCount > MAX_SKILL_TOKENS) errors.push(`Skill exceeds approximately ${MAX_SKILL_TOKENS} tokens: ${skill.path} (${tokenCount})`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const actualSkillPaths = new Set(skillPaths);
|
|
132
|
+
for (const skillPath of actualSkillPaths) if (!declaredPaths.has(skillPath)) errors.push(`Skill is missing from manifest: ${skillPath}`);
|
|
133
|
+
for (const skillPath of declaredPaths) if (!actualSkillPaths.has(skillPath)) errors.push(`manifest lists missing Skill: ${skillPath}`);
|
|
134
|
+
|
|
135
|
+
const ids = new Set();
|
|
136
|
+
const responsibilityOwners = new Set();
|
|
137
|
+
for (const entry of manifest.ownership) {
|
|
138
|
+
if (!entry || typeof entry !== "object") {
|
|
139
|
+
errors.push("ownership entry must be an object");
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
for (const key of ["id", "owner", "surfaces", "enforcement"]) {
|
|
143
|
+
if (!(key in entry)) errors.push(`ownership entry ${entry.id || "<unknown>"} missing ${key}`);
|
|
144
|
+
}
|
|
145
|
+
if (ids.has(entry.id)) errors.push(`duplicate ownership id: ${entry.id}`);
|
|
146
|
+
ids.add(entry.id);
|
|
147
|
+
if (responsibilityOwners.has(entry.owner)) errors.push(`duplicate responsibility owner: ${entry.owner}`);
|
|
148
|
+
responsibilityOwners.add(entry.owner);
|
|
149
|
+
if (!NAME_PATTERN.test(entry.id || "")) errors.push(`invalid ownership id: ${entry.id || "<empty>"}`);
|
|
150
|
+
const safeOwnerPath = isSafeRelativePath(entry.owner);
|
|
151
|
+
if (!safeOwnerPath) errors.push(`unsafe ownership owner: ${entry.id}`);
|
|
152
|
+
const ownerPathExists = safeOwnerPath && exists(entry.owner);
|
|
153
|
+
if (!ownerPathExists) errors.push(`owner path does not exist: ${entry.owner}`);
|
|
154
|
+
if (!declaredPaths.has(entry.owner)) errors.push(`ownership owner must be a registered Skill: ${entry.id} -> ${entry.owner}`);
|
|
155
|
+
if (!Array.isArray(entry.surfaces) || entry.surfaces.length === 0) errors.push(`ownership surfaces must be non-empty: ${entry.id}`);
|
|
156
|
+
for (const surface of entry.surfaces || []) {
|
|
157
|
+
if (!isSafeRelativePath(surface)) errors.push(`unsafe ownership surface: ${entry.id} -> ${surface}`);
|
|
158
|
+
else if (!exists(surface)) errors.push(`ownership surface does not exist: ${entry.id} -> ${surface}`);
|
|
159
|
+
}
|
|
160
|
+
if (!["advisory", "blocking"].includes(entry.enforcement)) errors.push(`invalid enforcement for ${entry.id}: ${entry.enforcement}`);
|
|
161
|
+
}
|
|
162
|
+
return errors;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function runSkillManifestChecks(context) {
|
|
166
|
+
const { exists, read, rel, fail } = context;
|
|
167
|
+
if (!exists(MANIFEST_PATH)) return fail(`${MANIFEST_PATH} is missing`);
|
|
168
|
+
let manifest;
|
|
169
|
+
try {
|
|
170
|
+
manifest = JSON.parse(read(MANIFEST_PATH));
|
|
171
|
+
} catch (error) {
|
|
172
|
+
return fail(`${MANIFEST_PATH} is invalid JSON: ${error.message}`);
|
|
173
|
+
}
|
|
174
|
+
const skillPaths = context.walk("skills").filter((file) => file.endsWith("/SKILL.md"));
|
|
175
|
+
const errors = validateManifest(manifest, {
|
|
176
|
+
exists,
|
|
177
|
+
read,
|
|
178
|
+
skillPaths,
|
|
179
|
+
});
|
|
180
|
+
const router = "skills/using-superpowers/SKILL.md";
|
|
181
|
+
if (exists(router)) errors.push(...validateNativeRoutes(manifest, read(router)));
|
|
182
|
+
for (const error of errors) fail(error);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function validateNativeRoutes(manifest, routerBody) {
|
|
186
|
+
const errors = [];
|
|
187
|
+
const skills = Array.isArray(manifest?.skills) ? manifest.skills : [];
|
|
188
|
+
for (const match of routerBody.matchAll(/->\s*(native-entry\s+)?(skills\/[a-z0-9-]+\/SKILL\.md|[a-z0-9-]+)[ \t]*\r?$/gm)) {
|
|
189
|
+
const skill = skills.find((entry) => entry?.path === match[2] || entry?.name === match[2]);
|
|
190
|
+
if (skill?.invocation === "explicit-only" && !match[1]) {
|
|
191
|
+
errors.push(`router must use native-entry for explicit-only Skill: ${skill.name}`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return errors;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
module.exports = { MANIFEST_PATH, parseFrontmatter, validateManifest, validateNativeRoutes, runSkillManifestChecks };
|