@kodax-ai/kodax 0.7.95 → 0.7.96-alpha.2
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/CHANGELOG.md +178 -1
- package/LICENSE +158 -158
- package/README.md +149 -24
- package/README_CN.md +117 -24
- package/config-templates/config.example.jsonc +2 -1
- package/config-templates/integrations/a2a.example.jsonc +91 -91
- package/config-templates/integrations/extensions.example.jsonc +7 -7
- package/config-templates/integrations/mcp.example.jsonc +16 -16
- package/dist/builtin/code-review/SKILL.md +82 -82
- package/dist/builtin/git-workflow/SKILL.md +84 -84
- package/dist/builtin/skill-creator/SKILL.md +127 -127
- package/dist/builtin/skill-creator/agents/analyzer.md +12 -12
- package/dist/builtin/skill-creator/agents/comparator.md +13 -13
- package/dist/builtin/skill-creator/agents/grader.md +13 -13
- package/dist/builtin/skill-creator/references/schemas.md +227 -227
- package/dist/builtin/skill-creator/scripts/aggregate-benchmark.d.ts +46 -46
- package/dist/builtin/skill-creator/scripts/aggregate-benchmark.js +208 -208
- package/dist/builtin/skill-creator/scripts/analyze-benchmark.d.ts +46 -46
- package/dist/builtin/skill-creator/scripts/analyze-benchmark.js +286 -286
- package/dist/builtin/skill-creator/scripts/compare-runs.d.ts +62 -62
- package/dist/builtin/skill-creator/scripts/compare-runs.js +330 -330
- package/dist/builtin/skill-creator/scripts/generate-review.d.ts +33 -33
- package/dist/builtin/skill-creator/scripts/generate-review.js +414 -414
- package/dist/builtin/skill-creator/scripts/grade-evals.d.ts +73 -73
- package/dist/builtin/skill-creator/scripts/grade-evals.js +402 -402
- package/dist/builtin/skill-creator/scripts/improve-description.d.ts +23 -23
- package/dist/builtin/skill-creator/scripts/improve-description.js +160 -160
- package/dist/builtin/skill-creator/scripts/init-skill.d.ts +14 -14
- package/dist/builtin/skill-creator/scripts/init-skill.js +155 -155
- package/dist/builtin/skill-creator/scripts/install-skill.d.ts +29 -29
- package/dist/builtin/skill-creator/scripts/install-skill.js +173 -173
- package/dist/builtin/skill-creator/scripts/package-skill.d.ts +38 -38
- package/dist/builtin/skill-creator/scripts/package-skill.js +121 -121
- package/dist/builtin/skill-creator/scripts/quick-validate.d.ts +8 -8
- package/dist/builtin/skill-creator/scripts/quick-validate.js +163 -163
- package/dist/builtin/skill-creator/scripts/run-eval.d.ts +66 -66
- package/dist/builtin/skill-creator/scripts/run-eval.js +353 -353
- package/dist/builtin/skill-creator/scripts/run-loop.d.ts +49 -49
- package/dist/builtin/skill-creator/scripts/run-loop.js +242 -242
- package/dist/builtin/skill-creator/scripts/run-trigger-eval.d.ts +58 -58
- package/dist/builtin/skill-creator/scripts/run-trigger-eval.js +224 -224
- package/dist/builtin/tdd/SKILL.md +56 -56
- package/dist/chunks/agent-4FABF6WK.js +2 -0
- package/dist/chunks/argument-completer-72VHB2VL.js +2 -0
- package/dist/chunks/{chunk-7JXA3533.js → chunk-4OIQZWA5.js} +223 -226
- package/dist/chunks/{chunk-BNVSKIAB.js → chunk-6BVF3HZ7.js} +136 -136
- package/dist/chunks/chunk-7JZZIFZH.js +501 -0
- package/dist/chunks/chunk-AC7Z2OIY.js +2 -0
- package/dist/chunks/{chunk-JS452J2F.js → chunk-C4KYZAFU.js} +2 -2
- package/dist/chunks/chunk-CHUPIWIF.js +251 -0
- package/dist/chunks/{chunk-C4DTUKTR.js → chunk-GYUU7XLH.js} +5 -4
- package/dist/chunks/{chunk-OK4AXDC5.js → chunk-HAX55GOQ.js} +1 -1
- package/dist/chunks/chunk-JKTJCGO2.js +418 -0
- package/dist/chunks/{chunk-O743AJ5V.js → chunk-LQYETRFK.js} +171 -175
- package/dist/chunks/{chunk-2PEDBGKN.js → chunk-LTUZTQ6W.js} +1 -1
- package/dist/chunks/chunk-LYWDUSKO.js +2 -0
- package/dist/chunks/chunk-NGH6T4FD.js +92 -0
- package/dist/chunks/{chunk-SRIJX5ZP.js → chunk-NVRWCSA5.js} +1 -1
- package/dist/chunks/chunk-O4DS7RIQ.js +384 -0
- package/dist/chunks/chunk-ORXU6OWZ.js +2 -0
- package/dist/chunks/chunk-POTW3O65.js +124 -0
- package/dist/chunks/{chunk-2TM3W3GK.js → chunk-RIQSS56Y.js} +1 -1
- package/dist/chunks/chunk-U27XKEN5.js +407 -0
- package/dist/chunks/{chunk-6ABQJUK6.js → chunk-XUX6OUCA.js} +2 -2
- package/dist/chunks/{client-JDOS3YJR.js → client-4C456K4O.js} +1 -1
- package/dist/chunks/compaction-config-3VQRDFF4.js +2 -0
- package/dist/chunks/{construction-bootstrap-YCWHHUYO.js → construction-bootstrap-AHN7EDGG.js} +1 -1
- package/dist/chunks/dist-BCBQXAGI.js +2 -0
- package/dist/chunks/dist-QK2YDWU6.js +2 -0
- package/dist/chunks/host-VIHV7ADG.js +2 -0
- package/dist/chunks/run-manager-NBVMU3KV.js +2 -0
- package/dist/chunks/utils-MEJZ2IGI.js +2 -0
- package/dist/index.d.ts +22 -21
- package/dist/index.js +7 -7
- package/dist/kodax_bootstrap.js +26 -26
- package/dist/kodax_cli.js +1905 -1882
- package/dist/native/darwin-arm64/LICENSE-APACHE.txt +13 -0
- package/dist/native/darwin-arm64/kodax-text-transaction.node +0 -0
- package/dist/native/darwin-arm64/manifest.json +16 -0
- package/dist/native/darwin-x64/LICENSE-APACHE.txt +13 -0
- package/dist/native/darwin-x64/kodax-text-transaction.node +0 -0
- package/dist/native/darwin-x64/manifest.json +16 -0
- package/dist/native/linux-arm64/LICENSE-APACHE.txt +13 -0
- package/dist/native/linux-arm64/kodax-text-transaction.node +0 -0
- package/dist/native/linux-arm64/manifest.json +16 -0
- package/dist/native/linux-x64/LICENSE-APACHE.txt +13 -0
- package/dist/native/linux-x64/kodax-text-transaction.node +0 -0
- package/dist/native/linux-x64/manifest.json +16 -0
- package/dist/native/win32-x64/LICENSE-APACHE.txt +13 -0
- package/dist/native/win32-x64/NOTICE-windows-sandbox.txt +8 -0
- package/dist/native/win32-x64/kodax-windows-sandbox.exe +0 -0
- package/dist/native/win32-x64/kodax-windows-text-transaction.node +0 -0
- package/dist/native/win32-x64/manifest.json +30 -0
- package/dist/provider-capabilities.json +108 -2
- package/dist/runtime-worker.js +1745 -1727
- package/dist/sandbox-network-broker.js +1715 -0
- package/dist/sdk-a2a.d.ts +13 -12
- package/dist/sdk-a2a.js +1 -1
- package/dist/sdk-agent.d.ts +27 -18
- package/dist/sdk-agent.js +1 -1
- package/dist/sdk-coding.d.ts +107 -58
- package/dist/sdk-coding.js +1 -1
- package/dist/sdk-experimental-memory.d.ts +4 -4
- package/dist/sdk-experimental-memory.js +1 -1
- package/dist/sdk-llm.d.ts +9 -10
- package/dist/sdk-llm.js +1 -1
- package/dist/sdk-mcp.js +1 -1
- package/dist/sdk-media.d.ts +1 -1
- package/dist/sdk-media.js +1 -1
- package/dist/sdk-repl.d.ts +25 -17
- package/dist/sdk-repl.js +1 -1
- package/dist/sdk-runtime.d.ts +41 -17
- package/dist/sdk-runtime.js +1 -1
- package/dist/sdk-sandbox.d.ts +17 -3
- package/dist/sdk-sandbox.js +1 -1
- package/dist/sdk-session.d.ts +8 -7
- package/dist/sdk-session.js +1 -1
- package/dist/sdk-skills.js +1 -1
- package/dist/semantic-worker.js +61 -61
- package/dist/types-chunks/{base.d-vopO1rml.d.ts → base.d-COo8E2dk.d.ts} +18 -27
- package/dist/types-chunks/{bash-prefix-extractor.d-B2rxNI4L.d.ts → bash-prefix-extractor.d-DQOlA8cy.d.ts} +72 -52
- package/dist/types-chunks/{capability-learning.d-CE1tm29C.d.ts → capability-learning.d-lRPgA3Or.d.ts} +1 -1
- package/dist/types-chunks/{capsule.d-Y7QRS4J2.d.ts → capsule.d-0zxsgXg_.d.ts} +3 -3
- package/dist/types-chunks/{controller.d-BR-UVeUR.d.ts → controller.d-BTtyIIC1.d.ts} +1 -1
- package/dist/types-chunks/{controller.d-C5noq5-w.d.ts → controller.d-C7tXUcXo.d.ts} +2 -2
- package/dist/types-chunks/{guardrail.d-DqHD-61O.d.ts → guardrail.d-DKTyEHJa.d.ts} +5 -5
- package/dist/types-chunks/{history-retrieval.d-CKU8zmt_.d.ts → history-retrieval.d-CHnL99S7.d.ts} +2 -2
- package/dist/types-chunks/{public-api.d-D7fXaWW8.d.ts → public-api.d-Dx3L3W4Z.d.ts} +7 -4
- package/dist/types-chunks/{repl.d-BYDb14s6.d.ts → repl.d-mO01olIa.d.ts} +5 -5
- package/dist/types-chunks/{resolver.d-CwHUwbdE.d.ts → resolver.d-DlXPjeyx.d.ts} +38 -6
- package/dist/types-chunks/{review-inbox.d-BSgFewyj.d.ts → review-inbox.d-WDSe1nze.d.ts} +1 -1
- package/dist/types-chunks/{run-manager.d-BVJSntpS.d.ts → run-manager.d-DENbbzgR.d.ts} +1 -1
- package/dist/types-chunks/{sdk-session-CqEG84oP.d.ts → sdk-session-DYHGXXH4.d.ts} +3 -3
- package/dist/types-chunks/{shell-command-sets.d-DqaaBwhU.d.ts → shell-command-sets.d-CjFqS4dp.d.ts} +1 -1
- package/dist/types-chunks/{side-query.d-iH0P9ASy.d.ts → side-query.d-j8A3sFv_.d.ts} +2 -2
- package/dist/types-chunks/{types.d-rUOjXych.d.ts → types.d-BbZjR0Wr.d.ts} +1 -1
- package/dist/types-chunks/{types.d-CaTXAW_Q.d.ts → types.d-BkTIKdH6.d.ts} +2 -2
- package/dist/types-chunks/{types.d-C5xQEFcj.d.ts → types.d-DncLrpu_.d.ts} +4 -4
- package/dist/types-chunks/{types.d-CK9A9rpP.d.ts → types.d-Xy0f3x4i.d.ts} +9 -0
- package/dist/types-chunks/{utils.d-CWUyLiXo.d.ts → utils.d-CnxefMos.d.ts} +6 -6
- package/package.json +10 -3
- package/public_docs/README.md +130 -0
- package/public_docs/configuration/sandbox.md +289 -0
- package/public_docs/sdk/embedder-guide.md +6674 -0
- package/scripts/kodax-bin.cjs +28 -28
- package/scripts/production-env.cjs +25 -25
- package/dist/chunks/agent-XXZMXKKA.js +0 -2
- package/dist/chunks/argument-completer-KCYDGTQW.js +0 -2
- package/dist/chunks/chunk-77PNP27P.js +0 -92
- package/dist/chunks/chunk-7QBWHCIZ.js +0 -2
- package/dist/chunks/chunk-BHE66SP3.js +0 -123
- package/dist/chunks/chunk-BR2OSB2I.js +0 -722
- package/dist/chunks/chunk-DSMONSVB.js +0 -407
- package/dist/chunks/chunk-Q5VRWSKG.js +0 -418
- package/dist/chunks/chunk-XWRPOGJN.js +0 -4
- package/dist/chunks/chunk-Y5VIQBT6.js +0 -383
- package/dist/chunks/compaction-config-EGS4577X.js +0 -2
- package/dist/chunks/dist-ITTXQHRJ.js +0 -2
- package/dist/chunks/dist-KFYN3OKD.js +0 -2
- package/dist/chunks/host-VAYADIPW.js +0 -2
- package/dist/chunks/run-manager-52IJZMZJ.js +0 -2
- package/dist/chunks/utils-P7PBSL3R.js +0 -2
- package/dist/sandbox-workspace-session.js +0 -1705
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export interface SkillValidationResult {
|
|
2
|
-
valid: boolean;
|
|
3
|
-
errors: string[];
|
|
4
|
-
warnings: string[];
|
|
5
|
-
frontmatter: Record<string, unknown> | null;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function validateSkillDirectory(skillDir: string): Promise<SkillValidationResult>;
|
|
1
|
+
export interface SkillValidationResult {
|
|
2
|
+
valid: boolean;
|
|
3
|
+
errors: string[];
|
|
4
|
+
warnings: string[];
|
|
5
|
+
frontmatter: Record<string, unknown> | null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function validateSkillDirectory(skillDir: string): Promise<SkillValidationResult>;
|
|
9
9
|
export declare function main(argv?: string[]): Promise<void>;
|
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { loadSkill } from './utils.js';
|
|
6
|
-
|
|
7
|
-
const ALLOWED_FRONTMATTER_KEYS = new Set([
|
|
8
|
-
'name',
|
|
9
|
-
'description',
|
|
10
|
-
'license',
|
|
11
|
-
'compatibility',
|
|
12
|
-
'metadata',
|
|
13
|
-
'allowed-tools',
|
|
14
|
-
'disable-model-invocation',
|
|
15
|
-
'user-invocable',
|
|
16
|
-
'argument-hint',
|
|
17
|
-
'context',
|
|
18
|
-
'agent',
|
|
19
|
-
'model',
|
|
20
|
-
'hooks',
|
|
21
|
-
]);
|
|
22
|
-
|
|
23
|
-
export async function validateSkillDirectory(skillDir) {
|
|
24
|
-
const result = {
|
|
25
|
-
valid: false,
|
|
26
|
-
errors: [],
|
|
27
|
-
warnings: [],
|
|
28
|
-
frontmatter: null,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
let skill;
|
|
32
|
-
try {
|
|
33
|
-
skill = await loadSkill(skillDir);
|
|
34
|
-
} catch (error) {
|
|
35
|
-
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const { frontmatter, body } = skill;
|
|
40
|
-
result.frontmatter = frontmatter;
|
|
41
|
-
|
|
42
|
-
const unexpectedKeys = Object.keys(frontmatter).filter((key) => !ALLOWED_FRONTMATTER_KEYS.has(key));
|
|
43
|
-
if (unexpectedKeys.length > 0) {
|
|
44
|
-
result.errors.push(
|
|
45
|
-
`Unexpected frontmatter keys: ${unexpectedKeys.sort().join(', ')}`
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const name = typeof frontmatter.name === 'string' ? frontmatter.name.trim() : '';
|
|
50
|
-
const description = typeof frontmatter.description === 'string'
|
|
51
|
-
? frontmatter.description.trim()
|
|
52
|
-
: '';
|
|
53
|
-
|
|
54
|
-
if (!name) {
|
|
55
|
-
result.errors.push('Missing required frontmatter field: name');
|
|
56
|
-
} else {
|
|
57
|
-
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name)) {
|
|
58
|
-
result.errors.push(
|
|
59
|
-
`Invalid skill name "${name}". Use lowercase kebab-case and avoid consecutive hyphens.`
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
if (name.length > 64) {
|
|
63
|
-
result.errors.push(`Skill name is too long (${name.length}/64).`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const dirName = path.basename(path.resolve(skillDir));
|
|
67
|
-
if (dirName !== name) {
|
|
68
|
-
result.warnings.push(
|
|
69
|
-
`Skill directory name "${dirName}" does not match frontmatter name "${name}".`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (!description) {
|
|
75
|
-
result.errors.push('Missing required frontmatter field: description');
|
|
76
|
-
} else {
|
|
77
|
-
if (description.length > 1024) {
|
|
78
|
-
result.errors.push(`Description is too long (${description.length}/1024).`);
|
|
79
|
-
}
|
|
80
|
-
if (/[<>]/.test(description)) {
|
|
81
|
-
result.errors.push('Description cannot contain angle brackets.');
|
|
82
|
-
}
|
|
83
|
-
if (!/[。.!?]/.test(description)) {
|
|
84
|
-
result.warnings.push('Description may be too terse; consider making the trigger conditions clearer.');
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (!body.trim()) {
|
|
89
|
-
result.errors.push('SKILL.md body is empty.');
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
if (frontmatter.compatibility != null) {
|
|
93
|
-
if (typeof frontmatter.compatibility !== 'string') {
|
|
94
|
-
result.errors.push('compatibility must be a string if provided.');
|
|
95
|
-
} else if (frontmatter.compatibility.length > 500) {
|
|
96
|
-
result.errors.push(`compatibility is too long (${frontmatter.compatibility.length}/500).`);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (frontmatter['allowed-tools'] != null) {
|
|
101
|
-
const allowedTools = frontmatter['allowed-tools'];
|
|
102
|
-
const validAllowedTools = typeof allowedTools === 'string'
|
|
103
|
-
|| (Array.isArray(allowedTools) && allowedTools.every((item) => typeof item === 'string'));
|
|
104
|
-
if (!validAllowedTools) {
|
|
105
|
-
result.errors.push('allowed-tools must be a string or string array.');
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (frontmatter['disable-model-invocation'] != null
|
|
110
|
-
&& typeof frontmatter['disable-model-invocation'] !== 'boolean') {
|
|
111
|
-
result.errors.push('disable-model-invocation must be a boolean.');
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (frontmatter['user-invocable'] != null && typeof frontmatter['user-invocable'] !== 'boolean') {
|
|
115
|
-
result.errors.push('user-invocable must be a boolean.');
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (frontmatter.context != null && frontmatter.context !== 'fork') {
|
|
119
|
-
result.errors.push('context must be "fork" when provided.');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (frontmatter.hooks != null && (typeof frontmatter.hooks !== 'object' || Array.isArray(frontmatter.hooks))) {
|
|
123
|
-
result.errors.push('hooks must be an object when provided.');
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
result.valid = result.errors.length === 0;
|
|
127
|
-
return result;
|
|
128
|
-
}
|
|
129
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { loadSkill } from './utils.js';
|
|
6
|
+
|
|
7
|
+
const ALLOWED_FRONTMATTER_KEYS = new Set([
|
|
8
|
+
'name',
|
|
9
|
+
'description',
|
|
10
|
+
'license',
|
|
11
|
+
'compatibility',
|
|
12
|
+
'metadata',
|
|
13
|
+
'allowed-tools',
|
|
14
|
+
'disable-model-invocation',
|
|
15
|
+
'user-invocable',
|
|
16
|
+
'argument-hint',
|
|
17
|
+
'context',
|
|
18
|
+
'agent',
|
|
19
|
+
'model',
|
|
20
|
+
'hooks',
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
export async function validateSkillDirectory(skillDir) {
|
|
24
|
+
const result = {
|
|
25
|
+
valid: false,
|
|
26
|
+
errors: [],
|
|
27
|
+
warnings: [],
|
|
28
|
+
frontmatter: null,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
let skill;
|
|
32
|
+
try {
|
|
33
|
+
skill = await loadSkill(skillDir);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
result.errors.push(error instanceof Error ? error.message : String(error));
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { frontmatter, body } = skill;
|
|
40
|
+
result.frontmatter = frontmatter;
|
|
41
|
+
|
|
42
|
+
const unexpectedKeys = Object.keys(frontmatter).filter((key) => !ALLOWED_FRONTMATTER_KEYS.has(key));
|
|
43
|
+
if (unexpectedKeys.length > 0) {
|
|
44
|
+
result.errors.push(
|
|
45
|
+
`Unexpected frontmatter keys: ${unexpectedKeys.sort().join(', ')}`
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const name = typeof frontmatter.name === 'string' ? frontmatter.name.trim() : '';
|
|
50
|
+
const description = typeof frontmatter.description === 'string'
|
|
51
|
+
? frontmatter.description.trim()
|
|
52
|
+
: '';
|
|
53
|
+
|
|
54
|
+
if (!name) {
|
|
55
|
+
result.errors.push('Missing required frontmatter field: name');
|
|
56
|
+
} else {
|
|
57
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name)) {
|
|
58
|
+
result.errors.push(
|
|
59
|
+
`Invalid skill name "${name}". Use lowercase kebab-case and avoid consecutive hyphens.`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
if (name.length > 64) {
|
|
63
|
+
result.errors.push(`Skill name is too long (${name.length}/64).`);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const dirName = path.basename(path.resolve(skillDir));
|
|
67
|
+
if (dirName !== name) {
|
|
68
|
+
result.warnings.push(
|
|
69
|
+
`Skill directory name "${dirName}" does not match frontmatter name "${name}".`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!description) {
|
|
75
|
+
result.errors.push('Missing required frontmatter field: description');
|
|
76
|
+
} else {
|
|
77
|
+
if (description.length > 1024) {
|
|
78
|
+
result.errors.push(`Description is too long (${description.length}/1024).`);
|
|
79
|
+
}
|
|
80
|
+
if (/[<>]/.test(description)) {
|
|
81
|
+
result.errors.push('Description cannot contain angle brackets.');
|
|
82
|
+
}
|
|
83
|
+
if (!/[。.!?]/.test(description)) {
|
|
84
|
+
result.warnings.push('Description may be too terse; consider making the trigger conditions clearer.');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!body.trim()) {
|
|
89
|
+
result.errors.push('SKILL.md body is empty.');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (frontmatter.compatibility != null) {
|
|
93
|
+
if (typeof frontmatter.compatibility !== 'string') {
|
|
94
|
+
result.errors.push('compatibility must be a string if provided.');
|
|
95
|
+
} else if (frontmatter.compatibility.length > 500) {
|
|
96
|
+
result.errors.push(`compatibility is too long (${frontmatter.compatibility.length}/500).`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (frontmatter['allowed-tools'] != null) {
|
|
101
|
+
const allowedTools = frontmatter['allowed-tools'];
|
|
102
|
+
const validAllowedTools = typeof allowedTools === 'string'
|
|
103
|
+
|| (Array.isArray(allowedTools) && allowedTools.every((item) => typeof item === 'string'));
|
|
104
|
+
if (!validAllowedTools) {
|
|
105
|
+
result.errors.push('allowed-tools must be a string or string array.');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (frontmatter['disable-model-invocation'] != null
|
|
110
|
+
&& typeof frontmatter['disable-model-invocation'] !== 'boolean') {
|
|
111
|
+
result.errors.push('disable-model-invocation must be a boolean.');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (frontmatter['user-invocable'] != null && typeof frontmatter['user-invocable'] !== 'boolean') {
|
|
115
|
+
result.errors.push('user-invocable must be a boolean.');
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (frontmatter.context != null && frontmatter.context !== 'fork') {
|
|
119
|
+
result.errors.push('context must be "fork" when provided.');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (frontmatter.hooks != null && (typeof frontmatter.hooks !== 'object' || Array.isArray(frontmatter.hooks))) {
|
|
123
|
+
result.errors.push('hooks must be an object when provided.');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
result.valid = result.errors.length === 0;
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
130
|
export async function main(argv = process.argv) {
|
|
131
131
|
const skillDir = argv[2];
|
|
132
|
-
if (!skillDir) {
|
|
133
|
-
console.error('Usage: node scripts/quick-validate.js <skill-directory>');
|
|
134
|
-
process.exit(1);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
const result = await validateSkillDirectory(skillDir);
|
|
138
|
-
|
|
139
|
-
if (result.errors.length === 0) {
|
|
140
|
-
console.log('Skill is valid.');
|
|
141
|
-
} else {
|
|
142
|
-
console.error('Skill validation failed:');
|
|
143
|
-
for (const error of result.errors) {
|
|
144
|
-
console.error(`- ${error}`);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (result.warnings.length > 0) {
|
|
149
|
-
console.log('Warnings:');
|
|
150
|
-
for (const warning of result.warnings) {
|
|
151
|
-
console.log(`- ${warning}`);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
process.exit(result.valid ? 0 : 1);
|
|
156
|
-
}
|
|
157
|
-
|
|
132
|
+
if (!skillDir) {
|
|
133
|
+
console.error('Usage: node scripts/quick-validate.js <skill-directory>');
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const result = await validateSkillDirectory(skillDir);
|
|
138
|
+
|
|
139
|
+
if (result.errors.length === 0) {
|
|
140
|
+
console.log('Skill is valid.');
|
|
141
|
+
} else {
|
|
142
|
+
console.error('Skill validation failed:');
|
|
143
|
+
for (const error of result.errors) {
|
|
144
|
+
console.error(`- ${error}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (result.warnings.length > 0) {
|
|
149
|
+
console.log('Warnings:');
|
|
150
|
+
for (const warning of result.warnings) {
|
|
151
|
+
console.log(`- ${warning}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
process.exit(result.valid ? 0 : 1);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
158
|
const isDirectRun = process.env.KODAX_MODULE_BUNDLE !== 'true'
|
|
159
159
|
&& process.argv[1]
|
|
160
|
-
&& fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
|
|
161
|
-
|
|
162
|
-
if (isDirectRun) {
|
|
163
|
-
main().catch((error) => {
|
|
164
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
165
|
-
process.exit(1);
|
|
166
|
-
});
|
|
167
|
-
}
|
|
160
|
+
&& fileURLToPath(import.meta.url) === path.resolve(process.argv[1]);
|
|
161
|
+
|
|
162
|
+
if (isDirectRun) {
|
|
163
|
+
main().catch((error) => {
|
|
164
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
165
|
+
process.exit(1);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
export interface SkillEvalAssertion {
|
|
2
|
-
text: string;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export interface SkillEvalItem {
|
|
6
|
-
id?: string | number;
|
|
7
|
-
name?: string;
|
|
8
|
-
prompt?: string;
|
|
9
|
-
query?: string;
|
|
10
|
-
expected_output?: string;
|
|
11
|
-
files?: string[];
|
|
12
|
-
assertions?: Array<string | SkillEvalAssertion>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface SkillEvalExecution {
|
|
16
|
-
result: {
|
|
17
|
-
success: boolean;
|
|
18
|
-
lastText: string;
|
|
19
|
-
signal?: 'COMPLETE' | 'BLOCKED' | 'DECIDE';
|
|
20
|
-
signalReason?: string;
|
|
21
|
-
messages: Array<Record<string, unknown>>;
|
|
22
|
-
sessionId: string;
|
|
23
|
-
interrupted?: boolean;
|
|
24
|
-
limitReached?: boolean;
|
|
25
|
-
};
|
|
26
|
-
totalTokens: number;
|
|
27
|
-
durationMs: number;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface RunEvalWorkspaceOptions {
|
|
31
|
-
skillPath: string;
|
|
32
|
-
evalsPath: string;
|
|
33
|
-
workspaceDir: string;
|
|
34
|
-
provider?: string;
|
|
35
|
-
model?: string;
|
|
36
|
-
runsPerConfig?: number;
|
|
37
|
-
maxIter?: number;
|
|
38
|
-
reasoningMode?: string;
|
|
39
|
-
cwd?: string;
|
|
40
|
-
configs?: string[];
|
|
41
|
-
output?: string;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function buildEvalPrompt(
|
|
45
|
-
evalItem: SkillEvalItem,
|
|
46
|
-
options: Pick<RunEvalWorkspaceOptions, 'evalsPath' | 'cwd'>
|
|
47
|
-
): Promise<string>;
|
|
48
|
-
|
|
49
|
-
export function runEvalWorkspace(
|
|
50
|
-
options: RunEvalWorkspaceOptions,
|
|
51
|
-
runner?: (
|
|
52
|
-
prompt: string,
|
|
53
|
-
options: RunEvalWorkspaceOptions & {
|
|
54
|
-
configName: string;
|
|
55
|
-
evalItem: SkillEvalItem;
|
|
56
|
-
runIndex: number;
|
|
57
|
-
}
|
|
58
|
-
) => Promise<SkillEvalExecution>
|
|
59
|
-
): Promise<{
|
|
60
|
-
workspace: string;
|
|
61
|
-
skill_name: string;
|
|
62
|
-
eval_count: number;
|
|
63
|
-
configs: string[];
|
|
64
|
-
runs_per_config: number;
|
|
65
|
-
reports: Array<Record<string, unknown>>;
|
|
66
|
-
}>;
|
|
1
|
+
export interface SkillEvalAssertion {
|
|
2
|
+
text: string;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export interface SkillEvalItem {
|
|
6
|
+
id?: string | number;
|
|
7
|
+
name?: string;
|
|
8
|
+
prompt?: string;
|
|
9
|
+
query?: string;
|
|
10
|
+
expected_output?: string;
|
|
11
|
+
files?: string[];
|
|
12
|
+
assertions?: Array<string | SkillEvalAssertion>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SkillEvalExecution {
|
|
16
|
+
result: {
|
|
17
|
+
success: boolean;
|
|
18
|
+
lastText: string;
|
|
19
|
+
signal?: 'COMPLETE' | 'BLOCKED' | 'DECIDE';
|
|
20
|
+
signalReason?: string;
|
|
21
|
+
messages: Array<Record<string, unknown>>;
|
|
22
|
+
sessionId: string;
|
|
23
|
+
interrupted?: boolean;
|
|
24
|
+
limitReached?: boolean;
|
|
25
|
+
};
|
|
26
|
+
totalTokens: number;
|
|
27
|
+
durationMs: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface RunEvalWorkspaceOptions {
|
|
31
|
+
skillPath: string;
|
|
32
|
+
evalsPath: string;
|
|
33
|
+
workspaceDir: string;
|
|
34
|
+
provider?: string;
|
|
35
|
+
model?: string;
|
|
36
|
+
runsPerConfig?: number;
|
|
37
|
+
maxIter?: number;
|
|
38
|
+
reasoningMode?: string;
|
|
39
|
+
cwd?: string;
|
|
40
|
+
configs?: string[];
|
|
41
|
+
output?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function buildEvalPrompt(
|
|
45
|
+
evalItem: SkillEvalItem,
|
|
46
|
+
options: Pick<RunEvalWorkspaceOptions, 'evalsPath' | 'cwd'>
|
|
47
|
+
): Promise<string>;
|
|
48
|
+
|
|
49
|
+
export function runEvalWorkspace(
|
|
50
|
+
options: RunEvalWorkspaceOptions,
|
|
51
|
+
runner?: (
|
|
52
|
+
prompt: string,
|
|
53
|
+
options: RunEvalWorkspaceOptions & {
|
|
54
|
+
configName: string;
|
|
55
|
+
evalItem: SkillEvalItem;
|
|
56
|
+
runIndex: number;
|
|
57
|
+
}
|
|
58
|
+
) => Promise<SkillEvalExecution>
|
|
59
|
+
): Promise<{
|
|
60
|
+
workspace: string;
|
|
61
|
+
skill_name: string;
|
|
62
|
+
eval_count: number;
|
|
63
|
+
configs: string[];
|
|
64
|
+
runs_per_config: number;
|
|
65
|
+
reports: Array<Record<string, unknown>>;
|
|
66
|
+
}>;
|
|
67
67
|
export declare function main(argv?: string[]): Promise<void>;
|