@t3lnet/sceneforge 1.0.14 → 1.0.15

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/dist/index.js CHANGED
@@ -2626,6 +2626,33 @@ async function mergeWithExisting(filePath, newContent) {
2626
2626
  throw error;
2627
2627
  }
2628
2628
  }
2629
+ async function writeSplitPointer(tool, stageNames, outputDir) {
2630
+ const config = getToolConfig(tool);
2631
+ const stageLines = stageNames.map((stage) => {
2632
+ const friendly = formatStageName(stage);
2633
+ const stageFile = `${config.splitFilePrefix}${getStageFileName(stage)}${config.fileExtension}`;
2634
+ const relativePath = path6.posix.join(config.splitDir, stageFile);
2635
+ return `- ${friendly}: ${relativePath}`;
2636
+ });
2637
+ const pointerBody = [
2638
+ "SceneForge context for this tool is split across the following stage files:",
2639
+ "",
2640
+ ...stageLines,
2641
+ "",
2642
+ `Open the stage file that matches the work you're doing, or run "npx sceneforge context preview --target ${tool} --stage <stage>" to inspect a specific stage.`
2643
+ ].join("\n");
2644
+ const formattedPointer = formatForTool(tool, pointerBody, {
2645
+ includeToolHeader: true
2646
+ });
2647
+ const combinedPath = path6.join(outputDir, config.combinedFile);
2648
+ await fs6.mkdir(path6.dirname(combinedPath), { recursive: true });
2649
+ const { content: finalContent, merged } = await mergeWithExisting(
2650
+ combinedPath,
2651
+ formattedPointer
2652
+ );
2653
+ await fs6.writeFile(combinedPath, finalContent, "utf-8");
2654
+ return { filePath: combinedPath, merged };
2655
+ }
2629
2656
  async function buildContext(tool, stage, variables) {
2630
2657
  const templates = [];
2631
2658
  const baseTemplates = await loadTemplatesByCategory("base");
@@ -2686,6 +2713,7 @@ async function deployContext(options) {
2686
2713
  });
2687
2714
  }
2688
2715
  } else {
2716
+ const deployedStages = [];
2689
2717
  for (const stg of stages) {
2690
2718
  try {
2691
2719
  const content = await buildContext(tool, stg, variables);
@@ -2708,6 +2736,7 @@ async function deployContext(options) {
2708
2736
  if (merged) {
2709
2737
  console.log(` [merged] ${path6.relative(outputDir, absolutePath)}`);
2710
2738
  }
2739
+ deployedStages.push(stg);
2711
2740
  } catch (error) {
2712
2741
  results.push({
2713
2742
  tool,
@@ -2718,6 +2747,24 @@ async function deployContext(options) {
2718
2747
  });
2719
2748
  }
2720
2749
  }
2750
+ if (deployedStages.length > 0) {
2751
+ const pointerResult = await writeSplitPointer(
2752
+ tool,
2753
+ deployedStages,
2754
+ outputDir
2755
+ );
2756
+ results.push({
2757
+ tool,
2758
+ filePath: pointerResult.filePath,
2759
+ created: true,
2760
+ skipped: false
2761
+ });
2762
+ if (pointerResult.merged) {
2763
+ console.log(
2764
+ ` [merged] ${path6.relative(outputDir, pointerResult.filePath)}`
2765
+ );
2766
+ }
2767
+ }
2721
2768
  }
2722
2769
  }
2723
2770
  return results;