@vertesia/build-tools 1.0.0-dev.20260128.144200 → 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.
- package/README.md +39 -0
- package/lib/build-tools.js +54 -6
- package/lib/build-tools.js.map +1 -1
- package/lib/cjs/index.js +2 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/presets/index.js +2 -1
- package/lib/cjs/presets/index.js.map +1 -1
- package/lib/cjs/presets/skill.js +52 -4
- package/lib/cjs/presets/skill.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/presets/index.js +1 -1
- package/lib/esm/presets/index.js.map +1 -1
- package/lib/esm/presets/skill.js +48 -3
- package/lib/esm/presets/skill.js.map +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/presets/index.d.ts +1 -1
- package/lib/types/presets/index.d.ts.map +1 -1
- package/lib/types/presets/skill.d.ts +253 -31
- package/lib/types/presets/skill.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/presets/index.ts +1 -1
- package/src/presets/skill.ts +51 -3
|
@@ -12,6 +12,9 @@ export type SkillContentType = 'md' | 'jst';
|
|
|
12
12
|
* Zod schema for skill definition
|
|
13
13
|
* This validates the structure of skill objects generated from markdown
|
|
14
14
|
* Matches the SkillDefinition interface from @vertesia/tools-sdk
|
|
15
|
+
*
|
|
16
|
+
* Note: The isEnabled property is not included in this schema because Zod cannot
|
|
17
|
+
* properly validate function signatures. It will be type-checked by TypeScript instead.
|
|
15
18
|
*/
|
|
16
19
|
export declare const SkillDefinitionSchema: z.ZodObject<{
|
|
17
20
|
name: z.ZodString;
|
|
@@ -64,57 +67,271 @@ export declare const SkillDefinitionSchema: z.ZodObject<{
|
|
|
64
67
|
related_tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
65
68
|
scripts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
66
69
|
widgets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
67
|
-
}, "
|
|
68
|
-
name:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
instructions:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
70
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
71
|
+
name: z.ZodString;
|
|
72
|
+
title: z.ZodOptional<z.ZodString>;
|
|
73
|
+
description: z.ZodString;
|
|
74
|
+
instructions: z.ZodString;
|
|
75
|
+
content_type: z.ZodEnum<["md", "jst"]>;
|
|
76
|
+
input_schema: z.ZodOptional<z.ZodObject<{
|
|
77
|
+
type: z.ZodLiteral<"object">;
|
|
78
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
79
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
80
|
+
}, "strip", z.ZodTypeAny, {
|
|
81
|
+
type: "object";
|
|
82
|
+
properties?: Record<string, any> | undefined;
|
|
83
|
+
required?: string[] | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
type: "object";
|
|
86
|
+
properties?: Record<string, any> | undefined;
|
|
87
|
+
required?: string[] | undefined;
|
|
88
|
+
}>>;
|
|
89
|
+
context_triggers: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
91
|
+
tool_names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
92
|
+
data_patterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
93
|
+
}, "strip", z.ZodTypeAny, {
|
|
76
94
|
keywords?: string[] | undefined;
|
|
77
95
|
tool_names?: string[] | undefined;
|
|
78
96
|
data_patterns?: string[] | undefined;
|
|
79
|
-
}
|
|
80
|
-
|
|
97
|
+
}, {
|
|
98
|
+
keywords?: string[] | undefined;
|
|
99
|
+
tool_names?: string[] | undefined;
|
|
100
|
+
data_patterns?: string[] | undefined;
|
|
101
|
+
}>>;
|
|
102
|
+
execution: z.ZodOptional<z.ZodObject<{
|
|
103
|
+
language: z.ZodString;
|
|
104
|
+
packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
105
|
+
system_packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
106
|
+
template: z.ZodOptional<z.ZodString>;
|
|
107
|
+
}, "strip", z.ZodTypeAny, {
|
|
108
|
+
language: string;
|
|
109
|
+
packages?: string[] | undefined;
|
|
110
|
+
system_packages?: string[] | undefined;
|
|
111
|
+
template?: string | undefined;
|
|
112
|
+
}, {
|
|
81
113
|
language: string;
|
|
82
114
|
packages?: string[] | undefined;
|
|
83
115
|
system_packages?: string[] | undefined;
|
|
84
116
|
template?: string | undefined;
|
|
85
|
-
}
|
|
86
|
-
related_tools
|
|
87
|
-
|
|
117
|
+
}>>;
|
|
118
|
+
related_tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
119
|
+
scripts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
120
|
+
widgets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
121
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
122
|
+
name: z.ZodString;
|
|
123
|
+
title: z.ZodOptional<z.ZodString>;
|
|
124
|
+
description: z.ZodString;
|
|
125
|
+
instructions: z.ZodString;
|
|
126
|
+
content_type: z.ZodEnum<["md", "jst"]>;
|
|
127
|
+
input_schema: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
type: z.ZodLiteral<"object">;
|
|
129
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
130
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
131
|
+
}, "strip", z.ZodTypeAny, {
|
|
132
|
+
type: "object";
|
|
133
|
+
properties?: Record<string, any> | undefined;
|
|
134
|
+
required?: string[] | undefined;
|
|
135
|
+
}, {
|
|
88
136
|
type: "object";
|
|
89
137
|
properties?: Record<string, any> | undefined;
|
|
90
138
|
required?: string[] | undefined;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
139
|
+
}>>;
|
|
140
|
+
context_triggers: z.ZodOptional<z.ZodObject<{
|
|
141
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
142
|
+
tool_names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
143
|
+
data_patterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
144
|
+
}, "strip", z.ZodTypeAny, {
|
|
145
|
+
keywords?: string[] | undefined;
|
|
146
|
+
tool_names?: string[] | undefined;
|
|
147
|
+
data_patterns?: string[] | undefined;
|
|
148
|
+
}, {
|
|
101
149
|
keywords?: string[] | undefined;
|
|
102
150
|
tool_names?: string[] | undefined;
|
|
103
151
|
data_patterns?: string[] | undefined;
|
|
104
|
-
}
|
|
105
|
-
execution
|
|
152
|
+
}>>;
|
|
153
|
+
execution: z.ZodOptional<z.ZodObject<{
|
|
154
|
+
language: z.ZodString;
|
|
155
|
+
packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
156
|
+
system_packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
157
|
+
template: z.ZodOptional<z.ZodString>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
language: string;
|
|
160
|
+
packages?: string[] | undefined;
|
|
161
|
+
system_packages?: string[] | undefined;
|
|
162
|
+
template?: string | undefined;
|
|
163
|
+
}, {
|
|
106
164
|
language: string;
|
|
107
165
|
packages?: string[] | undefined;
|
|
108
166
|
system_packages?: string[] | undefined;
|
|
109
167
|
template?: string | undefined;
|
|
110
|
-
}
|
|
111
|
-
related_tools
|
|
112
|
-
|
|
168
|
+
}>>;
|
|
169
|
+
related_tools: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
170
|
+
scripts: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
171
|
+
widgets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
172
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
173
|
+
/**
|
|
174
|
+
* Schema for validating properties exported from properties.ts
|
|
175
|
+
* This is a partial schema - allows any subset of SkillDefinition fields
|
|
176
|
+
*
|
|
177
|
+
* Note: Function properties like isEnabled cannot be validated by Zod for their signatures.
|
|
178
|
+
* Zod will only check that they are functions, not their specific parameter/return types.
|
|
179
|
+
* Use TypeScript for proper type checking of function signatures.
|
|
180
|
+
*/
|
|
181
|
+
export declare const SkillPropertiesSchema: z.ZodObject<{
|
|
182
|
+
name: z.ZodOptional<z.ZodString>;
|
|
183
|
+
title: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
184
|
+
description: z.ZodOptional<z.ZodString>;
|
|
185
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
186
|
+
content_type: z.ZodOptional<z.ZodEnum<["md", "jst"]>>;
|
|
187
|
+
input_schema: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
188
|
+
type: z.ZodLiteral<"object">;
|
|
189
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
190
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
192
|
type: "object";
|
|
114
193
|
properties?: Record<string, any> | undefined;
|
|
115
194
|
required?: string[] | undefined;
|
|
116
|
-
}
|
|
117
|
-
|
|
195
|
+
}, {
|
|
196
|
+
type: "object";
|
|
197
|
+
properties?: Record<string, any> | undefined;
|
|
198
|
+
required?: string[] | undefined;
|
|
199
|
+
}>>>;
|
|
200
|
+
context_triggers: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
201
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
202
|
+
tool_names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
203
|
+
data_patterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
205
|
+
keywords?: string[] | undefined;
|
|
206
|
+
tool_names?: string[] | undefined;
|
|
207
|
+
data_patterns?: string[] | undefined;
|
|
208
|
+
}, {
|
|
209
|
+
keywords?: string[] | undefined;
|
|
210
|
+
tool_names?: string[] | undefined;
|
|
211
|
+
data_patterns?: string[] | undefined;
|
|
212
|
+
}>>>;
|
|
213
|
+
execution: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
214
|
+
language: z.ZodString;
|
|
215
|
+
packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
216
|
+
system_packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
217
|
+
template: z.ZodOptional<z.ZodString>;
|
|
218
|
+
}, "strip", z.ZodTypeAny, {
|
|
219
|
+
language: string;
|
|
220
|
+
packages?: string[] | undefined;
|
|
221
|
+
system_packages?: string[] | undefined;
|
|
222
|
+
template?: string | undefined;
|
|
223
|
+
}, {
|
|
224
|
+
language: string;
|
|
225
|
+
packages?: string[] | undefined;
|
|
226
|
+
system_packages?: string[] | undefined;
|
|
227
|
+
template?: string | undefined;
|
|
228
|
+
}>>>;
|
|
229
|
+
related_tools: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
230
|
+
scripts: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
231
|
+
widgets: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
232
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
233
|
+
name: z.ZodOptional<z.ZodString>;
|
|
234
|
+
title: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
235
|
+
description: z.ZodOptional<z.ZodString>;
|
|
236
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
237
|
+
content_type: z.ZodOptional<z.ZodEnum<["md", "jst"]>>;
|
|
238
|
+
input_schema: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
239
|
+
type: z.ZodLiteral<"object">;
|
|
240
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
241
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
242
|
+
}, "strip", z.ZodTypeAny, {
|
|
243
|
+
type: "object";
|
|
244
|
+
properties?: Record<string, any> | undefined;
|
|
245
|
+
required?: string[] | undefined;
|
|
246
|
+
}, {
|
|
247
|
+
type: "object";
|
|
248
|
+
properties?: Record<string, any> | undefined;
|
|
249
|
+
required?: string[] | undefined;
|
|
250
|
+
}>>>;
|
|
251
|
+
context_triggers: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
252
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
253
|
+
tool_names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
254
|
+
data_patterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
255
|
+
}, "strip", z.ZodTypeAny, {
|
|
256
|
+
keywords?: string[] | undefined;
|
|
257
|
+
tool_names?: string[] | undefined;
|
|
258
|
+
data_patterns?: string[] | undefined;
|
|
259
|
+
}, {
|
|
260
|
+
keywords?: string[] | undefined;
|
|
261
|
+
tool_names?: string[] | undefined;
|
|
262
|
+
data_patterns?: string[] | undefined;
|
|
263
|
+
}>>>;
|
|
264
|
+
execution: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
265
|
+
language: z.ZodString;
|
|
266
|
+
packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
267
|
+
system_packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
268
|
+
template: z.ZodOptional<z.ZodString>;
|
|
269
|
+
}, "strip", z.ZodTypeAny, {
|
|
270
|
+
language: string;
|
|
271
|
+
packages?: string[] | undefined;
|
|
272
|
+
system_packages?: string[] | undefined;
|
|
273
|
+
template?: string | undefined;
|
|
274
|
+
}, {
|
|
275
|
+
language: string;
|
|
276
|
+
packages?: string[] | undefined;
|
|
277
|
+
system_packages?: string[] | undefined;
|
|
278
|
+
template?: string | undefined;
|
|
279
|
+
}>>>;
|
|
280
|
+
related_tools: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
281
|
+
scripts: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
282
|
+
widgets: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
283
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
284
|
+
name: z.ZodOptional<z.ZodString>;
|
|
285
|
+
title: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
286
|
+
description: z.ZodOptional<z.ZodString>;
|
|
287
|
+
instructions: z.ZodOptional<z.ZodString>;
|
|
288
|
+
content_type: z.ZodOptional<z.ZodEnum<["md", "jst"]>>;
|
|
289
|
+
input_schema: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
290
|
+
type: z.ZodLiteral<"object">;
|
|
291
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
292
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
293
|
+
}, "strip", z.ZodTypeAny, {
|
|
294
|
+
type: "object";
|
|
295
|
+
properties?: Record<string, any> | undefined;
|
|
296
|
+
required?: string[] | undefined;
|
|
297
|
+
}, {
|
|
298
|
+
type: "object";
|
|
299
|
+
properties?: Record<string, any> | undefined;
|
|
300
|
+
required?: string[] | undefined;
|
|
301
|
+
}>>>;
|
|
302
|
+
context_triggers: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
303
|
+
keywords: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
304
|
+
tool_names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
305
|
+
data_patterns: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
306
|
+
}, "strip", z.ZodTypeAny, {
|
|
307
|
+
keywords?: string[] | undefined;
|
|
308
|
+
tool_names?: string[] | undefined;
|
|
309
|
+
data_patterns?: string[] | undefined;
|
|
310
|
+
}, {
|
|
311
|
+
keywords?: string[] | undefined;
|
|
312
|
+
tool_names?: string[] | undefined;
|
|
313
|
+
data_patterns?: string[] | undefined;
|
|
314
|
+
}>>>;
|
|
315
|
+
execution: z.ZodOptional<z.ZodOptional<z.ZodObject<{
|
|
316
|
+
language: z.ZodString;
|
|
317
|
+
packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
318
|
+
system_packages: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
319
|
+
template: z.ZodOptional<z.ZodString>;
|
|
320
|
+
}, "strip", z.ZodTypeAny, {
|
|
321
|
+
language: string;
|
|
322
|
+
packages?: string[] | undefined;
|
|
323
|
+
system_packages?: string[] | undefined;
|
|
324
|
+
template?: string | undefined;
|
|
325
|
+
}, {
|
|
326
|
+
language: string;
|
|
327
|
+
packages?: string[] | undefined;
|
|
328
|
+
system_packages?: string[] | undefined;
|
|
329
|
+
template?: string | undefined;
|
|
330
|
+
}>>>;
|
|
331
|
+
related_tools: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
332
|
+
scripts: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
333
|
+
widgets: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
334
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
118
335
|
/**
|
|
119
336
|
* TypeScript type inferred from the Zod schema
|
|
120
337
|
* Can also be imported from consumer packages for type safety
|
|
@@ -128,6 +345,11 @@ export type SkillDefinition = z.infer<typeof SkillDefinitionSchema>;
|
|
|
128
345
|
* - Files with ?skill suffix: ./my-skill.md?skill
|
|
129
346
|
* - SKILL.md files: ./my-skill/SKILL.md
|
|
130
347
|
*
|
|
348
|
+
* Runtime Properties:
|
|
349
|
+
* - Supports properties.ts file in skill directory for runtime properties (functions, overrides)
|
|
350
|
+
* - Properties from properties.ts override those from frontmatter
|
|
351
|
+
* - See README.md for detailed usage examples
|
|
352
|
+
*
|
|
131
353
|
* @example
|
|
132
354
|
* ```typescript
|
|
133
355
|
* import skill1 from './my-skill.md?skill';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../../src/presets/skill.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../../src/presets/skill.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAIrD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,KAAK,CAAC;AA6E5C;;;;;;;;GAQG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAgBlB,CAAC;AAEjB;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAgD,CAAC;AAEnF;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAiGpE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,gBAAgB,EAAE,iBAqE9B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/build-tools",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.20260225.024852Z",
|
|
4
4
|
"description": "Build tools for Vertesia projects - Rollup and Vite plugins for transforming imports, bundling skills, and compiling widgets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"gray-matter": "^4.0.3",
|
|
31
31
|
"zod": "^3.24.1",
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
32
|
+
"@llumiverse/common": "1.0.0-dev.20260224.234313Z",
|
|
33
|
+
"@vertesia/common": "1.0.0-dev.20260225.024852Z"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"rollup": "^4.0.0"
|
package/src/index.ts
CHANGED
package/src/presets/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Preset transformers for common use cases
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
export { skillTransformer, SkillDefinitionSchema, type SkillDefinition, type SkillContentType } from './skill.js';
|
|
5
|
+
export { skillTransformer, SkillDefinitionSchema, SkillPropertiesSchema, type SkillDefinition, type SkillContentType } from './skill.js';
|
|
6
6
|
export { skillCollectionTransformer } from './skill-collection.js';
|
|
7
7
|
export { rawTransformer } from './raw.js';
|
|
8
8
|
export { promptTransformer, PromptDefinitionSchema, type PromptDefinition, type PromptContentType, PromptRole, TemplateType } from './prompt.js';
|
package/src/presets/skill.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Skill transformer preset for markdown files with frontmatter
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { existsSync } from 'node:fs';
|
|
5
7
|
import { z } from 'zod';
|
|
6
8
|
import type { TransformerPreset } from '../types.js';
|
|
7
9
|
import { parseFrontmatter } from '../parsers/frontmatter.js';
|
|
@@ -92,6 +94,9 @@ const SkillFrontmatterSchema = z.object({
|
|
|
92
94
|
* Zod schema for skill definition
|
|
93
95
|
* This validates the structure of skill objects generated from markdown
|
|
94
96
|
* Matches the SkillDefinition interface from @vertesia/tools-sdk
|
|
97
|
+
*
|
|
98
|
+
* Note: The isEnabled property is not included in this schema because Zod cannot
|
|
99
|
+
* properly validate function signatures. It will be type-checked by TypeScript instead.
|
|
95
100
|
*/
|
|
96
101
|
export const SkillDefinitionSchema = z.object({
|
|
97
102
|
name: z.string().min(1, 'Skill name is required'),
|
|
@@ -109,7 +114,17 @@ export const SkillDefinitionSchema = z.object({
|
|
|
109
114
|
related_tools: z.array(z.string()).optional(),
|
|
110
115
|
scripts: z.array(z.string()).optional(),
|
|
111
116
|
widgets: z.array(z.string()).optional()
|
|
112
|
-
});
|
|
117
|
+
}).passthrough();
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Schema for validating properties exported from properties.ts
|
|
121
|
+
* This is a partial schema - allows any subset of SkillDefinition fields
|
|
122
|
+
*
|
|
123
|
+
* Note: Function properties like isEnabled cannot be validated by Zod for their signatures.
|
|
124
|
+
* Zod will only check that they are functions, not their specific parameter/return types.
|
|
125
|
+
* Use TypeScript for proper type checking of function signatures.
|
|
126
|
+
*/
|
|
127
|
+
export const SkillPropertiesSchema = SkillDefinitionSchema.partial().passthrough();
|
|
113
128
|
|
|
114
129
|
/**
|
|
115
130
|
* TypeScript type inferred from the Zod schema
|
|
@@ -220,6 +235,11 @@ function buildSkillDefinition(
|
|
|
220
235
|
* - Files with ?skill suffix: ./my-skill.md?skill
|
|
221
236
|
* - SKILL.md files: ./my-skill/SKILL.md
|
|
222
237
|
*
|
|
238
|
+
* Runtime Properties:
|
|
239
|
+
* - Supports properties.ts file in skill directory for runtime properties (functions, overrides)
|
|
240
|
+
* - Properties from properties.ts override those from frontmatter
|
|
241
|
+
* - See README.md for detailed usage examples
|
|
242
|
+
*
|
|
223
243
|
* @example
|
|
224
244
|
* ```typescript
|
|
225
245
|
* import skill1 from './my-skill.md?skill';
|
|
@@ -238,8 +258,8 @@ export const skillTransformer: TransformerPreset = {
|
|
|
238
258
|
if (!frontmatterValidation.success) {
|
|
239
259
|
const errors = frontmatterValidation.error.errors
|
|
240
260
|
.map((err) => {
|
|
241
|
-
const
|
|
242
|
-
return ` - ${
|
|
261
|
+
const pathStr = err.path.length > 0 ? err.path.join('.') : 'frontmatter';
|
|
262
|
+
return ` - ${pathStr}: ${err.message}`;
|
|
243
263
|
})
|
|
244
264
|
.join('\n');
|
|
245
265
|
throw new Error(
|
|
@@ -262,6 +282,34 @@ export const skillTransformer: TransformerPreset = {
|
|
|
262
282
|
assets.scripts
|
|
263
283
|
);
|
|
264
284
|
|
|
285
|
+
// Check if properties.ts exists in the skill directory
|
|
286
|
+
const skillDir = path.dirname(filePath);
|
|
287
|
+
const propertiesPath = path.join(skillDir, 'properties.ts');
|
|
288
|
+
const hasProperties = existsSync(propertiesPath);
|
|
289
|
+
|
|
290
|
+
// If properties.ts exists, generate custom code with import and merge
|
|
291
|
+
// Rollup will handle transpiling properties.ts to properties.js
|
|
292
|
+
if (hasProperties) {
|
|
293
|
+
const skillDataJson = JSON.stringify(skillData, null, 2);
|
|
294
|
+
const code = `import properties from './properties.js';
|
|
295
|
+
|
|
296
|
+
// Runtime validation for function properties
|
|
297
|
+
if ('isEnabled' in properties && typeof properties.isEnabled !== 'function') {
|
|
298
|
+
throw new Error('properties.isEnabled must be a function, got ' + typeof properties.isEnabled);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const skill = ${skillDataJson};
|
|
302
|
+
|
|
303
|
+
export default { ...skill, ...properties };
|
|
304
|
+
`;
|
|
305
|
+
return {
|
|
306
|
+
data: skillData,
|
|
307
|
+
assets: assets.assetFiles,
|
|
308
|
+
widgets: assets.widgetMetadata,
|
|
309
|
+
code
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
|
|
265
313
|
return {
|
|
266
314
|
data: skillData,
|
|
267
315
|
assets: assets.assetFiles,
|