@t3lnet/sceneforge 1.0.9 → 1.0.11

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.
Files changed (35) hide show
  1. package/README.md +57 -0
  2. package/cli/cli.js +6 -0
  3. package/cli/commands/add-audio-to-steps.js +9 -3
  4. package/cli/commands/concat-final-videos.js +6 -2
  5. package/cli/commands/context.js +791 -0
  6. package/cli/commands/split-video.js +3 -1
  7. package/context/context-builder.ts +318 -0
  8. package/context/index.ts +52 -0
  9. package/context/template-loader.ts +161 -0
  10. package/context/templates/base/actions-reference.md +299 -0
  11. package/context/templates/base/cli-reference.md +236 -0
  12. package/context/templates/base/project-overview.md +58 -0
  13. package/context/templates/base/selectors-guide.md +233 -0
  14. package/context/templates/base/yaml-schema.md +210 -0
  15. package/context/templates/skills/balance-timing.md +136 -0
  16. package/context/templates/skills/debug-selector.md +193 -0
  17. package/context/templates/skills/generate-actions.md +94 -0
  18. package/context/templates/skills/optimize-demo.md +218 -0
  19. package/context/templates/skills/review-demo-yaml.md +164 -0
  20. package/context/templates/skills/write-step-script.md +136 -0
  21. package/context/templates/stages/stage1-actions.md +236 -0
  22. package/context/templates/stages/stage2-scripts.md +197 -0
  23. package/context/templates/stages/stage3-balancing.md +229 -0
  24. package/context/templates/stages/stage4-rebalancing.md +228 -0
  25. package/context/tests/context-builder.test.ts +237 -0
  26. package/context/tests/template-loader.test.ts +181 -0
  27. package/context/tests/tool-formatter.test.ts +198 -0
  28. package/context/tool-formatter.ts +189 -0
  29. package/dist/index.cjs +416 -11
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts +182 -1
  32. package/dist/index.d.ts +182 -1
  33. package/dist/index.js +391 -11
  34. package/dist/index.js.map +1 -1
  35. package/package.json +2 -1
package/dist/index.d.cts CHANGED
@@ -840,4 +840,185 @@ declare class ScriptGenerator {
840
840
  */
841
841
  declare function createScriptGenerator(demoName: string, title: string, startTimeMs?: number): ScriptGenerator;
842
842
 
843
- export { type ActionType, type AudioTimingManifest, DEMO_SCHEMA_VERSION, type DemoAction, type DemoContext, type DemoDefinition, type DemoResult, type DemoStep, type DragConfig, type ElementInfo, type GeneratedScript, type PickerResult, type PrivacyConfig, type RecordedInteraction, type RecordingState, type RunDemoOptions, ScriptGenerator, type ScriptOutput, type ScriptSegment, type SelectorCandidate, type SelectorConfig, type SelectorStrategy, type StepBoundary, type StepTarget, type StepTiming, type SynthesizedSegment, type TestSelectorResponse, type ScriptSegment$1 as VoiceScriptSegment, type VoiceSynthesisConfig, type VoiceSynthesisResult, VoiceSynthesizer, type WaitCondition, createClickAction, createDragAction, createEmptyDemo, createEmptyStep, createHoverAction, createNavigateAction, createScriptGenerator, createScrollAction, createScrollToAction, createTypeAction, createUploadAction, createVoiceSynthesizer, createWaitAction, createWaitForAction, demoClick, demoDefinitionSchema, demoHover, demoType, discoverDemos, formatValidationError, generateTimingManifest, highlightElement, injectCursorOverlay, loadDemoDefinition, moveCursorTo, parseDemoDefinition, parseFromYAML, removeCursorOverlay, resolvePath, resolveTarget, runDemo, runDemoFromFile, safeParseDemoDefinition, serializeToYAML, triggerClickRipple, validateDemoDefinition };
843
+ /**
844
+ * Template loading and composition for LLM context files.
845
+ * Loads markdown templates and supports variable interpolation.
846
+ */
847
+ interface TemplateVariables {
848
+ [key: string]: string | number | boolean | undefined;
849
+ }
850
+ interface LoadedTemplate {
851
+ name: string;
852
+ content: string;
853
+ category: "base" | "stages" | "skills";
854
+ }
855
+ /**
856
+ * Load a single template file by category and name.
857
+ */
858
+ declare function loadTemplate(category: "base" | "stages" | "skills", name: string): Promise<LoadedTemplate>;
859
+ /**
860
+ * Load all templates from a specific category.
861
+ */
862
+ declare function loadTemplatesByCategory(category: "base" | "stages" | "skills"): Promise<LoadedTemplate[]>;
863
+ /**
864
+ * Interpolate variables in template content.
865
+ * Variables use the format: {{variableName}}
866
+ */
867
+ declare function interpolateVariables(content: string, variables: TemplateVariables): string;
868
+ /**
869
+ * Compose multiple templates into a single document.
870
+ */
871
+ declare function composeTemplates(templates: LoadedTemplate[], options?: {
872
+ separator?: string;
873
+ includeHeaders?: boolean;
874
+ }): string;
875
+ /**
876
+ * List available templates by category.
877
+ */
878
+ declare function listTemplates(): Promise<{
879
+ base: string[];
880
+ stages: string[];
881
+ skills: string[];
882
+ }>;
883
+ /**
884
+ * Check if a template exists.
885
+ */
886
+ declare function templateExists(category: "base" | "stages" | "skills", name: string): Promise<boolean>;
887
+
888
+ /**
889
+ * Tool-specific formatting for LLM context files.
890
+ * Formats content and determines file locations for each target tool.
891
+ */
892
+ type TargetTool = "cursor" | "copilot" | "claude" | "codex";
893
+ type DeployFormat = "combined" | "split";
894
+ interface ToolConfig {
895
+ name: string;
896
+ description: string;
897
+ combinedFile: string;
898
+ splitDir: string;
899
+ splitFilePrefix: string;
900
+ fileExtension: string;
901
+ supportsSkills: boolean;
902
+ }
903
+ interface FormattedOutput {
904
+ tool: TargetTool;
905
+ filePath: string;
906
+ content: string;
907
+ }
908
+ /**
909
+ * Configuration for each supported LLM tool.
910
+ */
911
+ declare const TOOL_CONFIGS: Record<TargetTool, ToolConfig>;
912
+ /**
913
+ * Get the list of all supported tools.
914
+ */
915
+ declare function getSupportedTools(): TargetTool[];
916
+ /**
917
+ * Get configuration for a specific tool.
918
+ */
919
+ declare function getToolConfig(tool: TargetTool): ToolConfig;
920
+ /**
921
+ * Format content for a specific tool with appropriate headers and structure.
922
+ */
923
+ declare function formatForTool(tool: TargetTool, content: string, options?: {
924
+ stage?: string;
925
+ includeToolHeader?: boolean;
926
+ }): string;
927
+ /**
928
+ * Get the output file path for a tool.
929
+ */
930
+ declare function getOutputPath(tool: TargetTool, format: DeployFormat, outputDir: string, stageName?: string): string;
931
+ /**
932
+ * Get all output paths for a tool in split format.
933
+ */
934
+ declare function getSplitOutputPaths(tool: TargetTool, outputDir: string, stageNames: string[]): string[];
935
+ /**
936
+ * Format stage name for display.
937
+ */
938
+ declare function formatStageName(stage: string): string;
939
+ /**
940
+ * Get stage file name from stage identifier.
941
+ */
942
+ declare function getStageFileName(stage: string): string;
943
+ /**
944
+ * Validate a tool name.
945
+ */
946
+ declare function isValidTool(tool: string): tool is TargetTool;
947
+ /**
948
+ * Validate a deploy format.
949
+ */
950
+ declare function isValidFormat(format: string): format is DeployFormat;
951
+
952
+ /**
953
+ * Main context builder for generating LLM instruction files.
954
+ * Orchestrates template loading, composition, and formatting.
955
+ */
956
+
957
+ type Stage = "actions" | "scripts" | "balance" | "rebalance" | "all";
958
+ interface ContextBuilderOptions {
959
+ target: TargetTool | "all";
960
+ stage: Stage;
961
+ format: DeployFormat;
962
+ outputDir: string;
963
+ variables?: TemplateVariables;
964
+ }
965
+ interface DeployResult {
966
+ tool: TargetTool;
967
+ filePath: string;
968
+ stage?: string;
969
+ created: boolean;
970
+ skipped?: boolean;
971
+ error?: string;
972
+ }
973
+ interface PreviewResult {
974
+ tool: TargetTool;
975
+ stage?: string;
976
+ content: string;
977
+ }
978
+ /**
979
+ * Build context content for a specific tool and stage.
980
+ */
981
+ declare function buildContext(tool: TargetTool, stage: Stage, variables?: TemplateVariables): Promise<string>;
982
+ /**
983
+ * Deploy context files to the target directory.
984
+ */
985
+ declare function deployContext(options: ContextBuilderOptions): Promise<DeployResult[]>;
986
+ /**
987
+ * Preview context content without writing files.
988
+ */
989
+ declare function previewContext(tool: TargetTool, stage: Stage, variables?: TemplateVariables): Promise<PreviewResult>;
990
+ /**
991
+ * List deployed context files in a directory.
992
+ */
993
+ declare function listDeployedContext(outputDir: string): Promise<{
994
+ files: Array<{
995
+ tool: TargetTool;
996
+ path: string;
997
+ exists: boolean;
998
+ }>;
999
+ }>;
1000
+ /**
1001
+ * Remove deployed context files.
1002
+ */
1003
+ declare function removeContext(outputDir: string, target: TargetTool | "all"): Promise<Array<{
1004
+ path: string;
1005
+ removed: boolean;
1006
+ error?: string;
1007
+ }>>;
1008
+ /**
1009
+ * Get a skill template by name.
1010
+ */
1011
+ declare function getSkill(name: string): Promise<{
1012
+ name: string;
1013
+ content: string;
1014
+ } | null>;
1015
+ /**
1016
+ * List all available skills.
1017
+ */
1018
+ declare function listSkills(): Promise<string[]>;
1019
+ /**
1020
+ * Check if templates are available.
1021
+ */
1022
+ declare function hasTemplates(): Promise<boolean>;
1023
+
1024
+ export { type ActionType, type AudioTimingManifest, type ContextBuilderOptions, DEMO_SCHEMA_VERSION, type DemoAction, type DemoContext, type DemoDefinition, type DemoResult, type DemoStep, type DeployFormat, type DeployResult, type DragConfig, type ElementInfo, type FormattedOutput, type GeneratedScript, type LoadedTemplate, type PickerResult, type PreviewResult, type PrivacyConfig, type RecordedInteraction, type RecordingState, type RunDemoOptions, ScriptGenerator, type ScriptOutput, type ScriptSegment, type SelectorCandidate, type SelectorConfig, type SelectorStrategy, type Stage, type StepBoundary, type StepTarget, type StepTiming, type SynthesizedSegment, TOOL_CONFIGS, type TargetTool, type TemplateVariables, type TestSelectorResponse, type ToolConfig, type ScriptSegment$1 as VoiceScriptSegment, type VoiceSynthesisConfig, type VoiceSynthesisResult, VoiceSynthesizer, type WaitCondition, buildContext, composeTemplates, createClickAction, createDragAction, createEmptyDemo, createEmptyStep, createHoverAction, createNavigateAction, createScriptGenerator, createScrollAction, createScrollToAction, createTypeAction, createUploadAction, createVoiceSynthesizer, createWaitAction, createWaitForAction, demoClick, demoDefinitionSchema, demoHover, demoType, deployContext, discoverDemos, formatForTool, formatStageName, formatValidationError, generateTimingManifest, getOutputPath, getSkill, getSplitOutputPaths, getStageFileName, getSupportedTools, getToolConfig, hasTemplates, highlightElement, injectCursorOverlay, interpolateVariables, isValidFormat, isValidTool, listDeployedContext, listSkills, listTemplates, loadDemoDefinition, loadTemplate, loadTemplatesByCategory, moveCursorTo, parseDemoDefinition, parseFromYAML, previewContext, removeContext, removeCursorOverlay, resolvePath, resolveTarget, runDemo, runDemoFromFile, safeParseDemoDefinition, serializeToYAML, templateExists, triggerClickRipple, validateDemoDefinition };
package/dist/index.d.ts CHANGED
@@ -840,4 +840,185 @@ declare class ScriptGenerator {
840
840
  */
841
841
  declare function createScriptGenerator(demoName: string, title: string, startTimeMs?: number): ScriptGenerator;
842
842
 
843
- export { type ActionType, type AudioTimingManifest, DEMO_SCHEMA_VERSION, type DemoAction, type DemoContext, type DemoDefinition, type DemoResult, type DemoStep, type DragConfig, type ElementInfo, type GeneratedScript, type PickerResult, type PrivacyConfig, type RecordedInteraction, type RecordingState, type RunDemoOptions, ScriptGenerator, type ScriptOutput, type ScriptSegment, type SelectorCandidate, type SelectorConfig, type SelectorStrategy, type StepBoundary, type StepTarget, type StepTiming, type SynthesizedSegment, type TestSelectorResponse, type ScriptSegment$1 as VoiceScriptSegment, type VoiceSynthesisConfig, type VoiceSynthesisResult, VoiceSynthesizer, type WaitCondition, createClickAction, createDragAction, createEmptyDemo, createEmptyStep, createHoverAction, createNavigateAction, createScriptGenerator, createScrollAction, createScrollToAction, createTypeAction, createUploadAction, createVoiceSynthesizer, createWaitAction, createWaitForAction, demoClick, demoDefinitionSchema, demoHover, demoType, discoverDemos, formatValidationError, generateTimingManifest, highlightElement, injectCursorOverlay, loadDemoDefinition, moveCursorTo, parseDemoDefinition, parseFromYAML, removeCursorOverlay, resolvePath, resolveTarget, runDemo, runDemoFromFile, safeParseDemoDefinition, serializeToYAML, triggerClickRipple, validateDemoDefinition };
843
+ /**
844
+ * Template loading and composition for LLM context files.
845
+ * Loads markdown templates and supports variable interpolation.
846
+ */
847
+ interface TemplateVariables {
848
+ [key: string]: string | number | boolean | undefined;
849
+ }
850
+ interface LoadedTemplate {
851
+ name: string;
852
+ content: string;
853
+ category: "base" | "stages" | "skills";
854
+ }
855
+ /**
856
+ * Load a single template file by category and name.
857
+ */
858
+ declare function loadTemplate(category: "base" | "stages" | "skills", name: string): Promise<LoadedTemplate>;
859
+ /**
860
+ * Load all templates from a specific category.
861
+ */
862
+ declare function loadTemplatesByCategory(category: "base" | "stages" | "skills"): Promise<LoadedTemplate[]>;
863
+ /**
864
+ * Interpolate variables in template content.
865
+ * Variables use the format: {{variableName}}
866
+ */
867
+ declare function interpolateVariables(content: string, variables: TemplateVariables): string;
868
+ /**
869
+ * Compose multiple templates into a single document.
870
+ */
871
+ declare function composeTemplates(templates: LoadedTemplate[], options?: {
872
+ separator?: string;
873
+ includeHeaders?: boolean;
874
+ }): string;
875
+ /**
876
+ * List available templates by category.
877
+ */
878
+ declare function listTemplates(): Promise<{
879
+ base: string[];
880
+ stages: string[];
881
+ skills: string[];
882
+ }>;
883
+ /**
884
+ * Check if a template exists.
885
+ */
886
+ declare function templateExists(category: "base" | "stages" | "skills", name: string): Promise<boolean>;
887
+
888
+ /**
889
+ * Tool-specific formatting for LLM context files.
890
+ * Formats content and determines file locations for each target tool.
891
+ */
892
+ type TargetTool = "cursor" | "copilot" | "claude" | "codex";
893
+ type DeployFormat = "combined" | "split";
894
+ interface ToolConfig {
895
+ name: string;
896
+ description: string;
897
+ combinedFile: string;
898
+ splitDir: string;
899
+ splitFilePrefix: string;
900
+ fileExtension: string;
901
+ supportsSkills: boolean;
902
+ }
903
+ interface FormattedOutput {
904
+ tool: TargetTool;
905
+ filePath: string;
906
+ content: string;
907
+ }
908
+ /**
909
+ * Configuration for each supported LLM tool.
910
+ */
911
+ declare const TOOL_CONFIGS: Record<TargetTool, ToolConfig>;
912
+ /**
913
+ * Get the list of all supported tools.
914
+ */
915
+ declare function getSupportedTools(): TargetTool[];
916
+ /**
917
+ * Get configuration for a specific tool.
918
+ */
919
+ declare function getToolConfig(tool: TargetTool): ToolConfig;
920
+ /**
921
+ * Format content for a specific tool with appropriate headers and structure.
922
+ */
923
+ declare function formatForTool(tool: TargetTool, content: string, options?: {
924
+ stage?: string;
925
+ includeToolHeader?: boolean;
926
+ }): string;
927
+ /**
928
+ * Get the output file path for a tool.
929
+ */
930
+ declare function getOutputPath(tool: TargetTool, format: DeployFormat, outputDir: string, stageName?: string): string;
931
+ /**
932
+ * Get all output paths for a tool in split format.
933
+ */
934
+ declare function getSplitOutputPaths(tool: TargetTool, outputDir: string, stageNames: string[]): string[];
935
+ /**
936
+ * Format stage name for display.
937
+ */
938
+ declare function formatStageName(stage: string): string;
939
+ /**
940
+ * Get stage file name from stage identifier.
941
+ */
942
+ declare function getStageFileName(stage: string): string;
943
+ /**
944
+ * Validate a tool name.
945
+ */
946
+ declare function isValidTool(tool: string): tool is TargetTool;
947
+ /**
948
+ * Validate a deploy format.
949
+ */
950
+ declare function isValidFormat(format: string): format is DeployFormat;
951
+
952
+ /**
953
+ * Main context builder for generating LLM instruction files.
954
+ * Orchestrates template loading, composition, and formatting.
955
+ */
956
+
957
+ type Stage = "actions" | "scripts" | "balance" | "rebalance" | "all";
958
+ interface ContextBuilderOptions {
959
+ target: TargetTool | "all";
960
+ stage: Stage;
961
+ format: DeployFormat;
962
+ outputDir: string;
963
+ variables?: TemplateVariables;
964
+ }
965
+ interface DeployResult {
966
+ tool: TargetTool;
967
+ filePath: string;
968
+ stage?: string;
969
+ created: boolean;
970
+ skipped?: boolean;
971
+ error?: string;
972
+ }
973
+ interface PreviewResult {
974
+ tool: TargetTool;
975
+ stage?: string;
976
+ content: string;
977
+ }
978
+ /**
979
+ * Build context content for a specific tool and stage.
980
+ */
981
+ declare function buildContext(tool: TargetTool, stage: Stage, variables?: TemplateVariables): Promise<string>;
982
+ /**
983
+ * Deploy context files to the target directory.
984
+ */
985
+ declare function deployContext(options: ContextBuilderOptions): Promise<DeployResult[]>;
986
+ /**
987
+ * Preview context content without writing files.
988
+ */
989
+ declare function previewContext(tool: TargetTool, stage: Stage, variables?: TemplateVariables): Promise<PreviewResult>;
990
+ /**
991
+ * List deployed context files in a directory.
992
+ */
993
+ declare function listDeployedContext(outputDir: string): Promise<{
994
+ files: Array<{
995
+ tool: TargetTool;
996
+ path: string;
997
+ exists: boolean;
998
+ }>;
999
+ }>;
1000
+ /**
1001
+ * Remove deployed context files.
1002
+ */
1003
+ declare function removeContext(outputDir: string, target: TargetTool | "all"): Promise<Array<{
1004
+ path: string;
1005
+ removed: boolean;
1006
+ error?: string;
1007
+ }>>;
1008
+ /**
1009
+ * Get a skill template by name.
1010
+ */
1011
+ declare function getSkill(name: string): Promise<{
1012
+ name: string;
1013
+ content: string;
1014
+ } | null>;
1015
+ /**
1016
+ * List all available skills.
1017
+ */
1018
+ declare function listSkills(): Promise<string[]>;
1019
+ /**
1020
+ * Check if templates are available.
1021
+ */
1022
+ declare function hasTemplates(): Promise<boolean>;
1023
+
1024
+ export { type ActionType, type AudioTimingManifest, type ContextBuilderOptions, DEMO_SCHEMA_VERSION, type DemoAction, type DemoContext, type DemoDefinition, type DemoResult, type DemoStep, type DeployFormat, type DeployResult, type DragConfig, type ElementInfo, type FormattedOutput, type GeneratedScript, type LoadedTemplate, type PickerResult, type PreviewResult, type PrivacyConfig, type RecordedInteraction, type RecordingState, type RunDemoOptions, ScriptGenerator, type ScriptOutput, type ScriptSegment, type SelectorCandidate, type SelectorConfig, type SelectorStrategy, type Stage, type StepBoundary, type StepTarget, type StepTiming, type SynthesizedSegment, TOOL_CONFIGS, type TargetTool, type TemplateVariables, type TestSelectorResponse, type ToolConfig, type ScriptSegment$1 as VoiceScriptSegment, type VoiceSynthesisConfig, type VoiceSynthesisResult, VoiceSynthesizer, type WaitCondition, buildContext, composeTemplates, createClickAction, createDragAction, createEmptyDemo, createEmptyStep, createHoverAction, createNavigateAction, createScriptGenerator, createScrollAction, createScrollToAction, createTypeAction, createUploadAction, createVoiceSynthesizer, createWaitAction, createWaitForAction, demoClick, demoDefinitionSchema, demoHover, demoType, deployContext, discoverDemos, formatForTool, formatStageName, formatValidationError, generateTimingManifest, getOutputPath, getSkill, getSplitOutputPaths, getStageFileName, getSupportedTools, getToolConfig, hasTemplates, highlightElement, injectCursorOverlay, interpolateVariables, isValidFormat, isValidTool, listDeployedContext, listSkills, listTemplates, loadDemoDefinition, loadTemplate, loadTemplatesByCategory, moveCursorTo, parseDemoDefinition, parseFromYAML, previewContext, removeContext, removeCursorOverlay, resolvePath, resolveTarget, runDemo, runDemoFromFile, safeParseDemoDefinition, serializeToYAML, templateExists, triggerClickRipple, validateDemoDefinition };