@vertesia/build-tools 1.3.0 → 1.4.0-dev.20260615.042033Z
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 +3 -3
- package/lib/bin/build.d.ts +35 -0
- package/lib/bin/build.d.ts.map +1 -0
- package/lib/bin/build.js +79 -0
- package/lib/bin/build.js.map +1 -0
- package/lib/bin/config.d.ts +24 -0
- package/lib/bin/config.d.ts.map +1 -0
- package/lib/bin/config.js +91 -0
- package/lib/bin/config.js.map +1 -0
- package/lib/core/compilers/widget.d.ts +27 -0
- package/lib/core/compilers/widget.d.ts.map +1 -0
- package/lib/core/compilers/widget.js +37 -0
- package/lib/core/compilers/widget.js.map +1 -0
- package/lib/{types → core}/parsers/frontmatter.d.ts +1 -1
- package/lib/core/parsers/frontmatter.d.ts.map +1 -0
- package/lib/{esm → core}/parsers/frontmatter.js +1 -1
- package/lib/core/parsers/frontmatter.js.map +1 -0
- package/lib/core/transformers/index.d.ts +10 -0
- package/lib/core/transformers/index.d.ts.map +1 -0
- package/lib/core/transformers/index.js +10 -0
- package/lib/core/transformers/index.js.map +1 -0
- package/lib/{types/presets → core/transformers}/prompt.d.ts +7 -21
- package/lib/core/transformers/prompt.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/prompt.js +17 -14
- package/lib/core/transformers/prompt.js.map +1 -0
- package/lib/core/transformers/raw.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/raw.js +2 -2
- package/lib/core/transformers/raw.js.map +1 -0
- package/lib/core/transformers/skill-collection.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/skill-collection.js +5 -12
- package/lib/core/transformers/skill-collection.js.map +1 -0
- package/lib/core/transformers/skill.d.ts +111 -0
- package/lib/core/transformers/skill.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/skill.js +70 -51
- package/lib/core/transformers/skill.js.map +1 -0
- package/lib/core/transformers/template-collection.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/template-collection.js +5 -12
- package/lib/core/transformers/template-collection.js.map +1 -0
- package/lib/{types/presets → core/transformers}/template.d.ts +7 -22
- package/lib/core/transformers/template.d.ts.map +1 -0
- package/lib/{esm/presets → core/transformers}/template.js +16 -11
- package/lib/core/transformers/template.js.map +1 -0
- package/lib/{types → core}/types.d.ts +5 -61
- package/lib/core/types.d.ts.map +1 -0
- package/lib/core/types.js +6 -0
- package/lib/{cjs → core}/types.js.map +1 -1
- package/lib/core/utils/asset-copy.d.ts.map +1 -0
- package/lib/core/utils/asset-copy.js.map +1 -0
- package/lib/core/utils/asset-discovery.d.ts.map +1 -0
- package/lib/{esm → core}/utils/asset-discovery.js +4 -4
- package/lib/core/utils/asset-discovery.js.map +1 -0
- package/lib/core/utils/template-asset-discovery.d.ts.map +1 -0
- package/lib/{esm → core}/utils/template-asset-discovery.js +3 -7
- package/lib/core/utils/template-asset-discovery.js.map +1 -0
- package/lib/import-transform/builtins.d.ts +21 -0
- package/lib/import-transform/builtins.d.ts.map +1 -0
- package/lib/import-transform/builtins.js +50 -0
- package/lib/import-transform/builtins.js.map +1 -0
- package/lib/import-transform/chunk-emitter.d.ts +24 -0
- package/lib/import-transform/chunk-emitter.d.ts.map +1 -0
- package/lib/import-transform/chunk-emitter.js +35 -0
- package/lib/import-transform/chunk-emitter.js.map +1 -0
- package/lib/import-transform/detector.d.ts +24 -0
- package/lib/import-transform/detector.d.ts.map +1 -0
- package/lib/import-transform/detector.js +34 -0
- package/lib/import-transform/detector.js.map +1 -0
- package/lib/import-transform/index.d.ts +47 -0
- package/lib/import-transform/index.d.ts.map +1 -0
- package/lib/import-transform/index.js +115 -0
- package/lib/import-transform/index.js.map +1 -0
- package/lib/import-transform/patterns.d.ts +25 -0
- package/lib/import-transform/patterns.d.ts.map +1 -0
- package/lib/import-transform/patterns.js +27 -0
- package/lib/import-transform/patterns.js.map +1 -0
- package/lib/import-transform/resolver.d.ts +23 -0
- package/lib/import-transform/resolver.d.ts.map +1 -0
- package/lib/import-transform/resolver.js +30 -0
- package/lib/import-transform/resolver.js.map +1 -0
- package/lib/import-transform/rewriter.d.ts +21 -0
- package/lib/import-transform/rewriter.d.ts.map +1 -0
- package/lib/import-transform/rewriter.js +30 -0
- package/lib/import-transform/rewriter.js.map +1 -0
- package/lib/import-transform/scanner.d.ts +17 -0
- package/lib/import-transform/scanner.d.ts.map +1 -0
- package/lib/import-transform/scanner.js +46 -0
- package/lib/import-transform/scanner.js.map +1 -0
- package/lib/index.d.ts +39 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +43 -0
- package/lib/index.js.map +1 -0
- package/lib/vite/api-server.d.ts +54 -0
- package/lib/vite/api-server.d.ts.map +1 -0
- package/lib/vite/api-server.js +94 -0
- package/lib/vite/api-server.js.map +1 -0
- package/lib/vite/dev-server.d.ts +42 -0
- package/lib/vite/dev-server.d.ts.map +1 -0
- package/lib/vite/dev-server.js +111 -0
- package/lib/vite/dev-server.js.map +1 -0
- package/lib/vite/index.d.ts +15 -0
- package/lib/vite/index.d.ts.map +1 -0
- package/lib/vite/index.js +15 -0
- package/lib/vite/index.js.map +1 -0
- package/package.json +38 -28
- package/src/bin/build.ts +83 -0
- package/src/bin/config.ts +113 -0
- package/src/core/compilers/widget.ts +69 -0
- package/src/{parsers → core/parsers}/frontmatter.ts +2 -2
- package/src/core/transformers/index.ts +27 -0
- package/src/{presets → core/transformers}/prompt.ts +35 -32
- package/src/{presets → core/transformers}/raw.ts +2 -2
- package/src/{presets → core/transformers}/skill-collection.ts +5 -12
- package/src/{presets → core/transformers}/skill.ts +119 -99
- package/src/{presets → core/transformers}/template-collection.ts +76 -83
- package/src/{presets → core/transformers}/template.ts +121 -116
- package/src/core/types.ts +71 -0
- package/src/{utils → core/utils}/asset-copy.ts +3 -2
- package/src/{utils → core/utils}/asset-discovery.ts +5 -5
- package/src/{utils → core/utils}/template-asset-discovery.ts +70 -77
- package/src/import-transform/builtins.ts +56 -0
- package/src/import-transform/chunk-emitter.ts +60 -0
- package/src/import-transform/detector.ts +56 -0
- package/src/import-transform/index.ts +171 -0
- package/src/import-transform/patterns.ts +34 -0
- package/src/import-transform/resolver.ts +57 -0
- package/src/import-transform/rewriter.ts +48 -0
- package/src/import-transform/scanner.ts +55 -0
- package/src/index.ts +67 -42
- package/src/vite/api-server.ts +142 -0
- package/src/vite/dev-server.ts +128 -0
- package/src/vite/index.ts +15 -0
- package/lib/build-tools.js +0 -2054
- package/lib/build-tools.js.map +0 -1
- package/lib/cjs/index.js +0 -43
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/parsers/frontmatter.js +0 -25
- package/lib/cjs/parsers/frontmatter.js.map +0 -1
- package/lib/cjs/plugin.js +0 -150
- package/lib/cjs/plugin.js.map +0 -1
- package/lib/cjs/presets/index.js +0 -25
- package/lib/cjs/presets/index.js.map +0 -1
- package/lib/cjs/presets/prompt.js +0 -185
- package/lib/cjs/presets/prompt.js.map +0 -1
- package/lib/cjs/presets/raw.js +0 -25
- package/lib/cjs/presets/raw.js.map +0 -1
- package/lib/cjs/presets/skill-collection.js +0 -83
- package/lib/cjs/presets/skill-collection.js.map +0 -1
- package/lib/cjs/presets/skill.js +0 -272
- package/lib/cjs/presets/skill.js.map +0 -1
- package/lib/cjs/presets/template-collection.js +0 -80
- package/lib/cjs/presets/template-collection.js.map +0 -1
- package/lib/cjs/presets/template.js +0 -105
- package/lib/cjs/presets/template.js.map +0 -1
- package/lib/cjs/types.js +0 -6
- package/lib/cjs/utils/asset-copy.js +0 -61
- package/lib/cjs/utils/asset-copy.js.map +0 -1
- package/lib/cjs/utils/asset-discovery.js +0 -100
- package/lib/cjs/utils/asset-discovery.js.map +0 -1
- package/lib/cjs/utils/template-asset-discovery.js +0 -63
- package/lib/cjs/utils/template-asset-discovery.js.map +0 -1
- package/lib/cjs/utils/widget-compiler.js +0 -115
- package/lib/cjs/utils/widget-compiler.js.map +0 -1
- package/lib/cjs/vite.js +0 -45
- package/lib/cjs/vite.js.map +0 -1
- package/lib/esm/index.js +0 -26
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/parsers/frontmatter.js.map +0 -1
- package/lib/esm/plugin.js +0 -144
- package/lib/esm/plugin.js.map +0 -1
- package/lib/esm/presets/index.js +0 -10
- package/lib/esm/presets/index.js.map +0 -1
- package/lib/esm/presets/prompt.js.map +0 -1
- package/lib/esm/presets/raw.js.map +0 -1
- package/lib/esm/presets/skill-collection.js.map +0 -1
- package/lib/esm/presets/skill.js.map +0 -1
- package/lib/esm/presets/template-collection.js.map +0 -1
- package/lib/esm/presets/template.js.map +0 -1
- package/lib/esm/types.js +0 -5
- package/lib/esm/types.js.map +0 -1
- package/lib/esm/utils/asset-copy.js.map +0 -1
- package/lib/esm/utils/asset-discovery.js.map +0 -1
- package/lib/esm/utils/template-asset-discovery.js.map +0 -1
- package/lib/esm/utils/widget-compiler.js +0 -76
- package/lib/esm/utils/widget-compiler.js.map +0 -1
- package/lib/esm/vite.js +0 -42
- package/lib/esm/vite.js.map +0 -1
- package/lib/types/index.d.ts +0 -24
- package/lib/types/index.d.ts.map +0 -1
- package/lib/types/parsers/frontmatter.d.ts.map +0 -1
- package/lib/types/plugin.d.ts +0 -10
- package/lib/types/plugin.d.ts.map +0 -1
- package/lib/types/presets/index.d.ts +0 -10
- package/lib/types/presets/index.d.ts.map +0 -1
- package/lib/types/presets/prompt.d.ts.map +0 -1
- package/lib/types/presets/raw.d.ts.map +0 -1
- package/lib/types/presets/skill-collection.d.ts.map +0 -1
- package/lib/types/presets/skill.d.ts +0 -361
- package/lib/types/presets/skill.d.ts.map +0 -1
- package/lib/types/presets/template-collection.d.ts.map +0 -1
- package/lib/types/presets/template.d.ts.map +0 -1
- package/lib/types/types.d.ts.map +0 -1
- package/lib/types/utils/asset-copy.d.ts.map +0 -1
- package/lib/types/utils/asset-discovery.d.ts.map +0 -1
- package/lib/types/utils/template-asset-discovery.d.ts.map +0 -1
- package/lib/types/utils/widget-compiler.d.ts +0 -15
- package/lib/types/utils/widget-compiler.d.ts.map +0 -1
- package/lib/types/vite.d.ts +0 -32
- package/lib/types/vite.d.ts.map +0 -1
- package/src/plugin.ts +0 -166
- package/src/presets/index.ts +0 -10
- package/src/types.ts +0 -140
- package/src/utils/widget-compiler.ts +0 -98
- package/src/vite.ts +0 -45
- /package/lib/{types/presets → core/transformers}/raw.d.ts +0 -0
- /package/lib/{types/presets → core/transformers}/skill-collection.d.ts +0 -0
- /package/lib/{types/presets → core/transformers}/template-collection.d.ts +0 -0
- /package/lib/{types → core}/utils/asset-copy.d.ts +0 -0
- /package/lib/{esm → core}/utils/asset-copy.js +0 -0
- /package/lib/{types → core}/utils/asset-discovery.d.ts +0 -0
- /package/lib/{types → core}/utils/template-asset-discovery.d.ts +0 -0
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ description: A helpful skill
|
|
|
76
76
|
content_type: md
|
|
77
77
|
context_triggers:
|
|
78
78
|
keywords: [skill, helper]
|
|
79
|
-
|
|
79
|
+
tools: [tool1, tool2]
|
|
80
80
|
---
|
|
81
81
|
|
|
82
82
|
# My Skill
|
|
@@ -95,7 +95,7 @@ This is the skill content in markdown.
|
|
|
95
95
|
context_triggers: {
|
|
96
96
|
keywords: ['skill', 'helper']
|
|
97
97
|
},
|
|
98
|
-
|
|
98
|
+
tools: ['tool1', 'tool2'],
|
|
99
99
|
scripts: ['helper.js', 'script.py'], // If .js/.py files exist in skill dir
|
|
100
100
|
widgets: ['chart', 'user-select'] // If .tsx files exist in skill dir
|
|
101
101
|
}
|
|
@@ -133,7 +133,7 @@ This is the skill content in markdown.
|
|
|
133
133
|
system_packages?: string[]; // System-level packages
|
|
134
134
|
template?: string; // Code template
|
|
135
135
|
};
|
|
136
|
-
|
|
136
|
+
tools?: string[]; // Optional: Related tool names
|
|
137
137
|
scripts?: string[]; // Optional: Script files in skill dir
|
|
138
138
|
widgets?: string[]; // Optional: Widget names in skill dir
|
|
139
139
|
isEnabled?: (context: any) => Promise<boolean>; // Optional: Runtime filter function
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `vertesia-build` — Vertesia plugin build CLI.
|
|
4
|
+
*
|
|
5
|
+
* Today this runs the post-`tsc` finalization step: import transformation
|
|
6
|
+
* (`?skill` / `?raw` / `?prompt` / `?template` / `?skills` / `?templates`
|
|
7
|
+
* and bare `SKILL.md` / `TEMPLATE.md` imports), asset copying, and esbuild
|
|
8
|
+
* widget bundling.
|
|
9
|
+
*
|
|
10
|
+
* Reads its configuration from the consuming package's `package.json` under
|
|
11
|
+
* the `vertesia-build` key, then delegates to `transformImports` in
|
|
12
|
+
* `@vertesia/build-tools`.
|
|
13
|
+
*
|
|
14
|
+
* Usage in a plugin's package.json:
|
|
15
|
+
*
|
|
16
|
+
* {
|
|
17
|
+
* "scripts": {
|
|
18
|
+
* "build:server": "tsc -p tsconfig.tool-server.json && vertesia-build"
|
|
19
|
+
* },
|
|
20
|
+
* "vertesia-build": {
|
|
21
|
+
* "libDir": "./lib",
|
|
22
|
+
* "srcDir": "./src/tool-server",
|
|
23
|
+
* "transformers": ["skill", "skills", "template", "templates", "prompt", "raw"],
|
|
24
|
+
* "assetsDir": "./dist",
|
|
25
|
+
* "widgetsDir": "widgets",
|
|
26
|
+
* "widgetConfig": { "minify": false }
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* Available transformer names: skill, skills, template, templates, prompt, raw.
|
|
31
|
+
* The `transformers` field is required so consumers explicitly opt in to each
|
|
32
|
+
* preset (and so missing or misspelled names fail loudly at build time).
|
|
33
|
+
*/
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/bin/build.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG"}
|
package/lib/bin/build.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* `vertesia-build` — Vertesia plugin build CLI.
|
|
4
|
+
*
|
|
5
|
+
* Today this runs the post-`tsc` finalization step: import transformation
|
|
6
|
+
* (`?skill` / `?raw` / `?prompt` / `?template` / `?skills` / `?templates`
|
|
7
|
+
* and bare `SKILL.md` / `TEMPLATE.md` imports), asset copying, and esbuild
|
|
8
|
+
* widget bundling.
|
|
9
|
+
*
|
|
10
|
+
* Reads its configuration from the consuming package's `package.json` under
|
|
11
|
+
* the `vertesia-build` key, then delegates to `transformImports` in
|
|
12
|
+
* `@vertesia/build-tools`.
|
|
13
|
+
*
|
|
14
|
+
* Usage in a plugin's package.json:
|
|
15
|
+
*
|
|
16
|
+
* {
|
|
17
|
+
* "scripts": {
|
|
18
|
+
* "build:server": "tsc -p tsconfig.tool-server.json && vertesia-build"
|
|
19
|
+
* },
|
|
20
|
+
* "vertesia-build": {
|
|
21
|
+
* "libDir": "./lib",
|
|
22
|
+
* "srcDir": "./src/tool-server",
|
|
23
|
+
* "transformers": ["skill", "skills", "template", "templates", "prompt", "raw"],
|
|
24
|
+
* "assetsDir": "./dist",
|
|
25
|
+
* "widgetsDir": "widgets",
|
|
26
|
+
* "widgetConfig": { "minify": false }
|
|
27
|
+
* }
|
|
28
|
+
* }
|
|
29
|
+
*
|
|
30
|
+
* Available transformer names: skill, skills, template, templates, prompt, raw.
|
|
31
|
+
* The `transformers` field is required so consumers explicitly opt in to each
|
|
32
|
+
* preset (and so missing or misspelled names fail loudly at build time).
|
|
33
|
+
*/
|
|
34
|
+
import { readFileSync } from 'node:fs';
|
|
35
|
+
import path from 'node:path';
|
|
36
|
+
import { transformImports } from '../import-transform/index.js';
|
|
37
|
+
import { resolveConfig, VertesiaBuildConfigError } from './config.js';
|
|
38
|
+
function fail(message) {
|
|
39
|
+
console.error(`vertesia-build: ${message}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
function readPackageJson(cwd) {
|
|
43
|
+
const pkgPath = path.join(cwd, 'package.json');
|
|
44
|
+
let raw;
|
|
45
|
+
try {
|
|
46
|
+
raw = readFileSync(pkgPath, 'utf-8');
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
fail(`could not read ${pkgPath}: ${error.message}`);
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
return JSON.parse(raw);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
fail(`could not parse ${pkgPath}: ${error.message}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
async function main() {
|
|
59
|
+
const cwd = process.cwd();
|
|
60
|
+
const pkg = readPackageJson(cwd);
|
|
61
|
+
let options;
|
|
62
|
+
try {
|
|
63
|
+
options = resolveConfig(pkg, cwd);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (error instanceof VertesiaBuildConfigError) {
|
|
67
|
+
fail(error.message);
|
|
68
|
+
}
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
const result = await transformImports(options);
|
|
72
|
+
console.log(`vertesia-build: files=${result.filesProcessed} chunks=${result.chunksEmitted} ` +
|
|
73
|
+
`assets=${result.assetsCopied} widgets=${result.widgetsCompiled}`);
|
|
74
|
+
}
|
|
75
|
+
main().catch((error) => {
|
|
76
|
+
console.error(`vertesia-build: ${error.stack ?? error.message}`);
|
|
77
|
+
process.exit(1);
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/bin/build.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gB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,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC/C,OAAO,CAAC,GAAG,CACP,yBAAyB,MAAM,CAAC,cAAc,WAAW,MAAM,CAAC,aAAa,GAAG;QAC5E,UAAU,MAAM,CAAC,YAAY,YAAY,MAAM,CAAC,eAAe,EAAE,CACxE,CAAC;AACN,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,mBAAoB,KAAe,CAAC,KAAK,IAAK,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IACvF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure config-parsing logic for the `vertesia-build` CLI.
|
|
3
|
+
*
|
|
4
|
+
* Lives in its own module so it can be unit-tested without spawning a
|
|
5
|
+
* subprocess. Errors are surfaced as thrown exceptions — the CLI entry
|
|
6
|
+
* point (`build.ts`) catches them and translates to `process.exit(1)`
|
|
7
|
+
* with a clear message.
|
|
8
|
+
*/
|
|
9
|
+
import type { TransformImportsOptions } from '../import-transform/index.js';
|
|
10
|
+
export declare const CONFIG_KEY = "vertesia-build";
|
|
11
|
+
export declare class VertesiaBuildConfigError extends Error {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Parse and validate the `vertesia-build` block of a package.json.
|
|
16
|
+
*
|
|
17
|
+
* @param pkg Parsed contents of the consuming `package.json`.
|
|
18
|
+
* @param cwd Working directory used to resolve relative paths in the config.
|
|
19
|
+
* @returns Resolved options suitable for passing to `transformImports`.
|
|
20
|
+
* @throws {VertesiaBuildConfigError} when the config is missing, malformed,
|
|
21
|
+
* or references unknown transformers.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveConfig(pkg: Record<string, unknown>, cwd: string): TransformImportsOptions;
|
|
24
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/bin/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAE5E,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAE3C,qBAAa,wBAAyB,SAAQ,KAAK;gBACnC,OAAO,EAAE,MAAM;CAI9B;AAWD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAwEhG"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure config-parsing logic for the `vertesia-build` CLI.
|
|
3
|
+
*
|
|
4
|
+
* Lives in its own module so it can be unit-tested without spawning a
|
|
5
|
+
* subprocess. Errors are surfaced as thrown exceptions — the CLI entry
|
|
6
|
+
* point (`build.ts`) catches them and translates to `process.exit(1)`
|
|
7
|
+
* with a clear message.
|
|
8
|
+
*/
|
|
9
|
+
import path from 'node:path';
|
|
10
|
+
import { resolveTransformerNames } from '../import-transform/builtins.js';
|
|
11
|
+
export const CONFIG_KEY = 'vertesia-build';
|
|
12
|
+
export class VertesiaBuildConfigError extends Error {
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.name = 'VertesiaBuildConfigError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Parse and validate the `vertesia-build` block of a package.json.
|
|
20
|
+
*
|
|
21
|
+
* @param pkg Parsed contents of the consuming `package.json`.
|
|
22
|
+
* @param cwd Working directory used to resolve relative paths in the config.
|
|
23
|
+
* @returns Resolved options suitable for passing to `transformImports`.
|
|
24
|
+
* @throws {VertesiaBuildConfigError} when the config is missing, malformed,
|
|
25
|
+
* or references unknown transformers.
|
|
26
|
+
*/
|
|
27
|
+
export function resolveConfig(pkg, cwd) {
|
|
28
|
+
const raw = pkg[CONFIG_KEY];
|
|
29
|
+
if (raw === undefined) {
|
|
30
|
+
throw new VertesiaBuildConfigError(`missing "${CONFIG_KEY}" key in package.json at ${cwd}.`);
|
|
31
|
+
}
|
|
32
|
+
if (typeof raw !== 'object' || raw === null || Array.isArray(raw)) {
|
|
33
|
+
throw new VertesiaBuildConfigError(`"${CONFIG_KEY}" must be an object in package.json.`);
|
|
34
|
+
}
|
|
35
|
+
const cfg = raw;
|
|
36
|
+
if (typeof cfg.libDir !== 'string' || cfg.libDir.length === 0) {
|
|
37
|
+
throw new VertesiaBuildConfigError(`"${CONFIG_KEY}.libDir" must be a non-empty string.`);
|
|
38
|
+
}
|
|
39
|
+
if (typeof cfg.srcDir !== 'string' || cfg.srcDir.length === 0) {
|
|
40
|
+
throw new VertesiaBuildConfigError(`"${CONFIG_KEY}.srcDir" must be a non-empty string.`);
|
|
41
|
+
}
|
|
42
|
+
if (!Array.isArray(cfg.transformers) || cfg.transformers.length === 0) {
|
|
43
|
+
throw new VertesiaBuildConfigError(`"${CONFIG_KEY}.transformers" must be a non-empty array of transformer names.`);
|
|
44
|
+
}
|
|
45
|
+
const names = [];
|
|
46
|
+
for (const entry of cfg.transformers) {
|
|
47
|
+
if (typeof entry !== 'string' || entry.length === 0) {
|
|
48
|
+
throw new VertesiaBuildConfigError(`every entry in "${CONFIG_KEY}.transformers" must be a non-empty string.`);
|
|
49
|
+
}
|
|
50
|
+
names.push(entry);
|
|
51
|
+
}
|
|
52
|
+
let transformers;
|
|
53
|
+
try {
|
|
54
|
+
transformers = resolveTransformerNames(names);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
// resolveTransformerNames throws plain Error; rewrap so callers can
|
|
58
|
+
// identify config-level failures uniformly.
|
|
59
|
+
throw new VertesiaBuildConfigError(error.message);
|
|
60
|
+
}
|
|
61
|
+
const resolved = {
|
|
62
|
+
libDir: path.resolve(cwd, cfg.libDir),
|
|
63
|
+
srcDir: path.resolve(cwd, cfg.srcDir),
|
|
64
|
+
transformers,
|
|
65
|
+
};
|
|
66
|
+
if (cfg.assetsDir !== undefined) {
|
|
67
|
+
if (cfg.assetsDir === false) {
|
|
68
|
+
resolved.assetsDir = false;
|
|
69
|
+
}
|
|
70
|
+
else if (typeof cfg.assetsDir === 'string' && cfg.assetsDir.length > 0) {
|
|
71
|
+
resolved.assetsDir = path.resolve(cwd, cfg.assetsDir);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
throw new VertesiaBuildConfigError(`"${CONFIG_KEY}.assetsDir" must be a string path or false.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (cfg.widgetsDir !== undefined) {
|
|
78
|
+
if (typeof cfg.widgetsDir !== 'string' || cfg.widgetsDir.length === 0) {
|
|
79
|
+
throw new VertesiaBuildConfigError(`"${CONFIG_KEY}.widgetsDir" must be a non-empty string when set.`);
|
|
80
|
+
}
|
|
81
|
+
resolved.widgetsDir = cfg.widgetsDir;
|
|
82
|
+
}
|
|
83
|
+
if (cfg.widgetConfig !== undefined) {
|
|
84
|
+
if (typeof cfg.widgetConfig !== 'object' || cfg.widgetConfig === null || Array.isArray(cfg.widgetConfig)) {
|
|
85
|
+
throw new VertesiaBuildConfigError(`"${CONFIG_KEY}.widgetConfig" must be an object when set.`);
|
|
86
|
+
}
|
|
87
|
+
resolved.widgetConfig = cfg.widgetConfig;
|
|
88
|
+
}
|
|
89
|
+
return resolved;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/bin/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG1E,MAAM,CAAC,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CAA6C,CAAC,CAAC;QACpG,CAAC;IACL,CAAC;IAED,IAAI,GAAG,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QAC/B,IAAI,OAAO,GAAG,CAAC,UAAU,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpE,MAAM,IAAI,wBAAwB,CAAC,IAAI,UAAU,mDAAmD,CAAC,CAAC;QAC1G,CAAC;QACD,QAAQ,CAAC,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC;IACzC,CAAC;IAED,IAAI,GAAG,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACjC,IAAI,OAAO,GAAG,CAAC,YAAY,KAAK,QAAQ,IAAI,GAAG,CAAC,YAAY,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YACvG,MAAM,IAAI,wBAAwB,CAAC,IAAI,UAAU,4CAA4C,CAAC,CAAC;QACnG,CAAC;QACD,QAAQ,CAAC,YAAY,GAAG,GAAG,CAAC,YAAuD,CAAC;IACxF,CAAC;IAED,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widget bundler using esbuild.
|
|
3
|
+
*
|
|
4
|
+
* Takes already-compiled JavaScript widget entries (produced by `tsc` from
|
|
5
|
+
* `.tsx` sources) and emits a single-file ESM bundle with React-family
|
|
6
|
+
* packages left as external imports.
|
|
7
|
+
*
|
|
8
|
+
* No TypeScript / JSX transformation happens here — `tsc` does that during
|
|
9
|
+
* the main build step. This module is a pure module concatenator.
|
|
10
|
+
*/
|
|
11
|
+
export interface WidgetCompilerConfig {
|
|
12
|
+
/** External package names that should not be bundled. */
|
|
13
|
+
external?: string[];
|
|
14
|
+
/** Minify the output. Default: false */
|
|
15
|
+
minify?: boolean;
|
|
16
|
+
/** Emit source maps. Default: true */
|
|
17
|
+
sourcemap?: boolean | 'inline' | 'external';
|
|
18
|
+
}
|
|
19
|
+
export interface WidgetInput {
|
|
20
|
+
/** Widget name (used for the output file name, without extension). */
|
|
21
|
+
name: string;
|
|
22
|
+
/** Absolute path to the already-compiled `.js` entry to bundle. */
|
|
23
|
+
entry: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function compileWidget(widget: WidgetInput, outputDir: string, config?: WidgetCompilerConfig): Promise<string>;
|
|
26
|
+
export declare function compileWidgets(widgets: WidgetInput[], outputDir: string, config?: WidgetCompilerConfig): Promise<number>;
|
|
27
|
+
//# sourceMappingURL=widget.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../../src/core/compilers/widget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,MAAM,WAAW,oBAAoB;IACjC,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,sCAAsC;IACtC,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,UAAU,CAAC;CAC/C;AAED,MAAM,WAAW,WAAW;IACxB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IAEb,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,aAAa,CAC/B,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,oBAAyB,GAClC,OAAO,CAAC,MAAM,CAAC,CAiBjB;AAED,wBAAsB,cAAc,CAChC,OAAO,EAAE,WAAW,EAAE,EACtB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,oBAAyB,GAClC,OAAO,CAAC,MAAM,CAAC,CAMjB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Widget bundler using esbuild.
|
|
3
|
+
*
|
|
4
|
+
* Takes already-compiled JavaScript widget entries (produced by `tsc` from
|
|
5
|
+
* `.tsx` sources) and emits a single-file ESM bundle with React-family
|
|
6
|
+
* packages left as external imports.
|
|
7
|
+
*
|
|
8
|
+
* No TypeScript / JSX transformation happens here — `tsc` does that during
|
|
9
|
+
* the main build step. This module is a pure module concatenator.
|
|
10
|
+
*/
|
|
11
|
+
import path from 'node:path';
|
|
12
|
+
import { build } from 'esbuild';
|
|
13
|
+
const DEFAULT_EXTERNALS = ['react', 'react-dom', 'react/jsx-runtime', 'react/jsx-dev-runtime', 'react-dom/client'];
|
|
14
|
+
export async function compileWidget(widget, outputDir, config = {}) {
|
|
15
|
+
const { external = DEFAULT_EXTERNALS, minify = false, sourcemap = true } = config;
|
|
16
|
+
const outfile = path.join(outputDir, `${widget.name}.js`);
|
|
17
|
+
await build({
|
|
18
|
+
entryPoints: [widget.entry],
|
|
19
|
+
outfile,
|
|
20
|
+
bundle: true,
|
|
21
|
+
format: 'esm',
|
|
22
|
+
platform: 'browser',
|
|
23
|
+
external,
|
|
24
|
+
minify,
|
|
25
|
+
sourcemap,
|
|
26
|
+
logLevel: 'silent',
|
|
27
|
+
});
|
|
28
|
+
return outfile;
|
|
29
|
+
}
|
|
30
|
+
export async function compileWidgets(widgets, outputDir, config = {}) {
|
|
31
|
+
if (widgets.length === 0) {
|
|
32
|
+
return 0;
|
|
33
|
+
}
|
|
34
|
+
await Promise.all(widgets.map((widget) => compileWidget(widget, outputDir, config)));
|
|
35
|
+
return widgets.length;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=widget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../src/core/compilers/widget.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,mBA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,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB,4BAA4B;IAC5B,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAQnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../../src/core/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"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset transformers for common use cases
|
|
3
|
+
*/
|
|
4
|
+
export { type PromptContentType, type PromptDefinition, PromptDefinitionSchema, PromptRole, promptTransformer, TemplateType, } from './prompt.js';
|
|
5
|
+
export { rawTransformer } from './raw.js';
|
|
6
|
+
export { type SkillContentType, type SkillDefinition, SkillDefinitionSchema, SkillPropertiesSchema, skillTransformer, } from './skill.js';
|
|
7
|
+
export { skillCollectionTransformer } from './skill-collection.js';
|
|
8
|
+
export { type RenderingTemplateDefinition, RenderingTemplateDefinitionSchema, templateTransformer, } from './template.js';
|
|
9
|
+
export { templateCollectionTransformer } from './template-collection.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/transformers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACH,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EACjB,YAAY,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EACH,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EACH,KAAK,2BAA2B,EAChC,iCAAiC,EACjC,mBAAmB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preset transformers for common use cases
|
|
3
|
+
*/
|
|
4
|
+
export { PromptDefinitionSchema, PromptRole, promptTransformer, TemplateType, } from './prompt.js';
|
|
5
|
+
export { rawTransformer } from './raw.js';
|
|
6
|
+
export { SkillDefinitionSchema, SkillPropertiesSchema, skillTransformer, } from './skill.js';
|
|
7
|
+
export { skillCollectionTransformer } from './skill-collection.js';
|
|
8
|
+
export { RenderingTemplateDefinitionSchema, templateTransformer, } from './template.js';
|
|
9
|
+
export { templateCollectionTransformer } from './template-collection.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/transformers/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAGH,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EACjB,YAAY,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAGH,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAEH,iCAAiC,EACjC,mBAAmB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,6BAA6B,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Prompt transformer preset for template files with frontmatter
|
|
3
3
|
* Supports .jst, .hbs, and plain text files
|
|
4
4
|
*/
|
|
5
|
+
import { PromptRole } from '@llumiverse/common';
|
|
6
|
+
import { type JSONSchema, TemplateType } from '@vertesia/common';
|
|
5
7
|
import { z } from 'zod';
|
|
6
8
|
import type { TransformerPreset } from '../types.js';
|
|
7
|
-
import { TemplateType } from '@vertesia/common';
|
|
8
|
-
import { PromptRole } from '@llumiverse/common';
|
|
9
9
|
/**
|
|
10
10
|
* Re-export types for backwards compatibility
|
|
11
11
|
*/
|
|
12
|
-
export {
|
|
12
|
+
export { PromptRole, TemplateType };
|
|
13
13
|
/**
|
|
14
14
|
* Template type alias
|
|
15
15
|
*/
|
|
@@ -19,27 +19,13 @@ export type PromptContentType = TemplateType;
|
|
|
19
19
|
* Zod schema for prompt definition
|
|
20
20
|
*/
|
|
21
21
|
export declare const PromptDefinitionSchema: z.ZodObject<{
|
|
22
|
-
role: z.
|
|
22
|
+
role: z.ZodEnum<typeof PromptRole>;
|
|
23
23
|
content: z.ZodString;
|
|
24
|
-
content_type: z.
|
|
25
|
-
schema: z.ZodOptional<z.
|
|
24
|
+
content_type: z.ZodEnum<typeof TemplateType>;
|
|
25
|
+
schema: z.ZodOptional<z.ZodCustom<JSONSchema, JSONSchema>>;
|
|
26
26
|
name: z.ZodOptional<z.ZodString>;
|
|
27
27
|
externalId: z.ZodOptional<z.ZodString>;
|
|
28
|
-
},
|
|
29
|
-
content_type: TemplateType;
|
|
30
|
-
content: string;
|
|
31
|
-
role: PromptRole;
|
|
32
|
-
schema?: any;
|
|
33
|
-
name?: string | undefined;
|
|
34
|
-
externalId?: string | undefined;
|
|
35
|
-
}, {
|
|
36
|
-
content_type: TemplateType;
|
|
37
|
-
content: string;
|
|
38
|
-
role: PromptRole;
|
|
39
|
-
schema?: any;
|
|
40
|
-
name?: string | undefined;
|
|
41
|
-
externalId?: string | undefined;
|
|
42
|
-
}>;
|
|
28
|
+
}, z.core.$strip>;
|
|
43
29
|
/**
|
|
44
30
|
* TypeScript type inferred from the Zod schema
|
|
45
31
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../src/core/transformers/prompt.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,KAAK,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AAEpC;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAoB7C;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;iBAOjC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAkGtE;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,EAAE,iBA4D/B,CAAC"}
|
|
@@ -2,29 +2,31 @@
|
|
|
2
2
|
* Prompt transformer preset for template files with frontmatter
|
|
3
3
|
* Supports .jst, .hbs, and plain text files
|
|
4
4
|
*/
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { PromptRole } from '@llumiverse/common';
|
|
7
|
+
import { TemplateType } from '@vertesia/common';
|
|
5
8
|
import { z } from 'zod';
|
|
6
9
|
import { parseFrontmatter } from '../parsers/frontmatter.js';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import { TemplateType } from '@vertesia/common';
|
|
9
|
-
import { PromptRole } from '@llumiverse/common';
|
|
10
10
|
/**
|
|
11
11
|
* Re-export types for backwards compatibility
|
|
12
12
|
*/
|
|
13
|
-
export {
|
|
13
|
+
export { PromptRole, TemplateType };
|
|
14
14
|
/**
|
|
15
15
|
* Zod schema for prompt frontmatter validation
|
|
16
16
|
*/
|
|
17
|
-
const PromptFrontmatterSchema = z
|
|
17
|
+
const PromptFrontmatterSchema = z
|
|
18
|
+
.object({
|
|
18
19
|
// Required fields
|
|
19
20
|
role: z.nativeEnum(PromptRole, {
|
|
20
|
-
|
|
21
|
+
error: 'Role must be one of: safety, system, user, assistant, negative',
|
|
21
22
|
}),
|
|
22
23
|
// Optional fields
|
|
23
24
|
content_type: z.nativeEnum(TemplateType).optional(),
|
|
24
25
|
schema: z.string().optional(),
|
|
25
26
|
name: z.string().optional(),
|
|
26
27
|
externalId: z.string().optional(),
|
|
27
|
-
})
|
|
28
|
+
})
|
|
29
|
+
.strict();
|
|
28
30
|
/**
|
|
29
31
|
* MUST be kept in sync with @vertesia/common InCodePrompt
|
|
30
32
|
* Zod schema for prompt definition
|
|
@@ -33,7 +35,7 @@ export const PromptDefinitionSchema = z.object({
|
|
|
33
35
|
role: z.nativeEnum(PromptRole),
|
|
34
36
|
content: z.string(),
|
|
35
37
|
content_type: z.nativeEnum(TemplateType),
|
|
36
|
-
schema: z.
|
|
38
|
+
schema: z.custom().optional(),
|
|
37
39
|
name: z.string().optional(),
|
|
38
40
|
externalId: z.string().optional(),
|
|
39
41
|
});
|
|
@@ -50,17 +52,17 @@ function normalizeSchemaPath(schemaPath) {
|
|
|
50
52
|
let normalized = schemaPath.trim();
|
|
51
53
|
// Add './' prefix if not already a relative path
|
|
52
54
|
if (!normalized.startsWith('.')) {
|
|
53
|
-
normalized =
|
|
55
|
+
normalized = `./${normalized}`;
|
|
54
56
|
}
|
|
55
57
|
// Get the extension
|
|
56
58
|
const ext = path.extname(normalized);
|
|
57
59
|
if (ext === '.ts') {
|
|
58
60
|
// Replace .ts with .js
|
|
59
|
-
normalized = normalized.slice(0, -3)
|
|
61
|
+
normalized = `${normalized.slice(0, -3)}.js`;
|
|
60
62
|
}
|
|
61
63
|
else if (!ext) {
|
|
62
64
|
// No extension, add .js
|
|
63
|
-
normalized = normalized
|
|
65
|
+
normalized = `${normalized}.js`;
|
|
64
66
|
}
|
|
65
67
|
// If extension is already .js or something else, leave as is
|
|
66
68
|
return normalized;
|
|
@@ -138,7 +140,7 @@ export const promptTransformer = {
|
|
|
138
140
|
// Validate frontmatter
|
|
139
141
|
const frontmatterValidation = PromptFrontmatterSchema.safeParse(frontmatter);
|
|
140
142
|
if (!frontmatterValidation.success) {
|
|
141
|
-
const errors = frontmatterValidation.error.
|
|
143
|
+
const errors = frontmatterValidation.error.issues
|
|
142
144
|
.map((err) => {
|
|
143
145
|
const path = err.path.length > 0 ? err.path.join('.') : 'frontmatter';
|
|
144
146
|
return ` - ${path}: ${err.message}`;
|
|
@@ -146,8 +148,9 @@ export const promptTransformer = {
|
|
|
146
148
|
.join('\n');
|
|
147
149
|
throw new Error(`Invalid frontmatter in ${filePath}:\n${errors}`);
|
|
148
150
|
}
|
|
151
|
+
const validatedFrontmatter = frontmatterValidation.data;
|
|
149
152
|
// Build prompt definition
|
|
150
|
-
const { prompt, imports, schemaImportName } = buildPromptDefinition(
|
|
153
|
+
const { prompt, imports, schemaImportName } = buildPromptDefinition(validatedFrontmatter, promptContent, filePath);
|
|
151
154
|
// If schema is specified, generate custom code with schema reference
|
|
152
155
|
if (schemaImportName) {
|
|
153
156
|
// Build the code manually to avoid JSON.stringify issues with schema reference
|
|
@@ -176,6 +179,6 @@ export const promptTransformer = {
|
|
|
176
179
|
return {
|
|
177
180
|
data: prompt,
|
|
178
181
|
};
|
|
179
|
-
}
|
|
182
|
+
},
|
|
180
183
|
};
|
|
181
184
|
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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AC,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 @@
|
|
|
1
|
+
{"version":3,"file":"raw.d.ts","sourceRoot":"","sources":["../../../src/core/transformers/raw.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc,EAAE,iBAO5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw.js","sourceRoot":"","sources":["../../../src/core/transformers/raw.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAsB;IAC7C,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,CAAC,OAAe,EAAE,EAAE;QAC3B,OAAO;YACH,IAAI,EAAE,OAAO;SAChB,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-collection.d.ts","sourceRoot":"","sources":["../../../src/core/transformers/skill-collection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,0BAA0B,EAAE,iBAkDxC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Skill collection transformer for directory-based skill imports
|
|
3
3
|
* Scans a directory for subdirectories containing SKILL.md files
|
|
4
4
|
*/
|
|
5
|
-
import { readdirSync, statSync
|
|
5
|
+
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
/**
|
|
8
8
|
* Skill collection transformer preset
|
|
@@ -54,24 +54,17 @@ export const skillCollectionTransformer = {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
catch
|
|
58
|
-
// Skip entries that can't be read
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
57
|
+
catch { }
|
|
61
58
|
}
|
|
62
59
|
if (names.length === 0) {
|
|
63
60
|
console.warn(`No SKILL.md files found in subdirectories of ${dirPath}`);
|
|
64
61
|
}
|
|
65
62
|
// Generate code that imports all skills and exports as array
|
|
66
|
-
const code = [
|
|
67
|
-
...imports,
|
|
68
|
-
'',
|
|
69
|
-
`export default [${names.join(', ')}];`
|
|
70
|
-
].join('\n');
|
|
63
|
+
const code = [...imports, '', `export default [${names.join(', ')}];`].join('\n');
|
|
71
64
|
return {
|
|
72
65
|
data: null, // Not used when custom code is provided
|
|
73
|
-
code
|
|
66
|
+
code,
|
|
74
67
|
};
|
|
75
|
-
}
|
|
68
|
+
},
|
|
76
69
|
};
|
|
77
70
|
//# sourceMappingURL=skill-collection.js.map
|