claude-everything-workflow 0.1.9 → 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 +20 -20
- package/CLAUDE.md +1 -5
- package/README.md +151 -113
- package/agents/e2e-runner.md +8 -141
- package/agents/harness-optimizer.md +3 -2
- package/commands/code-review.md +10 -15
- package/commands/learn.md +97 -0
- package/commands/pr.md +5 -6
- package/commands/to-spec.md +11 -0
- package/commands/verify.md +7 -11
- package/harness/manifest.json +346 -0
- package/hooks/check-code-size.js +33 -12
- package/hooks/check-console-log.js +72 -24
- package/package.json +10 -2
- package/rules/01-base.md +9 -49
- package/rules/02-code-size.md +5 -20
- package/rules/03-architecture.md +9 -61
- package/rules/04-error-handling.md +4 -26
- package/rules/05-git-workflow.md +12 -39
- package/rules/06-comments.md +3 -43
- package/rules/07-forbidden.md +8 -31
- package/rules/08-specialty-rules-index.md +18 -0
- package/rules/09-first-principles-adversarial-testing.md +6 -18
- package/rules/common/agent-orchestration.md +8 -47
- package/rules/common/context-hygiene.md +9 -72
- package/rules/common/harness-engineering.md +11 -38
- package/rules/common/hooks.md +13 -82
- package/rules/common/performance.md +8 -71
- package/rules/common/pr-automation.md +7 -68
- package/rules/common/skills-learning.md +12 -36
- package/rules/common/testing.md +16 -59
- package/scripts/cleanup-retired-skills.js +214 -0
- package/scripts/install-rules.js +100 -0
- package/scripts/install.ps1 +99 -87
- package/scripts/install.sh +77 -78
- package/scripts/learning/review-confidence.js +1 -4
- package/scripts/legacy-common-rule-hashes.json +78 -0
- package/scripts/merge-claude-settings.cjs +75 -0
- package/scripts/retired-skill-files.json +54 -0
- package/scripts/upstream-capability-baseline.json +27 -0
- package/scripts/upstream-capability-map.json +155 -0
- package/scripts/verify/core.js +91 -0
- package/scripts/verify/grilling-spec-gate-checks.js +266 -0
- package/scripts/verify/install-rules.test.js +156 -0
- package/scripts/verify/metadata-checks.js +747 -0
- package/scripts/verify/repository-checks.js +409 -0
- package/scripts/verify/runtime-checks.js +593 -0
- 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 +685 -0
- package/scripts/verify/workflow-ownership-fixtures.js +371 -0
- package/scripts/verify/workflow-ownership.js +780 -0
- package/scripts/verify-harness.js +18 -1075
- package/scripts/verify-upstream-capability-map.js +118 -0
- package/skills/README.md +28 -16
- package/skills/code-review/SKILL.md +63 -0
- package/skills/code-review/references/spec-reviewer-prompt.md +24 -0
- package/skills/code-review/references/standards-reviewer-prompt.md +35 -0
- package/skills/codebase-design/SKILL.md +63 -0
- package/skills/codebase-design/references/deepening.md +27 -0
- package/skills/codebase-design/references/design-it-twice.md +17 -0
- package/skills/continuous-learning-v2/SKILL.md +8 -8
- package/skills/continuous-learning-v2/config.json +0 -4
- package/skills/domain-modeling/SKILL.md +101 -0
- package/skills/e2e-testing/SKILL.md +20 -310
- package/skills/e2e-testing/references/playwright-patterns.md +324 -0
- package/skills/feature-acceptance/SKILL.md +89 -0
- package/skills/grilling/SKILL.md +83 -0
- package/skills/handoff/SKILL.md +55 -0
- package/skills/handoff/agents/openai.yaml +2 -0
- package/skills/implement/SKILL.md +48 -0
- package/skills/implement/references/ticket-delivery.md +43 -0
- package/skills/improve-codebase-architecture/SKILL.md +47 -0
- package/skills/improve-codebase-architecture/agents/openai.yaml +2 -0
- package/skills/iterative-retrieval/SKILL.md +10 -1
- package/skills/learn/README.md +2 -2
- package/skills/prototype/SKILL.md +50 -0
- package/skills/prototype/references/logic.md +28 -0
- package/skills/prototype/references/ui.md +30 -0
- package/skills/resolving-merge-conflicts/SKILL.md +27 -0
- package/skills/spec-gate/SKILL.md +149 -0
- package/skills/spec-gate/agents/openai.yaml +4 -0
- package/skills/spec-gate/references/spec-document-reviewer-prompt.md +31 -0
- package/skills/subagent-driven-development/SKILL.md +95 -414
- package/skills/systematic-debugging/SKILL.md +11 -49
- package/skills/systematic-debugging/references/diagnosing-bugs.upstream.md +129 -0
- package/skills/systematic-debugging/scripts/hitl-loop.template.js +75 -0
- package/skills/systematic-debugging/scripts/hitl-loop.template.sh +41 -0
- package/skills/test-driven-development/SKILL.md +24 -4
- package/skills/to-tickets/SKILL.md +96 -0
- package/skills/triage/SKILL.md +53 -0
- package/skills/triage/agents/openai.yaml +2 -0
- package/skills/triage/references/agent-brief.md +32 -0
- package/skills/triage/references/out-of-scope.md +14 -0
- package/skills/using-git-worktrees/SKILL.md +8 -5
- package/skills/using-superpowers/SKILL.md +76 -43
- 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 +62 -0
- package/skills/visual-companion/agents/openai.yaml +4 -0
- package/skills/{brainstorming/visual-companion.md → visual-companion/references/guide.md} +1 -1
- package/skills/{brainstorming → visual-companion}/scripts/frame-template.html +42 -12
- package/skills/visual-companion/scripts/pages.cjs +28 -0
- package/skills/visual-companion/scripts/server-utils.cjs +82 -0
- package/skills/{brainstorming → visual-companion}/scripts/server.cjs +108 -248
- package/skills/{brainstorming → visual-companion}/scripts/start-server.sh +18 -4
- package/skills/visual-companion/scripts/websocket.cjs +86 -0
- package/agents/architect.md +0 -59
- package/agents/code-reviewer.md +0 -57
- package/agents/planner.md +0 -124
- package/agents/tdd-guide.md +0 -101
- package/commands/e2e.md +0 -28
- package/commands/evolve.md +0 -42
- package/commands/harness-audit.md +0 -27
- package/commands/instinct-status.md +0 -38
- package/commands/learn-eval.md +0 -91
- package/commands/projects.md +0 -27
- package/commands/promote.md +0 -29
- package/commands/prune.md +0 -46
- package/commands/tdd.md +0 -27
- package/homunculus/instincts/personal/always-test-first.md +0 -28
- package/homunculus/instincts/personal/pr-ci-quality-gate.md +0 -30
- package/rules/08-ecc-integration.md +0 -46
- package/rules/common/implementation.md +0 -25
- package/rules/common/security.md +0 -19
- package/skills/brainstorming/SKILL.md +0 -185
- package/skills/brainstorming/agents/openai.yaml +0 -3
- package/skills/brainstorming/spec-document-reviewer-prompt.md +0 -49
- package/skills/context-budget/SKILL.md +0 -59
- package/skills/discover-unknowns-zh/SKILL.md +0 -112
- package/skills/discover-unknowns-zh/agents/openai.yaml +0 -4
- package/skills/discover-unknowns-zh/references/prompt-patterns.md +0 -144
- package/skills/documentation-lookup/SKILL.md +0 -90
- package/skills/executing-plans/SKILL.md +0 -66
- package/skills/find-skills/SKILL.md +0 -142
- package/skills/skill-creator/LICENSE.txt +0 -202
- package/skills/skill-creator/SKILL.md +0 -356
- package/skills/skill-creator/references/output-patterns.md +0 -82
- package/skills/skill-creator/references/workflows.md +0 -28
- package/skills/skill-creator/scripts/init_skill.py +0 -303
- package/skills/skill-creator/scripts/package_skill.py +0 -110
- package/skills/skill-creator/scripts/quick_validate.py +0 -95
- package/skills/subagent-driven-development/implementer-prompt.md +0 -139
- package/skills/subagent-driven-development/scripts/review-package +0 -44
- package/skills/subagent-driven-development/scripts/sdd-workspace +0 -22
- package/skills/subagent-driven-development/scripts/task-brief +0 -40
- package/skills/subagent-driven-development/task-reviewer-prompt.md +0 -188
- package/skills/writing-plans/SKILL.md +0 -206
- package/skills/writing-plans/plan-document-reviewer-prompt.md +0 -49
- /package/skills/{brainstorming → visual-companion}/scripts/helper.js +0 -0
- /package/skills/{brainstorming → visual-companion}/scripts/stop-server.sh +0 -0
|
@@ -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 };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const assert = require("assert");
|
|
4
|
+
const { validateManifest } = require("./skill-manifest-checks");
|
|
5
|
+
|
|
6
|
+
function run() {
|
|
7
|
+
const valid = {
|
|
8
|
+
schemaVersion: 1,
|
|
9
|
+
skills: [
|
|
10
|
+
{
|
|
11
|
+
name: "demo-skill",
|
|
12
|
+
path: "skills/demo-skill/SKILL.md",
|
|
13
|
+
owner: "skills/demo-skill/SKILL.md",
|
|
14
|
+
version: "0.1.0",
|
|
15
|
+
compatibility: ["claude-code", "codex"],
|
|
16
|
+
allowedTools: null,
|
|
17
|
+
invocation: "implicit",
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
ownership: [
|
|
21
|
+
{
|
|
22
|
+
id: "routing",
|
|
23
|
+
owner: "skills/demo-skill/SKILL.md",
|
|
24
|
+
surfaces: ["AGENTS.md"],
|
|
25
|
+
enforcement: "advisory",
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
assert.deepStrictEqual(validateManifest(valid, {
|
|
31
|
+
exists: (file) => file === "skills/demo-skill/SKILL.md" || file === "AGENTS.md",
|
|
32
|
+
skillPaths: ["skills/demo-skill/SKILL.md"],
|
|
33
|
+
// 元数据验证不应要求固定的流程正文;正文可以按需移到 references/。
|
|
34
|
+
read: () => "---\nname: demo-skill\ndescription: demo\n---\n",
|
|
35
|
+
}), []);
|
|
36
|
+
|
|
37
|
+
const longDescription = structuredClone(valid);
|
|
38
|
+
assert.match(validateManifest(longDescription, {
|
|
39
|
+
exists: (file) => file === "skills/demo-skill/SKILL.md" || file === "AGENTS.md",
|
|
40
|
+
skillPaths: ["skills/demo-skill/SKILL.md"],
|
|
41
|
+
read: () => `---\nname: demo-skill\ndescription: ${"x".repeat(129)}\n---\n`,
|
|
42
|
+
}).join("\n"), /description exceeds/);
|
|
43
|
+
|
|
44
|
+
const duplicate = structuredClone(valid);
|
|
45
|
+
duplicate.skills.push({ ...duplicate.skills[0], name: "other", path: "skills/demo-skill/SKILL.md" });
|
|
46
|
+
assert.match(validateManifest(duplicate, {
|
|
47
|
+
exists: () => true,
|
|
48
|
+
skillPaths: ["skills/demo-skill/SKILL.md"],
|
|
49
|
+
}).join("\n"), /duplicate skill path/);
|
|
50
|
+
|
|
51
|
+
const missingOwner = structuredClone(valid);
|
|
52
|
+
missingOwner.ownership[0].owner = "rules/missing.md";
|
|
53
|
+
assert.match(validateManifest(missingOwner, {
|
|
54
|
+
exists: (file) => file === "skills/demo-skill/SKILL.md" || file === "AGENTS.md",
|
|
55
|
+
skillPaths: ["skills/demo-skill/SKILL.md"],
|
|
56
|
+
}).join("\n"), /owner path does not exist/);
|
|
57
|
+
|
|
58
|
+
const unsafePath = structuredClone(valid);
|
|
59
|
+
unsafePath.skills[0].path = "../outside/SKILL.md";
|
|
60
|
+
assert.match(validateManifest(unsafePath, {
|
|
61
|
+
exists: () => true,
|
|
62
|
+
skillPaths: ["skills/demo-skill/SKILL.md"],
|
|
63
|
+
read: () => "---\nname: demo-skill\ndescription: demo\n---\n",
|
|
64
|
+
}).join("\n"), /unsafe skill path/);
|
|
65
|
+
|
|
66
|
+
const missingSkill = structuredClone(valid);
|
|
67
|
+
assert.match(validateManifest(missingSkill, {
|
|
68
|
+
exists: (file) => file === "skills/demo-skill/SKILL.md" || file === "AGENTS.md",
|
|
69
|
+
skillPaths: ["skills/demo-skill/SKILL.md", "skills/other/SKILL.md"],
|
|
70
|
+
read: () => "---\nname: demo-skill\ndescription: demo\n---\n",
|
|
71
|
+
}).join("\n"), /missing from manifest/);
|
|
72
|
+
|
|
73
|
+
const duplicateOwner = structuredClone(valid);
|
|
74
|
+
duplicateOwner.skills.push({ ...duplicateOwner.skills[0], name: "other", path: "skills/other/SKILL.md", owner: "skills/demo-skill/SKILL.md" });
|
|
75
|
+
assert.match(validateManifest(duplicateOwner, {
|
|
76
|
+
exists: () => true,
|
|
77
|
+
skillPaths: ["skills/demo-skill/SKILL.md", "skills/other/SKILL.md"],
|
|
78
|
+
read: (file) => `---\nname: ${file.includes("other") ? "other" : "demo-skill"}\ndescription: demo\n---\n`,
|
|
79
|
+
}).join("\n"), /duplicate skill owner/);
|
|
80
|
+
|
|
81
|
+
const policyConflict = structuredClone(valid);
|
|
82
|
+
policyConflict.skills[0].invocation = "implicit";
|
|
83
|
+
assert.match(validateManifest(policyConflict, {
|
|
84
|
+
exists: (file) => file === "skills/demo-skill/SKILL.md" || file === "AGENTS.md" || file === "skills/demo-skill/agents/openai.yaml",
|
|
85
|
+
skillPaths: ["skills/demo-skill/SKILL.md"],
|
|
86
|
+
read: (file) => file.endsWith("openai.yaml")
|
|
87
|
+
? "policy:\n allow_implicit_invocation: false\n"
|
|
88
|
+
: "---\nname: demo-skill\ndescription: demo\n---\n",
|
|
89
|
+
}).join("\n"), /conflicts with policy/);
|
|
90
|
+
|
|
91
|
+
const explicitInvocationConflict = structuredClone(valid);
|
|
92
|
+
explicitInvocationConflict.skills[0].invocation = "explicit-only";
|
|
93
|
+
assert.match(validateManifest(explicitInvocationConflict, {
|
|
94
|
+
exists: (file) => file === "skills/demo-skill/SKILL.md" || file === "AGENTS.md",
|
|
95
|
+
skillPaths: ["skills/demo-skill/SKILL.md"],
|
|
96
|
+
read: () => "---\nname: demo-skill\ndescription: demo\n---\n",
|
|
97
|
+
}).join("\n"), /must disable implicit invocation/);
|
|
98
|
+
|
|
99
|
+
const frontmatterPolicyConflict = structuredClone(valid);
|
|
100
|
+
assert.match(validateManifest(frontmatterPolicyConflict, {
|
|
101
|
+
exists: (file) => file === "skills/demo-skill/SKILL.md" || file === "AGENTS.md",
|
|
102
|
+
skillPaths: ["skills/demo-skill/SKILL.md"],
|
|
103
|
+
read: () => "---\nname: demo-skill\ndescription: demo\ndisable-model-invocation: true\n---\n",
|
|
104
|
+
}).join("\n"), /conflicts with frontmatter/);
|
|
105
|
+
|
|
106
|
+
const missingPath = structuredClone(valid);
|
|
107
|
+
delete missingPath.skills[0].path;
|
|
108
|
+
assert.doesNotThrow(() => validateManifest(missingPath, {
|
|
109
|
+
exists: () => false,
|
|
110
|
+
skillPaths: [],
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
const versionConflict = structuredClone(valid);
|
|
114
|
+
assert.match(validateManifest(versionConflict, {
|
|
115
|
+
exists: (file) => file === "skills/demo-skill/SKILL.md" || file === "AGENTS.md",
|
|
116
|
+
skillPaths: ["skills/demo-skill/SKILL.md"],
|
|
117
|
+
read: () => "---\nname: demo-skill\ndescription: demo\nversion: 2.0.0\n---\n",
|
|
118
|
+
}).join("\n"), /version does not match frontmatter/);
|
|
119
|
+
|
|
120
|
+
console.log("skill manifest checks tests passed");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
run();
|