@vertesia/build-tools 0.80.0 → 0.80.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/build-tools.js +1122 -8
- package/lib/build-tools.js.map +1 -1
- package/lib/cjs/index.js +6 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/plugin.js +14 -6
- package/lib/cjs/plugin.js.map +1 -1
- package/lib/cjs/presets/index.js +8 -1
- package/lib/cjs/presets/index.js.map +1 -1
- package/lib/cjs/presets/prompt.js +185 -0
- package/lib/cjs/presets/prompt.js.map +1 -0
- package/lib/cjs/presets/skill-collection.js +83 -0
- package/lib/cjs/presets/skill-collection.js.map +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/plugin.js +14 -6
- package/lib/esm/plugin.js.map +1 -1
- package/lib/esm/presets/index.js +2 -0
- package/lib/esm/presets/index.js.map +1 -1
- package/lib/esm/presets/prompt.js +181 -0
- package/lib/esm/presets/prompt.js.map +1 -0
- package/lib/esm/presets/skill-collection.js +77 -0
- package/lib/esm/presets/skill-collection.js.map +1 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/plugin.d.ts.map +1 -1
- package/lib/types/presets/index.d.ts +2 -0
- package/lib/types/presets/index.d.ts.map +1 -1
- package/lib/types/presets/prompt.d.ts +63 -0
- package/lib/types/presets/prompt.d.ts.map +1 -0
- package/lib/types/presets/skill-collection.d.ts +26 -0
- package/lib/types/presets/skill-collection.d.ts.map +1 -0
- package/lib/types/types.d.ts +2 -0
- package/lib/types/types.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/index.ts +8 -1
- package/src/plugin.ts +14 -6
- package/src/presets/index.ts +2 -0
- package/src/presets/prompt.ts +227 -0
- package/src/presets/skill-collection.ts +86 -0
- package/src/types.ts +3 -0
package/lib/cjs/presets/index.js
CHANGED
|
@@ -3,10 +3,17 @@
|
|
|
3
3
|
* Preset transformers for common use cases
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.rawTransformer = exports.SkillDefinitionSchema = exports.skillTransformer = void 0;
|
|
6
|
+
exports.TemplateType = exports.PromptRole = exports.PromptDefinitionSchema = exports.promptTransformer = exports.rawTransformer = exports.skillCollectionTransformer = exports.SkillDefinitionSchema = exports.skillTransformer = void 0;
|
|
7
7
|
var skill_js_1 = require("./skill.js");
|
|
8
8
|
Object.defineProperty(exports, "skillTransformer", { enumerable: true, get: function () { return skill_js_1.skillTransformer; } });
|
|
9
9
|
Object.defineProperty(exports, "SkillDefinitionSchema", { enumerable: true, get: function () { return skill_js_1.SkillDefinitionSchema; } });
|
|
10
|
+
var skill_collection_js_1 = require("./skill-collection.js");
|
|
11
|
+
Object.defineProperty(exports, "skillCollectionTransformer", { enumerable: true, get: function () { return skill_collection_js_1.skillCollectionTransformer; } });
|
|
10
12
|
var raw_js_1 = require("./raw.js");
|
|
11
13
|
Object.defineProperty(exports, "rawTransformer", { enumerable: true, get: function () { return raw_js_1.rawTransformer; } });
|
|
14
|
+
var prompt_js_1 = require("./prompt.js");
|
|
15
|
+
Object.defineProperty(exports, "promptTransformer", { enumerable: true, get: function () { return prompt_js_1.promptTransformer; } });
|
|
16
|
+
Object.defineProperty(exports, "PromptDefinitionSchema", { enumerable: true, get: function () { return prompt_js_1.PromptDefinitionSchema; } });
|
|
17
|
+
Object.defineProperty(exports, "PromptRole", { enumerable: true, get: function () { return prompt_js_1.PromptRole; } });
|
|
18
|
+
Object.defineProperty(exports, "TemplateType", { enumerable: true, get: function () { return prompt_js_1.TemplateType; } });
|
|
12
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/presets/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uCAAkH;AAAzG,4GAAA,gBAAgB,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AAChD,mCAA0C;AAAjC,wGAAA,cAAc,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/presets/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,uCAAkH;AAAzG,4GAAA,gBAAgB,OAAA;AAAE,iHAAA,qBAAqB,OAAA;AAChD,6DAAmE;AAA1D,iIAAA,0BAA0B,OAAA;AACnC,mCAA0C;AAAjC,wGAAA,cAAc,OAAA;AACvB,yCAAiJ;AAAxI,8GAAA,iBAAiB,OAAA;AAAE,mHAAA,sBAAsB,OAAA;AAAiD,uGAAA,UAAU,OAAA;AAAE,yGAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Prompt transformer preset for template files with frontmatter
|
|
4
|
+
* Supports .jst, .hbs, and plain text files
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.promptTransformer = exports.PromptDefinitionSchema = exports.PromptRole = exports.TemplateType = void 0;
|
|
11
|
+
const zod_1 = require("zod");
|
|
12
|
+
const frontmatter_js_1 = require("../parsers/frontmatter.js");
|
|
13
|
+
const path_1 = __importDefault(require("path"));
|
|
14
|
+
const common_1 = require("@vertesia/common");
|
|
15
|
+
Object.defineProperty(exports, "TemplateType", { enumerable: true, get: function () { return common_1.TemplateType; } });
|
|
16
|
+
const common_2 = require("@llumiverse/common");
|
|
17
|
+
Object.defineProperty(exports, "PromptRole", { enumerable: true, get: function () { return common_2.PromptRole; } });
|
|
18
|
+
/**
|
|
19
|
+
* Zod schema for prompt frontmatter validation
|
|
20
|
+
*/
|
|
21
|
+
const PromptFrontmatterSchema = zod_1.z.object({
|
|
22
|
+
// Required fields
|
|
23
|
+
role: zod_1.z.nativeEnum(common_2.PromptRole, {
|
|
24
|
+
errorMap: () => ({ message: 'Role must be one of: safety, system, user, assistant, negative' })
|
|
25
|
+
}),
|
|
26
|
+
// Optional fields
|
|
27
|
+
content_type: zod_1.z.nativeEnum(common_1.TemplateType).optional(),
|
|
28
|
+
schema: zod_1.z.string().optional(),
|
|
29
|
+
name: zod_1.z.string().optional(),
|
|
30
|
+
externalId: zod_1.z.string().optional(),
|
|
31
|
+
}).strict();
|
|
32
|
+
/**
|
|
33
|
+
* MUST be kept in sync with @vertesia/common InCodePrompt
|
|
34
|
+
* Zod schema for prompt definition
|
|
35
|
+
*/
|
|
36
|
+
exports.PromptDefinitionSchema = zod_1.z.object({
|
|
37
|
+
role: zod_1.z.nativeEnum(common_2.PromptRole),
|
|
38
|
+
content: zod_1.z.string(),
|
|
39
|
+
content_type: zod_1.z.nativeEnum(common_1.TemplateType),
|
|
40
|
+
schema: zod_1.z.any().optional(),
|
|
41
|
+
name: zod_1.z.string().optional(),
|
|
42
|
+
externalId: zod_1.z.string().optional(),
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Normalize schema path for import
|
|
46
|
+
* - Adds './' prefix if not a relative path
|
|
47
|
+
* - Replaces .ts with .js
|
|
48
|
+
* - Adds .js if no extension
|
|
49
|
+
*
|
|
50
|
+
* @param schemaPath - Original schema path from frontmatter
|
|
51
|
+
* @returns Normalized path for ES module import
|
|
52
|
+
*/
|
|
53
|
+
function normalizeSchemaPath(schemaPath) {
|
|
54
|
+
let normalized = schemaPath.trim();
|
|
55
|
+
// Add './' prefix if not already a relative path
|
|
56
|
+
if (!normalized.startsWith('.')) {
|
|
57
|
+
normalized = './' + normalized;
|
|
58
|
+
}
|
|
59
|
+
// Get the extension
|
|
60
|
+
const ext = path_1.default.extname(normalized);
|
|
61
|
+
if (ext === '.ts') {
|
|
62
|
+
// Replace .ts with .js
|
|
63
|
+
normalized = normalized.slice(0, -3) + '.js';
|
|
64
|
+
}
|
|
65
|
+
else if (!ext) {
|
|
66
|
+
// No extension, add .js
|
|
67
|
+
normalized = normalized + '.js';
|
|
68
|
+
}
|
|
69
|
+
// If extension is already .js or something else, leave as is
|
|
70
|
+
return normalized;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Infer content type from file extension
|
|
74
|
+
*
|
|
75
|
+
* @param filePath - Path to the prompt file
|
|
76
|
+
* @returns Inferred content type
|
|
77
|
+
*/
|
|
78
|
+
function inferContentType(filePath) {
|
|
79
|
+
const ext = path_1.default.extname(filePath).toLowerCase();
|
|
80
|
+
switch (ext) {
|
|
81
|
+
case '.jst':
|
|
82
|
+
return common_1.TemplateType.jst;
|
|
83
|
+
case '.hbs':
|
|
84
|
+
return common_1.TemplateType.handlebars;
|
|
85
|
+
default:
|
|
86
|
+
return common_1.TemplateType.text;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Build a PromptDefinition from frontmatter and content
|
|
91
|
+
*
|
|
92
|
+
* @param frontmatter - Parsed frontmatter object
|
|
93
|
+
* @param content - Prompt content (body of the file)
|
|
94
|
+
* @param filePath - Path to the prompt file (for content type inference)
|
|
95
|
+
* @returns Prompt definition object and optional imports
|
|
96
|
+
*/
|
|
97
|
+
function buildPromptDefinition(frontmatter, content, filePath) {
|
|
98
|
+
// Determine content type from frontmatter or file extension
|
|
99
|
+
const content_type = frontmatter.content_type || inferContentType(filePath);
|
|
100
|
+
const prompt = {
|
|
101
|
+
role: frontmatter.role,
|
|
102
|
+
content,
|
|
103
|
+
content_type,
|
|
104
|
+
};
|
|
105
|
+
// Add optional fields
|
|
106
|
+
if (frontmatter.name) {
|
|
107
|
+
prompt.name = frontmatter.name;
|
|
108
|
+
}
|
|
109
|
+
if (frontmatter.externalId) {
|
|
110
|
+
prompt.externalId = frontmatter.externalId;
|
|
111
|
+
}
|
|
112
|
+
// Handle schema import if specified
|
|
113
|
+
let imports;
|
|
114
|
+
let schemaImportName;
|
|
115
|
+
if (frontmatter.schema) {
|
|
116
|
+
const normalizedPath = normalizeSchemaPath(frontmatter.schema);
|
|
117
|
+
schemaImportName = '__promptSchema';
|
|
118
|
+
imports = [`import ${schemaImportName} from '${normalizedPath}';`];
|
|
119
|
+
}
|
|
120
|
+
return { prompt, imports, schemaImportName };
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Prompt transformer preset
|
|
124
|
+
* Transforms template files with ?prompt suffix into prompt definition objects
|
|
125
|
+
*
|
|
126
|
+
* Supported file types:
|
|
127
|
+
* - .jst (JavaScript template literals) → content_type: 'jst'
|
|
128
|
+
* - .hbs (Handlebars templates) → content_type: 'handlebars'
|
|
129
|
+
* - .txt or other → content_type: 'text'
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* import PROMPT from './prompt.hbs?prompt';
|
|
134
|
+
* // PROMPT is an InCodePrompt object
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
exports.promptTransformer = {
|
|
138
|
+
pattern: /\?prompt$/,
|
|
139
|
+
schema: exports.PromptDefinitionSchema,
|
|
140
|
+
transform: (content, filePath) => {
|
|
141
|
+
const { frontmatter, content: promptContent } = (0, frontmatter_js_1.parseFrontmatter)(content);
|
|
142
|
+
// Validate frontmatter
|
|
143
|
+
const frontmatterValidation = PromptFrontmatterSchema.safeParse(frontmatter);
|
|
144
|
+
if (!frontmatterValidation.success) {
|
|
145
|
+
const errors = frontmatterValidation.error.errors
|
|
146
|
+
.map((err) => {
|
|
147
|
+
const path = err.path.length > 0 ? err.path.join('.') : 'frontmatter';
|
|
148
|
+
return ` - ${path}: ${err.message}`;
|
|
149
|
+
})
|
|
150
|
+
.join('\n');
|
|
151
|
+
throw new Error(`Invalid frontmatter in ${filePath}:\n${errors}`);
|
|
152
|
+
}
|
|
153
|
+
// Build prompt definition
|
|
154
|
+
const { prompt, imports, schemaImportName } = buildPromptDefinition(frontmatter, promptContent, filePath);
|
|
155
|
+
// If schema is specified, generate custom code with schema reference
|
|
156
|
+
if (schemaImportName) {
|
|
157
|
+
// Build the code manually to avoid JSON.stringify issues with schema reference
|
|
158
|
+
const lines = [
|
|
159
|
+
'export default {',
|
|
160
|
+
` role: "${prompt.role}",`,
|
|
161
|
+
` content: ${JSON.stringify(prompt.content)},`,
|
|
162
|
+
` content_type: "${prompt.content_type}",`,
|
|
163
|
+
` schema: ${schemaImportName}`,
|
|
164
|
+
];
|
|
165
|
+
if (prompt.name) {
|
|
166
|
+
lines.splice(4, 0, ` name: ${JSON.stringify(prompt.name)},`);
|
|
167
|
+
}
|
|
168
|
+
if (prompt.externalId) {
|
|
169
|
+
lines.splice(4, 0, ` externalId: ${JSON.stringify(prompt.externalId)},`);
|
|
170
|
+
}
|
|
171
|
+
lines.push('};');
|
|
172
|
+
const code = lines.join('\n');
|
|
173
|
+
return {
|
|
174
|
+
data: prompt,
|
|
175
|
+
imports,
|
|
176
|
+
code,
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
// Standard case without schema
|
|
180
|
+
return {
|
|
181
|
+
data: prompt,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
};
|
|
185
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/presets/prompt.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,6BAAwB;AAExB,8DAA6D;AAC7D,gDAAwB;AACxB,6CAAgD;AAMvC,6FANA,qBAAY,OAMA;AALrB,+CAAgD;AAKzB,2FALd,mBAAU,OAKc;AAOjC;;GAEG;AACH,MAAM,uBAAuB,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,kBAAkB;IAClB,IAAI,EAAE,OAAC,CAAC,UAAU,CAAC,mBAAU,EAAE;QAC3B,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,gEAAgE,EAAE,CAAC;KAClG,CAAC;IA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AAC,IAAI,IAAI;gBAC3B,cAAc,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG;gBAC/C,oBAAoB,MAAM,CAAC,YAAY,IAAI;gBAC3C,aAAa,gBAAgB,EAAE;aAClC,CAAC;YAEF,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBACd,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClE,CAAC;YACD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;gBACpB,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,iBAAiB,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;YAC9E,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAE9B,OAAO;gBACH,IAAI,EAAE,MAAM;gBACZ,OAAO;gBACP,IAAI;aACP,CAAC;QACN,CAAC;QAED,+BAA+B;QAC/B,OAAO;YACH,IAAI,EAAE,MAAM;SACf,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Skill collection transformer for directory-based skill imports
|
|
4
|
+
* Scans a directory for subdirectories containing SKILL.md files
|
|
5
|
+
*/
|
|
6
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
|
+
};
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.skillCollectionTransformer = void 0;
|
|
11
|
+
const node_fs_1 = require("node:fs");
|
|
12
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
13
|
+
/**
|
|
14
|
+
* Skill collection transformer preset
|
|
15
|
+
* Transforms directory imports with ?skills suffix into an array of skill imports
|
|
16
|
+
*
|
|
17
|
+
* Matches:
|
|
18
|
+
* - ./all?skills (recommended - generates all.js in the directory)
|
|
19
|
+
* - ./_skills?skills (generates _skills.js in the directory)
|
|
20
|
+
* - Any path ending with a filename and ?skills
|
|
21
|
+
*
|
|
22
|
+
* NOTE: A filename before ?skills is REQUIRED to avoid naming conflicts.
|
|
23
|
+
* The filename becomes the output module name.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import skills from './all?skills';
|
|
28
|
+
* // Scans current directory for subdirectories with SKILL.md
|
|
29
|
+
* // Generates all.js containing array of all skills
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
exports.skillCollectionTransformer = {
|
|
33
|
+
pattern: /\/[^/?]+\?skills$/,
|
|
34
|
+
virtual: true, // Indicates this doesn't transform a real file
|
|
35
|
+
transform: (_content, filePath) => {
|
|
36
|
+
// Remove ?skills suffix and the filename to get directory path
|
|
37
|
+
// Example: /path/code/all?skills -> /path/code/all -> /path/code/
|
|
38
|
+
const pathWithoutQuery = filePath.replace(/\?skills$/, '');
|
|
39
|
+
const dirPath = node_path_1.default.dirname(pathWithoutQuery);
|
|
40
|
+
if (!(0, node_fs_1.existsSync)(dirPath)) {
|
|
41
|
+
throw new Error(`Directory not found: ${dirPath}`);
|
|
42
|
+
}
|
|
43
|
+
if (!(0, node_fs_1.statSync)(dirPath).isDirectory()) {
|
|
44
|
+
throw new Error(`Not a directory: ${dirPath}`);
|
|
45
|
+
}
|
|
46
|
+
// Scan for subdirectories containing SKILL.md
|
|
47
|
+
const entries = (0, node_fs_1.readdirSync)(dirPath);
|
|
48
|
+
const imports = [];
|
|
49
|
+
const names = [];
|
|
50
|
+
for (const entry of entries) {
|
|
51
|
+
const entryPath = node_path_1.default.join(dirPath, entry);
|
|
52
|
+
try {
|
|
53
|
+
if ((0, node_fs_1.statSync)(entryPath).isDirectory()) {
|
|
54
|
+
const skillFile = node_path_1.default.join(entryPath, 'SKILL.md');
|
|
55
|
+
if ((0, node_fs_1.existsSync)(skillFile)) {
|
|
56
|
+
// Generate unique identifier from directory name
|
|
57
|
+
const identifier = `Skill_${entry.replace(/[^a-zA-Z0-9_]/g, '_')}`;
|
|
58
|
+
imports.push(`import ${identifier} from './${entry}/SKILL.md';`);
|
|
59
|
+
names.push(identifier);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
// Skip entries that can't be read
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (names.length === 0) {
|
|
69
|
+
console.warn(`No SKILL.md files found in subdirectories of ${dirPath}`);
|
|
70
|
+
}
|
|
71
|
+
// Generate code that imports all skills and exports as array
|
|
72
|
+
const code = [
|
|
73
|
+
...imports,
|
|
74
|
+
'',
|
|
75
|
+
`export default [${names.join(', ')}];`
|
|
76
|
+
].join('\n');
|
|
77
|
+
return {
|
|
78
|
+
data: null, // Not used when custom code is provided
|
|
79
|
+
code
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=skill-collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-collection.js","sourceRoot":"","sources":["../../../src/presets/skill-collection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;AAEH,qCAA4D;AAC5D,0DAA6B;AAG7B;;;;;;;;;;;;;;;;;;GAkBG;AACU,QAAA,0BAA0B,GAAsB;IACzD,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,IAAI,EAAE,+CAA+C;IAC9D,SAAS,EAAE,CAAC,QAAgB,EAAE,QAAgB,EAAE,EAAE;QAC9C,+DAA+D;QAC/D,kEAAkE;QAClE,MAAM,gBAAgB,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,C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QAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,gDAAgD,OAAO,EAAE,CAAC,CAAC;QAC5E,CAAC;QAED,6DAA6D;QAC7D,MAAM,IAAI,GAAG;YACT,GAAG,OAAO;YACV,EAAE;YACF,mBAAmB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;SAC1C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;YACH,IAAI,EAAE,IAAI,EAAE,wCAAwC;YACpD,IAAI;SACP,CAAC;IACN,CAAC;CACJ,CAAC"}
|
package/lib/esm/index.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
// Core plugin
|
|
21
21
|
export { vertesiaImportPlugin } from './plugin.js';
|
|
22
22
|
// Presets
|
|
23
|
-
export { skillTransformer, rawTransformer, SkillDefinitionSchema } from './presets/index.js';
|
|
23
|
+
export { skillTransformer, rawTransformer, skillCollectionTransformer, promptTransformer, SkillDefinitionSchema, PromptDefinitionSchema, PromptRole, TemplateType } from './presets/index.js';
|
|
24
24
|
// Utilities
|
|
25
25
|
export { parseFrontmatter } from './parsers/frontmatter.js';
|
|
26
26
|
//# sourceMappingURL=index.js.map
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +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,qBAAqB,
|
|
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,sBAAsB,EAKtB,UAAU,EACV,YAAY,EACf,MAAM,oBAAoB,CAAC;AAE5B,YAAY;AACZ,OAAO,EAAE,gBAAgB,EAA0B,MAAM,0BAA0B,CAAC"}
|
package/lib/esm/plugin.js
CHANGED
|
@@ -30,7 +30,13 @@ export function vertesiaImportPlugin(config) {
|
|
|
30
30
|
// Handle relative imports
|
|
31
31
|
if (source.startsWith('.') && importer) {
|
|
32
32
|
const cleanSource = source.replace(transformer.pattern, '');
|
|
33
|
-
|
|
33
|
+
// Strip query parameters from importer to get the file path
|
|
34
|
+
const cleanImporter = importer.indexOf('?') >= 0
|
|
35
|
+
? importer.substring(0, importer.indexOf('?'))
|
|
36
|
+
: importer;
|
|
37
|
+
// Always use dirname to get the directory containing the importer
|
|
38
|
+
const baseDir = path.dirname(cleanImporter);
|
|
39
|
+
const resolved = path.resolve(baseDir, cleanSource);
|
|
34
40
|
// Return with the pattern suffix to identify it in load
|
|
35
41
|
const suffix = source.match(transformer.pattern)?.[0] || '';
|
|
36
42
|
return resolved + suffix;
|
|
@@ -62,8 +68,10 @@ export function vertesiaImportPlugin(config) {
|
|
|
62
68
|
return null; // Not for us
|
|
63
69
|
}
|
|
64
70
|
try {
|
|
65
|
-
// Read file content
|
|
66
|
-
const content =
|
|
71
|
+
// Read file content (skip for virtual transforms)
|
|
72
|
+
const content = matchedTransformer.virtual
|
|
73
|
+
? ''
|
|
74
|
+
: readFileSync(cleanId, 'utf-8');
|
|
67
75
|
// Transform the content
|
|
68
76
|
const result = await matchedTransformer.transform(content, cleanId);
|
|
69
77
|
// Collect assets if any
|
|
@@ -85,13 +93,13 @@ export function vertesiaImportPlugin(config) {
|
|
|
85
93
|
}
|
|
86
94
|
}
|
|
87
95
|
// Generate code
|
|
96
|
+
const imports = result.imports ? result.imports.join('\n') + '\n\n' : '';
|
|
88
97
|
if (result.code) {
|
|
89
|
-
// Custom code provided
|
|
90
|
-
return result.code;
|
|
98
|
+
// Custom code provided - prepend imports
|
|
99
|
+
return imports + result.code;
|
|
91
100
|
}
|
|
92
101
|
else {
|
|
93
102
|
// Default: export data (escape if string, otherwise stringify as JSON)
|
|
94
|
-
const imports = result.imports ? result.imports.join('\n') + '\n\n' : '';
|
|
95
103
|
const dataJson = JSON.stringify(result.data, null, 2);
|
|
96
104
|
return `${imports}export default ${dataJson};`;
|
|
97
105
|
}
|
package/lib/esm/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG5D;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAoB;IACrD,MAAM,EAAE,YAAY,EAAE,SAAS,GAAG,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,CAAC;IAEpE,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;IACzF,CAAC;IAED,8CAA8C;IAC9C,MAAM,eAAe,GAAgB,EAAE,CAAC;IACxC,MAAM,gBAAgB,GAAqB,EAAE,CAAC;IAC9C,MAAM,gBAAgB,GAAG,SAAS,KAAK,KAAK,CAAC;IAC7C,MAAM,oBAAoB,GAAG,YAAY,KAAK,SAAS,IAAI,SAAS,KAAK,KAAK,CAAC;IAE/E,OAAO;QACH,IAAI,EAAE,wBAAwB;QAE9B;;WAEG;QACH,SAAS,CAAC,MAAc,EAAE,QAA4B;YAClD,2CAA2C;YAC3C,KAA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|
2
2
|
* Preset transformers for common use cases
|
|
3
3
|
*/
|
|
4
4
|
export { skillTransformer, SkillDefinitionSchema } from './skill.js';
|
|
5
|
+
export { skillCollectionTransformer } from './skill-collection.js';
|
|
5
6
|
export { rawTransformer } from './raw.js';
|
|
7
|
+
export { promptTransformer, PromptDefinitionSchema, PromptRole, TemplateType } from './prompt.js';
|
|
6
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/presets/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAA+C,MAAM,YAAY,CAAC;AAClH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/presets/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAA+C,MAAM,YAAY,CAAC;AAClH,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAiD,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt transformer preset for template files with frontmatter
|
|
3
|
+
* Supports .jst, .hbs, and plain text files
|
|
4
|
+
*/
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { parseFrontmatter } from '../parsers/frontmatter.js';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { TemplateType } from '@vertesia/common';
|
|
9
|
+
import { PromptRole } from '@llumiverse/common';
|
|
10
|
+
/**
|
|
11
|
+
* Re-export types for backwards compatibility
|
|
12
|
+
*/
|
|
13
|
+
export { TemplateType, PromptRole };
|
|
14
|
+
/**
|
|
15
|
+
* Zod schema for prompt frontmatter validation
|
|
16
|
+
*/
|
|
17
|
+
const PromptFrontmatterSchema = z.object({
|
|
18
|
+
// Required fields
|
|
19
|
+
role: z.nativeEnum(PromptRole, {
|
|
20
|
+
errorMap: () => ({ message: 'Role must be one of: safety, system, user, assistant, negative' })
|
|
21
|
+
}),
|
|
22
|
+
// Optional fields
|
|
23
|
+
content_type: z.nativeEnum(TemplateType).optional(),
|
|
24
|
+
schema: z.string().optional(),
|
|
25
|
+
name: z.string().optional(),
|
|
26
|
+
externalId: z.string().optional(),
|
|
27
|
+
}).strict();
|
|
28
|
+
/**
|
|
29
|
+
* MUST be kept in sync with @vertesia/common InCodePrompt
|
|
30
|
+
* Zod schema for prompt definition
|
|
31
|
+
*/
|
|
32
|
+
export const PromptDefinitionSchema = z.object({
|
|
33
|
+
role: z.nativeEnum(PromptRole),
|
|
34
|
+
content: z.string(),
|
|
35
|
+
content_type: z.nativeEnum(TemplateType),
|
|
36
|
+
schema: z.any().optional(),
|
|
37
|
+
name: z.string().optional(),
|
|
38
|
+
externalId: z.string().optional(),
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Normalize schema path for import
|
|
42
|
+
* - Adds './' prefix if not a relative path
|
|
43
|
+
* - Replaces .ts with .js
|
|
44
|
+
* - Adds .js if no extension
|
|
45
|
+
*
|
|
46
|
+
* @param schemaPath - Original schema path from frontmatter
|
|
47
|
+
* @returns Normalized path for ES module import
|
|
48
|
+
*/
|
|
49
|
+
function normalizeSchemaPath(schemaPath) {
|
|
50
|
+
let normalized = schemaPath.trim();
|
|
51
|
+
// Add './' prefix if not already a relative path
|
|
52
|
+
if (!normalized.startsWith('.')) {
|
|
53
|
+
normalized = './' + normalized;
|
|
54
|
+
}
|
|
55
|
+
// Get the extension
|
|
56
|
+
const ext = path.extname(normalized);
|
|
57
|
+
if (ext === '.ts') {
|
|
58
|
+
// Replace .ts with .js
|
|
59
|
+
normalized = normalized.slice(0, -3) + '.js';
|
|
60
|
+
}
|
|
61
|
+
else if (!ext) {
|
|
62
|
+
// No extension, add .js
|
|
63
|
+
normalized = normalized + '.js';
|
|
64
|
+
}
|
|
65
|
+
// If extension is already .js or something else, leave as is
|
|
66
|
+
return normalized;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Infer content type from file extension
|
|
70
|
+
*
|
|
71
|
+
* @param filePath - Path to the prompt file
|
|
72
|
+
* @returns Inferred content type
|
|
73
|
+
*/
|
|
74
|
+
function inferContentType(filePath) {
|
|
75
|
+
const ext = path.extname(filePath).toLowerCase();
|
|
76
|
+
switch (ext) {
|
|
77
|
+
case '.jst':
|
|
78
|
+
return TemplateType.jst;
|
|
79
|
+
case '.hbs':
|
|
80
|
+
return TemplateType.handlebars;
|
|
81
|
+
default:
|
|
82
|
+
return TemplateType.text;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Build a PromptDefinition from frontmatter and content
|
|
87
|
+
*
|
|
88
|
+
* @param frontmatter - Parsed frontmatter object
|
|
89
|
+
* @param content - Prompt content (body of the file)
|
|
90
|
+
* @param filePath - Path to the prompt file (for content type inference)
|
|
91
|
+
* @returns Prompt definition object and optional imports
|
|
92
|
+
*/
|
|
93
|
+
function buildPromptDefinition(frontmatter, content, filePath) {
|
|
94
|
+
// Determine content type from frontmatter or file extension
|
|
95
|
+
const content_type = frontmatter.content_type || inferContentType(filePath);
|
|
96
|
+
const prompt = {
|
|
97
|
+
role: frontmatter.role,
|
|
98
|
+
content,
|
|
99
|
+
content_type,
|
|
100
|
+
};
|
|
101
|
+
// Add optional fields
|
|
102
|
+
if (frontmatter.name) {
|
|
103
|
+
prompt.name = frontmatter.name;
|
|
104
|
+
}
|
|
105
|
+
if (frontmatter.externalId) {
|
|
106
|
+
prompt.externalId = frontmatter.externalId;
|
|
107
|
+
}
|
|
108
|
+
// Handle schema import if specified
|
|
109
|
+
let imports;
|
|
110
|
+
let schemaImportName;
|
|
111
|
+
if (frontmatter.schema) {
|
|
112
|
+
const normalizedPath = normalizeSchemaPath(frontmatter.schema);
|
|
113
|
+
schemaImportName = '__promptSchema';
|
|
114
|
+
imports = [`import ${schemaImportName} from '${normalizedPath}';`];
|
|
115
|
+
}
|
|
116
|
+
return { prompt, imports, schemaImportName };
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Prompt transformer preset
|
|
120
|
+
* Transforms template files with ?prompt suffix into prompt definition objects
|
|
121
|
+
*
|
|
122
|
+
* Supported file types:
|
|
123
|
+
* - .jst (JavaScript template literals) → content_type: 'jst'
|
|
124
|
+
* - .hbs (Handlebars templates) → content_type: 'handlebars'
|
|
125
|
+
* - .txt or other → content_type: 'text'
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* import PROMPT from './prompt.hbs?prompt';
|
|
130
|
+
* // PROMPT is an InCodePrompt object
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
export const promptTransformer = {
|
|
134
|
+
pattern: /\?prompt$/,
|
|
135
|
+
schema: PromptDefinitionSchema,
|
|
136
|
+
transform: (content, filePath) => {
|
|
137
|
+
const { frontmatter, content: promptContent } = parseFrontmatter(content);
|
|
138
|
+
// Validate frontmatter
|
|
139
|
+
const frontmatterValidation = PromptFrontmatterSchema.safeParse(frontmatter);
|
|
140
|
+
if (!frontmatterValidation.success) {
|
|
141
|
+
const errors = frontmatterValidation.error.errors
|
|
142
|
+
.map((err) => {
|
|
143
|
+
const path = err.path.length > 0 ? err.path.join('.') : 'frontmatter';
|
|
144
|
+
return ` - ${path}: ${err.message}`;
|
|
145
|
+
})
|
|
146
|
+
.join('\n');
|
|
147
|
+
throw new Error(`Invalid frontmatter in ${filePath}:\n${errors}`);
|
|
148
|
+
}
|
|
149
|
+
// Build prompt definition
|
|
150
|
+
const { prompt, imports, schemaImportName } = buildPromptDefinition(frontmatter, promptContent, filePath);
|
|
151
|
+
// If schema is specified, generate custom code with schema reference
|
|
152
|
+
if (schemaImportName) {
|
|
153
|
+
// Build the code manually to avoid JSON.stringify issues with schema reference
|
|
154
|
+
const lines = [
|
|
155
|
+
'export default {',
|
|
156
|
+
` role: "${prompt.role}",`,
|
|
157
|
+
` content: ${JSON.stringify(prompt.content)},`,
|
|
158
|
+
` content_type: "${prompt.content_type}",`,
|
|
159
|
+
` schema: ${schemaImportName}`,
|
|
160
|
+
];
|
|
161
|
+
if (prompt.name) {
|
|
162
|
+
lines.splice(4, 0, ` name: ${JSON.stringify(prompt.name)},`);
|
|
163
|
+
}
|
|
164
|
+
if (prompt.externalId) {
|
|
165
|
+
lines.splice(4, 0, ` externalId: ${JSON.stringify(prompt.externalId)},`);
|
|
166
|
+
}
|
|
167
|
+
lines.push('};');
|
|
168
|
+
const code = lines.join('\n');
|
|
169
|
+
return {
|
|
170
|
+
data: prompt,
|
|
171
|
+
imports,
|
|
172
|
+
code,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
// Standard case without schema
|
|
176
|
+
return {
|
|
177
|
+
data: prompt,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../src/presets/prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC;AAOpC;;GAEG;AACH,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,kBAAkB;IAClB,IAAI,E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