@venizia/vulcan 0.2.0-2 → 0.2.0-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/package.json +3 -3
- package/src/doctor/skills.ts +48 -11
- package/src/sync/planner.ts +21 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/vulcan",
|
|
3
|
-
"version": "0.2.0-
|
|
3
|
+
"version": "0.2.0-3",
|
|
4
4
|
"description": "VULCAN - one setup, one workflow for every project: init, sync, doctor, upgrade, and `vulcan x` for the shipped tools. Bun-only.",
|
|
5
5
|
"homepage": "https://github.com/VENIZIA-AI/vulcan/tree/main/packages/cli",
|
|
6
6
|
"repository": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"test": "NODE_ENV=test bun test --env-file=.env.test"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@venizia/vulcan-atlas": "0.2.0-
|
|
48
|
-
"@venizia/vulcan-okf": "0.2.0-
|
|
47
|
+
"@venizia/vulcan-atlas": "0.2.0-3",
|
|
48
|
+
"@venizia/vulcan-okf": "0.2.0-3",
|
|
49
49
|
"zod": "^4.5.4"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
package/src/doctor/skills.ts
CHANGED
|
@@ -33,13 +33,46 @@ const filesOf = (opts: { directory: string }): string[] =>
|
|
|
33
33
|
const lineCountOf = (opts: { text: string }): number =>
|
|
34
34
|
opts.text.replace(/\n$/, '').split('\n').length;
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const parseYaml = (opts: { text: string }): { value?: unknown; error?: string } => {
|
|
37
|
+
try {
|
|
38
|
+
return { value: Bun.YAML.parse(opts.text) };
|
|
39
|
+
} catch (error) {
|
|
40
|
+
return { error: error instanceof Error ? error.message : String(error) };
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The frontmatter's fields, or why they cannot be read. Bun's YAML error names no line, so the line
|
|
46
|
+
* is the first one at which the block stops parsing - counted in the file, the opening `---` is 1.
|
|
47
|
+
*/
|
|
48
|
+
const frontmatterOf = (opts: {
|
|
49
|
+
text: string;
|
|
50
|
+
}): { data: Record<string, unknown>; error?: string } => {
|
|
37
51
|
const block = FRONTMATTER.exec(opts.text)?.[1];
|
|
38
|
-
const parsed: unknown = block === undefined ? undefined : Bun.YAML.parse(block);
|
|
39
52
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
53
|
+
if (block === undefined) {
|
|
54
|
+
return { data: {} };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const parsed = parseYaml({ text: block });
|
|
58
|
+
|
|
59
|
+
if (parsed.error !== undefined) {
|
|
60
|
+
const blockLines = block.split('\n');
|
|
61
|
+
const failsAt = blockLines.findIndex(
|
|
62
|
+
(_line, index) =>
|
|
63
|
+
parseYaml({ text: blockLines.slice(0, index + 1).join('\n') }).error !== undefined,
|
|
64
|
+
);
|
|
65
|
+
const where = failsAt === -1 ? '' : ` at line ${failsAt + 2}`;
|
|
66
|
+
|
|
67
|
+
return { data: {}, error: `the frontmatter is not valid YAML${where} (${parsed.error})` };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
data:
|
|
72
|
+
typeof parsed.value === 'object' && parsed.value !== null
|
|
73
|
+
? Object.fromEntries(Object.entries(parsed.value))
|
|
74
|
+
: {},
|
|
75
|
+
};
|
|
43
76
|
};
|
|
44
77
|
|
|
45
78
|
/** Every rule one skill directory breaks, each a message naming the file. */
|
|
@@ -53,19 +86,23 @@ export const lintSkill = (opts: { directory: string }): string[] => {
|
|
|
53
86
|
const problems: string[] = [];
|
|
54
87
|
const text = readFileSync(skillFile, 'utf8');
|
|
55
88
|
const frontmatter = frontmatterOf({ text });
|
|
56
|
-
const { name, description } = frontmatter;
|
|
89
|
+
const { name, description } = frontmatter.data;
|
|
57
90
|
|
|
58
|
-
|
|
91
|
+
// One file a project cannot parse is a finding about that file - the other checks still run.
|
|
92
|
+
if (frontmatter.error !== undefined) {
|
|
93
|
+
problems.push(`SKILL.md: ${frontmatter.error}`);
|
|
94
|
+
} else if (typeof name !== 'string' || !NAME_PATTERN.test(name) || RESERVED_NAME.test(name)) {
|
|
59
95
|
problems.push(
|
|
60
96
|
`SKILL.md: name '${String(name)}' - at most 64 characters of a-z, 0-9 and hyphens, never 'claude' or 'anthropic'`,
|
|
61
97
|
);
|
|
62
98
|
}
|
|
63
99
|
|
|
64
100
|
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
101
|
+
frontmatter.error === undefined &&
|
|
102
|
+
(typeof description !== 'string' ||
|
|
103
|
+
description.trim().length === 0 ||
|
|
104
|
+
description.length > MAX_DESCRIPTION ||
|
|
105
|
+
XML_TAG.test(description))
|
|
69
106
|
) {
|
|
70
107
|
problems.push('SKILL.md: the description must be 1-1024 characters with no XML tags');
|
|
71
108
|
}
|
package/src/sync/planner.ts
CHANGED
|
@@ -225,7 +225,27 @@ const planSkillLinks = (opts: { root: string }): ISyncAction[] => {
|
|
|
225
225
|
: { path, status: SyncStatuses.CREATED, apply: link };
|
|
226
226
|
});
|
|
227
227
|
|
|
228
|
-
|
|
228
|
+
// A link into the shipped skills whose skill this VULCAN no longer has (a downgrade, a retired
|
|
229
|
+
// skill) is sync's own and dead: taken back. Any other link or directory stays.
|
|
230
|
+
const shippedRoots = [stableSkills, join(BASE_DIRECTORY, SyncConstants.SKILLS_DIRECTORY)];
|
|
231
|
+
const linked = new Set(sources.map(source => basename(source)));
|
|
232
|
+
const stale = (existsSync(target) ? readdirSync(target) : [])
|
|
233
|
+
.filter(name => !linked.has(name))
|
|
234
|
+
.map(name => join(target, name))
|
|
235
|
+
.filter(
|
|
236
|
+
path =>
|
|
237
|
+
isSymlink({ path }) &&
|
|
238
|
+
!existsSync(path) &&
|
|
239
|
+
shippedRoots.some(root => readlinkSync(path).startsWith(`${root}/`)),
|
|
240
|
+
)
|
|
241
|
+
.map((path): ISyncAction => ({
|
|
242
|
+
path,
|
|
243
|
+
status: SyncStatuses.REMOVED,
|
|
244
|
+
note: 'a shipped skill this version no longer has',
|
|
245
|
+
apply: () => rmSync(path),
|
|
246
|
+
}));
|
|
247
|
+
|
|
248
|
+
return [...links, ...shadowing, ...stale];
|
|
229
249
|
};
|
|
230
250
|
|
|
231
251
|
/** The committed project manifest (Project Contract v1, C1), rendered from the config. */
|