@t3lnet/sceneforge 1.0.11 → 1.0.13
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/context-builder.ts +81 -2
- package/context/templates/base/cli-reference.md +37 -1
- package/context/templates/stages/stage4-rebalancing.md +22 -0
- package/dist/index.cjs +56 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -4
- package/dist/index.js.map +1 -1
- package/dist/templates/templates/base/actions-reference.md +299 -0
- package/dist/templates/templates/base/cli-reference.md +272 -0
- package/dist/templates/templates/base/project-overview.md +58 -0
- package/dist/templates/templates/base/selectors-guide.md +233 -0
- package/dist/templates/templates/base/yaml-schema.md +210 -0
- package/dist/templates/templates/skills/balance-timing.md +136 -0
- package/dist/templates/templates/skills/debug-selector.md +193 -0
- package/dist/templates/templates/skills/generate-actions.md +94 -0
- package/dist/templates/templates/skills/optimize-demo.md +218 -0
- package/dist/templates/templates/skills/review-demo-yaml.md +164 -0
- package/dist/templates/templates/skills/write-step-script.md +136 -0
- package/dist/templates/templates/stages/stage1-actions.md +236 -0
- package/dist/templates/templates/stages/stage2-scripts.md +197 -0
- package/dist/templates/templates/stages/stage3-balancing.md +229 -0
- package/dist/templates/templates/stages/stage4-rebalancing.md +250 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2574,6 +2574,42 @@ function isValidFormat(format) {
|
|
|
2574
2574
|
// context/context-builder.ts
|
|
2575
2575
|
import * as fs6 from "fs/promises";
|
|
2576
2576
|
import * as path6 from "path";
|
|
2577
|
+
var SCENEFORGE_START_MARKER = "<!-- SCENEFORGE_CONTEXT_START -->";
|
|
2578
|
+
var SCENEFORGE_END_MARKER = "<!-- SCENEFORGE_CONTEXT_END -->";
|
|
2579
|
+
function wrapWithMarkers(content) {
|
|
2580
|
+
return `${SCENEFORGE_START_MARKER}
|
|
2581
|
+
${content}
|
|
2582
|
+
${SCENEFORGE_END_MARKER}`;
|
|
2583
|
+
}
|
|
2584
|
+
async function mergeWithExisting(filePath, newContent) {
|
|
2585
|
+
const wrappedContent = wrapWithMarkers(newContent);
|
|
2586
|
+
try {
|
|
2587
|
+
const existingContent = await fs6.readFile(filePath, "utf-8");
|
|
2588
|
+
const startIndex = existingContent.indexOf(SCENEFORGE_START_MARKER);
|
|
2589
|
+
const endIndex = existingContent.indexOf(SCENEFORGE_END_MARKER);
|
|
2590
|
+
if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {
|
|
2591
|
+
const beforeSection = existingContent.slice(0, startIndex);
|
|
2592
|
+
const afterSection = existingContent.slice(
|
|
2593
|
+
endIndex + SCENEFORGE_END_MARKER.length
|
|
2594
|
+
);
|
|
2595
|
+
return {
|
|
2596
|
+
content: beforeSection + wrappedContent + afterSection,
|
|
2597
|
+
merged: true
|
|
2598
|
+
};
|
|
2599
|
+
} else {
|
|
2600
|
+
const separator = existingContent.trim().endsWith("-->") ? "\n\n" : "\n\n---\n\n";
|
|
2601
|
+
return {
|
|
2602
|
+
content: existingContent.trimEnd() + separator + wrappedContent + "\n",
|
|
2603
|
+
merged: true
|
|
2604
|
+
};
|
|
2605
|
+
}
|
|
2606
|
+
} catch (error) {
|
|
2607
|
+
if (error.code === "ENOENT") {
|
|
2608
|
+
return { content: wrappedContent, merged: false };
|
|
2609
|
+
}
|
|
2610
|
+
throw error;
|
|
2611
|
+
}
|
|
2612
|
+
}
|
|
2577
2613
|
async function buildContext(tool, stage, variables) {
|
|
2578
2614
|
const templates = [];
|
|
2579
2615
|
const baseTemplates = await loadTemplatesByCategory("base");
|
|
@@ -2611,12 +2647,20 @@ async function deployContext(options) {
|
|
|
2611
2647
|
const filePath = getOutputPath(tool, format, outputDir);
|
|
2612
2648
|
const absolutePath = path6.resolve(filePath);
|
|
2613
2649
|
await fs6.mkdir(path6.dirname(absolutePath), { recursive: true });
|
|
2614
|
-
|
|
2650
|
+
const { content: finalContent, merged } = await mergeWithExisting(
|
|
2651
|
+
absolutePath,
|
|
2652
|
+
content
|
|
2653
|
+
);
|
|
2654
|
+
await fs6.writeFile(absolutePath, finalContent, "utf-8");
|
|
2615
2655
|
results.push({
|
|
2616
2656
|
tool,
|
|
2617
2657
|
filePath: absolutePath,
|
|
2618
|
-
created: true
|
|
2658
|
+
created: true,
|
|
2659
|
+
skipped: false
|
|
2619
2660
|
});
|
|
2661
|
+
if (merged) {
|
|
2662
|
+
console.log(` [merged] ${path6.relative(outputDir, absolutePath)}`);
|
|
2663
|
+
}
|
|
2620
2664
|
} catch (error) {
|
|
2621
2665
|
results.push({
|
|
2622
2666
|
tool,
|
|
@@ -2633,13 +2677,21 @@ async function deployContext(options) {
|
|
|
2633
2677
|
const filePath = getOutputPath(tool, format, outputDir, stageName);
|
|
2634
2678
|
const absolutePath = path6.resolve(filePath);
|
|
2635
2679
|
await fs6.mkdir(path6.dirname(absolutePath), { recursive: true });
|
|
2636
|
-
|
|
2680
|
+
const { content: finalContent, merged } = await mergeWithExisting(
|
|
2681
|
+
absolutePath,
|
|
2682
|
+
content
|
|
2683
|
+
);
|
|
2684
|
+
await fs6.writeFile(absolutePath, finalContent, "utf-8");
|
|
2637
2685
|
results.push({
|
|
2638
2686
|
tool,
|
|
2639
2687
|
filePath: absolutePath,
|
|
2640
2688
|
stage: stg,
|
|
2641
|
-
created: true
|
|
2689
|
+
created: true,
|
|
2690
|
+
skipped: false
|
|
2642
2691
|
});
|
|
2692
|
+
if (merged) {
|
|
2693
|
+
console.log(` [merged] ${path6.relative(outputDir, absolutePath)}`);
|
|
2694
|
+
}
|
|
2643
2695
|
} catch (error) {
|
|
2644
2696
|
results.push({
|
|
2645
2697
|
tool,
|