@vertesia/build-tools 1.5.0-dev.20260725.083715Z → 1.5.0-dev.20260804.124748Z

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.
Files changed (59) hide show
  1. package/README.md +297 -266
  2. package/lib/bin/build.js +26 -1
  3. package/lib/bin/build.js.map +1 -1
  4. package/lib/bin/config.d.ts +12 -0
  5. package/lib/bin/config.d.ts.map +1 -1
  6. package/lib/bin/config.js +25 -0
  7. package/lib/bin/config.js.map +1 -1
  8. package/lib/core/skill-markdown/load-catalog.d.ts +30 -0
  9. package/lib/core/skill-markdown/load-catalog.d.ts.map +1 -0
  10. package/lib/core/skill-markdown/load-catalog.js +69 -0
  11. package/lib/core/skill-markdown/load-catalog.js.map +1 -0
  12. package/lib/core/skill-markdown/preprocess.d.ts +127 -0
  13. package/lib/core/skill-markdown/preprocess.d.ts.map +1 -0
  14. package/lib/core/skill-markdown/preprocess.js +455 -0
  15. package/lib/core/skill-markdown/preprocess.js.map +1 -0
  16. package/lib/core/skill-markdown/schema-validator.d.ts +109 -0
  17. package/lib/core/skill-markdown/schema-validator.d.ts.map +1 -0
  18. package/lib/core/skill-markdown/schema-validator.js +420 -0
  19. package/lib/core/skill-markdown/schema-validator.js.map +1 -0
  20. package/lib/core/transformers/index.d.ts +1 -1
  21. package/lib/core/transformers/index.d.ts.map +1 -1
  22. package/lib/core/transformers/index.js +1 -1
  23. package/lib/core/transformers/index.js.map +1 -1
  24. package/lib/core/transformers/skill.d.ts +15 -1
  25. package/lib/core/transformers/skill.d.ts.map +1 -1
  26. package/lib/core/transformers/skill.js +82 -60
  27. package/lib/core/transformers/skill.js.map +1 -1
  28. package/lib/import-transform/detector.d.ts +19 -6
  29. package/lib/import-transform/detector.d.ts.map +1 -1
  30. package/lib/import-transform/detector.js +73 -24
  31. package/lib/import-transform/detector.js.map +1 -1
  32. package/lib/import-transform/index.d.ts.map +1 -1
  33. package/lib/import-transform/index.js +10 -1
  34. package/lib/import-transform/index.js.map +1 -1
  35. package/lib/import-transform/patterns.d.ts +7 -8
  36. package/lib/import-transform/patterns.d.ts.map +1 -1
  37. package/lib/import-transform/patterns.js +7 -8
  38. package/lib/import-transform/patterns.js.map +1 -1
  39. package/lib/index.d.ts +7 -3
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js +9 -3
  42. package/lib/index.js.map +1 -1
  43. package/lib/vite/dev-server.d.ts +10 -0
  44. package/lib/vite/dev-server.d.ts.map +1 -1
  45. package/lib/vite/dev-server.js +36 -4
  46. package/lib/vite/dev-server.js.map +1 -1
  47. package/package.json +9 -12
  48. package/src/bin/build.ts +31 -2
  49. package/src/bin/config.ts +27 -0
  50. package/src/core/skill-markdown/load-catalog.ts +100 -0
  51. package/src/core/skill-markdown/preprocess.ts +632 -0
  52. package/src/core/skill-markdown/schema-validator.ts +517 -0
  53. package/src/core/transformers/index.ts +3 -0
  54. package/src/core/transformers/skill.ts +116 -53
  55. package/src/import-transform/detector.ts +78 -26
  56. package/src/import-transform/index.ts +12 -2
  57. package/src/import-transform/patterns.ts +7 -12
  58. package/src/index.ts +35 -2
  59. package/src/vite/dev-server.ts +52 -4
@@ -5,6 +5,7 @@ import { existsSync } from 'node:fs';
5
5
  import path from 'node:path';
6
6
  import { z } from 'zod';
7
7
  import { parseFrontmatter } from '../parsers/frontmatter.js';
8
+ import { assertSkillMarkdown, preprocessSkillMarkdown, } from '../skill-markdown/preprocess.js';
8
9
  import { discoverSkillAssets } from '../utils/asset-discovery.js';
9
10
  /**
10
11
  * Context triggers for auto-injection of skills (for frontmatter validation)
@@ -64,6 +65,7 @@ const SkillFrontmatterSchema = z
64
65
  // Flat structure fields (legacy)
65
66
  keywords: z.array(z.string()).optional(),
66
67
  tools: z.array(z.string()).optional(),
68
+ supporting_tools: z.array(z.string()).optional(),
67
69
  data_patterns: z.array(z.string()).optional(),
68
70
  language: z.string().optional(),
69
71
  packages: z.array(z.string()).optional(),
@@ -196,9 +198,12 @@ function buildSkillDefinition(frontmatter, instructions, contentType, widgets, s
196
198
  skill.execution.template = codeBlockMatch[1].trim();
197
199
  }
198
200
  }
199
- // Tools unlocked by this skill (from frontmatter `tools:` key)
200
- if (frontmatter.tools) {
201
- skill.tools = frontmatter.tools;
201
+ // Tools unlocked by this skill. `supporting_tools` unlock identically — the split exists only
202
+ // so validation knows which grants the author owes the reader an explanation for. Merged here so
203
+ // no runtime path has to know about the distinction.
204
+ const unlocked = [...(frontmatter.tools ?? []), ...(frontmatter.supporting_tools ?? [])];
205
+ if (unlocked.length > 0) {
206
+ skill.tools = unlocked;
202
207
  }
203
208
  // Input schema from frontmatter
204
209
  if (frontmatter.input_schema) {
@@ -207,57 +212,75 @@ function buildSkillDefinition(frontmatter, instructions, contentType, widgets, s
207
212
  return skill;
208
213
  }
209
214
  /**
210
- * Skill transformer preset
211
- * Transforms markdown files with ?skill suffix OR SKILL.md files into skill definition objects
215
+ * Render the skill body, failing closed when the semantic syntax is used without a catalog.
212
216
  *
213
- * Matches:
214
- * - Files with ?skill suffix: ./my-skill.md?skill
215
- * - SKILL.md files: ./my-skill/SKILL.md
216
- *
217
- * Runtime Properties:
218
- * - Supports properties.ts file in skill directory for runtime properties (functions, overrides)
219
- * - Properties from properties.ts override those from frontmatter
220
- * - See README.md for detailed usage examples
217
+ * Without this guard a package that writes `{@tool x}` but forgets to configure `skillCatalog`
218
+ * would ship the raw construct straight to the model — silently, and looking fine in review.
219
+ */
220
+ function renderSkillMarkdown(markdown, filePath, options) {
221
+ if (options) {
222
+ return assertSkillMarkdown(markdown, options, filePath).markdown;
223
+ }
224
+ const probe = preprocessSkillMarkdown(markdown, { tools: new Set(), skills: new Set() });
225
+ if (probe.references.length > 0 || probe.examples.length > 0 || probe.errors.length > 0) {
226
+ throw new Error(`${filePath} uses {@tool …}, {@skill …} or a tool= example tag, but this build supplies no ` +
227
+ 'skill catalog. Set "vertesia-build.skillCatalog" in package.json to a module exporting ' +
228
+ '{ tools, skills } (and optionally validateExample).');
229
+ }
230
+ return markdown;
231
+ }
232
+ /**
233
+ * Marks a rule as *this* preset rather than any rule that happens to share its pattern.
221
234
  *
222
- * @example
223
- * ```typescript
224
- * import skill1 from './my-skill.md?skill';
225
- * import skill2 from './my-skill/SKILL.md';
226
- * // Both are SkillDefinition objects
227
- * ```
235
+ * The CLI swaps in a catalog-bound skill transformer; matching on `pattern.source` would also
236
+ * replace an unrelated custom transformer registered for the same files.
228
237
  */
229
- export const skillTransformer = {
230
- pattern: /(\.md\?skill$|\/SKILL\.md$)/,
231
- schema: SkillDefinitionSchema,
232
- transform: (content, filePath) => {
233
- const { frontmatter, content: markdown } = parseFrontmatter(content);
234
- // Validate frontmatter first to catch unknown properties
235
- const frontmatterValidation = SkillFrontmatterSchema.safeParse(frontmatter);
236
- if (!frontmatterValidation.success) {
237
- const errors = frontmatterValidation.error.issues
238
- .map((err) => {
239
- const pathStr = err.path.length > 0 ? err.path.join('.') : 'frontmatter';
240
- return ` - ${pathStr}: ${err.message}`;
241
- })
242
- .join('\n');
243
- throw new Error(`Invalid frontmatter in ${filePath}:\n${errors}`);
244
- }
245
- const validatedFrontmatter = frontmatterValidation.data;
246
- // Determine content type from frontmatter or file extension
247
- const content_type = validatedFrontmatter.content_type || 'md';
248
- // Discover assets (scripts and widgets) in the skill directory
249
- const assets = discoverSkillAssets(filePath);
250
- // Build skill definition using the same logic as parseSkillFile in tools-sdk
251
- const skillData = buildSkillDefinition(validatedFrontmatter, markdown, content_type, assets.widgets, assets.scripts);
252
- // Check if properties.ts exists in the skill directory
253
- const skillDir = path.dirname(filePath);
254
- const propertiesPath = path.join(skillDir, 'properties.ts');
255
- const hasProperties = existsSync(propertiesPath);
256
- // If properties.ts exists, generate custom code with import and merge
257
- // Rollup will handle transpiling properties.ts to properties.js
258
- if (hasProperties) {
259
- const skillDataJson = JSON.stringify(skillData, null, 2);
260
- const code = `import properties from './properties.js';
238
+ const SKILL_TRANSFORMER = Symbol.for('@vertesia/build-tools:skillTransformer');
239
+ /** True when `rule` is a skill transformer produced by `createSkillTransformer`. */
240
+ export function isSkillTransformer(rule) {
241
+ return rule[SKILL_TRANSFORMER] === true;
242
+ }
243
+ /** Build a skill transformer bound to a specific catalog. `skillTransformer` is the unbound one. */
244
+ export function createSkillTransformer(config = {}) {
245
+ return {
246
+ [SKILL_TRANSFORMER]: true,
247
+ pattern: /(\.md\?skill$|\/SKILL\.md$)/,
248
+ schema: SkillDefinitionSchema,
249
+ transform: (content, filePath) => transformSkill(content, filePath, config),
250
+ };
251
+ }
252
+ export const skillTransformer = createSkillTransformer();
253
+ function transformSkill(content, filePath, config) {
254
+ const { frontmatter, content: rawMarkdown } = parseFrontmatter(content);
255
+ const markdown = renderSkillMarkdown(rawMarkdown, filePath, config.markdown);
256
+ // Validate frontmatter first to catch unknown properties
257
+ const frontmatterValidation = SkillFrontmatterSchema.safeParse(frontmatter);
258
+ if (!frontmatterValidation.success) {
259
+ const errors = frontmatterValidation.error.issues
260
+ .map((err) => {
261
+ const pathStr = err.path.length > 0 ? err.path.join('.') : 'frontmatter';
262
+ return ` - ${pathStr}: ${err.message}`;
263
+ })
264
+ .join('\n');
265
+ throw new Error(`Invalid frontmatter in ${filePath}:\n${errors}`);
266
+ }
267
+ const validatedFrontmatter = frontmatterValidation.data;
268
+ // Determine content type from frontmatter or file extension
269
+ const content_type = validatedFrontmatter.content_type || 'md';
270
+ // Discover assets (scripts and widgets) in the skill directory
271
+ const assets = discoverSkillAssets(filePath);
272
+ // Build skill definition using the same logic as parseSkillFile in tools-sdk
273
+ const skillData = buildSkillDefinition(validatedFrontmatter, markdown, content_type, assets.widgets, assets.scripts);
274
+ // Check if properties.ts exists in the skill directory
275
+ const skillDir = path.dirname(filePath);
276
+ const propertiesPath = path.join(skillDir, 'properties.ts');
277
+ const hasProperties = existsSync(propertiesPath);
278
+ // If properties.ts exists, generate custom code with import and merge.
279
+ // `tsc` has already emitted properties.js beside this chunk — the pipeline runs after it and
280
+ // never compiles TypeScript itself — so the generated module can import './properties.js'.
281
+ if (hasProperties) {
282
+ const skillDataJson = JSON.stringify(skillData, null, 2);
283
+ const code = `import properties from './properties.js';
261
284
 
262
285
  // Runtime validation for function properties
263
286
  if ('isEnabled' in properties && typeof properties.isEnabled !== 'function') {
@@ -268,18 +291,17 @@ const skill = ${skillDataJson};
268
291
 
269
292
  export default { ...skill, ...properties };
270
293
  `;
271
- return {
272
- data: skillData,
273
- assets: assets.assetFiles,
274
- widgets: assets.widgetMetadata,
275
- code,
276
- };
277
- }
278
294
  return {
279
295
  data: skillData,
280
296
  assets: assets.assetFiles,
281
297
  widgets: assets.widgetMetadata,
298
+ code,
282
299
  };
283
- },
284
- };
300
+ }
301
+ return {
302
+ data: skillData,
303
+ assets: assets.assetFiles,
304
+ widgets: assets.widgetMetadata,
305
+ };
306
+ }
285
307
  //# sourceMappingURL=skill.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"skill.js","sourceRoot":"","sources":["../../../src/core/transformers/skill.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAOlE;;GAEG;AACH,MAAM,qCAAqC,GAAG,CAAC;KAC1C,MAAM,CAAC;IACJ,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1C,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAChD,CAAC;KACD,MAAM,EA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ACzB,OAAO,EAAE,MAAM,CAAC,cAAc;YAC9B,IAAI;SACP,CAAC;IACN,CAAC;IAED,OAAO;QACH,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,MAAM,CAAC,UAAU;QACzB,OAAO,EAAE,MAAM,CAAC,cAAc;KACjC,CAAC;AACN,CAAC"}
@@ -1,11 +1,16 @@
1
1
  /**
2
- * Finds Vertesia query-style import specifiers inside a JavaScript source
3
- * file and maps each one to the transformer that should handle it.
2
+ * Finds Vertesia query-style import specifiers in a JavaScript source file and maps each one to
3
+ * the transformer that should handle it.
4
4
  *
5
- * The detector is regex-based and works on `tsc` output where import
6
- * specifiers are preserved literally. It identifies any string literal that
7
- * contains a known marker (`?skill`, `?raw`, …, or `/SKILL.md`) and then
8
- * matches the specifier against the configured transformer patterns.
5
+ * Detection uses a real ESM lexer (`es-module-lexer`) rather than a regex over string literals,
6
+ * because a regex models the wrong thing: it matches anything that *looks* like a specifier. A doc
7
+ * comment mentioning `` `?skill` ``, or an ordinary constant such as
8
+ * `const example = './example/SKILL.md'`, were both detected as imports — the former resolved to a
9
+ * directory and killed the build with `EISDIR`.
10
+ *
11
+ * Lexing the module handles comments, template literals, regex literals, static imports,
12
+ * re-exports (`export … from`) and dynamic `import()` in one pass, and still yields the source
13
+ * offsets the rewriter needs.
9
14
  */
10
15
  import type { TransformerRule } from '../core/types.js';
11
16
  export interface ImportOccurrence {
@@ -20,5 +25,13 @@ export interface ImportOccurrence {
20
25
  /** The quote character used in the source. */
21
26
  quote: "'" | '"' | '`';
22
27
  }
28
+ /**
29
+ * Throws if `content` cannot be lexed.
30
+ *
31
+ * Deliberately not caught: the scanner only reaches this for files that already contain a
32
+ * transformation marker, so a swallowed lexer failure would mean a real `?skill` import is left
33
+ * untransformed and the raw specifier ships to the runtime. A build that cannot read a file must
34
+ * stop, not quietly emit less. `transformImports` adds the file path to the message.
35
+ */
23
36
  export declare function detectQueryImports(content: string, transformers: TransformerRule[]): ImportOccurrence[];
24
37
  //# sourceMappingURL=detector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/import-transform/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,MAAM,WAAW,gBAAgB;IAC7B,2DAA2D;IAC3D,WAAW,EAAE,eAAe,CAAC;IAE7B,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAElB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IAEnB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IAEjB,8CAA8C;IAC9C,KAAK,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC1B;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,gBAAgB,EAAE,CAyBvG"}
1
+ {"version":3,"file":"detector.d.ts","sourceRoot":"","sources":["../../src/import-transform/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC7B,2DAA2D;IAC3D,WAAW,EAAE,eAAe,CAAC;IAE7B,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAElB,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IAEnB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAC;IAEjB,8CAA8C;IAC9C,KAAK,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAC1B;AAoCD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,gBAAgB,EAAE,CA8BvG"}
@@ -1,33 +1,82 @@
1
1
  /**
2
- * Finds Vertesia query-style import specifiers inside a JavaScript source
3
- * file and maps each one to the transformer that should handle it.
2
+ * Finds Vertesia query-style import specifiers in a JavaScript source file and maps each one to
3
+ * the transformer that should handle it.
4
4
  *
5
- * The detector is regex-based and works on `tsc` output where import
6
- * specifiers are preserved literally. It identifies any string literal that
7
- * contains a known marker (`?skill`, `?raw`, …, or `/SKILL.md`) and then
8
- * matches the specifier against the configured transformer patterns.
5
+ * Detection uses a real ESM lexer (`es-module-lexer`) rather than a regex over string literals,
6
+ * because a regex models the wrong thing: it matches anything that *looks* like a specifier. A doc
7
+ * comment mentioning `` `?skill` ``, or an ordinary constant such as
8
+ * `const example = './example/SKILL.md'`, were both detected as imports — the former resolved to a
9
+ * directory and killed the build with `EISDIR`.
10
+ *
11
+ * Lexing the module handles comments, template literals, regex literals, static imports,
12
+ * re-exports (`export … from`) and dynamic `import()` in one pass, and still yields the source
13
+ * offsets the rewriter needs.
14
+ */
15
+ import { initSync, parse } from 'es-module-lexer';
16
+ /**
17
+ * `es-module-lexer` is WASM-backed and must be initialised before the first `parse`.
18
+ *
19
+ * Initialised synchronously and once, so `detectQueryImports` stays a plain function — making it
20
+ * async would push a promise through the scanner and every caller for no benefit.
21
+ */
22
+ let initialised = false;
23
+ function ensureInitialised() {
24
+ if (!initialised) {
25
+ initSync();
26
+ initialised = true;
27
+ }
28
+ }
29
+ const QUOTES = new Set(["'", '"', '`']);
30
+ /**
31
+ * Locate the quotes around a specifier.
32
+ *
33
+ * The lexer reports the specifier *without* surrounding quotes for static imports but *with* them
34
+ * for dynamic ones, and the rewriter splices over the quoted range — so normalise here rather than
35
+ * making every caller know the difference.
36
+ */
37
+ function quoteBounds(source, start, end) {
38
+ if (QUOTES.has(source[start - 1]) && QUOTES.has(source[end])) {
39
+ return { quoteStart: start - 1, quoteEnd: end + 1 };
40
+ }
41
+ if (QUOTES.has(source[start]) && QUOTES.has(source[end - 1])) {
42
+ return { quoteStart: start, quoteEnd: end };
43
+ }
44
+ // A dynamic import whose specifier is a computed expression: nothing to rewrite.
45
+ return undefined;
46
+ }
47
+ /**
48
+ * Throws if `content` cannot be lexed.
49
+ *
50
+ * Deliberately not caught: the scanner only reaches this for files that already contain a
51
+ * transformation marker, so a swallowed lexer failure would mean a real `?skill` import is left
52
+ * untransformed and the raw specifier ships to the runtime. A build that cannot read a file must
53
+ * stop, not quietly emit less. `transformImports` adds the file path to the message.
9
54
  */
10
- import { QUERY_STRING_LITERAL } from './patterns.js';
11
55
  export function detectQueryImports(content, transformers) {
56
+ ensureInitialised();
57
+ const [imports] = parse(content);
12
58
  const occurrences = [];
13
- QUERY_STRING_LITERAL.lastIndex = 0;
14
- let match;
15
- // biome-ignore lint/suspicious/noAssignInExpressions: regex .exec() loop
16
- while ((match = QUERY_STRING_LITERAL.exec(content)) !== null) {
17
- const quote = match[1];
18
- const specifier = match[2];
19
- for (const transformer of transformers) {
20
- if (transformer.pattern.test(specifier)) {
21
- occurrences.push({
22
- transformer,
23
- specifier,
24
- quoteStart: match.index,
25
- quoteEnd: match.index + match[0].length,
26
- quote,
27
- });
28
- break;
29
- }
59
+ for (const entry of imports) {
60
+ const specifier = entry.n;
61
+ if (specifier === undefined) {
62
+ // `import.meta`, or a dynamic import with a non-literal specifier.
63
+ continue;
64
+ }
65
+ const bounds = quoteBounds(content, entry.s, entry.e);
66
+ if (!bounds) {
67
+ continue;
68
+ }
69
+ const transformer = transformers.find((rule) => rule.pattern.test(specifier));
70
+ if (!transformer) {
71
+ continue;
30
72
  }
73
+ occurrences.push({
74
+ transformer,
75
+ specifier,
76
+ quoteStart: bounds.quoteStart,
77
+ quoteEnd: bounds.quoteEnd,
78
+ quote: content[bounds.quoteStart],
79
+ });
31
80
  }
32
81
  return occurrences;
33
82
  }
@@ -1 +1 @@
1
- {"version":3,"file":"detector.js","sourceRoot":"","sources":["../../src/import-transform/detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAmBrD,MAAM,UAAU,kBAAkB,CAAC,OAAe,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,CAAC,SAAS,CAAC,CAAC,CAAC;QAC9E,IAAI,CAAC,WAAW,EAAE,CAAC;YACf,SAAS;QACb,CAAC;QACD,WAAW,CAAC,IAAI,CAAC;YACb,WAAW;YACX,SAAS;YACT,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,CAAoB;SACvD,CAAC,CAAC;IACP,CAAC;IAED,OAAO,WAAW,CAAC;AACvB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/import-transform/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAUnE,MAAM,WAAW,uBAAuB;IACpC,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IAEf,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;IAEf,6BAA6B;IAC7B,YAAY,EAAE,eAAe,EAAE,CAAC;IAEhC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAE3B,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACvC;AAED,MAAM,WAAW,sBAAsB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAOD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CA2FrG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/import-transform/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAGH,OAAO,EAAkB,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACxF,OAAO,KAAK,EAAa,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAUnE,MAAM,WAAW,uBAAuB;IACpC,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IAEf,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;IAEf,6BAA6B;IAC7B,YAAY,EAAE,eAAe,EAAE,CAAC;IAEhC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAE3B,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,6DAA6D;IAC7D,YAAY,CAAC,EAAE,oBAAoB,CAAC;CACvC;AAED,MAAM,WAAW,sBAAsB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAOD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAqGrG"}
@@ -48,7 +48,16 @@ export async function transformImports(opts) {
48
48
  let filesProcessed = 0;
49
49
  while (workQueue.length > 0) {
50
50
  const file = workQueue.shift();
51
- const occurrences = detectQueryImports(file.content, transformers);
51
+ let occurrences;
52
+ try {
53
+ occurrences = detectQueryImports(file.content, transformers);
54
+ }
55
+ catch (error) {
56
+ // Fail closed. This file reached the queue because it contains a transformation
57
+ // marker, so a lexer failure means a real import may go untransformed — the raw
58
+ // specifier would then ship to the runtime.
59
+ throw new Error(`Failed to parse imports in ${file.path}: ${error.message}`);
60
+ }
52
61
  if (occurrences.length === 0) {
53
62
  continue;
54
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/import-transform/index.ts"],"names":[],"mappings":"AAAA;;;;;;;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O,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC"}
@@ -1,7 +1,11 @@
1
1
  /**
2
- * Shared regex fragments used by the scanner, detector, and orchestrator to
3
- * identify Vertesia query-style imports. Keep these in sync with the
4
- * `pattern` field of each transformer in `core/transformers/`.
2
+ * Shared regex fragments used by the scanner and orchestrator to cheaply pre-filter files that
3
+ * could contain Vertesia query-style imports. Keep these in sync with the `pattern` field of each
4
+ * transformer in `core/transformers/`.
5
+ *
6
+ * These are a *sniff* only. Deciding what is actually an import is the detector's job, and it
7
+ * lexes the module rather than matching string literals — a literal-matching regex used to live
8
+ * here too, and it could not tell an import from a comment or a constant.
5
9
  */
6
10
  /**
7
11
  * Suffix tokens for `?xxx` query imports.
@@ -17,9 +21,4 @@ export declare const BARE_FILENAMES: readonly ["SKILL.md", "TEMPLATE.md"];
17
21
  * Cheap regex check before invoking the more expensive detector.
18
22
  */
19
23
  export declare const SNIFF_PATTERN: RegExp;
20
- /**
21
- * Matches a quoted string literal whose contents end with a query marker.
22
- * Capture group 1 is the quote character; capture group 2 is the specifier.
23
- */
24
- export declare const QUERY_STRING_LITERAL: RegExp;
25
24
  //# sourceMappingURL=patterns.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/import-transform/patterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,wEAAyE,CAAC;AAErG;;;GAGG;AACH,eAAO,MAAM,cAAc,sCAAuC,CAAC;AAKnE;;;GAGG;AACH,eAAO,MAAM,aAAa,QAA8D,CAAC;AAEzF;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAGhC,CAAC"}
1
+ {"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/import-transform/patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,wEAAyE,CAAC;AAErG;;;GAGG;AACH,eAAO,MAAM,cAAc,sCAAuC,CAAC;AAKnE;;;GAGG;AACH,eAAO,MAAM,aAAa,QAA8D,CAAC"}
@@ -1,7 +1,11 @@
1
1
  /**
2
- * Shared regex fragments used by the scanner, detector, and orchestrator to
3
- * identify Vertesia query-style imports. Keep these in sync with the
4
- * `pattern` field of each transformer in `core/transformers/`.
2
+ * Shared regex fragments used by the scanner and orchestrator to cheaply pre-filter files that
3
+ * could contain Vertesia query-style imports. Keep these in sync with the `pattern` field of each
4
+ * transformer in `core/transformers/`.
5
+ *
6
+ * These are a *sniff* only. Deciding what is actually an import is the detector's job, and it
7
+ * lexes the module rather than matching string literals — a literal-matching regex used to live
8
+ * here too, and it could not tell an import from a comment or a constant.
5
9
  */
6
10
  /**
7
11
  * Suffix tokens for `?xxx` query imports.
@@ -19,9 +23,4 @@ const BARE_GROUP = BARE_FILENAMES.map((name) => `\\/${name.replace('.', '\\.')}`
19
23
  * Cheap regex check before invoking the more expensive detector.
20
24
  */
21
25
  export const SNIFF_PATTERN = new RegExp(`\\?(?:${QUERY_GROUP})\\b|(?:${BARE_GROUP})\\b`);
22
- /**
23
- * Matches a quoted string literal whose contents end with a query marker.
24
- * Capture group 1 is the quote character; capture group 2 is the specifier.
25
- */
26
- export const QUERY_STRING_LITERAL = new RegExp(`(['"\`])([^'"\`]*?(?:\\?(?:${QUERY_GROUP})|${BARE_GROUP})[^'"\`]*)\\1`, 'g');
27
26
  //# sourceMappingURL=patterns.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../src/import-transform/patterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAErG;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,UAAU,EAAE,aA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21
  * @example
22
22
  * ```typescript
23
- * import { transformImports } from '@vertesia/build-tools';
23
+ * import { resolveTransformerNames, transformImports } from '@vertesia/build-tools';
24
24
  *
25
25
  * await transformImports({
26
26
  * libDir: './lib',
27
27
  * srcDir: './src',
28
- * transformers: ['skill', 'raw'],
28
+ * // Resolved rules, not names — use resolveTransformerNames to go from one to the other.
29
+ * transformers: resolveTransformerNames(['skill', 'raw']),
29
30
  * assetsDir: './dist',
30
31
  * });
31
32
  * ```
32
33
  */
33
34
  export { compileWidget, compileWidgets, type WidgetCompilerConfig, type WidgetInput, } from './core/compilers/widget.js';
34
35
  export { type FrontmatterResult, parseFrontmatter } from './core/parsers/frontmatter.js';
35
- export { type PromptContentType, type PromptDefinition, PromptDefinitionSchema, PromptRole, promptTransformer, type RenderingTemplateDefinition, RenderingTemplateDefinitionSchema, rawTransformer, type SkillContentType, type SkillDefinition, SkillDefinitionSchema, SkillPropertiesSchema, skillCollectionTransformer, skillTransformer, TemplateType, templateCollectionTransformer, templateTransformer, } from './core/transformers/index.js';
36
+ export { loadSkillCatalog, readPackageJson, } from './core/skill-markdown/load-catalog.js';
37
+ export { assertSkillMarkdown, DEFAULT_SKILL_TOOL_PREFIX, type PreprocessSkillMarkdownOptions, type PreprocessSkillMarkdownResult, preprocessSkillMarkdown, type SkillExample, type SkillReference, type SkillReferenceKind, } from './core/skill-markdown/preprocess.js';
38
+ export { checkDispatchDescriptor, createSchemaExampleValidator, createSchemaFieldValidator, type DispatchResolution, nodesAtPath, pairDispatchedInputs, resolveDispatchedNames, schemaNodeAtPath, type ToolDispatchDescriptor, type ToolSchemaEntry, toolNamesAtPath, } from './core/skill-markdown/schema-validator.js';
39
+ export { createSkillTransformer, isSkillTransformer, type PromptContentType, type PromptDefinition, PromptDefinitionSchema, PromptRole, promptTransformer, type RenderingTemplateDefinition, RenderingTemplateDefinitionSchema, rawTransformer, type SkillContentType, type SkillDefinition, SkillDefinitionSchema, SkillPropertiesSchema, type SkillTransformerConfig, skillCollectionTransformer, skillTransformer, TemplateType, templateCollectionTransformer, templateTransformer, } from './core/transformers/index.js';
36
40
  export type { AssetFile, TransformerPreset, TransformerRule, TransformFunction, TransformResult, } from './core/types.js';
37
41
  export { BUILTIN_TRANSFORMER_NAMES, BUILTIN_TRANSFORMERS, resolveTransformerNames, } from './import-transform/builtins.js';
38
42
  export { type TransformImportsOptions, type TransformImportsResult, transformImports, } from './import-transform/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EACH,aAAa,EACb,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,WAAW,GACnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,KAAK,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEzF,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EACjB,KAAK,2BAA2B,EAChC,iCAAiC,EACjC,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,6BAA6B,EAC7B,mBAAmB,GACtB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACR,SAAS,EACT,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,eAAe,GAClB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,GAC1B,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACH,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,gBAAgB,GACnB,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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AC5B,KAAK,sBAAsB,EAC3B,gBAAgB,GACnB,MAAM,6BAA6B,CAAC"}
package/lib/index.js CHANGED
@@ -20,12 +20,13 @@
20
20
  *
21
21
  * @example
22
22
  * ```typescript
23
- * import { transformImports } from '@vertesia/build-tools';
23
+ * import { resolveTransformerNames, transformImports } from '@vertesia/build-tools';
24
24
  *
25
25
  * await transformImports({
26
26
  * libDir: './lib',
27
27
  * srcDir: './src',
28
- * transformers: ['skill', 'raw'],
28
+ * // Resolved rules, not names — use resolveTransformerNames to go from one to the other.
29
+ * transformers: resolveTransformerNames(['skill', 'raw']),
29
30
  * assetsDir: './dist',
30
31
  * });
31
32
  * ```
@@ -34,8 +35,13 @@
34
35
  export { compileWidget, compileWidgets, } from './core/compilers/widget.js';
35
36
  // Parsers
36
37
  export { parseFrontmatter } from './core/parsers/frontmatter.js';
38
+ export { loadSkillCatalog, readPackageJson, } from './core/skill-markdown/load-catalog.js';
39
+ // Skill markdown preprocessor: `{@tool …}` / `{@skill …}` resolution and tagged-example
40
+ // validation. Pure — the consuming build supplies the catalog and the schema validator.
41
+ export { assertSkillMarkdown, DEFAULT_SKILL_TOOL_PREFIX, preprocessSkillMarkdown, } from './core/skill-markdown/preprocess.js';
42
+ export { checkDispatchDescriptor, createSchemaExampleValidator, createSchemaFieldValidator, nodesAtPath, pairDispatchedInputs, resolveDispatchedNames, schemaNodeAtPath, toolNamesAtPath, } from './core/skill-markdown/schema-validator.js';
37
43
  // Transformers (the pure transformation functions)
38
- export { PromptDefinitionSchema, PromptRole, promptTransformer, RenderingTemplateDefinitionSchema, rawTransformer, SkillDefinitionSchema, SkillPropertiesSchema, skillCollectionTransformer, skillTransformer, TemplateType, templateCollectionTransformer, templateTransformer, } from './core/transformers/index.js';
44
+ export { createSkillTransformer, isSkillTransformer, PromptDefinitionSchema, PromptRole, promptTransformer, RenderingTemplateDefinitionSchema, rawTransformer, SkillDefinitionSchema, SkillPropertiesSchema, skillCollectionTransformer, skillTransformer, TemplateType, templateCollectionTransformer, templateTransformer, } from './core/transformers/index.js';
39
45
  // CLI-friendly transformer name registry
40
46
  export { BUILTIN_TRANSFORMER_NAMES, BUILTIN_TRANSFORMERS, resolveTransformerNames, } from './import-transform/builtins.js';
41
47
  // Standalone import transformer (tsc → vertesia-build pipeline)
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,+BAA+B;AAC/B,OAAO,EACH,aAAa,EACb,cAAc,GAGjB,MAAM,4BAA4B,CAAC;AACpC,UAAU;AACV,OAAO,EAA0B,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACzF,mDAAmD;AACnD,OAAO,EAGH,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EAEjB,iCAAiC,EACjC,cAAc,EAGd,qBAAqB,EACrB,qBAAqB,EACrB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,6BAA6B,EAC7B,mBAAmB,GACtB,MAAM,8BAA8B,CAAC;AAStC,yCAAyC;AACzC,OAAO,EACH,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,gEAAgE;AAChE,OAAO,EAGH,gBAAgB,GACnB,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,+BAA+B;AAC/B,OAAO,EACH,aAAa,EACb,cAAc,GAGjB,MAAM,4BAA4B,CAAC;AACpC,UAAU;AACV,OAAO,EAA0B,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACzF,OAAO,EACH,gBAAgB,EAChB,eAAe,GAClB,MAAM,uCAAuC,CAAC;AAC/C,wFAAwF;AACxF,wFAAwF;AACxF,OAAO,EACH,mBAAmB,EACnB,yBAAyB,EAGzB,uBAAuB,GAI1B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,uBAAuB,EACvB,4BAA4B,EAC5B,0BAA0B,EAE1B,WAAW,EACX,oBAAoB,EACpB,sBAAsB,EACtB,gBAAgB,EAGhB,eAAe,GAClB,MAAM,2CAA2C,CAAC;AACnD,mDAAmD;AACnD,OAAO,EACH,sBAAsB,EACtB,kBAAkB,EAGlB,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EAEjB,iCAAiC,EACjC,cAAc,EAGd,qBAAqB,EACrB,qBAAqB,EAErB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,6BAA6B,EAC7B,mBAAmB,GACtB,MAAM,8BAA8B,CAAC;AAStC,yCAAyC;AACzC,OAAO,EACH,yBAAyB,EACzB,oBAAoB,EACpB,uBAAuB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,gEAAgE;AAChE,OAAO,EAGH,gBAAgB,GACnB,MAAM,6BAA6B,CAAC"}
@@ -30,6 +30,7 @@
30
30
  * ```
31
31
  */
32
32
  import type { Plugin } from 'vite';
33
+ import type { PreprocessSkillMarkdownOptions } from '../core/skill-markdown/preprocess.js';
33
34
  export interface VertesiaDevServerPluginOptions {
34
35
  /**
35
36
  * Names of transformers to activate. Defaults to all built-ins:
@@ -37,6 +38,15 @@ export interface VertesiaDevServerPluginOptions {
37
38
  * Pass a subset to disable transformers you don't use.
38
39
  */
39
40
  transformers?: readonly string[];
41
+ /**
42
+ * Catalog used to resolve `{@tool …}` / `{@skill …}` and validate `tool=`-tagged examples.
43
+ *
44
+ * Defaults to the module named by `vertesia-build.skillCatalog` in the package.json of the
45
+ * Vite root, which is the same key the CLI reads — so dev, test and build agree without the
46
+ * setting being written twice. Pass a path to override it, or an object to supply a catalog
47
+ * directly (useful in tests).
48
+ */
49
+ skillCatalog?: string | PreprocessSkillMarkdownOptions | false;
40
50
  }
41
51
  export declare function vertesiaDevServerPlugin(options?: VertesiaDevServerPluginOptions): Plugin;
42
52
  //# sourceMappingURL=dev-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/vite/dev-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,MAAM,WAAW,8BAA8B;IAC3C;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAED,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,8BAAmC,GAAG,MAAM,CAoE5F"}
1
+ {"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/vite/dev-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAEnC,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,sCAAsC,CAAC;AAK3F,MAAM,WAAW,8BAA8B;IAC3C;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEjC;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,8BAA8B,GAAG,KAAK,CAAC;CAClE;AAED,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,8BAAmC,GAAG,MAAM,CAuG5F"}