@vibeframe/cli 0.27.0
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/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-lint.log +21 -0
- package/.turbo/turbo-test.log +689 -0
- package/dist/agent/adapters/claude.d.ts +15 -0
- package/dist/agent/adapters/claude.d.ts.map +1 -0
- package/dist/agent/adapters/claude.js +119 -0
- package/dist/agent/adapters/claude.js.map +1 -0
- package/dist/agent/adapters/gemini.d.ts +15 -0
- package/dist/agent/adapters/gemini.d.ts.map +1 -0
- package/dist/agent/adapters/gemini.js +132 -0
- package/dist/agent/adapters/gemini.js.map +1 -0
- package/dist/agent/adapters/index.d.ts +27 -0
- package/dist/agent/adapters/index.d.ts.map +1 -0
- package/dist/agent/adapters/index.js +38 -0
- package/dist/agent/adapters/index.js.map +1 -0
- package/dist/agent/adapters/ollama.d.ts +20 -0
- package/dist/agent/adapters/ollama.d.ts.map +1 -0
- package/dist/agent/adapters/ollama.js +186 -0
- package/dist/agent/adapters/ollama.js.map +1 -0
- package/dist/agent/adapters/openai.d.ts +15 -0
- package/dist/agent/adapters/openai.d.ts.map +1 -0
- package/dist/agent/adapters/openai.js +92 -0
- package/dist/agent/adapters/openai.js.map +1 -0
- package/dist/agent/adapters/xai.d.ts +15 -0
- package/dist/agent/adapters/xai.d.ts.map +1 -0
- package/dist/agent/adapters/xai.js +95 -0
- package/dist/agent/adapters/xai.js.map +1 -0
- package/dist/agent/index.d.ts +69 -0
- package/dist/agent/index.d.ts.map +1 -0
- package/dist/agent/index.js +180 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/agent/memory/index.d.ts +70 -0
- package/dist/agent/memory/index.d.ts.map +1 -0
- package/dist/agent/memory/index.js +132 -0
- package/dist/agent/memory/index.js.map +1 -0
- package/dist/agent/prompts/system.d.ts +6 -0
- package/dist/agent/prompts/system.d.ts.map +1 -0
- package/dist/agent/prompts/system.js +103 -0
- package/dist/agent/prompts/system.js.map +1 -0
- package/dist/agent/tools/ai-editing.d.ts +15 -0
- package/dist/agent/tools/ai-editing.d.ts.map +1 -0
- package/dist/agent/tools/ai-editing.js +763 -0
- package/dist/agent/tools/ai-editing.js.map +1 -0
- package/dist/agent/tools/ai-generation.d.ts +13 -0
- package/dist/agent/tools/ai-generation.d.ts.map +1 -0
- package/dist/agent/tools/ai-generation.js +973 -0
- package/dist/agent/tools/ai-generation.js.map +1 -0
- package/dist/agent/tools/ai-pipeline.d.ts +14 -0
- package/dist/agent/tools/ai-pipeline.d.ts.map +1 -0
- package/dist/agent/tools/ai-pipeline.js +961 -0
- package/dist/agent/tools/ai-pipeline.js.map +1 -0
- package/dist/agent/tools/ai.d.ts +13 -0
- package/dist/agent/tools/ai.d.ts.map +1 -0
- package/dist/agent/tools/ai.js +19 -0
- package/dist/agent/tools/ai.js.map +1 -0
- package/dist/agent/tools/batch.d.ts +6 -0
- package/dist/agent/tools/batch.d.ts.map +1 -0
- package/dist/agent/tools/batch.js +383 -0
- package/dist/agent/tools/batch.js.map +1 -0
- package/dist/agent/tools/e2e.test.d.ts +26 -0
- package/dist/agent/tools/e2e.test.d.ts.map +1 -0
- package/dist/agent/tools/e2e.test.js +397 -0
- package/dist/agent/tools/e2e.test.js.map +1 -0
- package/dist/agent/tools/export.d.ts +6 -0
- package/dist/agent/tools/export.d.ts.map +1 -0
- package/dist/agent/tools/export.js +171 -0
- package/dist/agent/tools/export.js.map +1 -0
- package/dist/agent/tools/filesystem.d.ts +6 -0
- package/dist/agent/tools/filesystem.d.ts.map +1 -0
- package/dist/agent/tools/filesystem.js +212 -0
- package/dist/agent/tools/filesystem.js.map +1 -0
- package/dist/agent/tools/index.d.ts +65 -0
- package/dist/agent/tools/index.d.ts.map +1 -0
- package/dist/agent/tools/index.js +120 -0
- package/dist/agent/tools/index.js.map +1 -0
- package/dist/agent/tools/integration.test.d.ts +11 -0
- package/dist/agent/tools/integration.test.d.ts.map +1 -0
- package/dist/agent/tools/integration.test.js +659 -0
- package/dist/agent/tools/integration.test.js.map +1 -0
- package/dist/agent/tools/media.d.ts +6 -0
- package/dist/agent/tools/media.d.ts.map +1 -0
- package/dist/agent/tools/media.js +616 -0
- package/dist/agent/tools/media.js.map +1 -0
- package/dist/agent/tools/project.d.ts +6 -0
- package/dist/agent/tools/project.d.ts.map +1 -0
- package/dist/agent/tools/project.js +284 -0
- package/dist/agent/tools/project.js.map +1 -0
- package/dist/agent/tools/timeline.d.ts +6 -0
- package/dist/agent/tools/timeline.d.ts.map +1 -0
- package/dist/agent/tools/timeline.js +873 -0
- package/dist/agent/tools/timeline.js.map +1 -0
- package/dist/agent/types.d.ts +59 -0
- package/dist/agent/types.d.ts.map +1 -0
- package/dist/agent/types.js +5 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/commands/agent.d.ts +21 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +290 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/ai-analyze.d.ts +106 -0
- package/dist/commands/ai-analyze.d.ts.map +1 -0
- package/dist/commands/ai-analyze.js +327 -0
- package/dist/commands/ai-analyze.js.map +1 -0
- package/dist/commands/ai-animated-caption.d.ts +64 -0
- package/dist/commands/ai-animated-caption.d.ts.map +1 -0
- package/dist/commands/ai-animated-caption.js +272 -0
- package/dist/commands/ai-animated-caption.js.map +1 -0
- package/dist/commands/ai-audio.d.ts +20 -0
- package/dist/commands/ai-audio.d.ts.map +1 -0
- package/dist/commands/ai-audio.js +808 -0
- package/dist/commands/ai-audio.js.map +1 -0
- package/dist/commands/ai-broll.d.ts +15 -0
- package/dist/commands/ai-broll.d.ts.map +1 -0
- package/dist/commands/ai-broll.js +406 -0
- package/dist/commands/ai-broll.js.map +1 -0
- package/dist/commands/ai-edit-cli.d.ts +14 -0
- package/dist/commands/ai-edit-cli.d.ts.map +1 -0
- package/dist/commands/ai-edit-cli.js +579 -0
- package/dist/commands/ai-edit-cli.js.map +1 -0
- package/dist/commands/ai-edit.d.ts +398 -0
- package/dist/commands/ai-edit.d.ts.map +1 -0
- package/dist/commands/ai-edit.js +1019 -0
- package/dist/commands/ai-edit.js.map +1 -0
- package/dist/commands/ai-fill-gaps.d.ts +14 -0
- package/dist/commands/ai-fill-gaps.d.ts.map +1 -0
- package/dist/commands/ai-fill-gaps.js +451 -0
- package/dist/commands/ai-fill-gaps.js.map +1 -0
- package/dist/commands/ai-helpers.d.ts +20 -0
- package/dist/commands/ai-helpers.d.ts.map +1 -0
- package/dist/commands/ai-helpers.js +59 -0
- package/dist/commands/ai-helpers.js.map +1 -0
- package/dist/commands/ai-highlights.d.ts +127 -0
- package/dist/commands/ai-highlights.d.ts.map +1 -0
- package/dist/commands/ai-highlights.js +1026 -0
- package/dist/commands/ai-highlights.js.map +1 -0
- package/dist/commands/ai-image.d.ts +34 -0
- package/dist/commands/ai-image.d.ts.map +1 -0
- package/dist/commands/ai-image.js +653 -0
- package/dist/commands/ai-image.js.map +1 -0
- package/dist/commands/ai-motion.d.ts +50 -0
- package/dist/commands/ai-motion.d.ts.map +1 -0
- package/dist/commands/ai-motion.js +271 -0
- package/dist/commands/ai-motion.js.map +1 -0
- package/dist/commands/ai-narrate.d.ts +66 -0
- package/dist/commands/ai-narrate.d.ts.map +1 -0
- package/dist/commands/ai-narrate.js +329 -0
- package/dist/commands/ai-narrate.js.map +1 -0
- package/dist/commands/ai-review.d.ts +57 -0
- package/dist/commands/ai-review.d.ts.map +1 -0
- package/dist/commands/ai-review.js +251 -0
- package/dist/commands/ai-review.js.map +1 -0
- package/dist/commands/ai-script-pipeline-cli.d.ts +9 -0
- package/dist/commands/ai-script-pipeline-cli.d.ts.map +1 -0
- package/dist/commands/ai-script-pipeline-cli.js +1494 -0
- package/dist/commands/ai-script-pipeline-cli.js.map +1 -0
- package/dist/commands/ai-script-pipeline.d.ts +259 -0
- package/dist/commands/ai-script-pipeline.d.ts.map +1 -0
- package/dist/commands/ai-script-pipeline.js +1027 -0
- package/dist/commands/ai-script-pipeline.js.map +1 -0
- package/dist/commands/ai-suggest-edit.d.ts +14 -0
- package/dist/commands/ai-suggest-edit.d.ts.map +1 -0
- package/dist/commands/ai-suggest-edit.js +220 -0
- package/dist/commands/ai-suggest-edit.js.map +1 -0
- package/dist/commands/ai-video-fx.d.ts +14 -0
- package/dist/commands/ai-video-fx.d.ts.map +1 -0
- package/dist/commands/ai-video-fx.js +395 -0
- package/dist/commands/ai-video-fx.js.map +1 -0
- package/dist/commands/ai-video.d.ts +15 -0
- package/dist/commands/ai-video.d.ts.map +1 -0
- package/dist/commands/ai-video.js +785 -0
- package/dist/commands/ai-video.js.map +1 -0
- package/dist/commands/ai-viral.d.ts +15 -0
- package/dist/commands/ai-viral.d.ts.map +1 -0
- package/dist/commands/ai-viral.js +519 -0
- package/dist/commands/ai-viral.js.map +1 -0
- package/dist/commands/ai-visual-fx.d.ts +14 -0
- package/dist/commands/ai-visual-fx.d.ts.map +1 -0
- package/dist/commands/ai-visual-fx.js +505 -0
- package/dist/commands/ai-visual-fx.js.map +1 -0
- package/dist/commands/ai.d.ts +38 -0
- package/dist/commands/ai.d.ts.map +1 -0
- package/dist/commands/ai.js +225 -0
- package/dist/commands/ai.js.map +1 -0
- package/dist/commands/ai.test.d.ts +2 -0
- package/dist/commands/ai.test.d.ts.map +1 -0
- package/dist/commands/ai.test.js +554 -0
- package/dist/commands/ai.test.js.map +1 -0
- package/dist/commands/analyze.d.ts +16 -0
- package/dist/commands/analyze.d.ts.map +1 -0
- package/dist/commands/analyze.js +247 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/audio.d.ts +18 -0
- package/dist/commands/audio.d.ts.map +1 -0
- package/dist/commands/audio.js +539 -0
- package/dist/commands/audio.js.map +1 -0
- package/dist/commands/batch.d.ts +3 -0
- package/dist/commands/batch.d.ts.map +1 -0
- package/dist/commands/batch.js +366 -0
- package/dist/commands/batch.js.map +1 -0
- package/dist/commands/batch.test.d.ts +2 -0
- package/dist/commands/batch.test.d.ts.map +1 -0
- package/dist/commands/batch.test.js +203 -0
- package/dist/commands/batch.test.js.map +1 -0
- package/dist/commands/detect.d.ts +3 -0
- package/dist/commands/detect.d.ts.map +1 -0
- package/dist/commands/detect.js +273 -0
- package/dist/commands/detect.js.map +1 -0
- package/dist/commands/doctor.d.ts +6 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +191 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/edit-cmd.d.ts +26 -0
- package/dist/commands/edit-cmd.d.ts.map +1 -0
- package/dist/commands/edit-cmd.js +870 -0
- package/dist/commands/edit-cmd.js.map +1 -0
- package/dist/commands/export.d.ts +39 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +730 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/generate.d.ts +25 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +1885 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/media.d.ts +3 -0
- package/dist/commands/media.d.ts.map +1 -0
- package/dist/commands/media.js +165 -0
- package/dist/commands/media.js.map +1 -0
- package/dist/commands/output.d.ts +45 -0
- package/dist/commands/output.d.ts.map +1 -0
- package/dist/commands/output.js +122 -0
- package/dist/commands/output.js.map +1 -0
- package/dist/commands/pipeline.d.ts +19 -0
- package/dist/commands/pipeline.d.ts.map +1 -0
- package/dist/commands/pipeline.js +345 -0
- package/dist/commands/pipeline.js.map +1 -0
- package/dist/commands/project.d.ts +3 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +139 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/project.test.d.ts +2 -0
- package/dist/commands/project.test.d.ts.map +1 -0
- package/dist/commands/project.test.js +105 -0
- package/dist/commands/project.test.js.map +1 -0
- package/dist/commands/sanitize.d.ts +21 -0
- package/dist/commands/sanitize.d.ts.map +1 -0
- package/dist/commands/sanitize.js +56 -0
- package/dist/commands/sanitize.js.map +1 -0
- package/dist/commands/schema.d.ts +11 -0
- package/dist/commands/schema.d.ts.map +1 -0
- package/dist/commands/schema.js +101 -0
- package/dist/commands/schema.js.map +1 -0
- package/dist/commands/setup.d.ts +6 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +440 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/timeline.d.ts +3 -0
- package/dist/commands/timeline.d.ts.map +1 -0
- package/dist/commands/timeline.js +469 -0
- package/dist/commands/timeline.js.map +1 -0
- package/dist/commands/timeline.test.d.ts +2 -0
- package/dist/commands/timeline.test.d.ts.map +1 -0
- package/dist/commands/timeline.test.js +320 -0
- package/dist/commands/timeline.test.js.map +1 -0
- package/dist/commands/validate.d.ts +32 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +63 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/config/config.test.d.ts +2 -0
- package/dist/config/config.test.d.ts.map +1 -0
- package/dist/config/config.test.js +164 -0
- package/dist/config/config.test.js.map +1 -0
- package/dist/config/index.d.ts +35 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +101 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/schema.d.ts +43 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +42 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/engine/index.d.ts +3 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +2 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/project.d.ts +84 -0
- package/dist/engine/project.d.ts.map +1 -0
- package/dist/engine/project.js +355 -0
- package/dist/engine/project.js.map +1 -0
- package/dist/engine/project.test.d.ts +2 -0
- package/dist/engine/project.test.d.ts.map +1 -0
- package/dist/engine/project.test.js +599 -0
- package/dist/engine/project.test.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +131 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/api-key.d.ts +36 -0
- package/dist/utils/api-key.d.ts.map +1 -0
- package/dist/utils/api-key.js +211 -0
- package/dist/utils/api-key.js.map +1 -0
- package/dist/utils/api-key.test.d.ts +2 -0
- package/dist/utils/api-key.test.d.ts.map +1 -0
- package/dist/utils/api-key.test.js +35 -0
- package/dist/utils/api-key.test.js.map +1 -0
- package/dist/utils/audio.d.ts +23 -0
- package/dist/utils/audio.d.ts.map +1 -0
- package/dist/utils/audio.js +79 -0
- package/dist/utils/audio.js.map +1 -0
- package/dist/utils/exec-safe.d.ts +22 -0
- package/dist/utils/exec-safe.d.ts.map +1 -0
- package/dist/utils/exec-safe.js +62 -0
- package/dist/utils/exec-safe.js.map +1 -0
- package/dist/utils/first-run.d.ts +13 -0
- package/dist/utils/first-run.d.ts.map +1 -0
- package/dist/utils/first-run.js +48 -0
- package/dist/utils/first-run.js.map +1 -0
- package/dist/utils/provider-resolver.d.ts +15 -0
- package/dist/utils/provider-resolver.d.ts.map +1 -0
- package/dist/utils/provider-resolver.js +42 -0
- package/dist/utils/provider-resolver.js.map +1 -0
- package/dist/utils/remotion.d.ts +210 -0
- package/dist/utils/remotion.d.ts.map +1 -0
- package/dist/utils/remotion.js +731 -0
- package/dist/utils/remotion.js.map +1 -0
- package/dist/utils/subtitle.d.ts +65 -0
- package/dist/utils/subtitle.d.ts.map +1 -0
- package/dist/utils/subtitle.js +135 -0
- package/dist/utils/subtitle.js.map +1 -0
- package/dist/utils/subtitle.test.d.ts +2 -0
- package/dist/utils/subtitle.test.d.ts.map +1 -0
- package/dist/utils/subtitle.test.js +175 -0
- package/dist/utils/subtitle.test.js.map +1 -0
- package/dist/utils/tty.d.ts +45 -0
- package/dist/utils/tty.d.ts.map +1 -0
- package/dist/utils/tty.js +172 -0
- package/dist/utils/tty.js.map +1 -0
- package/package.json +102 -0
- package/src/agent/adapters/claude.ts +143 -0
- package/src/agent/adapters/gemini.ts +159 -0
- package/src/agent/adapters/index.ts +61 -0
- package/src/agent/adapters/ollama.ts +231 -0
- package/src/agent/adapters/openai.ts +116 -0
- package/src/agent/adapters/xai.ts +119 -0
- package/src/agent/index.ts +251 -0
- package/src/agent/memory/index.ts +151 -0
- package/src/agent/prompts/system.ts +106 -0
- package/src/agent/tools/ai-editing.ts +845 -0
- package/src/agent/tools/ai-generation.ts +1073 -0
- package/src/agent/tools/ai-pipeline.ts +1055 -0
- package/src/agent/tools/ai.ts +21 -0
- package/src/agent/tools/batch.ts +429 -0
- package/src/agent/tools/e2e.test.ts +545 -0
- package/src/agent/tools/export.ts +184 -0
- package/src/agent/tools/filesystem.ts +237 -0
- package/src/agent/tools/index.ts +150 -0
- package/src/agent/tools/integration.test.ts +775 -0
- package/src/agent/tools/media.ts +697 -0
- package/src/agent/tools/project.ts +313 -0
- package/src/agent/tools/timeline.ts +951 -0
- package/src/agent/types.ts +68 -0
- package/src/commands/agent.ts +340 -0
- package/src/commands/ai-analyze.ts +429 -0
- package/src/commands/ai-animated-caption.ts +390 -0
- package/src/commands/ai-audio.ts +941 -0
- package/src/commands/ai-broll.ts +490 -0
- package/src/commands/ai-edit-cli.ts +658 -0
- package/src/commands/ai-edit.ts +1542 -0
- package/src/commands/ai-fill-gaps.ts +566 -0
- package/src/commands/ai-helpers.ts +65 -0
- package/src/commands/ai-highlights.ts +1303 -0
- package/src/commands/ai-image.ts +761 -0
- package/src/commands/ai-motion.ts +347 -0
- package/src/commands/ai-narrate.ts +451 -0
- package/src/commands/ai-review.ts +309 -0
- package/src/commands/ai-script-pipeline-cli.ts +1710 -0
- package/src/commands/ai-script-pipeline.ts +1365 -0
- package/src/commands/ai-suggest-edit.ts +264 -0
- package/src/commands/ai-video-fx.ts +445 -0
- package/src/commands/ai-video.ts +915 -0
- package/src/commands/ai-viral.ts +595 -0
- package/src/commands/ai-visual-fx.ts +601 -0
- package/src/commands/ai.test.ts +627 -0
- package/src/commands/ai.ts +307 -0
- package/src/commands/analyze.ts +282 -0
- package/src/commands/audio.ts +644 -0
- package/src/commands/batch.test.ts +279 -0
- package/src/commands/batch.ts +440 -0
- package/src/commands/detect.ts +329 -0
- package/src/commands/doctor.ts +237 -0
- package/src/commands/edit-cmd.ts +1014 -0
- package/src/commands/export.ts +918 -0
- package/src/commands/generate.ts +2146 -0
- package/src/commands/media.ts +177 -0
- package/src/commands/output.ts +142 -0
- package/src/commands/pipeline.ts +398 -0
- package/src/commands/project.test.ts +127 -0
- package/src/commands/project.ts +149 -0
- package/src/commands/sanitize.ts +60 -0
- package/src/commands/schema.ts +130 -0
- package/src/commands/setup.ts +509 -0
- package/src/commands/timeline.test.ts +499 -0
- package/src/commands/timeline.ts +529 -0
- package/src/commands/validate.ts +77 -0
- package/src/config/config.test.ts +197 -0
- package/src/config/index.ts +125 -0
- package/src/config/schema.ts +82 -0
- package/src/engine/index.ts +2 -0
- package/src/engine/project.test.ts +702 -0
- package/src/engine/project.ts +439 -0
- package/src/index.ts +146 -0
- package/src/utils/api-key.test.ts +41 -0
- package/src/utils/api-key.ts +247 -0
- package/src/utils/audio.ts +83 -0
- package/src/utils/exec-safe.ts +75 -0
- package/src/utils/first-run.ts +52 -0
- package/src/utils/provider-resolver.ts +56 -0
- package/src/utils/remotion.ts +951 -0
- package/src/utils/subtitle.test.ts +227 -0
- package/src/utils/subtitle.ts +169 -0
- package/src/utils/tty.ts +196 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,440 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { readFile, writeFile, readdir } from "node:fs/promises";
|
|
3
|
+
import { resolve, basename, extname, join } from "node:path";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import ora from "ora";
|
|
6
|
+
import { Project, type ProjectFile } from "../engine/index.js";
|
|
7
|
+
import type { MediaType, EffectType } from "@vibeframe/core/timeline";
|
|
8
|
+
|
|
9
|
+
export const batchCommand = new Command("batch")
|
|
10
|
+
.description("Batch operations for processing multiple items");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Detect media type from file extension
|
|
14
|
+
*/
|
|
15
|
+
function detectMediaType(filePath: string): MediaType {
|
|
16
|
+
const ext = extname(filePath).toLowerCase();
|
|
17
|
+
const videoExts = [".mp4", ".mov", ".avi", ".mkv", ".webm", ".m4v"];
|
|
18
|
+
const audioExts = [".mp3", ".wav", ".aac", ".flac", ".ogg", ".m4a"];
|
|
19
|
+
const imageExts = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".bmp"];
|
|
20
|
+
|
|
21
|
+
if (videoExts.includes(ext)) return "video";
|
|
22
|
+
if (audioExts.includes(ext)) return "audio";
|
|
23
|
+
if (imageExts.includes(ext)) return "image";
|
|
24
|
+
return "video"; // Default to video
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Check if file is a media file
|
|
29
|
+
*/
|
|
30
|
+
function isMediaFile(filePath: string): boolean {
|
|
31
|
+
const ext = extname(filePath).toLowerCase();
|
|
32
|
+
const mediaExts = [
|
|
33
|
+
".mp4", ".mov", ".avi", ".mkv", ".webm", ".m4v",
|
|
34
|
+
".mp3", ".wav", ".aac", ".flac", ".ogg", ".m4a",
|
|
35
|
+
".jpg", ".jpeg", ".png", ".gif", ".webp", ".bmp",
|
|
36
|
+
];
|
|
37
|
+
return mediaExts.includes(ext);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// ============ batch import ============
|
|
41
|
+
|
|
42
|
+
batchCommand
|
|
43
|
+
.command("import")
|
|
44
|
+
.description("Import multiple media files from a directory")
|
|
45
|
+
.argument("<project>", "Project file path")
|
|
46
|
+
.argument("<directory>", "Directory containing media files")
|
|
47
|
+
.option("-r, --recursive", "Search subdirectories", false)
|
|
48
|
+
.option("-d, --duration <seconds>", "Default duration for images", "5")
|
|
49
|
+
.option("--filter <pattern>", "Filter files by extension (e.g., '.mp4,.mov')")
|
|
50
|
+
.action(async (projectPath: string, directory: string, options) => {
|
|
51
|
+
const spinner = ora("Scanning directory...").start();
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const filePath = resolve(process.cwd(), projectPath);
|
|
55
|
+
const content = await readFile(filePath, "utf-8");
|
|
56
|
+
const data: ProjectFile = JSON.parse(content);
|
|
57
|
+
const project = Project.fromJSON(data);
|
|
58
|
+
|
|
59
|
+
const dirPath = resolve(process.cwd(), directory);
|
|
60
|
+
const filterExts = options.filter
|
|
61
|
+
? options.filter.split(",").map((e: string) => e.trim().toLowerCase())
|
|
62
|
+
: null;
|
|
63
|
+
|
|
64
|
+
// Collect media files
|
|
65
|
+
const mediaFiles: string[] = [];
|
|
66
|
+
|
|
67
|
+
const scanDir = async (dir: string): Promise<void> => {
|
|
68
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
69
|
+
|
|
70
|
+
for (const entry of entries) {
|
|
71
|
+
const entryPath = join(dir, entry.name);
|
|
72
|
+
|
|
73
|
+
if (entry.isDirectory() && options.recursive) {
|
|
74
|
+
await scanDir(entryPath);
|
|
75
|
+
} else if (entry.isFile()) {
|
|
76
|
+
const ext = extname(entry.name).toLowerCase();
|
|
77
|
+
const matchesFilter = !filterExts || filterExts.includes(ext);
|
|
78
|
+
|
|
79
|
+
if (matchesFilter && isMediaFile(entryPath)) {
|
|
80
|
+
mediaFiles.push(entryPath);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
await scanDir(dirPath);
|
|
87
|
+
|
|
88
|
+
if (mediaFiles.length === 0) {
|
|
89
|
+
spinner.fail(chalk.red("No media files found in directory"));
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Sort files alphabetically
|
|
94
|
+
mediaFiles.sort();
|
|
95
|
+
|
|
96
|
+
spinner.text = `Importing ${mediaFiles.length} files...`;
|
|
97
|
+
|
|
98
|
+
const addedSources: string[] = [];
|
|
99
|
+
const defaultDuration = parseFloat(options.duration);
|
|
100
|
+
|
|
101
|
+
for (const mediaFile of mediaFiles) {
|
|
102
|
+
const mediaName = basename(mediaFile);
|
|
103
|
+
const mediaType = detectMediaType(mediaFile);
|
|
104
|
+
const duration = mediaType === "image" ? defaultDuration : 0;
|
|
105
|
+
|
|
106
|
+
const source = project.addSource({
|
|
107
|
+
name: mediaName,
|
|
108
|
+
type: mediaType,
|
|
109
|
+
url: mediaFile,
|
|
110
|
+
duration,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
addedSources.push(source.id);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
await writeFile(filePath, JSON.stringify(project.toJSON(), null, 2), "utf-8");
|
|
117
|
+
|
|
118
|
+
spinner.succeed(chalk.green(`Imported ${addedSources.length} media files`));
|
|
119
|
+
console.log();
|
|
120
|
+
|
|
121
|
+
for (const file of mediaFiles) {
|
|
122
|
+
console.log(chalk.dim(" +"), basename(file));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
console.log();
|
|
126
|
+
} catch (error) {
|
|
127
|
+
spinner.fail(chalk.red("Import failed"));
|
|
128
|
+
if (error instanceof Error) {
|
|
129
|
+
console.error(chalk.red(error.message));
|
|
130
|
+
}
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// ============ batch concat ============
|
|
136
|
+
|
|
137
|
+
batchCommand
|
|
138
|
+
.command("concat")
|
|
139
|
+
.description("Concatenate multiple sources into sequential clips")
|
|
140
|
+
.argument("<project>", "Project file path")
|
|
141
|
+
.argument("[source-ids...]", "Source IDs to concatenate (or --all)")
|
|
142
|
+
.option("--all", "Concatenate all sources in order", false)
|
|
143
|
+
.option("--track <track-id>", "Track to place clips on")
|
|
144
|
+
.option("--start <seconds>", "Starting time", "0")
|
|
145
|
+
.option("--gap <seconds>", "Gap between clips", "0")
|
|
146
|
+
.action(async (projectPath: string, sourceIds: string[], options) => {
|
|
147
|
+
const spinner = ora("Creating clips...").start();
|
|
148
|
+
|
|
149
|
+
try {
|
|
150
|
+
const filePath = resolve(process.cwd(), projectPath);
|
|
151
|
+
const content = await readFile(filePath, "utf-8");
|
|
152
|
+
const data: ProjectFile = JSON.parse(content);
|
|
153
|
+
const project = Project.fromJSON(data);
|
|
154
|
+
|
|
155
|
+
const sources = project.getSources();
|
|
156
|
+
|
|
157
|
+
if (sources.length === 0) {
|
|
158
|
+
spinner.fail(chalk.red("No sources in project"));
|
|
159
|
+
process.exit(1);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Get sources to concatenate
|
|
163
|
+
let selectedSources = sources;
|
|
164
|
+
if (!options.all && sourceIds.length > 0) {
|
|
165
|
+
selectedSources = sourceIds
|
|
166
|
+
.map((id) => sources.find((s) => s.id === id))
|
|
167
|
+
.filter((s): s is NonNullable<typeof s> => s !== undefined);
|
|
168
|
+
|
|
169
|
+
if (selectedSources.length === 0) {
|
|
170
|
+
spinner.fail(chalk.red("No matching sources found"));
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Determine track
|
|
176
|
+
const tracks = project.getTracks();
|
|
177
|
+
let trackId = options.track;
|
|
178
|
+
|
|
179
|
+
if (!trackId) {
|
|
180
|
+
// Use first video track for video, first audio track for audio
|
|
181
|
+
const firstSource = selectedSources[0];
|
|
182
|
+
const matchingTrack = tracks.find((t) => t.type === firstSource.type);
|
|
183
|
+
trackId = matchingTrack?.id || tracks[0].id;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const startTime = parseFloat(options.start);
|
|
187
|
+
const gap = parseFloat(options.gap);
|
|
188
|
+
let currentTime = startTime;
|
|
189
|
+
const addedClips: string[] = [];
|
|
190
|
+
|
|
191
|
+
for (const source of selectedSources) {
|
|
192
|
+
const clip = project.addClip({
|
|
193
|
+
sourceId: source.id,
|
|
194
|
+
trackId,
|
|
195
|
+
startTime: currentTime,
|
|
196
|
+
duration: source.duration,
|
|
197
|
+
sourceStartOffset: 0,
|
|
198
|
+
sourceEndOffset: source.duration,
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
addedClips.push(clip.id);
|
|
202
|
+
currentTime += source.duration + gap;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
await writeFile(filePath, JSON.stringify(project.toJSON(), null, 2), "utf-8");
|
|
206
|
+
|
|
207
|
+
spinner.succeed(chalk.green(`Created ${addedClips.length} clips`));
|
|
208
|
+
console.log();
|
|
209
|
+
console.log(chalk.dim(" Total duration:"), `${currentTime - gap}s`);
|
|
210
|
+
console.log(chalk.dim(" Track:"), trackId);
|
|
211
|
+
|
|
212
|
+
for (let i = 0; i < selectedSources.length; i++) {
|
|
213
|
+
console.log(chalk.dim(` ${i + 1}.`), selectedSources[i].name);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
console.log();
|
|
217
|
+
} catch (error) {
|
|
218
|
+
spinner.fail(chalk.red("Concat failed"));
|
|
219
|
+
if (error instanceof Error) {
|
|
220
|
+
console.error(chalk.red(error.message));
|
|
221
|
+
}
|
|
222
|
+
process.exit(1);
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// ============ batch apply-effect ============
|
|
227
|
+
|
|
228
|
+
batchCommand
|
|
229
|
+
.command("apply-effect")
|
|
230
|
+
.description("Apply an effect to multiple clips")
|
|
231
|
+
.argument("<project>", "Project file path")
|
|
232
|
+
.argument("<effect-type>", "Effect type (fadeIn, fadeOut, blur, etc.)")
|
|
233
|
+
.argument("[clip-ids...]", "Clip IDs to apply effect to (or --all)")
|
|
234
|
+
.option("--all", "Apply to all clips", false)
|
|
235
|
+
.option("-d, --duration <seconds>", "Effect duration", "1")
|
|
236
|
+
.option("-s, --start <seconds>", "Effect start time (relative to clip)", "0")
|
|
237
|
+
.option("--intensity <value>", "Effect intensity (0-1)", "1")
|
|
238
|
+
.action(
|
|
239
|
+
async (
|
|
240
|
+
projectPath: string,
|
|
241
|
+
effectType: string,
|
|
242
|
+
clipIds: string[],
|
|
243
|
+
options
|
|
244
|
+
) => {
|
|
245
|
+
const spinner = ora("Applying effects...").start();
|
|
246
|
+
|
|
247
|
+
try {
|
|
248
|
+
const filePath = resolve(process.cwd(), projectPath);
|
|
249
|
+
const content = await readFile(filePath, "utf-8");
|
|
250
|
+
const data: ProjectFile = JSON.parse(content);
|
|
251
|
+
const project = Project.fromJSON(data);
|
|
252
|
+
|
|
253
|
+
const clips = project.getClips();
|
|
254
|
+
|
|
255
|
+
if (clips.length === 0) {
|
|
256
|
+
spinner.fail(chalk.red("No clips in project"));
|
|
257
|
+
process.exit(1);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
// Get clips to apply effect to
|
|
261
|
+
let selectedClips = clips;
|
|
262
|
+
if (!options.all && clipIds.length > 0) {
|
|
263
|
+
selectedClips = clipIds
|
|
264
|
+
.map((id) => clips.find((c) => c.id === id))
|
|
265
|
+
.filter((c): c is NonNullable<typeof c> => c !== undefined);
|
|
266
|
+
|
|
267
|
+
if (selectedClips.length === 0) {
|
|
268
|
+
spinner.fail(chalk.red("No matching clips found"));
|
|
269
|
+
process.exit(1);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const duration = parseFloat(options.duration);
|
|
274
|
+
const startTime = parseFloat(options.start);
|
|
275
|
+
const intensity = parseFloat(options.intensity);
|
|
276
|
+
let appliedCount = 0;
|
|
277
|
+
|
|
278
|
+
for (const clip of selectedClips) {
|
|
279
|
+
const effect = project.addEffect(clip.id, {
|
|
280
|
+
type: effectType as EffectType,
|
|
281
|
+
startTime,
|
|
282
|
+
duration,
|
|
283
|
+
params: { intensity },
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
if (effect) {
|
|
287
|
+
appliedCount++;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
await writeFile(filePath, JSON.stringify(project.toJSON(), null, 2), "utf-8");
|
|
292
|
+
|
|
293
|
+
spinner.succeed(
|
|
294
|
+
chalk.green(`Applied ${effectType} to ${appliedCount} clips`)
|
|
295
|
+
);
|
|
296
|
+
console.log();
|
|
297
|
+
console.log(chalk.dim(" Effect:"), effectType);
|
|
298
|
+
console.log(chalk.dim(" Duration:"), `${duration}s`);
|
|
299
|
+
console.log(chalk.dim(" Intensity:"), intensity);
|
|
300
|
+
console.log();
|
|
301
|
+
} catch (error) {
|
|
302
|
+
spinner.fail(chalk.red("Apply effect failed"));
|
|
303
|
+
if (error instanceof Error) {
|
|
304
|
+
console.error(chalk.red(error.message));
|
|
305
|
+
}
|
|
306
|
+
process.exit(1);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
// ============ batch remove-clips ============
|
|
312
|
+
|
|
313
|
+
batchCommand
|
|
314
|
+
.command("remove-clips")
|
|
315
|
+
.description("Remove multiple clips from the timeline")
|
|
316
|
+
.argument("<project>", "Project file path")
|
|
317
|
+
.argument("[clip-ids...]", "Clip IDs to remove")
|
|
318
|
+
.option("--all", "Remove all clips", false)
|
|
319
|
+
.option("--track <track-id>", "Remove clips from specific track only")
|
|
320
|
+
.action(async (projectPath: string, clipIds: string[], options) => {
|
|
321
|
+
const spinner = ora("Removing clips...").start();
|
|
322
|
+
|
|
323
|
+
try {
|
|
324
|
+
const filePath = resolve(process.cwd(), projectPath);
|
|
325
|
+
const content = await readFile(filePath, "utf-8");
|
|
326
|
+
const data: ProjectFile = JSON.parse(content);
|
|
327
|
+
const project = Project.fromJSON(data);
|
|
328
|
+
|
|
329
|
+
const clips = project.getClips();
|
|
330
|
+
|
|
331
|
+
if (clips.length === 0) {
|
|
332
|
+
spinner.fail(chalk.red("No clips in project"));
|
|
333
|
+
process.exit(1);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
// Get clips to remove
|
|
337
|
+
let clipsToRemove = clips;
|
|
338
|
+
|
|
339
|
+
if (options.track) {
|
|
340
|
+
clipsToRemove = clips.filter((c) => c.trackId === options.track);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (!options.all && clipIds.length > 0) {
|
|
344
|
+
clipsToRemove = clipIds
|
|
345
|
+
.map((id) => clips.find((c) => c.id === id))
|
|
346
|
+
.filter((c): c is NonNullable<typeof c> => c !== undefined);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (clipsToRemove.length === 0) {
|
|
350
|
+
spinner.fail(chalk.red("No matching clips found"));
|
|
351
|
+
process.exit(1);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
let removedCount = 0;
|
|
355
|
+
for (const clip of clipsToRemove) {
|
|
356
|
+
if (project.removeClip(clip.id)) {
|
|
357
|
+
removedCount++;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
await writeFile(filePath, JSON.stringify(project.toJSON(), null, 2), "utf-8");
|
|
362
|
+
|
|
363
|
+
spinner.succeed(chalk.green(`Removed ${removedCount} clips`));
|
|
364
|
+
console.log();
|
|
365
|
+
} catch (error) {
|
|
366
|
+
spinner.fail(chalk.red("Remove clips failed"));
|
|
367
|
+
if (error instanceof Error) {
|
|
368
|
+
console.error(chalk.red(error.message));
|
|
369
|
+
}
|
|
370
|
+
process.exit(1);
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
// ============ batch info ============
|
|
375
|
+
|
|
376
|
+
batchCommand
|
|
377
|
+
.command("info")
|
|
378
|
+
.description("Show batch processing statistics")
|
|
379
|
+
.argument("<project>", "Project file path")
|
|
380
|
+
.action(async (projectPath: string) => {
|
|
381
|
+
const spinner = ora("Loading project...").start();
|
|
382
|
+
|
|
383
|
+
try {
|
|
384
|
+
const filePath = resolve(process.cwd(), projectPath);
|
|
385
|
+
const content = await readFile(filePath, "utf-8");
|
|
386
|
+
const data: ProjectFile = JSON.parse(content);
|
|
387
|
+
const project = Project.fromJSON(data);
|
|
388
|
+
|
|
389
|
+
const sources = project.getSources();
|
|
390
|
+
const clips = project.getClips();
|
|
391
|
+
const tracks = project.getTracks();
|
|
392
|
+
const summary = project.getSummary();
|
|
393
|
+
|
|
394
|
+
spinner.stop();
|
|
395
|
+
|
|
396
|
+
console.log(chalk.bold("\nProject Statistics\n"));
|
|
397
|
+
|
|
398
|
+
// Sources breakdown
|
|
399
|
+
const videoSources = sources.filter((s) => s.type === "video").length;
|
|
400
|
+
const audioSources = sources.filter((s) => s.type === "audio").length;
|
|
401
|
+
const imageSources = sources.filter((s) => s.type === "image").length;
|
|
402
|
+
|
|
403
|
+
console.log(chalk.cyan("Sources:"), sources.length);
|
|
404
|
+
if (videoSources > 0) console.log(chalk.dim(" Video:"), videoSources);
|
|
405
|
+
if (audioSources > 0) console.log(chalk.dim(" Audio:"), audioSources);
|
|
406
|
+
if (imageSources > 0) console.log(chalk.dim(" Image:"), imageSources);
|
|
407
|
+
|
|
408
|
+
// Clips breakdown
|
|
409
|
+
const clipsPerTrack = tracks.map((t) => ({
|
|
410
|
+
track: t.name,
|
|
411
|
+
count: clips.filter((c) => c.trackId === t.id).length,
|
|
412
|
+
}));
|
|
413
|
+
|
|
414
|
+
console.log(chalk.cyan("\nClips:"), clips.length);
|
|
415
|
+
for (const { track, count } of clipsPerTrack) {
|
|
416
|
+
if (count > 0) console.log(chalk.dim(` ${track}:`), count);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Effects count
|
|
420
|
+
const totalEffects = clips.reduce((sum, c) => sum + c.effects.length, 0);
|
|
421
|
+
if (totalEffects > 0) {
|
|
422
|
+
console.log(chalk.cyan("\nEffects:"), totalEffects);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// Timeline info
|
|
426
|
+
console.log(chalk.cyan("\nTimeline:"));
|
|
427
|
+
console.log(chalk.dim(" Duration:"), `${summary.duration.toFixed(1)}s`);
|
|
428
|
+
console.log(chalk.dim(" Tracks:"), tracks.length);
|
|
429
|
+
console.log(chalk.dim(" Frame rate:"), `${summary.frameRate} fps`);
|
|
430
|
+
console.log(chalk.dim(" Aspect ratio:"), summary.aspectRatio);
|
|
431
|
+
|
|
432
|
+
console.log();
|
|
433
|
+
} catch (error) {
|
|
434
|
+
spinner.fail(chalk.red("Failed to load project"));
|
|
435
|
+
if (error instanceof Error) {
|
|
436
|
+
console.error(chalk.red(error.message));
|
|
437
|
+
}
|
|
438
|
+
process.exit(1);
|
|
439
|
+
}
|
|
440
|
+
});
|