@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,177 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { stat } from "node:fs/promises";
|
|
3
|
+
import { resolve, extname, basename } from "node:path";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import ora from "ora";
|
|
6
|
+
import * as musicMetadata from "music-metadata";
|
|
7
|
+
|
|
8
|
+
export const mediaCommand = new Command("media")
|
|
9
|
+
.description("Media file utilities");
|
|
10
|
+
|
|
11
|
+
mediaCommand
|
|
12
|
+
.command("info")
|
|
13
|
+
.description("Get media file information")
|
|
14
|
+
.argument("<file>", "Media file path")
|
|
15
|
+
.action(async (file: string) => {
|
|
16
|
+
const spinner = ora("Analyzing media...").start();
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const filePath = resolve(process.cwd(), file);
|
|
20
|
+
const ext = extname(filePath).toLowerCase();
|
|
21
|
+
const fileName = basename(filePath);
|
|
22
|
+
const fileStat = await stat(filePath);
|
|
23
|
+
|
|
24
|
+
const mediaType = detectMediaType(ext);
|
|
25
|
+
|
|
26
|
+
spinner.stop();
|
|
27
|
+
|
|
28
|
+
console.log();
|
|
29
|
+
console.log(chalk.bold.cyan("Media Info"));
|
|
30
|
+
console.log(chalk.dim("─".repeat(50)));
|
|
31
|
+
console.log(chalk.dim(" File:"), fileName);
|
|
32
|
+
console.log(chalk.dim(" Path:"), filePath);
|
|
33
|
+
console.log(chalk.dim(" Size:"), formatFileSize(fileStat.size));
|
|
34
|
+
console.log(chalk.dim(" Type:"), mediaType);
|
|
35
|
+
|
|
36
|
+
if (mediaType === "audio" || mediaType === "video") {
|
|
37
|
+
try {
|
|
38
|
+
const metadata = await musicMetadata.parseFile(filePath);
|
|
39
|
+
|
|
40
|
+
console.log();
|
|
41
|
+
console.log(chalk.bold.cyan("Format"));
|
|
42
|
+
console.log(chalk.dim("─".repeat(50)));
|
|
43
|
+
|
|
44
|
+
if (metadata.format.container) {
|
|
45
|
+
console.log(chalk.dim(" Container:"), metadata.format.container);
|
|
46
|
+
}
|
|
47
|
+
if (metadata.format.codec) {
|
|
48
|
+
console.log(chalk.dim(" Codec:"), metadata.format.codec);
|
|
49
|
+
}
|
|
50
|
+
if (metadata.format.duration) {
|
|
51
|
+
console.log(chalk.dim(" Duration:"), formatDuration(metadata.format.duration));
|
|
52
|
+
}
|
|
53
|
+
if (metadata.format.bitrate) {
|
|
54
|
+
console.log(chalk.dim(" Bitrate:"), formatBitrate(metadata.format.bitrate));
|
|
55
|
+
}
|
|
56
|
+
if (metadata.format.sampleRate) {
|
|
57
|
+
console.log(chalk.dim(" Sample Rate:"), `${metadata.format.sampleRate} Hz`);
|
|
58
|
+
}
|
|
59
|
+
if (metadata.format.numberOfChannels) {
|
|
60
|
+
console.log(chalk.dim(" Channels:"), metadata.format.numberOfChannels);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Video-specific info (if available)
|
|
64
|
+
if (metadata.format.trackInfo && metadata.format.trackInfo.length > 0) {
|
|
65
|
+
const videoTrack = metadata.format.trackInfo.find(
|
|
66
|
+
(t) => (t as Record<string, unknown>).type === "video"
|
|
67
|
+
) as Record<string, unknown> | undefined;
|
|
68
|
+
if (videoTrack) {
|
|
69
|
+
console.log();
|
|
70
|
+
console.log(chalk.bold.cyan("Video"));
|
|
71
|
+
console.log(chalk.dim("─".repeat(50)));
|
|
72
|
+
if (videoTrack.width && videoTrack.height) {
|
|
73
|
+
console.log(chalk.dim(" Resolution:"), `${videoTrack.width}x${videoTrack.height}`);
|
|
74
|
+
}
|
|
75
|
+
if (videoTrack.frameRate) {
|
|
76
|
+
console.log(chalk.dim(" Frame Rate:"), `${videoTrack.frameRate} fps`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Audio tags
|
|
82
|
+
if (metadata.common && Object.keys(metadata.common).length > 0) {
|
|
83
|
+
const { title, artist, album, year, genre } = metadata.common;
|
|
84
|
+
if (title || artist || album) {
|
|
85
|
+
console.log();
|
|
86
|
+
console.log(chalk.bold.cyan("Tags"));
|
|
87
|
+
console.log(chalk.dim("─".repeat(50)));
|
|
88
|
+
if (title) console.log(chalk.dim(" Title:"), title);
|
|
89
|
+
if (artist) console.log(chalk.dim(" Artist:"), artist);
|
|
90
|
+
if (album) console.log(chalk.dim(" Album:"), album);
|
|
91
|
+
if (year) console.log(chalk.dim(" Year:"), year);
|
|
92
|
+
if (genre && genre.length > 0) console.log(chalk.dim(" Genre:"), genre.join(", "));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
} catch (metadataError) {
|
|
96
|
+
console.log();
|
|
97
|
+
console.log(chalk.yellow(" Could not parse detailed metadata"));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (mediaType === "image") {
|
|
102
|
+
console.log();
|
|
103
|
+
console.log(chalk.dim(" (Image metadata parsing not yet supported)"));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
console.log();
|
|
107
|
+
} catch (error) {
|
|
108
|
+
spinner.fail(chalk.red("Failed to analyze media"));
|
|
109
|
+
if (error instanceof Error) {
|
|
110
|
+
console.error(chalk.red(error.message));
|
|
111
|
+
}
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
mediaCommand
|
|
117
|
+
.command("duration")
|
|
118
|
+
.description("Get media duration in seconds (for scripting)")
|
|
119
|
+
.argument("<file>", "Media file path")
|
|
120
|
+
.action(async (file: string) => {
|
|
121
|
+
try {
|
|
122
|
+
const filePath = resolve(process.cwd(), file);
|
|
123
|
+
const metadata = await musicMetadata.parseFile(filePath);
|
|
124
|
+
|
|
125
|
+
if (metadata.format.duration) {
|
|
126
|
+
console.log(metadata.format.duration.toFixed(3));
|
|
127
|
+
} else {
|
|
128
|
+
console.error("Could not determine duration");
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
} catch (error) {
|
|
132
|
+
console.error("Failed to get duration");
|
|
133
|
+
process.exit(1);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
function detectMediaType(ext: string): "video" | "audio" | "image" | "unknown" {
|
|
138
|
+
const videoExts = [".mp4", ".mov", ".webm", ".avi", ".mkv", ".m4v", ".flv", ".wmv"];
|
|
139
|
+
const audioExts = [".mp3", ".wav", ".ogg", ".m4a", ".aac", ".flac", ".wma", ".aiff"];
|
|
140
|
+
const imageExts = [".jpg", ".jpeg", ".png", ".gif", ".webp", ".bmp", ".svg", ".tiff"];
|
|
141
|
+
|
|
142
|
+
if (videoExts.includes(ext)) return "video";
|
|
143
|
+
if (audioExts.includes(ext)) return "audio";
|
|
144
|
+
if (imageExts.includes(ext)) return "image";
|
|
145
|
+
return "unknown";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function formatFileSize(bytes: number): string {
|
|
149
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
150
|
+
let size = bytes;
|
|
151
|
+
let unitIndex = 0;
|
|
152
|
+
|
|
153
|
+
while (size >= 1024 && unitIndex < units.length - 1) {
|
|
154
|
+
size /= 1024;
|
|
155
|
+
unitIndex++;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return `${size.toFixed(2)} ${units[unitIndex]}`;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function formatDuration(seconds: number): string {
|
|
162
|
+
const hrs = Math.floor(seconds / 3600);
|
|
163
|
+
const mins = Math.floor((seconds % 3600) / 60);
|
|
164
|
+
const secs = (seconds % 60).toFixed(2);
|
|
165
|
+
|
|
166
|
+
if (hrs > 0) {
|
|
167
|
+
return `${hrs}:${mins.toString().padStart(2, "0")}:${secs.padStart(5, "0")}`;
|
|
168
|
+
}
|
|
169
|
+
return `${mins}:${secs.padStart(5, "0")}`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function formatBitrate(bps: number): string {
|
|
173
|
+
if (bps >= 1000000) {
|
|
174
|
+
return `${(bps / 1000000).toFixed(2)} Mbps`;
|
|
175
|
+
}
|
|
176
|
+
return `${(bps / 1000).toFixed(0)} kbps`;
|
|
177
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module output
|
|
3
|
+
* @description Shared output helper for --json structured output support.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import chalk from "chalk";
|
|
7
|
+
import ora from "ora";
|
|
8
|
+
|
|
9
|
+
// ── Exit Codes ───────────────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
export enum ExitCode {
|
|
12
|
+
SUCCESS = 0,
|
|
13
|
+
GENERAL = 1,
|
|
14
|
+
USAGE = 2,
|
|
15
|
+
NOT_FOUND = 3,
|
|
16
|
+
AUTH = 4,
|
|
17
|
+
API_ERROR = 5,
|
|
18
|
+
NETWORK = 6,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// ── Structured Errors ────────────────────────────────────────────────────
|
|
22
|
+
|
|
23
|
+
export interface StructuredError {
|
|
24
|
+
success: false;
|
|
25
|
+
error: string;
|
|
26
|
+
code: string;
|
|
27
|
+
exitCode: ExitCode;
|
|
28
|
+
suggestion?: string;
|
|
29
|
+
retryable: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function usageError(msg: string, suggestion?: string): StructuredError {
|
|
33
|
+
return { success: false, error: msg, code: "USAGE_ERROR", exitCode: ExitCode.USAGE, suggestion, retryable: false };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function authError(envVar: string, provider: string): StructuredError {
|
|
37
|
+
return {
|
|
38
|
+
success: false,
|
|
39
|
+
error: `${provider} API key required.`,
|
|
40
|
+
code: "API_KEY_MISSING",
|
|
41
|
+
exitCode: ExitCode.AUTH,
|
|
42
|
+
suggestion: `Set ${envVar} in .env, or run: vibe setup`,
|
|
43
|
+
retryable: false,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function apiError(msg: string, retryable = false): StructuredError {
|
|
48
|
+
return { success: false, error: msg, code: "API_ERROR", exitCode: ExitCode.API_ERROR, suggestion: retryable ? "Retry the command." : undefined, retryable };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function notFoundError(path: string): StructuredError {
|
|
52
|
+
return { success: false, error: `File not found: ${path}`, code: "NOT_FOUND", exitCode: ExitCode.NOT_FOUND, retryable: false };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function networkError(msg: string): StructuredError {
|
|
56
|
+
return { success: false, error: msg, code: "NETWORK_ERROR", exitCode: ExitCode.NETWORK, suggestion: "Check your internet connection and retry.", retryable: true };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function generalError(msg: string, suggestion?: string): StructuredError {
|
|
60
|
+
return { success: false, error: msg, code: "ERROR", exitCode: ExitCode.GENERAL, suggestion, retryable: false };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Output structured error then exit */
|
|
64
|
+
export function exitWithError(err: StructuredError): never {
|
|
65
|
+
if (isJsonMode()) {
|
|
66
|
+
console.log(JSON.stringify(err, null, 2));
|
|
67
|
+
} else {
|
|
68
|
+
console.error(chalk.red(`\n ${err.error}`));
|
|
69
|
+
if (err.suggestion) {
|
|
70
|
+
console.error(chalk.dim(` ${err.suggestion}`));
|
|
71
|
+
}
|
|
72
|
+
console.error();
|
|
73
|
+
}
|
|
74
|
+
process.exit(err.exitCode);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ── Output Modes ─────────────────────────────────────────────────────────
|
|
78
|
+
|
|
79
|
+
/** Check if --json flag is active */
|
|
80
|
+
export function isJsonMode(): boolean {
|
|
81
|
+
return process.env.VIBE_JSON_OUTPUT === "1";
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** Check if --quiet flag is active */
|
|
85
|
+
export function isQuietMode(): boolean {
|
|
86
|
+
return process.env.VIBE_QUIET_OUTPUT === "1";
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Output result - JSON mode outputs JSON, quiet mode outputs primary value only */
|
|
90
|
+
export function outputResult(result: Record<string, unknown>): void {
|
|
91
|
+
if (isJsonMode()) {
|
|
92
|
+
// Apply --fields filtering if specified
|
|
93
|
+
const fields = process.env.VIBE_OUTPUT_FIELDS;
|
|
94
|
+
if (fields) {
|
|
95
|
+
const keys = fields.split(",").map((k) => k.trim());
|
|
96
|
+
const filtered: Record<string, unknown> = {};
|
|
97
|
+
for (const key of keys) {
|
|
98
|
+
if (key in result) filtered[key] = result[key];
|
|
99
|
+
}
|
|
100
|
+
// Always include success
|
|
101
|
+
if ("success" in result) filtered.success = result.success;
|
|
102
|
+
console.log(JSON.stringify(filtered, null, 2));
|
|
103
|
+
} else {
|
|
104
|
+
console.log(JSON.stringify(result, null, 2));
|
|
105
|
+
}
|
|
106
|
+
} else if (isQuietMode()) {
|
|
107
|
+
// In quiet mode, output the primary value only (path, url, or id)
|
|
108
|
+
const primary = result.output ?? result.path ?? result.url ?? result.id ?? result.result;
|
|
109
|
+
if (primary !== undefined) console.log(String(primary));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** Wrap console output - suppressed in JSON/quiet mode */
|
|
114
|
+
export function log(...args: unknown[]): void {
|
|
115
|
+
if (!isJsonMode() && !isQuietMode()) {
|
|
116
|
+
console.log(...args);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Create a spinner that is silent in JSON/quiet mode */
|
|
121
|
+
export function spinner(text: string): ReturnType<typeof ora> {
|
|
122
|
+
if (isJsonMode() || isQuietMode()) {
|
|
123
|
+
return ora({ text, isSilent: true });
|
|
124
|
+
}
|
|
125
|
+
return ora(text);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** Suggest next steps - only in human interactive mode */
|
|
129
|
+
export function suggestNext(tip: string): void {
|
|
130
|
+
if (!isJsonMode() && !isQuietMode() && process.stdout.isTTY) {
|
|
131
|
+
console.log(chalk.dim(`\n Tip: ${tip}`));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** Output an error - always outputs (JSON mode writes to stdout as JSON) */
|
|
136
|
+
export function outputError(error: string, details?: Record<string, unknown>): void {
|
|
137
|
+
if (isJsonMode()) {
|
|
138
|
+
console.log(JSON.stringify({ success: false, error, ...details }, null, 2));
|
|
139
|
+
} else {
|
|
140
|
+
console.error(error);
|
|
141
|
+
}
|
|
142
|
+
}
|