@vertesia/build-tools 1.0.0-dev.20260203.130115Z → 1.0.0-dev.20260225.024852Z

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 (80) hide show
  1. package/README.md +39 -0
  2. package/lib/build-tools.js +1798 -0
  3. package/lib/build-tools.js.map +1 -0
  4. package/lib/cjs/index.js +40 -0
  5. package/lib/cjs/index.js.map +1 -0
  6. package/lib/cjs/package.json +3 -0
  7. package/lib/cjs/parsers/frontmatter.js +25 -0
  8. package/lib/cjs/parsers/frontmatter.js.map +1 -0
  9. package/lib/cjs/plugin.js +150 -0
  10. package/lib/cjs/plugin.js.map +1 -0
  11. package/lib/cjs/presets/index.js +20 -0
  12. package/lib/cjs/presets/index.js.map +1 -0
  13. package/lib/cjs/presets/prompt.js +185 -0
  14. package/lib/cjs/presets/prompt.js.map +1 -0
  15. package/lib/cjs/presets/raw.js +25 -0
  16. package/lib/cjs/presets/raw.js.map +1 -0
  17. package/lib/cjs/presets/skill-collection.js +83 -0
  18. package/lib/cjs/presets/skill-collection.js.map +1 -0
  19. package/lib/cjs/presets/skill.js +272 -0
  20. package/lib/cjs/presets/skill.js.map +1 -0
  21. package/lib/cjs/types.js +6 -0
  22. package/lib/cjs/types.js.map +1 -0
  23. package/lib/cjs/utils/asset-copy.js +61 -0
  24. package/lib/cjs/utils/asset-copy.js.map +1 -0
  25. package/lib/cjs/utils/asset-discovery.js +100 -0
  26. package/lib/cjs/utils/asset-discovery.js.map +1 -0
  27. package/lib/cjs/utils/widget-compiler.js +115 -0
  28. package/lib/cjs/utils/widget-compiler.js.map +1 -0
  29. package/lib/esm/index.js +26 -0
  30. package/lib/esm/index.js.map +1 -0
  31. package/lib/esm/parsers/frontmatter.js +19 -0
  32. package/lib/esm/parsers/frontmatter.js.map +1 -0
  33. package/lib/esm/plugin.js +144 -0
  34. package/lib/esm/plugin.js.map +1 -0
  35. package/lib/esm/presets/index.js +8 -0
  36. package/lib/esm/presets/index.js.map +1 -0
  37. package/lib/esm/presets/prompt.js +181 -0
  38. package/lib/esm/presets/prompt.js.map +1 -0
  39. package/lib/esm/presets/raw.js +22 -0
  40. package/lib/esm/presets/raw.js.map +1 -0
  41. package/lib/esm/presets/skill-collection.js +77 -0
  42. package/lib/esm/presets/skill-collection.js.map +1 -0
  43. package/lib/esm/presets/skill.js +266 -0
  44. package/lib/esm/presets/skill.js.map +1 -0
  45. package/lib/esm/types.js +5 -0
  46. package/lib/esm/types.js.map +1 -0
  47. package/lib/esm/utils/asset-copy.js +54 -0
  48. package/lib/esm/utils/asset-copy.js.map +1 -0
  49. package/lib/esm/utils/asset-discovery.js +94 -0
  50. package/lib/esm/utils/asset-discovery.js.map +1 -0
  51. package/lib/esm/utils/widget-compiler.js +76 -0
  52. package/lib/esm/utils/widget-compiler.js.map +1 -0
  53. package/lib/types/index.d.ts +24 -0
  54. package/lib/types/index.d.ts.map +1 -0
  55. package/lib/types/parsers/frontmatter.d.ts +19 -0
  56. package/lib/types/parsers/frontmatter.d.ts.map +1 -0
  57. package/lib/types/plugin.d.ts +10 -0
  58. package/lib/types/plugin.d.ts.map +1 -0
  59. package/lib/types/presets/index.d.ts +8 -0
  60. package/lib/types/presets/index.d.ts.map +1 -0
  61. package/lib/types/presets/prompt.d.ts +63 -0
  62. package/lib/types/presets/prompt.d.ts.map +1 -0
  63. package/lib/types/presets/raw.d.ts +16 -0
  64. package/lib/types/presets/raw.d.ts.map +1 -0
  65. package/lib/types/presets/skill-collection.d.ts +26 -0
  66. package/lib/types/presets/skill-collection.d.ts.map +1 -0
  67. package/lib/types/presets/skill.d.ts +361 -0
  68. package/lib/types/presets/skill.d.ts.map +1 -0
  69. package/lib/types/types.d.ts +115 -0
  70. package/lib/types/types.d.ts.map +1 -0
  71. package/lib/types/utils/asset-copy.d.ts +20 -0
  72. package/lib/types/utils/asset-copy.d.ts.map +1 -0
  73. package/lib/types/utils/asset-discovery.d.ts +38 -0
  74. package/lib/types/utils/asset-discovery.d.ts.map +1 -0
  75. package/lib/types/utils/widget-compiler.d.ts +15 -0
  76. package/lib/types/utils/widget-compiler.d.ts.map +1 -0
  77. package/package.json +3 -3
  78. package/src/index.ts +1 -0
  79. package/src/presets/index.ts +1 -1
  80. package/src/presets/skill.ts +51 -3
@@ -0,0 +1,272 @@
1
+ "use strict";
2
+ /**
3
+ * Skill transformer preset for markdown files with frontmatter
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.skillTransformer = exports.SkillPropertiesSchema = exports.SkillDefinitionSchema = void 0;
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ const node_fs_1 = require("node:fs");
12
+ const zod_1 = require("zod");
13
+ const frontmatter_js_1 = require("../parsers/frontmatter.js");
14
+ const asset_discovery_js_1 = require("../utils/asset-discovery.js");
15
+ /**
16
+ * Context triggers for auto-injection of skills (for frontmatter validation)
17
+ */
18
+ const SkillContextTriggersFrontmatterSchema = zod_1.z.object({
19
+ keywords: zod_1.z.array(zod_1.z.string()).optional(),
20
+ tool_names: zod_1.z.array(zod_1.z.string()).optional(),
21
+ data_patterns: zod_1.z.array(zod_1.z.string()).optional()
22
+ }).strict();
23
+ /**
24
+ * Context triggers for auto-injection of skills (for output validation)
25
+ */
26
+ const SkillContextTriggersSchema = zod_1.z.object({
27
+ keywords: zod_1.z.array(zod_1.z.string()).optional(),
28
+ tool_names: zod_1.z.array(zod_1.z.string()).optional(),
29
+ data_patterns: zod_1.z.array(zod_1.z.string()).optional()
30
+ }).optional();
31
+ /**
32
+ * Execution configuration for skills that need code execution (for frontmatter validation)
33
+ */
34
+ const SkillExecutionFrontmatterSchema = zod_1.z.object({
35
+ language: zod_1.z.string(),
36
+ packages: zod_1.z.array(zod_1.z.string()).optional(),
37
+ system_packages: zod_1.z.array(zod_1.z.string()).optional(),
38
+ template: zod_1.z.string().optional()
39
+ }).strict();
40
+ /**
41
+ * Execution configuration for skills that need code execution (for output validation)
42
+ */
43
+ const SkillExecutionSchema = zod_1.z.object({
44
+ language: zod_1.z.string(),
45
+ packages: zod_1.z.array(zod_1.z.string()).optional(),
46
+ system_packages: zod_1.z.array(zod_1.z.string()).optional(),
47
+ template: zod_1.z.string().optional()
48
+ }).optional();
49
+ /**
50
+ * Zod schema for skill frontmatter validation
51
+ * This validates the YAML frontmatter before transformation
52
+ * Supports both flat and nested structures
53
+ */
54
+ const SkillFrontmatterSchema = zod_1.z.object({
55
+ // Required fields
56
+ name: zod_1.z.string().min(1, 'Skill name is required'),
57
+ description: zod_1.z.string().min(1, 'Skill description is required'),
58
+ // Optional fields
59
+ title: zod_1.z.string().optional(),
60
+ content_type: zod_1.z.enum(['md', 'jst']).optional(),
61
+ // Flat structure fields (legacy)
62
+ keywords: zod_1.z.array(zod_1.z.string()).optional(),
63
+ tools: zod_1.z.array(zod_1.z.string()).optional(),
64
+ data_patterns: zod_1.z.array(zod_1.z.string()).optional(),
65
+ language: zod_1.z.string().optional(),
66
+ packages: zod_1.z.array(zod_1.z.string()).optional(),
67
+ system_packages: zod_1.z.array(zod_1.z.string()).optional(),
68
+ // Nested structure fields
69
+ context_triggers: SkillContextTriggersFrontmatterSchema.optional(),
70
+ execution: SkillExecutionFrontmatterSchema.optional(),
71
+ related_tools: zod_1.z.array(zod_1.z.string()).optional(),
72
+ input_schema: zod_1.z.object({
73
+ type: zod_1.z.literal('object'),
74
+ properties: zod_1.z.record(zod_1.z.any()).optional(),
75
+ required: zod_1.z.array(zod_1.z.string()).optional()
76
+ }).optional(),
77
+ // Asset fields (auto-discovered but can be overridden)
78
+ scripts: zod_1.z.array(zod_1.z.string()).optional(),
79
+ widgets: zod_1.z.array(zod_1.z.string()).optional()
80
+ }).strict();
81
+ /**
82
+ * MUST be kept in sync with @vertesia/tools-sdk SkillDefinition
83
+ * Zod schema for skill definition
84
+ * This validates the structure of skill objects generated from markdown
85
+ * Matches the SkillDefinition interface from @vertesia/tools-sdk
86
+ *
87
+ * Note: The isEnabled property is not included in this schema because Zod cannot
88
+ * properly validate function signatures. It will be type-checked by TypeScript instead.
89
+ */
90
+ exports.SkillDefinitionSchema = zod_1.z.object({
91
+ name: zod_1.z.string().min(1, 'Skill name is required'),
92
+ title: zod_1.z.string().optional(),
93
+ description: zod_1.z.string().min(1, 'Skill description is required'),
94
+ instructions: zod_1.z.string(),
95
+ content_type: zod_1.z.enum(['md', 'jst']),
96
+ input_schema: zod_1.z.object({
97
+ type: zod_1.z.literal('object'),
98
+ properties: zod_1.z.record(zod_1.z.any()).optional(),
99
+ required: zod_1.z.array(zod_1.z.string()).optional()
100
+ }).optional(),
101
+ context_triggers: SkillContextTriggersSchema,
102
+ execution: SkillExecutionSchema,
103
+ related_tools: zod_1.z.array(zod_1.z.string()).optional(),
104
+ scripts: zod_1.z.array(zod_1.z.string()).optional(),
105
+ widgets: zod_1.z.array(zod_1.z.string()).optional()
106
+ }).passthrough();
107
+ /**
108
+ * Schema for validating properties exported from properties.ts
109
+ * This is a partial schema - allows any subset of SkillDefinition fields
110
+ *
111
+ * Note: Function properties like isEnabled cannot be validated by Zod for their signatures.
112
+ * Zod will only check that they are functions, not their specific parameter/return types.
113
+ * Use TypeScript for proper type checking of function signatures.
114
+ */
115
+ exports.SkillPropertiesSchema = exports.SkillDefinitionSchema.partial().passthrough();
116
+ /**
117
+ * Build a SkillDefinition from frontmatter and markdown content.
118
+ * This mirrors the logic in @vertesia/tools-sdk parseSkillFile function.
119
+ *
120
+ * Supports two frontmatter structures:
121
+ *
122
+ * 1. Flat structure (matches parseSkillFile in tools-sdk):
123
+ * keywords: [...]
124
+ * tools: [...]
125
+ * language: python
126
+ * packages: [...]
127
+ *
128
+ * 2. Nested structure (for more explicit YAML):
129
+ * context_triggers:
130
+ * keywords: [...]
131
+ * tool_names: [...]
132
+ * execution:
133
+ * language: python
134
+ * packages: [...]
135
+ * related_tools: [...]
136
+ *
137
+ * @param frontmatter - Parsed frontmatter object
138
+ * @param instructions - Markdown content (body of the file)
139
+ * @param contentType - Content type ('md' or 'jst')
140
+ * @param widgets - Discovered widget names
141
+ * @param scripts - Discovered script names
142
+ * @returns Skill definition object
143
+ */
144
+ function buildSkillDefinition(frontmatter, instructions, contentType, widgets, scripts) {
145
+ const skill = {
146
+ name: frontmatter.name,
147
+ title: frontmatter.title,
148
+ description: frontmatter.description,
149
+ instructions,
150
+ content_type: contentType,
151
+ widgets: widgets.length > 0 ? widgets : undefined,
152
+ scripts: scripts.length > 0 ? scripts : undefined,
153
+ };
154
+ // Build context triggers - support both flat and nested structure
155
+ // Nested: context_triggers: { keywords: [...], tool_names: [...] }
156
+ // Flat: keywords: [...], tools: [...]
157
+ const contextTriggers = frontmatter.context_triggers;
158
+ const hasNestedTriggers = contextTriggers && typeof contextTriggers === 'object';
159
+ const hasFlatTriggers = frontmatter.keywords || frontmatter.tools || frontmatter.data_patterns;
160
+ if (hasNestedTriggers || hasFlatTriggers) {
161
+ skill.context_triggers = {
162
+ keywords: hasNestedTriggers ? contextTriggers.keywords : frontmatter.keywords,
163
+ tool_names: hasNestedTriggers ? contextTriggers.tool_names : frontmatter.tools,
164
+ data_patterns: hasNestedTriggers ? contextTriggers.data_patterns : frontmatter.data_patterns,
165
+ };
166
+ }
167
+ // Build execution config - support both flat and nested structure
168
+ const execution = frontmatter.execution;
169
+ const hasNestedExecution = execution && typeof execution === 'object';
170
+ const hasFlatExecution = frontmatter.language;
171
+ if (hasNestedExecution || hasFlatExecution) {
172
+ skill.execution = {
173
+ language: hasNestedExecution ? execution.language : frontmatter.language,
174
+ packages: hasNestedExecution ? execution.packages : frontmatter.packages,
175
+ system_packages: hasNestedExecution ? execution.system_packages : frontmatter.system_packages,
176
+ };
177
+ // Extract code template from instructions if present
178
+ const codeBlockMatch = instructions.match(/```(?:python|javascript|typescript|js|ts|py)\n([\s\S]*?)```/);
179
+ if (codeBlockMatch) {
180
+ skill.execution.template = codeBlockMatch[1].trim();
181
+ }
182
+ }
183
+ // Related tools - support both direct field and from tools field
184
+ if (frontmatter.related_tools) {
185
+ skill.related_tools = frontmatter.related_tools;
186
+ }
187
+ else if (frontmatter.tools && !hasNestedTriggers) {
188
+ // If tools is not part of context_triggers, use it as related_tools
189
+ skill.related_tools = frontmatter.tools;
190
+ }
191
+ // Input schema from frontmatter
192
+ if (frontmatter.input_schema) {
193
+ skill.input_schema = frontmatter.input_schema;
194
+ }
195
+ return skill;
196
+ }
197
+ /**
198
+ * Skill transformer preset
199
+ * Transforms markdown files with ?skill suffix OR SKILL.md files into skill definition objects
200
+ *
201
+ * Matches:
202
+ * - Files with ?skill suffix: ./my-skill.md?skill
203
+ * - SKILL.md files: ./my-skill/SKILL.md
204
+ *
205
+ * Runtime Properties:
206
+ * - Supports properties.ts file in skill directory for runtime properties (functions, overrides)
207
+ * - Properties from properties.ts override those from frontmatter
208
+ * - See README.md for detailed usage examples
209
+ *
210
+ * @example
211
+ * ```typescript
212
+ * import skill1 from './my-skill.md?skill';
213
+ * import skill2 from './my-skill/SKILL.md';
214
+ * // Both are SkillDefinition objects
215
+ * ```
216
+ */
217
+ exports.skillTransformer = {
218
+ pattern: /(\.md\?skill$|\/SKILL\.md$)/,
219
+ schema: exports.SkillDefinitionSchema,
220
+ transform: (content, filePath) => {
221
+ const { frontmatter, content: markdown } = (0, frontmatter_js_1.parseFrontmatter)(content);
222
+ // Validate frontmatter first to catch unknown properties
223
+ const frontmatterValidation = SkillFrontmatterSchema.safeParse(frontmatter);
224
+ if (!frontmatterValidation.success) {
225
+ const errors = frontmatterValidation.error.errors
226
+ .map((err) => {
227
+ const pathStr = err.path.length > 0 ? err.path.join('.') : 'frontmatter';
228
+ return ` - ${pathStr}: ${err.message}`;
229
+ })
230
+ .join('\n');
231
+ throw new Error(`Invalid frontmatter in ${filePath}:\n${errors}`);
232
+ }
233
+ // Determine content type from frontmatter or file extension
234
+ const content_type = frontmatter.content_type || 'md';
235
+ // Discover assets (scripts and widgets) in the skill directory
236
+ const assets = (0, asset_discovery_js_1.discoverSkillAssets)(filePath);
237
+ // Build skill definition using the same logic as parseSkillFile in tools-sdk
238
+ const skillData = buildSkillDefinition(frontmatter, markdown, content_type, assets.widgets, assets.scripts);
239
+ // Check if properties.ts exists in the skill directory
240
+ const skillDir = node_path_1.default.dirname(filePath);
241
+ const propertiesPath = node_path_1.default.join(skillDir, 'properties.ts');
242
+ const hasProperties = (0, node_fs_1.existsSync)(propertiesPath);
243
+ // If properties.ts exists, generate custom code with import and merge
244
+ // Rollup will handle transpiling properties.ts to properties.js
245
+ if (hasProperties) {
246
+ const skillDataJson = JSON.stringify(skillData, null, 2);
247
+ const code = `import properties from './properties.js';
248
+
249
+ // Runtime validation for function properties
250
+ if ('isEnabled' in properties && typeof properties.isEnabled !== 'function') {
251
+ throw new Error('properties.isEnabled must be a function, got ' + typeof properties.isEnabled);
252
+ }
253
+
254
+ const skill = ${skillDataJson};
255
+
256
+ export default { ...skill, ...properties };
257
+ `;
258
+ return {
259
+ data: skillData,
260
+ assets: assets.assetFiles,
261
+ widgets: assets.widgetMetadata,
262
+ code
263
+ };
264
+ }
265
+ return {
266
+ data: skillData,
267
+ assets: assets.assetFiles,
268
+ widgets: assets.widgetMetadata
269
+ };
270
+ }
271
+ };
272
+ //# sourceMappingURL=skill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.js","sourceRoot":"","sources":["../../../src/presets/skill.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;AAEH,0DAA6B;AAC7B,qCAAqC;AACrC,6BAAwB;AAExB,8DAA6D;AAC7D,oEAAkE;AAOlE;;GAEG;AACH,MAAM,qCAAqC,GAAG,OAAC,CAAC,MAAM,CAAC;IACnD,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,E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__esModule", { value: true });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ /**
3
+ * Utilities for copying asset files during build
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.copyAssetFile = copyAssetFile;
10
+ exports.copyAssets = copyAssets;
11
+ const node_fs_1 = require("node:fs");
12
+ const node_path_1 = __importDefault(require("node:path"));
13
+ /**
14
+ * Ensure a directory exists, creating it recursively if needed
15
+ */
16
+ function ensureDirectory(dirPath) {
17
+ try {
18
+ (0, node_fs_1.mkdirSync)(dirPath, { recursive: true });
19
+ }
20
+ catch (error) {
21
+ // Ignore if directory already exists
22
+ if (error.code !== 'EEXIST') {
23
+ throw error;
24
+ }
25
+ }
26
+ }
27
+ /**
28
+ * Copy an asset file to its destination
29
+ *
30
+ * @param asset - Asset file information
31
+ * @param assetsRoot - Root directory for assets
32
+ */
33
+ function copyAssetFile(asset, assetsRoot) {
34
+ const destPath = node_path_1.default.join(assetsRoot, asset.destPath);
35
+ const destDir = node_path_1.default.dirname(destPath);
36
+ // Ensure destination directory exists
37
+ ensureDirectory(destDir);
38
+ // Copy file
39
+ try {
40
+ (0, node_fs_1.copyFileSync)(asset.sourcePath, destPath);
41
+ }
42
+ catch (error) {
43
+ throw new Error(`Failed to copy asset from ${asset.sourcePath} to ${destPath}: ${error instanceof Error ? error.message : String(error)}`);
44
+ }
45
+ }
46
+ /**
47
+ * Copy multiple asset files
48
+ *
49
+ * @param assets - Array of asset files to copy
50
+ * @param assetsRoot - Root directory for assets
51
+ * @returns Number of files copied
52
+ */
53
+ function copyAssets(assets, assetsRoot) {
54
+ let copied = 0;
55
+ for (const asset of assets) {
56
+ copyAssetFile(asset, assetsRoot);
57
+ copied++;
58
+ }
59
+ return copied;
60
+ }
61
+ //# sourceMappingURL=asset-copy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-copy.js","sourceRoot":"","sources":["../../../src/utils/asset-copy.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AA0BH,sCAgBC;AASD,gCASC;AA1DD,qCAAkD;AAClD,0DAA6B;AAG7B;;GAEG;AACH,SAAS,eAAe,CAAC,OAAe;IACpC,IAAI,CAAC;QACD,IAAA,mBAAS,EAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,qCAAqC;QACrC,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACrD,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,KAAgB,EAAE,UAAkB;IAC9D,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEvC,sCAAsC;IACtC,eAAe,CAAC,OAAO,CAAC,CAAC;IAEzB,YAAY;IACZ,IAAI,CAAC;QACD,IAAA,sBAAY,EAAC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACX,6BAA6B,KAAK,CAAC,UAAU,OAAO,QAAQ,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CACtH,EAAE,CACL,CAAC;IACN,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,MAAmB,EAAE,UAAkB;IAC9D,IAAI,MAAM,GAAG,CAAC,CAAC;IAEf,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QACjC,MAAM,EAAE,CAAC;IACb,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ /**
3
+ * Utilities for discovering asset files (scripts, widgets) in skill directories
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.discoverSkillAssets = discoverSkillAssets;
10
+ const node_fs_1 = require("node:fs");
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ /**
13
+ * Check if a file exists and is a regular file
14
+ */
15
+ function isFile(filePath) {
16
+ try {
17
+ return (0, node_fs_1.statSync)(filePath).isFile();
18
+ }
19
+ catch {
20
+ return false;
21
+ }
22
+ }
23
+ /**
24
+ * Get all files in a directory (non-recursive)
25
+ */
26
+ function getFilesInDirectory(dirPath) {
27
+ try {
28
+ return (0, node_fs_1.readdirSync)(dirPath).filter(file => {
29
+ const fullPath = node_path_1.default.join(dirPath, file);
30
+ return isFile(fullPath);
31
+ });
32
+ }
33
+ catch {
34
+ return [];
35
+ }
36
+ }
37
+ /**
38
+ * Check if a file is a script file (.js or .py)
39
+ */
40
+ function isScriptFile(fileName) {
41
+ return /\.(js|py)$/.test(fileName);
42
+ }
43
+ /**
44
+ * Check if a file is a widget file (.tsx)
45
+ */
46
+ function isWidgetFile(fileName) {
47
+ return /\.tsx$/.test(fileName);
48
+ }
49
+ /**
50
+ * Extract widget name from .tsx file (remove extension)
51
+ */
52
+ function getWidgetName(fileName) {
53
+ return fileName.replace(/\.tsx$/, '');
54
+ }
55
+ /**
56
+ * Discover assets (scripts and widgets) in a skill directory
57
+ *
58
+ * @param skillFilePath - Absolute path to the skill.md file
59
+ * @param options - Asset discovery options
60
+ * @returns Discovered assets and metadata
61
+ */
62
+ function discoverSkillAssets(skillFilePath, options = {}) {
63
+ const skillDir = node_path_1.default.dirname(skillFilePath);
64
+ const files = getFilesInDirectory(skillDir);
65
+ const scripts = [];
66
+ const widgets = [];
67
+ const widgetMetadata = [];
68
+ const assetFiles = [];
69
+ const scriptsDir = options.scriptsDir || 'scripts';
70
+ for (const file of files) {
71
+ const fullPath = node_path_1.default.join(skillDir, file);
72
+ if (isScriptFile(file)) {
73
+ // Script file (.js or .py)
74
+ scripts.push(file);
75
+ assetFiles.push({
76
+ sourcePath: fullPath,
77
+ destPath: node_path_1.default.join(scriptsDir, file),
78
+ type: 'script'
79
+ });
80
+ }
81
+ else if (isWidgetFile(file)) {
82
+ // Widget file (.tsx)
83
+ const widgetName = getWidgetName(file);
84
+ widgets.push(widgetName);
85
+ widgetMetadata.push({
86
+ name: widgetName,
87
+ path: fullPath
88
+ });
89
+ // Note: We don't add widget .tsx files to assetFiles
90
+ // Widgets are compiled by the plugin if widgetConfig is provided
91
+ }
92
+ }
93
+ return {
94
+ scripts,
95
+ widgets,
96
+ widgetMetadata,
97
+ assetFiles
98
+ };
99
+ }
100
+ //# sourceMappingURL=asset-discovery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-discovery.js","sourceRoot":"","sources":["../../../src/utils/asset-discovery.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAuFH,kDAgDC;AArID,qCAAgD;AAChD,0DAA6B;AA+B7B;;GAEG;AACH,SAAS,MAAM,CAAC,QAAgB;IAC5B,IAAI,CAAC;QACD,OAAO,IAAA,kBAAQ,EAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACL,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,OAAe;IACxC,IAAI,CAAC;QACD,OAAO,IAAA,qBAA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C3B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,UAAU,CAAC,IAAI,CAAC;gBACZ,UAAU,EAAE,QAAQ;gBACpB,QAAQ,EAAE,mBAAI,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC;gBACrC,IAAI,EAAE,QAAQ;aACjB,CAAC,CAAC;QACP,CAAC;aAAM,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5B,qBAAqB;YACrB,MAAM,UAAU,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;YACvC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACzB,cAAc,CAAC,IAAI,CAAC;gBAChB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;aACjB,CAAC,CAAC;YAEH,qDAAqD;YACrD,iEAAiE;QACrE,CAAC;IACL,CAAC;IAED,OAAO;QACH,OAAO;QACP,OAAO;QACP,cAAc;QACd,UAAU;KACb,CAAC;AACN,CAAC"}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ /**
3
+ * Widget compilation utility using Rollup
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.compileWidgets = compileWidgets;
43
+ const rollup_1 = require("rollup");
44
+ const node_path_1 = __importDefault(require("node:path"));
45
+ /**
46
+ * Default external dependencies for widgets
47
+ */
48
+ const DEFAULT_EXTERNALS = [
49
+ 'react',
50
+ 'react-dom',
51
+ 'react/jsx-runtime',
52
+ 'react/jsx-dev-runtime',
53
+ 'react-dom/client'
54
+ ];
55
+ /**
56
+ * Compile widgets using Rollup
57
+ *
58
+ * @param widgets - Array of widget metadata to compile
59
+ * @param outputDir - Directory to write compiled widgets
60
+ * @param config - Widget compilation configuration
61
+ * @returns Number of widgets compiled
62
+ */
63
+ async function compileWidgets(widgets, outputDir, config = {}) {
64
+ if (widgets.length === 0) {
65
+ return 0;
66
+ }
67
+ const { external = DEFAULT_EXTERNALS, tsconfig = './tsconfig.json', typescript: typescriptOptions = {}, minify = false } = config;
68
+ // Build each widget separately to get individual bundles
69
+ const buildPromises = widgets.map(async (widget) => {
70
+ // Dynamically import plugins - use any to bypass TypeScript module resolution issues
71
+ const typescript = (await Promise.resolve(`${'@rollup/plugin-typescript'}`).then(s => __importStar(require(s)))).default;
72
+ const nodeResolve = (await Promise.resolve(`${'@rollup/plugin-node-resolve'}`).then(s => __importStar(require(s)))).default;
73
+ const commonjs = (await Promise.resolve(`${'@rollup/plugin-commonjs'}`).then(s => __importStar(require(s)))).default;
74
+ const plugins = [
75
+ typescript({
76
+ tsconfig,
77
+ declaration: false,
78
+ sourceMap: true,
79
+ ...typescriptOptions
80
+ }),
81
+ nodeResolve({
82
+ browser: true,
83
+ preferBuiltins: false,
84
+ extensions: ['.tsx', '.ts', '.jsx', '.js']
85
+ }),
86
+ commonjs()
87
+ ];
88
+ // Add minification if requested
89
+ if (minify) {
90
+ const { terser } = await Promise.resolve(`${'rollup-plugin-terser'}`).then(s => __importStar(require(s)));
91
+ plugins.push(terser({
92
+ compress: {
93
+ drop_console: false
94
+ }
95
+ }));
96
+ }
97
+ const rollupConfig = {
98
+ input: widget.path,
99
+ output: {
100
+ file: node_path_1.default.join(outputDir, `${widget.name}.js`),
101
+ format: 'es',
102
+ sourcemap: true,
103
+ inlineDynamicImports: true
104
+ },
105
+ external,
106
+ plugins
107
+ };
108
+ const bundle = await (0, rollup_1.rollup)(rollupConfig);
109
+ await bundle.write(rollupConfig.output);
110
+ await bundle.close();
111
+ });
112
+ await Promise.all(buildPromises);
113
+ return widgets.length;
114
+ }
115
+ //# sourceMappingURL=widget-compiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-compiler.js","sourceRoot":"","sources":["../../../src/utils/widget-compiler.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BH,wCAqEC;AA7FD,mCAAiE;AACjE,0DAA6B;AAI7B;;GAEG;AACH,MAAM,iBAAiB,GAAG;IACtB,OAAO;IACP,WAAW;IACX,mBAAmB;IACnB,uBAAuB;IACvB,kBAAkB;CACrB,CAAC;AAEF;;;;;;;GAOG;AACI,KAAK,UAAU,cAAc,CAChC,OAAyB,EACzB,SAAiB,EACjB,SAAuB,EAAE;IAEzB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC,CAAC;IACb,CAAC;IAED,MAAM,EACF,QAAQ,GAAG,iBAAiB,EAC5B,QAAQ,GAA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AE,IAAI;aAC7B;YACD,QAAQ;YACR,OAAO;SACV,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAA,eAAM,EAAC,YAAY,CAAC,CAAC;QAC1C,MAAM,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,MAAa,CAAC,CAAC;QAC/C,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACjC,OAAO,OAAO,CAAC,MAAM,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Vertesia Rollup Import Plugin
3
+ *
4
+ * A flexible Rollup plugin for transforming imports with custom compilers and validation.
5
+ * Supports preset transformers for common use cases (skills, raw files) and custom transformers.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { vertesiaImportPlugin, skillTransformer, rawTransformer } from '@vertesia/build-tools';
10
+ *
11
+ * export default {
12
+ * plugins: [
13
+ * vertesiaImportPlugin({
14
+ * transformers: [skillTransformer, rawTransformer]
15
+ * })
16
+ * ]
17
+ * };
18
+ * ```
19
+ */
20
+ // Core plugin
21
+ export { vertesiaImportPlugin } from './plugin.js';
22
+ // Presets
23
+ export { skillTransformer, rawTransformer, skillCollectionTransformer, promptTransformer, SkillDefinitionSchema, SkillPropertiesSchema, PromptDefinitionSchema, PromptRole, TemplateType } from './presets/index.js';
24
+ // Utilities
25
+ export { parseFrontmatter } from './parsers/frontmatter.js';
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,cAAc;AACd,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAanD,UAAU;AACV,OAAO,EACH,gBAAgB,EAChB,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EAKtB,UAAU,EACV,YAAY,EACf,MAAM,oBAAoB,CAAC;AAE5B,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAA0B,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Frontmatter parser utility using gray-matter
3
+ */
4
+ import matter from 'gray-matter';
5
+ /**
6
+ * Parse YAML frontmatter from markdown content
7
+ *
8
+ * @param content - Raw markdown content with optional frontmatter
9
+ * @returns Parsed frontmatter and content
10
+ */
11
+ export function parseFrontmatter(content) {
12
+ const result = matter(content);
13
+ return {
14
+ frontmatter: result.data,
15
+ content: result.content,
16
+ original: content
17
+ };
18
+ }
19
+ //# sourceMappingURL=frontmatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../../src/parsers/frontmatter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,MAAM,MAAM,aAAa,CAAC;AAajC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC5C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE/B,OAAO;QACH,WAAW,EAAE,MAAM,CAAC,IAAI;QACxB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,QAAQ,EAAE,OAAO;KACpB,CAAC;AACN,CAAC"}