@t3lnet/sceneforge 1.0.13 → 1.0.14
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/context/template-loader.ts +20 -2
- package/dist/index.cjs +18 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- /package/dist/templates/{templates/base → base}/actions-reference.md +0 -0
- /package/dist/templates/{templates/base → base}/cli-reference.md +0 -0
- /package/dist/templates/{templates/base → base}/project-overview.md +0 -0
- /package/dist/templates/{templates/base → base}/selectors-guide.md +0 -0
- /package/dist/templates/{templates/base → base}/yaml-schema.md +0 -0
- /package/dist/templates/{templates/skills → skills}/balance-timing.md +0 -0
- /package/dist/templates/{templates/skills → skills}/debug-selector.md +0 -0
- /package/dist/templates/{templates/skills → skills}/generate-actions.md +0 -0
- /package/dist/templates/{templates/skills → skills}/optimize-demo.md +0 -0
- /package/dist/templates/{templates/skills → skills}/review-demo-yaml.md +0 -0
- /package/dist/templates/{templates/skills → skills}/write-step-script.md +0 -0
- /package/dist/templates/{templates/stages → stages}/stage1-actions.md +0 -0
- /package/dist/templates/{templates/stages → stages}/stage2-scripts.md +0 -0
- /package/dist/templates/{templates/stages → stages}/stage3-balancing.md +0 -0
- /package/dist/templates/{templates/stages → stages}/stage4-rebalancing.md +0 -0
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Loads markdown templates and supports variable interpolation.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { existsSync } from "fs";
|
|
6
7
|
import * as fs from "fs/promises";
|
|
7
8
|
import * as path from "path";
|
|
8
9
|
import { fileURLToPath } from "url";
|
|
@@ -24,7 +25,22 @@ export interface LoadedTemplate {
|
|
|
24
25
|
* Get the templates directory path.
|
|
25
26
|
*/
|
|
26
27
|
function getTemplatesDir(): string {
|
|
27
|
-
|
|
28
|
+
const candidates = [
|
|
29
|
+
// Standard dist layout: dist/templates/{base,stages,skills}
|
|
30
|
+
path.join(__dirname, "templates"),
|
|
31
|
+
// Nested layout if templates were copied into an existing dist/templates
|
|
32
|
+
path.join(__dirname, "templates", "templates"),
|
|
33
|
+
// Source layout when templates are shipped under context/templates
|
|
34
|
+
path.join(__dirname, "..", "context", "templates"),
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
for (const candidate of candidates) {
|
|
38
|
+
if (existsSync(path.join(candidate, "base"))) {
|
|
39
|
+
return candidate;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return candidates[0];
|
|
28
44
|
}
|
|
29
45
|
|
|
30
46
|
/**
|
|
@@ -68,7 +84,9 @@ export async function loadTemplatesByCategory(
|
|
|
68
84
|
|
|
69
85
|
return templates;
|
|
70
86
|
} catch (error) {
|
|
71
|
-
throw new Error(
|
|
87
|
+
throw new Error(
|
|
88
|
+
`Failed to load templates from ${category} in ${templatesDir}: ${error}`
|
|
89
|
+
);
|
|
72
90
|
}
|
|
73
91
|
}
|
|
74
92
|
|
package/dist/index.cjs
CHANGED
|
@@ -2483,6 +2483,7 @@ async function discoverDemos(demoDir) {
|
|
|
2483
2483
|
}
|
|
2484
2484
|
|
|
2485
2485
|
// context/template-loader.ts
|
|
2486
|
+
var import_fs = require("fs");
|
|
2486
2487
|
var fs5 = __toESM(require("fs/promises"), 1);
|
|
2487
2488
|
var path5 = __toESM(require("path"), 1);
|
|
2488
2489
|
var import_url = require("url");
|
|
@@ -2490,7 +2491,20 @@ var import_meta = {};
|
|
|
2490
2491
|
var __filename = (0, import_url.fileURLToPath)(import_meta.url);
|
|
2491
2492
|
var __dirname = path5.dirname(__filename);
|
|
2492
2493
|
function getTemplatesDir() {
|
|
2493
|
-
|
|
2494
|
+
const candidates = [
|
|
2495
|
+
// Standard dist layout: dist/templates/{base,stages,skills}
|
|
2496
|
+
path5.join(__dirname, "templates"),
|
|
2497
|
+
// Nested layout if templates were copied into an existing dist/templates
|
|
2498
|
+
path5.join(__dirname, "templates", "templates"),
|
|
2499
|
+
// Source layout when templates are shipped under context/templates
|
|
2500
|
+
path5.join(__dirname, "..", "context", "templates")
|
|
2501
|
+
];
|
|
2502
|
+
for (const candidate of candidates) {
|
|
2503
|
+
if ((0, import_fs.existsSync)(path5.join(candidate, "base"))) {
|
|
2504
|
+
return candidate;
|
|
2505
|
+
}
|
|
2506
|
+
}
|
|
2507
|
+
return candidates[0];
|
|
2494
2508
|
}
|
|
2495
2509
|
async function loadTemplate(category, name) {
|
|
2496
2510
|
const templatesDir = getTemplatesDir();
|
|
@@ -2517,7 +2531,9 @@ async function loadTemplatesByCategory(category) {
|
|
|
2517
2531
|
}
|
|
2518
2532
|
return templates;
|
|
2519
2533
|
} catch (error) {
|
|
2520
|
-
throw new Error(
|
|
2534
|
+
throw new Error(
|
|
2535
|
+
`Failed to load templates from ${category} in ${templatesDir}: ${error}`
|
|
2536
|
+
);
|
|
2521
2537
|
}
|
|
2522
2538
|
}
|
|
2523
2539
|
function interpolateVariables(content, variables) {
|