@vibeframe/cli 0.54.0 → 0.55.1
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 +63452 -233
- package/package.json +11 -6
- package/dist/agent/adapters/claude.d.ts +0 -15
- package/dist/agent/adapters/claude.d.ts.map +0 -1
- package/dist/agent/adapters/claude.js +0 -119
- package/dist/agent/adapters/claude.js.map +0 -1
- package/dist/agent/adapters/gemini.d.ts +0 -15
- package/dist/agent/adapters/gemini.d.ts.map +0 -1
- package/dist/agent/adapters/gemini.js +0 -132
- package/dist/agent/adapters/gemini.js.map +0 -1
- package/dist/agent/adapters/index.d.ts +0 -28
- package/dist/agent/adapters/index.d.ts.map +0 -1
- package/dist/agent/adapters/index.js +0 -43
- package/dist/agent/adapters/index.js.map +0 -1
- package/dist/agent/adapters/ollama.d.ts +0 -20
- package/dist/agent/adapters/ollama.d.ts.map +0 -1
- package/dist/agent/adapters/ollama.js +0 -186
- package/dist/agent/adapters/ollama.js.map +0 -1
- package/dist/agent/adapters/openai.d.ts +0 -15
- package/dist/agent/adapters/openai.d.ts.map +0 -1
- package/dist/agent/adapters/openai.js +0 -92
- package/dist/agent/adapters/openai.js.map +0 -1
- package/dist/agent/adapters/openrouter.d.ts +0 -16
- package/dist/agent/adapters/openrouter.d.ts.map +0 -1
- package/dist/agent/adapters/openrouter.js +0 -100
- package/dist/agent/adapters/openrouter.js.map +0 -1
- package/dist/agent/adapters/openrouter.test.d.ts +0 -5
- package/dist/agent/adapters/openrouter.test.d.ts.map +0 -1
- package/dist/agent/adapters/openrouter.test.js +0 -73
- package/dist/agent/adapters/openrouter.test.js.map +0 -1
- package/dist/agent/adapters/xai.d.ts +0 -15
- package/dist/agent/adapters/xai.d.ts.map +0 -1
- package/dist/agent/adapters/xai.js +0 -95
- package/dist/agent/adapters/xai.js.map +0 -1
- package/dist/agent/index.d.ts +0 -69
- package/dist/agent/index.d.ts.map +0 -1
- package/dist/agent/index.js +0 -180
- package/dist/agent/index.js.map +0 -1
- package/dist/agent/memory/index.d.ts +0 -70
- package/dist/agent/memory/index.d.ts.map +0 -1
- package/dist/agent/memory/index.js +0 -132
- package/dist/agent/memory/index.js.map +0 -1
- package/dist/agent/prompts/system.d.ts +0 -6
- package/dist/agent/prompts/system.d.ts.map +0 -1
- package/dist/agent/prompts/system.js +0 -103
- package/dist/agent/prompts/system.js.map +0 -1
- package/dist/agent/tools/ai-editing.d.ts +0 -15
- package/dist/agent/tools/ai-editing.d.ts.map +0 -1
- package/dist/agent/tools/ai-editing.js +0 -763
- package/dist/agent/tools/ai-editing.js.map +0 -1
- package/dist/agent/tools/ai-generation.d.ts +0 -13
- package/dist/agent/tools/ai-generation.d.ts.map +0 -1
- package/dist/agent/tools/ai-generation.js +0 -973
- package/dist/agent/tools/ai-generation.js.map +0 -1
- package/dist/agent/tools/ai-pipeline.d.ts +0 -14
- package/dist/agent/tools/ai-pipeline.d.ts.map +0 -1
- package/dist/agent/tools/ai-pipeline.js +0 -961
- package/dist/agent/tools/ai-pipeline.js.map +0 -1
- package/dist/agent/tools/ai.d.ts +0 -13
- package/dist/agent/tools/ai.d.ts.map +0 -1
- package/dist/agent/tools/ai.js +0 -19
- package/dist/agent/tools/ai.js.map +0 -1
- package/dist/agent/tools/batch.d.ts +0 -6
- package/dist/agent/tools/batch.d.ts.map +0 -1
- package/dist/agent/tools/batch.js +0 -383
- package/dist/agent/tools/batch.js.map +0 -1
- package/dist/agent/tools/e2e.test.d.ts +0 -26
- package/dist/agent/tools/e2e.test.d.ts.map +0 -1
- package/dist/agent/tools/e2e.test.js +0 -397
- package/dist/agent/tools/e2e.test.js.map +0 -1
- package/dist/agent/tools/export.d.ts +0 -6
- package/dist/agent/tools/export.d.ts.map +0 -1
- package/dist/agent/tools/export.js +0 -171
- package/dist/agent/tools/export.js.map +0 -1
- package/dist/agent/tools/filesystem.d.ts +0 -6
- package/dist/agent/tools/filesystem.d.ts.map +0 -1
- package/dist/agent/tools/filesystem.js +0 -212
- package/dist/agent/tools/filesystem.js.map +0 -1
- package/dist/agent/tools/index.d.ts +0 -66
- package/dist/agent/tools/index.d.ts.map +0 -1
- package/dist/agent/tools/index.js +0 -123
- package/dist/agent/tools/index.js.map +0 -1
- package/dist/agent/tools/integration.test.d.ts +0 -11
- package/dist/agent/tools/integration.test.d.ts.map +0 -1
- package/dist/agent/tools/integration.test.js +0 -659
- package/dist/agent/tools/integration.test.js.map +0 -1
- package/dist/agent/tools/media.d.ts +0 -6
- package/dist/agent/tools/media.d.ts.map +0 -1
- package/dist/agent/tools/media.js +0 -616
- package/dist/agent/tools/media.js.map +0 -1
- package/dist/agent/tools/project.d.ts +0 -6
- package/dist/agent/tools/project.d.ts.map +0 -1
- package/dist/agent/tools/project.js +0 -284
- package/dist/agent/tools/project.js.map +0 -1
- package/dist/agent/tools/scene.d.ts +0 -17
- package/dist/agent/tools/scene.d.ts.map +0 -1
- package/dist/agent/tools/scene.js +0 -263
- package/dist/agent/tools/scene.js.map +0 -1
- package/dist/agent/tools/scene.test.d.ts +0 -2
- package/dist/agent/tools/scene.test.d.ts.map +0 -1
- package/dist/agent/tools/scene.test.js +0 -139
- package/dist/agent/tools/scene.test.js.map +0 -1
- package/dist/agent/tools/timeline.d.ts +0 -6
- package/dist/agent/tools/timeline.d.ts.map +0 -1
- package/dist/agent/tools/timeline.js +0 -875
- package/dist/agent/tools/timeline.js.map +0 -1
- package/dist/agent/types.d.ts +0 -59
- package/dist/agent/types.d.ts.map +0 -1
- package/dist/agent/types.js +0 -5
- package/dist/agent/types.js.map +0 -1
- package/dist/commands/_shared/scene-html-emit.d.ts +0 -120
- package/dist/commands/_shared/scene-html-emit.d.ts.map +0 -1
- package/dist/commands/_shared/scene-html-emit.js +0 -422
- package/dist/commands/_shared/scene-html-emit.js.map +0 -1
- package/dist/commands/_shared/scene-html-emit.test.d.ts +0 -2
- package/dist/commands/_shared/scene-html-emit.test.d.ts.map +0 -1
- package/dist/commands/_shared/scene-html-emit.test.js +0 -396
- package/dist/commands/_shared/scene-html-emit.test.js.map +0 -1
- package/dist/commands/_shared/scene-lint.d.ts +0 -110
- package/dist/commands/_shared/scene-lint.d.ts.map +0 -1
- package/dist/commands/_shared/scene-lint.js +0 -207
- package/dist/commands/_shared/scene-lint.js.map +0 -1
- package/dist/commands/_shared/scene-lint.test.d.ts +0 -2
- package/dist/commands/_shared/scene-lint.test.d.ts.map +0 -1
- package/dist/commands/_shared/scene-lint.test.js +0 -208
- package/dist/commands/_shared/scene-lint.test.js.map +0 -1
- package/dist/commands/_shared/scene-project.d.ts +0 -101
- package/dist/commands/_shared/scene-project.d.ts.map +0 -1
- package/dist/commands/_shared/scene-project.js +0 -281
- package/dist/commands/_shared/scene-project.js.map +0 -1
- package/dist/commands/_shared/scene-project.test.d.ts +0 -2
- package/dist/commands/_shared/scene-project.test.d.ts.map +0 -1
- package/dist/commands/_shared/scene-project.test.js +0 -203
- package/dist/commands/_shared/scene-project.test.js.map +0 -1
- package/dist/commands/_shared/scene-render.d.ts +0 -79
- package/dist/commands/_shared/scene-render.d.ts.map +0 -1
- package/dist/commands/_shared/scene-render.js +0 -138
- package/dist/commands/_shared/scene-render.js.map +0 -1
- package/dist/commands/_shared/scene-render.test.d.ts +0 -2
- package/dist/commands/_shared/scene-render.test.d.ts.map +0 -1
- package/dist/commands/_shared/scene-render.test.js +0 -145
- package/dist/commands/_shared/scene-render.test.js.map +0 -1
- package/dist/commands/_shared/segments-to-scenes.d.ts +0 -85
- package/dist/commands/_shared/segments-to-scenes.d.ts.map +0 -1
- package/dist/commands/_shared/segments-to-scenes.js +0 -202
- package/dist/commands/_shared/segments-to-scenes.js.map +0 -1
- package/dist/commands/_shared/segments-to-scenes.test.d.ts +0 -2
- package/dist/commands/_shared/segments-to-scenes.test.d.ts.map +0 -1
- package/dist/commands/_shared/segments-to-scenes.test.js +0 -219
- package/dist/commands/_shared/segments-to-scenes.test.js.map +0 -1
- package/dist/commands/_shared/tts-resolve.d.ts +0 -75
- package/dist/commands/_shared/tts-resolve.d.ts.map +0 -1
- package/dist/commands/_shared/tts-resolve.js +0 -89
- package/dist/commands/_shared/tts-resolve.js.map +0 -1
- package/dist/commands/_shared/tts-resolve.test.d.ts +0 -6
- package/dist/commands/_shared/tts-resolve.test.d.ts.map +0 -1
- package/dist/commands/_shared/tts-resolve.test.js +0 -147
- package/dist/commands/_shared/tts-resolve.test.js.map +0 -1
- package/dist/commands/agent.d.ts +0 -21
- package/dist/commands/agent.d.ts.map +0 -1
- package/dist/commands/agent.js +0 -285
- package/dist/commands/agent.js.map +0 -1
- package/dist/commands/ai-analyze.d.ts +0 -106
- package/dist/commands/ai-analyze.d.ts.map +0 -1
- package/dist/commands/ai-analyze.js +0 -320
- package/dist/commands/ai-analyze.js.map +0 -1
- package/dist/commands/ai-animated-caption.d.ts +0 -64
- package/dist/commands/ai-animated-caption.d.ts.map +0 -1
- package/dist/commands/ai-animated-caption.js +0 -272
- package/dist/commands/ai-animated-caption.js.map +0 -1
- package/dist/commands/ai-audio.d.ts +0 -98
- package/dist/commands/ai-audio.d.ts.map +0 -1
- package/dist/commands/ai-audio.js +0 -1059
- package/dist/commands/ai-audio.js.map +0 -1
- package/dist/commands/ai-broll.d.ts +0 -15
- package/dist/commands/ai-broll.d.ts.map +0 -1
- package/dist/commands/ai-broll.js +0 -421
- package/dist/commands/ai-broll.js.map +0 -1
- package/dist/commands/ai-edit-cli.d.ts +0 -14
- package/dist/commands/ai-edit-cli.d.ts.map +0 -1
- package/dist/commands/ai-edit-cli.js +0 -585
- package/dist/commands/ai-edit-cli.js.map +0 -1
- package/dist/commands/ai-edit.d.ts +0 -398
- package/dist/commands/ai-edit.d.ts.map +0 -1
- package/dist/commands/ai-edit.js +0 -1060
- package/dist/commands/ai-edit.js.map +0 -1
- package/dist/commands/ai-fill-gaps.d.ts +0 -14
- package/dist/commands/ai-fill-gaps.d.ts.map +0 -1
- package/dist/commands/ai-fill-gaps.js +0 -447
- package/dist/commands/ai-fill-gaps.js.map +0 -1
- package/dist/commands/ai-helpers.d.ts +0 -20
- package/dist/commands/ai-helpers.d.ts.map +0 -1
- package/dist/commands/ai-helpers.js +0 -59
- package/dist/commands/ai-helpers.js.map +0 -1
- package/dist/commands/ai-highlights.d.ts +0 -127
- package/dist/commands/ai-highlights.d.ts.map +0 -1
- package/dist/commands/ai-highlights.js +0 -1053
- package/dist/commands/ai-highlights.js.map +0 -1
- package/dist/commands/ai-image.d.ts +0 -76
- package/dist/commands/ai-image.d.ts.map +0 -1
- package/dist/commands/ai-image.js +0 -858
- package/dist/commands/ai-image.js.map +0 -1
- package/dist/commands/ai-motion.d.ts +0 -50
- package/dist/commands/ai-motion.d.ts.map +0 -1
- package/dist/commands/ai-motion.js +0 -297
- package/dist/commands/ai-motion.js.map +0 -1
- package/dist/commands/ai-narrate.d.ts +0 -66
- package/dist/commands/ai-narrate.d.ts.map +0 -1
- package/dist/commands/ai-narrate.js +0 -332
- package/dist/commands/ai-narrate.js.map +0 -1
- package/dist/commands/ai-review.d.ts +0 -57
- package/dist/commands/ai-review.d.ts.map +0 -1
- package/dist/commands/ai-review.js +0 -270
- package/dist/commands/ai-review.js.map +0 -1
- package/dist/commands/ai-script-pipeline-cli.d.ts +0 -9
- package/dist/commands/ai-script-pipeline-cli.d.ts.map +0 -1
- package/dist/commands/ai-script-pipeline-cli.js +0 -502
- package/dist/commands/ai-script-pipeline-cli.js.map +0 -1
- package/dist/commands/ai-script-pipeline.d.ts +0 -305
- package/dist/commands/ai-script-pipeline.d.ts.map +0 -1
- package/dist/commands/ai-script-pipeline.js +0 -1546
- package/dist/commands/ai-script-pipeline.js.map +0 -1
- package/dist/commands/ai-suggest-edit.d.ts +0 -14
- package/dist/commands/ai-suggest-edit.d.ts.map +0 -1
- package/dist/commands/ai-suggest-edit.js +0 -215
- package/dist/commands/ai-suggest-edit.js.map +0 -1
- package/dist/commands/ai-video-fx.d.ts +0 -14
- package/dist/commands/ai-video-fx.d.ts.map +0 -1
- package/dist/commands/ai-video-fx.js +0 -396
- package/dist/commands/ai-video-fx.js.map +0 -1
- package/dist/commands/ai-video.d.ts +0 -91
- package/dist/commands/ai-video.d.ts.map +0 -1
- package/dist/commands/ai-video.js +0 -1055
- package/dist/commands/ai-video.js.map +0 -1
- package/dist/commands/ai-viral.d.ts +0 -15
- package/dist/commands/ai-viral.d.ts.map +0 -1
- package/dist/commands/ai-viral.js +0 -507
- package/dist/commands/ai-viral.js.map +0 -1
- package/dist/commands/ai-visual-fx.d.ts +0 -14
- package/dist/commands/ai-visual-fx.d.ts.map +0 -1
- package/dist/commands/ai-visual-fx.js +0 -521
- package/dist/commands/ai-visual-fx.js.map +0 -1
- package/dist/commands/ai.d.ts +0 -38
- package/dist/commands/ai.d.ts.map +0 -1
- package/dist/commands/ai.js +0 -225
- package/dist/commands/ai.js.map +0 -1
- package/dist/commands/ai.test.d.ts +0 -2
- package/dist/commands/ai.test.d.ts.map +0 -1
- package/dist/commands/ai.test.js +0 -557
- package/dist/commands/ai.test.js.map +0 -1
- package/dist/commands/analyze.d.ts +0 -16
- package/dist/commands/analyze.d.ts.map +0 -1
- package/dist/commands/analyze.js +0 -247
- package/dist/commands/analyze.js.map +0 -1
- package/dist/commands/audio.d.ts +0 -18
- package/dist/commands/audio.d.ts.map +0 -1
- package/dist/commands/audio.js +0 -539
- package/dist/commands/audio.js.map +0 -1
- package/dist/commands/batch.d.ts +0 -3
- package/dist/commands/batch.d.ts.map +0 -1
- package/dist/commands/batch.js +0 -419
- package/dist/commands/batch.js.map +0 -1
- package/dist/commands/batch.test.d.ts +0 -2
- package/dist/commands/batch.test.d.ts.map +0 -1
- package/dist/commands/batch.test.js +0 -203
- package/dist/commands/batch.test.js.map +0 -1
- package/dist/commands/context.d.ts +0 -7
- package/dist/commands/context.d.ts.map +0 -1
- package/dist/commands/context.js +0 -66
- package/dist/commands/context.js.map +0 -1
- package/dist/commands/demo.d.ts +0 -7
- package/dist/commands/demo.d.ts.map +0 -1
- package/dist/commands/demo.js +0 -192
- package/dist/commands/demo.js.map +0 -1
- package/dist/commands/detect.d.ts +0 -56
- package/dist/commands/detect.d.ts.map +0 -1
- package/dist/commands/detect.js +0 -464
- package/dist/commands/detect.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -6
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -322
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/edit-cmd.d.ts +0 -112
- package/dist/commands/edit-cmd.d.ts.map +0 -1
- package/dist/commands/edit-cmd.js +0 -1041
- package/dist/commands/edit-cmd.js.map +0 -1
- package/dist/commands/export.d.ts +0 -61
- package/dist/commands/export.d.ts.map +0 -1
- package/dist/commands/export.js +0 -980
- package/dist/commands/export.js.map +0 -1
- package/dist/commands/export.test.d.ts +0 -2
- package/dist/commands/export.test.d.ts.map +0 -1
- package/dist/commands/export.test.js +0 -107
- package/dist/commands/export.test.js.map +0 -1
- package/dist/commands/generate.d.ts +0 -84
- package/dist/commands/generate.d.ts.map +0 -1
- package/dist/commands/generate.js +0 -2030
- package/dist/commands/generate.js.map +0 -1
- package/dist/commands/media.d.ts +0 -3
- package/dist/commands/media.d.ts.map +0 -1
- package/dist/commands/media.js +0 -163
- package/dist/commands/media.js.map +0 -1
- package/dist/commands/output.d.ts +0 -51
- package/dist/commands/output.d.ts.map +0 -1
- package/dist/commands/output.js +0 -219
- package/dist/commands/output.js.map +0 -1
- package/dist/commands/output.test.d.ts +0 -2
- package/dist/commands/output.test.d.ts.map +0 -1
- package/dist/commands/output.test.js +0 -151
- package/dist/commands/output.test.js.map +0 -1
- package/dist/commands/pipeline.d.ts +0 -19
- package/dist/commands/pipeline.d.ts.map +0 -1
- package/dist/commands/pipeline.js +0 -345
- package/dist/commands/pipeline.js.map +0 -1
- package/dist/commands/project.d.ts +0 -3
- package/dist/commands/project.d.ts.map +0 -1
- package/dist/commands/project.js +0 -181
- package/dist/commands/project.js.map +0 -1
- package/dist/commands/project.test.d.ts +0 -2
- package/dist/commands/project.test.d.ts.map +0 -1
- package/dist/commands/project.test.js +0 -105
- package/dist/commands/project.test.js.map +0 -1
- package/dist/commands/run.d.ts +0 -15
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands/run.js +0 -204
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/sanitize.d.ts +0 -21
- package/dist/commands/sanitize.d.ts.map +0 -1
- package/dist/commands/sanitize.js +0 -56
- package/dist/commands/sanitize.js.map +0 -1
- package/dist/commands/scene.d.ts +0 -86
- package/dist/commands/scene.d.ts.map +0 -1
- package/dist/commands/scene.js +0 -719
- package/dist/commands/scene.js.map +0 -1
- package/dist/commands/scene.test.d.ts +0 -2
- package/dist/commands/scene.test.d.ts.map +0 -1
- package/dist/commands/scene.test.js +0 -219
- package/dist/commands/scene.test.js.map +0 -1
- package/dist/commands/schema.d.ts +0 -13
- package/dist/commands/schema.d.ts.map +0 -1
- package/dist/commands/schema.js +0 -218
- package/dist/commands/schema.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -6
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/setup.js +0 -461
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/timeline.d.ts +0 -3
- package/dist/commands/timeline.d.ts.map +0 -1
- package/dist/commands/timeline.js +0 -609
- package/dist/commands/timeline.js.map +0 -1
- package/dist/commands/timeline.test.d.ts +0 -2
- package/dist/commands/timeline.test.d.ts.map +0 -1
- package/dist/commands/timeline.test.js +0 -334
- package/dist/commands/timeline.test.js.map +0 -1
- package/dist/commands/validate.d.ts +0 -34
- package/dist/commands/validate.d.ts.map +0 -1
- package/dist/commands/validate.js +0 -70
- package/dist/commands/validate.js.map +0 -1
- package/dist/config/config.test.d.ts +0 -2
- package/dist/config/config.test.d.ts.map +0 -1
- package/dist/config/config.test.js +0 -164
- package/dist/config/config.test.js.map +0 -1
- package/dist/config/index.d.ts +0 -35
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -101
- package/dist/config/index.js.map +0 -1
- package/dist/config/schema.d.ts +0 -52
- package/dist/config/schema.d.ts.map +0 -1
- package/dist/config/schema.js +0 -44
- package/dist/config/schema.js.map +0 -1
- package/dist/engine/index.d.ts +0 -3
- package/dist/engine/index.d.ts.map +0 -1
- package/dist/engine/index.js +0 -2
- package/dist/engine/index.js.map +0 -1
- package/dist/engine/project.d.ts +0 -84
- package/dist/engine/project.d.ts.map +0 -1
- package/dist/engine/project.js +0 -355
- package/dist/engine/project.js.map +0 -1
- package/dist/engine/project.test.d.ts +0 -2
- package/dist/engine/project.test.d.ts.map +0 -1
- package/dist/engine/project.test.js +0 -599
- package/dist/engine/project.test.js.map +0 -1
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/pipeline/executor.d.ts +0 -19
- package/dist/pipeline/executor.d.ts.map +0 -1
- package/dist/pipeline/executor.js +0 -397
- package/dist/pipeline/executor.js.map +0 -1
- package/dist/pipeline/index.d.ts +0 -4
- package/dist/pipeline/index.d.ts.map +0 -1
- package/dist/pipeline/index.js +0 -2
- package/dist/pipeline/index.js.map +0 -1
- package/dist/pipeline/renderers/__tests__/html-template.test.d.ts +0 -2
- package/dist/pipeline/renderers/__tests__/html-template.test.d.ts.map +0 -1
- package/dist/pipeline/renderers/__tests__/html-template.test.js +0 -170
- package/dist/pipeline/renderers/__tests__/html-template.test.js.map +0 -1
- package/dist/pipeline/renderers/__tests__/integration.test.d.ts +0 -2
- package/dist/pipeline/renderers/__tests__/integration.test.d.ts.map +0 -1
- package/dist/pipeline/renderers/__tests__/integration.test.js +0 -175
- package/dist/pipeline/renderers/__tests__/integration.test.js.map +0 -1
- package/dist/pipeline/renderers/chrome.d.ts +0 -26
- package/dist/pipeline/renderers/chrome.d.ts.map +0 -1
- package/dist/pipeline/renderers/chrome.js +0 -48
- package/dist/pipeline/renderers/chrome.js.map +0 -1
- package/dist/pipeline/renderers/html-clips.d.ts +0 -20
- package/dist/pipeline/renderers/html-clips.d.ts.map +0 -1
- package/dist/pipeline/renderers/html-clips.js +0 -50
- package/dist/pipeline/renderers/html-clips.js.map +0 -1
- package/dist/pipeline/renderers/html-runtime.d.ts +0 -7
- package/dist/pipeline/renderers/html-runtime.d.ts.map +0 -1
- package/dist/pipeline/renderers/html-runtime.js +0 -80
- package/dist/pipeline/renderers/html-runtime.js.map +0 -1
- package/dist/pipeline/renderers/html-template.d.ts +0 -3
- package/dist/pipeline/renderers/html-template.d.ts.map +0 -1
- package/dist/pipeline/renderers/html-template.js +0 -36
- package/dist/pipeline/renderers/html-template.js.map +0 -1
- package/dist/pipeline/renderers/hyperframes.d.ts +0 -8
- package/dist/pipeline/renderers/hyperframes.d.ts.map +0 -1
- package/dist/pipeline/renderers/hyperframes.js +0 -63
- package/dist/pipeline/renderers/hyperframes.js.map +0 -1
- package/dist/pipeline/renderers/project-builder.d.ts +0 -8
- package/dist/pipeline/renderers/project-builder.d.ts.map +0 -1
- package/dist/pipeline/renderers/project-builder.js +0 -65
- package/dist/pipeline/renderers/project-builder.js.map +0 -1
- package/dist/pipeline/renderers/types.d.ts +0 -41
- package/dist/pipeline/renderers/types.d.ts.map +0 -1
- package/dist/pipeline/renderers/types.js +0 -11
- package/dist/pipeline/renderers/types.js.map +0 -1
- package/dist/pipeline/resolver.d.ts +0 -20
- package/dist/pipeline/resolver.d.ts.map +0 -1
- package/dist/pipeline/resolver.js +0 -74
- package/dist/pipeline/resolver.js.map +0 -1
- package/dist/pipeline/types.d.ts +0 -82
- package/dist/pipeline/types.d.ts.map +0 -1
- package/dist/pipeline/types.js +0 -8
- package/dist/pipeline/types.js.map +0 -1
- package/dist/utils/api-key.d.ts +0 -33
- package/dist/utils/api-key.d.ts.map +0 -1
- package/dist/utils/api-key.js +0 -228
- package/dist/utils/api-key.js.map +0 -1
- package/dist/utils/api-key.test.d.ts +0 -2
- package/dist/utils/api-key.test.d.ts.map +0 -1
- package/dist/utils/api-key.test.js +0 -35
- package/dist/utils/api-key.test.js.map +0 -1
- package/dist/utils/audio.d.ts +0 -23
- package/dist/utils/audio.d.ts.map +0 -1
- package/dist/utils/audio.js +0 -79
- package/dist/utils/audio.js.map +0 -1
- package/dist/utils/exec-safe.d.ts +0 -22
- package/dist/utils/exec-safe.d.ts.map +0 -1
- package/dist/utils/exec-safe.js +0 -62
- package/dist/utils/exec-safe.js.map +0 -1
- package/dist/utils/first-run.d.ts +0 -17
- package/dist/utils/first-run.d.ts.map +0 -1
- package/dist/utils/first-run.js +0 -73
- package/dist/utils/first-run.js.map +0 -1
- package/dist/utils/input-validation.d.ts +0 -27
- package/dist/utils/input-validation.d.ts.map +0 -1
- package/dist/utils/input-validation.js +0 -67
- package/dist/utils/input-validation.js.map +0 -1
- package/dist/utils/provider-resolver.d.ts +0 -19
- package/dist/utils/provider-resolver.d.ts.map +0 -1
- package/dist/utils/provider-resolver.js +0 -75
- package/dist/utils/provider-resolver.js.map +0 -1
- package/dist/utils/remotion.d.ts +0 -231
- package/dist/utils/remotion.d.ts.map +0 -1
- package/dist/utils/remotion.js +0 -879
- package/dist/utils/remotion.js.map +0 -1
- package/dist/utils/subtitle.d.ts +0 -65
- package/dist/utils/subtitle.d.ts.map +0 -1
- package/dist/utils/subtitle.js +0 -135
- package/dist/utils/subtitle.js.map +0 -1
- package/dist/utils/subtitle.test.d.ts +0 -2
- package/dist/utils/subtitle.test.d.ts.map +0 -1
- package/dist/utils/subtitle.test.js +0 -175
- package/dist/utils/subtitle.test.js.map +0 -1
- package/dist/utils/tty.d.ts +0 -45
- package/dist/utils/tty.d.ts.map +0 -1
- package/dist/utils/tty.js +0 -231
- package/dist/utils/tty.js.map +0 -1
|
@@ -1,1059 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module ai-audio
|
|
3
|
-
* @description Audio commands for the VibeFrame CLI.
|
|
4
|
-
*
|
|
5
|
-
* ## Commands: vibe ai transcribe, vibe ai tts, vibe ai voices, vibe ai sfx,
|
|
6
|
-
* vibe ai isolate, vibe ai voice-clone, vibe ai music,
|
|
7
|
-
* vibe ai music-status, vibe ai audio-restore, vibe ai dub, vibe ai duck
|
|
8
|
-
* ## Dependencies: Whisper, ElevenLabs, Replicate, FFmpeg
|
|
9
|
-
*
|
|
10
|
-
* Extracted from ai.ts as part of modularisation.
|
|
11
|
-
* ai.ts calls registerAudioCommands(aiCommand).
|
|
12
|
-
* @see MODELS.md for AI model configuration
|
|
13
|
-
*/
|
|
14
|
-
import { resolve, dirname, basename, extname } from 'node:path';
|
|
15
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
16
|
-
import { existsSync } from 'node:fs';
|
|
17
|
-
import chalk from 'chalk';
|
|
18
|
-
import ora from 'ora';
|
|
19
|
-
import { WhisperProvider, ElevenLabsProvider, ReplicateProvider, ClaudeProvider, } from '@vibeframe/ai-providers';
|
|
20
|
-
import { getApiKey } from '../utils/api-key.js';
|
|
21
|
-
import { execSafe, execSafeSync, commandExists } from '../utils/exec-safe.js';
|
|
22
|
-
import { detectFormat, formatTranscript } from '../utils/subtitle.js';
|
|
23
|
-
import { formatTime } from './ai-helpers.js';
|
|
24
|
-
import { exitWithError, authError, notFoundError, apiError, usageError, generalError, outputResult } from './output.js';
|
|
25
|
-
import { validateOutputPath } from "./validate.js";
|
|
26
|
-
function _registerAudioCommands(aiCommand) {
|
|
27
|
-
aiCommand
|
|
28
|
-
.command("transcribe")
|
|
29
|
-
.description("Transcribe audio using Whisper")
|
|
30
|
-
.argument("<audio>", "Audio file path")
|
|
31
|
-
.option("-k, --api-key <key>", "OpenAI API key (or set OPENAI_API_KEY env)")
|
|
32
|
-
.option("-l, --language <lang>", "Language code (e.g., en, ko)")
|
|
33
|
-
.option("-o, --output <path>", "Output file path")
|
|
34
|
-
.option("-f, --format <format>", "Output format: json, srt, vtt (auto-detected from extension)")
|
|
35
|
-
.option("--dry-run", "Preview parameters without executing")
|
|
36
|
-
.action(async (audioPath, options) => {
|
|
37
|
-
try {
|
|
38
|
-
if (options.output) {
|
|
39
|
-
validateOutputPath(options.output);
|
|
40
|
-
}
|
|
41
|
-
if (options.dryRun) {
|
|
42
|
-
outputResult({ dryRun: true, command: "ai transcribe", params: { audio: audioPath, output: options.output, language: options.language, format: options.format } });
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const apiKey = await getApiKey("OPENAI_API_KEY", "OpenAI", options.apiKey);
|
|
46
|
-
if (!apiKey) {
|
|
47
|
-
exitWithError(authError("OPENAI_API_KEY", "OpenAI"));
|
|
48
|
-
}
|
|
49
|
-
const spinner = ora("Initializing Whisper...").start();
|
|
50
|
-
const whisper = new WhisperProvider();
|
|
51
|
-
await whisper.initialize({ apiKey });
|
|
52
|
-
spinner.text = "Reading audio file...";
|
|
53
|
-
const absPath = resolve(process.cwd(), audioPath);
|
|
54
|
-
const audioBuffer = await readFile(absPath);
|
|
55
|
-
const audioBlob = new Blob([audioBuffer]);
|
|
56
|
-
spinner.text = "Transcribing...";
|
|
57
|
-
const result = await whisper.transcribe(audioBlob, options.language);
|
|
58
|
-
if (result.status === "failed") {
|
|
59
|
-
spinner.fail("Transcription failed");
|
|
60
|
-
exitWithError(apiError(`Transcription failed: ${result.error}`, true));
|
|
61
|
-
}
|
|
62
|
-
spinner.succeed(chalk.green("Transcription complete"));
|
|
63
|
-
console.log();
|
|
64
|
-
console.log(chalk.bold.cyan("Transcript"));
|
|
65
|
-
console.log(chalk.dim("─".repeat(60)));
|
|
66
|
-
console.log(result.fullText);
|
|
67
|
-
console.log();
|
|
68
|
-
if (result.segments && result.segments.length > 0) {
|
|
69
|
-
console.log(chalk.bold.cyan("Segments"));
|
|
70
|
-
console.log(chalk.dim("─".repeat(60)));
|
|
71
|
-
for (const seg of result.segments) {
|
|
72
|
-
const time = `[${formatTime(seg.startTime)} - ${formatTime(seg.endTime)}]`;
|
|
73
|
-
console.log(`${chalk.dim(time)} ${seg.text}`);
|
|
74
|
-
}
|
|
75
|
-
console.log();
|
|
76
|
-
}
|
|
77
|
-
if (options.output) {
|
|
78
|
-
const outputPath = resolve(process.cwd(), options.output);
|
|
79
|
-
const format = detectFormat(options.output, options.format);
|
|
80
|
-
const content = formatTranscript(result, format);
|
|
81
|
-
await writeFile(outputPath, content, "utf-8");
|
|
82
|
-
console.log(chalk.green(`Saved ${format.toUpperCase()} to: ${outputPath}`));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (error) {
|
|
86
|
-
exitWithError(apiError(`Transcription failed: ${error instanceof Error ? error.message : String(error)}`, true));
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
aiCommand
|
|
90
|
-
.command("tts")
|
|
91
|
-
.description("Generate speech from text using ElevenLabs")
|
|
92
|
-
.argument("<text>", "Text to convert to speech")
|
|
93
|
-
.option("-k, --api-key <key>", "ElevenLabs API key (or set ELEVENLABS_API_KEY env)")
|
|
94
|
-
.option("-o, --output <path>", "Output audio file path", "output.mp3")
|
|
95
|
-
.option("-v, --voice <id>", "Voice ID (default: Rachel)", "21m00Tcm4TlvDq8ikWAM")
|
|
96
|
-
.option("--list-voices", "List available voices")
|
|
97
|
-
.option("--dry-run", "Preview parameters without executing")
|
|
98
|
-
.action(async (text, options) => {
|
|
99
|
-
try {
|
|
100
|
-
if (options.output) {
|
|
101
|
-
validateOutputPath(options.output);
|
|
102
|
-
}
|
|
103
|
-
if (options.dryRun) {
|
|
104
|
-
outputResult({ dryRun: true, command: "ai tts", params: { text, output: options.output, voice: options.voice } });
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const apiKey = await getApiKey("ELEVENLABS_API_KEY", "ElevenLabs", options.apiKey);
|
|
108
|
-
if (!apiKey) {
|
|
109
|
-
exitWithError(authError("ELEVENLABS_API_KEY", "ElevenLabs"));
|
|
110
|
-
}
|
|
111
|
-
const elevenlabs = new ElevenLabsProvider();
|
|
112
|
-
await elevenlabs.initialize({ apiKey });
|
|
113
|
-
// List voices mode
|
|
114
|
-
if (options.listVoices) {
|
|
115
|
-
const spinner = ora("Fetching voices...").start();
|
|
116
|
-
const voices = await elevenlabs.getVoices();
|
|
117
|
-
spinner.succeed(chalk.green(`Found ${voices.length} voices`));
|
|
118
|
-
console.log();
|
|
119
|
-
console.log(chalk.bold.cyan("Available Voices"));
|
|
120
|
-
console.log(chalk.dim("─".repeat(60)));
|
|
121
|
-
for (const voice of voices) {
|
|
122
|
-
console.log();
|
|
123
|
-
console.log(`${chalk.bold(voice.name)} ${chalk.dim(`(${voice.voice_id})`)}`);
|
|
124
|
-
console.log(` Category: ${voice.category}`);
|
|
125
|
-
if (voice.labels) {
|
|
126
|
-
const labels = Object.entries(voice.labels)
|
|
127
|
-
.map(([k, v]) => `${k}: ${v}`)
|
|
128
|
-
.join(", ");
|
|
129
|
-
console.log(` ${chalk.dim(labels)}`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
console.log();
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
const spinner = ora("Generating speech...").start();
|
|
136
|
-
const result = await elevenlabs.textToSpeech(text, {
|
|
137
|
-
voiceId: options.voice,
|
|
138
|
-
});
|
|
139
|
-
if (!result.success || !result.audioBuffer) {
|
|
140
|
-
spinner.fail("TTS generation failed");
|
|
141
|
-
exitWithError(apiError(result.error || "TTS generation failed", true));
|
|
142
|
-
}
|
|
143
|
-
const outputPath = resolve(process.cwd(), options.output);
|
|
144
|
-
await writeFile(outputPath, result.audioBuffer);
|
|
145
|
-
spinner.succeed(chalk.green("Speech generated"));
|
|
146
|
-
console.log();
|
|
147
|
-
console.log(chalk.dim(`Characters: ${result.characterCount}`));
|
|
148
|
-
console.log(chalk.green(`Saved to: ${outputPath}`));
|
|
149
|
-
console.log();
|
|
150
|
-
}
|
|
151
|
-
catch (error) {
|
|
152
|
-
exitWithError(apiError(`TTS generation failed: ${error instanceof Error ? error.message : String(error)}`, true));
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
aiCommand
|
|
156
|
-
.command("voices")
|
|
157
|
-
.description("List available ElevenLabs voices")
|
|
158
|
-
.option("-k, --api-key <key>", "ElevenLabs API key (or set ELEVENLABS_API_KEY env)")
|
|
159
|
-
.action(async (options) => {
|
|
160
|
-
try {
|
|
161
|
-
const apiKey = await getApiKey("ELEVENLABS_API_KEY", "ElevenLabs", options.apiKey);
|
|
162
|
-
if (!apiKey) {
|
|
163
|
-
exitWithError(authError("ELEVENLABS_API_KEY", "ElevenLabs"));
|
|
164
|
-
}
|
|
165
|
-
const spinner = ora("Fetching voices...").start();
|
|
166
|
-
const elevenlabs = new ElevenLabsProvider();
|
|
167
|
-
await elevenlabs.initialize({ apiKey });
|
|
168
|
-
const voices = await elevenlabs.getVoices();
|
|
169
|
-
spinner.succeed(chalk.green(`Found ${voices.length} voices`));
|
|
170
|
-
console.log();
|
|
171
|
-
console.log(chalk.bold.cyan("Available Voices"));
|
|
172
|
-
console.log(chalk.dim("─".repeat(60)));
|
|
173
|
-
for (const voice of voices) {
|
|
174
|
-
console.log();
|
|
175
|
-
console.log(`${chalk.bold(voice.name)} ${chalk.dim(`(${voice.voice_id})`)}`);
|
|
176
|
-
console.log(` Category: ${voice.category}`);
|
|
177
|
-
}
|
|
178
|
-
console.log();
|
|
179
|
-
}
|
|
180
|
-
catch (error) {
|
|
181
|
-
exitWithError(apiError(`Failed to fetch voices: ${error instanceof Error ? error.message : String(error)}`, true));
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
aiCommand
|
|
185
|
-
.command("sfx")
|
|
186
|
-
.description("Generate sound effect using ElevenLabs")
|
|
187
|
-
.argument("<prompt>", "Description of the sound effect")
|
|
188
|
-
.option("-k, --api-key <key>", "ElevenLabs API key (or set ELEVENLABS_API_KEY env)")
|
|
189
|
-
.option("-o, --output <path>", "Output audio file path", "sound-effect.mp3")
|
|
190
|
-
.option("-d, --duration <seconds>", "Duration in seconds (0.5-22, default: auto)")
|
|
191
|
-
.option("--prompt-influence <value>", "Prompt influence (0-1, default: 0.3)")
|
|
192
|
-
.option("--dry-run", "Preview parameters without executing")
|
|
193
|
-
.action(async (prompt, options) => {
|
|
194
|
-
try {
|
|
195
|
-
if (options.output) {
|
|
196
|
-
validateOutputPath(options.output);
|
|
197
|
-
}
|
|
198
|
-
if (options.dryRun) {
|
|
199
|
-
outputResult({ dryRun: true, command: "ai sfx", params: { prompt, output: options.output, duration: options.duration, promptInfluence: options.promptInfluence } });
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
const apiKey = await getApiKey("ELEVENLABS_API_KEY", "ElevenLabs", options.apiKey);
|
|
203
|
-
if (!apiKey) {
|
|
204
|
-
exitWithError(authError("ELEVENLABS_API_KEY", "ElevenLabs"));
|
|
205
|
-
}
|
|
206
|
-
const spinner = ora("Generating sound effect...").start();
|
|
207
|
-
const elevenlabs = new ElevenLabsProvider();
|
|
208
|
-
await elevenlabs.initialize({ apiKey });
|
|
209
|
-
const result = await elevenlabs.generateSoundEffect(prompt, {
|
|
210
|
-
duration: options.duration ? parseFloat(options.duration) : undefined,
|
|
211
|
-
promptInfluence: options.promptInfluence ? parseFloat(options.promptInfluence) : undefined,
|
|
212
|
-
});
|
|
213
|
-
if (!result.success || !result.audioBuffer) {
|
|
214
|
-
spinner.fail("Sound effect generation failed");
|
|
215
|
-
exitWithError(apiError(result.error || "Sound effect generation failed", true));
|
|
216
|
-
}
|
|
217
|
-
const outputPath = resolve(process.cwd(), options.output);
|
|
218
|
-
await writeFile(outputPath, result.audioBuffer);
|
|
219
|
-
spinner.succeed(chalk.green("Sound effect generated"));
|
|
220
|
-
console.log(chalk.green(`Saved to: ${outputPath}`));
|
|
221
|
-
console.log();
|
|
222
|
-
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
exitWithError(apiError(`Sound effect generation failed: ${error instanceof Error ? error.message : String(error)}`, true));
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
aiCommand
|
|
228
|
-
.command("isolate")
|
|
229
|
-
.description("Isolate vocals from audio using ElevenLabs")
|
|
230
|
-
.argument("<audio>", "Input audio file path")
|
|
231
|
-
.option("-k, --api-key <key>", "ElevenLabs API key (or set ELEVENLABS_API_KEY env)")
|
|
232
|
-
.option("-o, --output <path>", "Output audio file path", "vocals.mp3")
|
|
233
|
-
.option("--dry-run", "Preview parameters without executing")
|
|
234
|
-
.action(async (audioPath, options) => {
|
|
235
|
-
try {
|
|
236
|
-
if (options.output) {
|
|
237
|
-
validateOutputPath(options.output);
|
|
238
|
-
}
|
|
239
|
-
if (options.dryRun) {
|
|
240
|
-
outputResult({ dryRun: true, command: "ai isolate", params: { audio: audioPath, output: options.output } });
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
const apiKey = await getApiKey("ELEVENLABS_API_KEY", "ElevenLabs", options.apiKey);
|
|
244
|
-
if (!apiKey) {
|
|
245
|
-
exitWithError(authError("ELEVENLABS_API_KEY", "ElevenLabs"));
|
|
246
|
-
}
|
|
247
|
-
const spinner = ora("Reading audio file...").start();
|
|
248
|
-
const absPath = resolve(process.cwd(), audioPath);
|
|
249
|
-
const audioBuffer = await readFile(absPath);
|
|
250
|
-
spinner.text = "Isolating vocals...";
|
|
251
|
-
const elevenlabs = new ElevenLabsProvider();
|
|
252
|
-
await elevenlabs.initialize({ apiKey });
|
|
253
|
-
const result = await elevenlabs.isolateVocals(audioBuffer);
|
|
254
|
-
if (!result.success || !result.audioBuffer) {
|
|
255
|
-
spinner.fail("Audio isolation failed");
|
|
256
|
-
exitWithError(apiError(result.error || "Audio isolation failed", true));
|
|
257
|
-
}
|
|
258
|
-
const outputPath = resolve(process.cwd(), options.output);
|
|
259
|
-
await writeFile(outputPath, result.audioBuffer);
|
|
260
|
-
spinner.succeed(chalk.green("Vocals isolated"));
|
|
261
|
-
console.log(chalk.green(`Saved to: ${outputPath}`));
|
|
262
|
-
console.log();
|
|
263
|
-
}
|
|
264
|
-
catch (error) {
|
|
265
|
-
exitWithError(apiError(`Audio isolation failed: ${error instanceof Error ? error.message : String(error)}`, true));
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
aiCommand
|
|
269
|
-
.command("voice-clone")
|
|
270
|
-
.description("Clone a voice from audio samples using ElevenLabs")
|
|
271
|
-
.argument("[samples...]", "Audio sample files (1-25 files)")
|
|
272
|
-
.option("-k, --api-key <key>", "ElevenLabs API key (or set ELEVENLABS_API_KEY env)")
|
|
273
|
-
.option("-n, --name <name>", "Voice name (required)")
|
|
274
|
-
.option("-d, --description <desc>", "Voice description")
|
|
275
|
-
.option("--labels <json>", "Labels as JSON (e.g., '{\"accent\": \"american\"}')")
|
|
276
|
-
.option("--remove-noise", "Remove background noise from samples")
|
|
277
|
-
.option("--list", "List all available voices")
|
|
278
|
-
.option("--dry-run", "Preview parameters without executing")
|
|
279
|
-
.action(async (samples, options) => {
|
|
280
|
-
try {
|
|
281
|
-
if (options.dryRun) {
|
|
282
|
-
outputResult({ dryRun: true, command: "ai voice-clone", params: { samples, name: options.name, description: options.description, removeNoise: options.removeNoise } });
|
|
283
|
-
return;
|
|
284
|
-
}
|
|
285
|
-
const apiKey = await getApiKey("ELEVENLABS_API_KEY", "ElevenLabs", options.apiKey);
|
|
286
|
-
if (!apiKey) {
|
|
287
|
-
exitWithError(authError("ELEVENLABS_API_KEY", "ElevenLabs"));
|
|
288
|
-
}
|
|
289
|
-
const elevenlabs = new ElevenLabsProvider();
|
|
290
|
-
await elevenlabs.initialize({ apiKey });
|
|
291
|
-
// List voices mode
|
|
292
|
-
if (options.list) {
|
|
293
|
-
const spinner = ora("Fetching voices...").start();
|
|
294
|
-
const voices = await elevenlabs.getVoices();
|
|
295
|
-
spinner.succeed(chalk.green(`Found ${voices.length} voices`));
|
|
296
|
-
console.log();
|
|
297
|
-
console.log(chalk.bold.cyan("Available Voices"));
|
|
298
|
-
console.log(chalk.dim("─".repeat(60)));
|
|
299
|
-
for (const voice of voices) {
|
|
300
|
-
const category = chalk.dim(`(${voice.category})`);
|
|
301
|
-
console.log(`${chalk.bold(voice.name)} ${category}`);
|
|
302
|
-
console.log(` ${chalk.dim("ID:")} ${voice.voice_id}`);
|
|
303
|
-
if (voice.labels && Object.keys(voice.labels).length > 0) {
|
|
304
|
-
console.log(` ${chalk.dim("Labels:")} ${JSON.stringify(voice.labels)}`);
|
|
305
|
-
}
|
|
306
|
-
console.log();
|
|
307
|
-
}
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
// Clone voice mode
|
|
311
|
-
if (!options.name) {
|
|
312
|
-
exitWithError(usageError("Voice name is required. Use --name <name>"));
|
|
313
|
-
}
|
|
314
|
-
if (!samples || samples.length === 0) {
|
|
315
|
-
exitWithError(usageError("At least one audio sample is required"));
|
|
316
|
-
}
|
|
317
|
-
const spinner = ora("Reading audio samples...").start();
|
|
318
|
-
const audioBuffers = [];
|
|
319
|
-
for (const samplePath of samples) {
|
|
320
|
-
const absPath = resolve(process.cwd(), samplePath);
|
|
321
|
-
if (!existsSync(absPath)) {
|
|
322
|
-
spinner.fail("File not found");
|
|
323
|
-
exitWithError(notFoundError(samplePath));
|
|
324
|
-
}
|
|
325
|
-
const buffer = await readFile(absPath);
|
|
326
|
-
audioBuffers.push(buffer);
|
|
327
|
-
}
|
|
328
|
-
spinner.text = `Cloning voice from ${audioBuffers.length} sample(s)...`;
|
|
329
|
-
const labels = options.labels ? JSON.parse(options.labels) : undefined;
|
|
330
|
-
const result = await elevenlabs.cloneVoice(audioBuffers, {
|
|
331
|
-
name: options.name,
|
|
332
|
-
description: options.description,
|
|
333
|
-
labels,
|
|
334
|
-
removeBackgroundNoise: options.removeNoise,
|
|
335
|
-
});
|
|
336
|
-
if (!result.success) {
|
|
337
|
-
spinner.fail("Voice cloning failed");
|
|
338
|
-
exitWithError(apiError(result.error || "Voice cloning failed", true));
|
|
339
|
-
}
|
|
340
|
-
spinner.succeed(chalk.green("Voice cloned successfully"));
|
|
341
|
-
console.log();
|
|
342
|
-
console.log(chalk.bold.cyan("Voice Details"));
|
|
343
|
-
console.log(chalk.dim("─".repeat(60)));
|
|
344
|
-
console.log(`Name: ${chalk.bold(options.name)}`);
|
|
345
|
-
console.log(`Voice ID: ${chalk.bold(result.voiceId)}`);
|
|
346
|
-
console.log();
|
|
347
|
-
console.log(chalk.dim("Use this voice ID with:"));
|
|
348
|
-
console.log(chalk.dim(` pnpm vibe ai tts "Hello world" -v ${result.voiceId}`));
|
|
349
|
-
console.log();
|
|
350
|
-
}
|
|
351
|
-
catch (error) {
|
|
352
|
-
exitWithError(apiError(`Voice cloning failed: ${error instanceof Error ? error.message : String(error)}`, true));
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
aiCommand
|
|
356
|
-
.command("music")
|
|
357
|
-
.description("Generate background music from a text prompt using MusicGen")
|
|
358
|
-
.argument("<prompt>", "Description of the music to generate")
|
|
359
|
-
.option("-k, --api-key <key>", "Replicate API token (or set REPLICATE_API_TOKEN env)")
|
|
360
|
-
.option("-d, --duration <seconds>", "Duration in seconds (1-30)", "8")
|
|
361
|
-
.option("-m, --melody <file>", "Reference melody audio file for conditioning")
|
|
362
|
-
.option("--model <model>", "Model variant: large, stereo-large, melody-large, stereo-melody-large", "stereo-large")
|
|
363
|
-
.option("-o, --output <path>", "Output audio file path", "music.mp3")
|
|
364
|
-
.option("--no-wait", "Don't wait for generation to complete (async mode)")
|
|
365
|
-
.option("--dry-run", "Preview parameters without executing")
|
|
366
|
-
.action(async (prompt, options) => {
|
|
367
|
-
try {
|
|
368
|
-
if (options.output) {
|
|
369
|
-
validateOutputPath(options.output);
|
|
370
|
-
}
|
|
371
|
-
if (options.dryRun) {
|
|
372
|
-
outputResult({ dryRun: true, command: "ai music", params: { prompt, output: options.output, duration: options.duration, model: options.model, melody: options.melody } });
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
const apiKey = await getApiKey("REPLICATE_API_TOKEN", "Replicate", options.apiKey);
|
|
376
|
-
if (!apiKey) {
|
|
377
|
-
exitWithError(authError("REPLICATE_API_TOKEN", "Replicate"));
|
|
378
|
-
}
|
|
379
|
-
const replicate = new ReplicateProvider();
|
|
380
|
-
await replicate.initialize({ apiKey });
|
|
381
|
-
const spinner = ora("Starting music generation...").start();
|
|
382
|
-
const duration = Math.max(1, Math.min(30, parseFloat(options.duration)));
|
|
383
|
-
// If melody file provided, upload it first
|
|
384
|
-
let melodyUrl;
|
|
385
|
-
if (options.melody) {
|
|
386
|
-
spinner.text = "Uploading melody reference...";
|
|
387
|
-
const absPath = resolve(process.cwd(), options.melody);
|
|
388
|
-
if (!existsSync(absPath)) {
|
|
389
|
-
spinner.fail("Melody file not found");
|
|
390
|
-
exitWithError(notFoundError(options.melody));
|
|
391
|
-
}
|
|
392
|
-
// For Replicate, we need a publicly accessible URL
|
|
393
|
-
// In practice, users would need to host the file or use a data URL
|
|
394
|
-
exitWithError(usageError("Melody conditioning requires a publicly accessible URL. Please upload your melody file and provide the URL."));
|
|
395
|
-
}
|
|
396
|
-
const result = await replicate.generateMusic(prompt, {
|
|
397
|
-
duration,
|
|
398
|
-
model: options.model,
|
|
399
|
-
melodyUrl,
|
|
400
|
-
});
|
|
401
|
-
if (!result.success || !result.taskId) {
|
|
402
|
-
spinner.fail("Music generation failed");
|
|
403
|
-
exitWithError(apiError(result.error || "Music generation failed", true));
|
|
404
|
-
}
|
|
405
|
-
if (!options.wait) {
|
|
406
|
-
spinner.succeed(chalk.green("Music generation started"));
|
|
407
|
-
console.log();
|
|
408
|
-
console.log(`Task ID: ${chalk.bold(result.taskId)}`);
|
|
409
|
-
console.log(chalk.dim("Check status with: pnpm vibe ai music-status " + result.taskId));
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
spinner.text = "Generating music (this may take a few minutes)...";
|
|
413
|
-
const finalResult = await replicate.waitForMusic(result.taskId);
|
|
414
|
-
if (!finalResult.success || !finalResult.audioUrl) {
|
|
415
|
-
spinner.fail("Music generation failed");
|
|
416
|
-
exitWithError(apiError(finalResult.error || "Music generation failed", true));
|
|
417
|
-
}
|
|
418
|
-
spinner.text = "Downloading generated audio...";
|
|
419
|
-
const response = await fetch(finalResult.audioUrl);
|
|
420
|
-
if (!response.ok) {
|
|
421
|
-
spinner.fail("Failed to download generated audio");
|
|
422
|
-
exitWithError(apiError("Failed to download generated audio", true));
|
|
423
|
-
}
|
|
424
|
-
const audioBuffer = Buffer.from(await response.arrayBuffer());
|
|
425
|
-
const outputPath = resolve(process.cwd(), options.output);
|
|
426
|
-
await writeFile(outputPath, audioBuffer);
|
|
427
|
-
spinner.succeed(chalk.green("Music generated successfully"));
|
|
428
|
-
console.log();
|
|
429
|
-
console.log(`Saved to: ${chalk.bold(outputPath)}`);
|
|
430
|
-
console.log(`Duration: ${duration}s`);
|
|
431
|
-
console.log(`Model: ${options.model}`);
|
|
432
|
-
console.log();
|
|
433
|
-
}
|
|
434
|
-
catch (error) {
|
|
435
|
-
exitWithError(apiError(`Music generation failed: ${error instanceof Error ? error.message : String(error)}`, true));
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
aiCommand
|
|
439
|
-
.command("music-status")
|
|
440
|
-
.description("Check music generation status")
|
|
441
|
-
.argument("<task-id>", "Task ID from music generation")
|
|
442
|
-
.option("-k, --api-key <key>", "Replicate API token (or set REPLICATE_API_TOKEN env)")
|
|
443
|
-
.action(async (taskId, options) => {
|
|
444
|
-
try {
|
|
445
|
-
const apiKey = await getApiKey("REPLICATE_API_TOKEN", "Replicate", options.apiKey);
|
|
446
|
-
if (!apiKey) {
|
|
447
|
-
exitWithError(authError("REPLICATE_API_TOKEN", "Replicate"));
|
|
448
|
-
}
|
|
449
|
-
const replicate = new ReplicateProvider();
|
|
450
|
-
await replicate.initialize({ apiKey });
|
|
451
|
-
const result = await replicate.getMusicStatus(taskId);
|
|
452
|
-
console.log();
|
|
453
|
-
console.log(chalk.bold.cyan("Music Generation Status"));
|
|
454
|
-
console.log(chalk.dim("─".repeat(60)));
|
|
455
|
-
console.log(`Task ID: ${taskId}`);
|
|
456
|
-
if (result.audioUrl) {
|
|
457
|
-
console.log(`Status: ${chalk.green("completed")}`);
|
|
458
|
-
console.log(`Audio URL: ${result.audioUrl}`);
|
|
459
|
-
}
|
|
460
|
-
else if (result.error) {
|
|
461
|
-
console.log(`Status: ${chalk.red("failed")}`);
|
|
462
|
-
console.log(`Error: ${result.error}`);
|
|
463
|
-
}
|
|
464
|
-
else {
|
|
465
|
-
console.log(`Status: ${chalk.yellow("processing")}`);
|
|
466
|
-
}
|
|
467
|
-
console.log();
|
|
468
|
-
}
|
|
469
|
-
catch (error) {
|
|
470
|
-
exitWithError(apiError(`Failed to get music status: ${error instanceof Error ? error.message : String(error)}`, true));
|
|
471
|
-
}
|
|
472
|
-
});
|
|
473
|
-
aiCommand
|
|
474
|
-
.command("audio-restore")
|
|
475
|
-
.description("Restore audio quality (denoise, enhance)")
|
|
476
|
-
.argument("<audio>", "Input audio file path")
|
|
477
|
-
.option("-k, --api-key <key>", "Replicate API token (or set REPLICATE_API_TOKEN env)")
|
|
478
|
-
.option("-o, --output <path>", "Output audio file path")
|
|
479
|
-
.option("--ffmpeg", "Use FFmpeg for restoration (free, no API needed)")
|
|
480
|
-
.option("--denoise", "Enable noise reduction (default: true)", true)
|
|
481
|
-
.option("--no-denoise", "Disable noise reduction")
|
|
482
|
-
.option("--enhance", "Enable audio enhancement")
|
|
483
|
-
.option("--noise-floor <dB>", "FFmpeg noise floor threshold", "-30")
|
|
484
|
-
.option("--dry-run", "Preview parameters without executing")
|
|
485
|
-
.action(async (audioPath, options) => {
|
|
486
|
-
try {
|
|
487
|
-
if (options.output) {
|
|
488
|
-
validateOutputPath(options.output);
|
|
489
|
-
}
|
|
490
|
-
const absPath = resolve(process.cwd(), audioPath);
|
|
491
|
-
if (!existsSync(absPath)) {
|
|
492
|
-
exitWithError(notFoundError(audioPath));
|
|
493
|
-
}
|
|
494
|
-
if (options.dryRun) {
|
|
495
|
-
outputResult({ dryRun: true, command: "ai audio-restore", params: { audio: audioPath, output: options.output, ffmpeg: options.ffmpeg, denoise: options.denoise, enhance: options.enhance, noiseFloor: options.noiseFloor } });
|
|
496
|
-
return;
|
|
497
|
-
}
|
|
498
|
-
// Default output path
|
|
499
|
-
const ext = extname(audioPath);
|
|
500
|
-
const baseName = basename(audioPath, ext);
|
|
501
|
-
const defaultOutput = `${baseName}-restored${ext || ".mp3"}`;
|
|
502
|
-
const outputPath = resolve(process.cwd(), options.output || defaultOutput);
|
|
503
|
-
// FFmpeg mode (free)
|
|
504
|
-
if (options.ffmpeg) {
|
|
505
|
-
const spinner = ora("Restoring audio with FFmpeg...").start();
|
|
506
|
-
try {
|
|
507
|
-
const noiseFloor = options.noiseFloor || "-30";
|
|
508
|
-
// Build filter chain
|
|
509
|
-
const filters = [];
|
|
510
|
-
if (options.denoise !== false) {
|
|
511
|
-
filters.push(`afftdn=nf=${noiseFloor}`);
|
|
512
|
-
}
|
|
513
|
-
if (options.enhance) {
|
|
514
|
-
filters.push("highpass=f=80");
|
|
515
|
-
filters.push("lowpass=f=12000");
|
|
516
|
-
filters.push("loudnorm=I=-16:TP=-1.5:LRA=11");
|
|
517
|
-
}
|
|
518
|
-
const ffmpegArgs = ["-i", absPath];
|
|
519
|
-
if (filters.length > 0) {
|
|
520
|
-
ffmpegArgs.push("-af", filters.join(","));
|
|
521
|
-
}
|
|
522
|
-
ffmpegArgs.push("-y", outputPath);
|
|
523
|
-
execSafeSync("ffmpeg", ffmpegArgs);
|
|
524
|
-
spinner.succeed(chalk.green("Audio restored with FFmpeg"));
|
|
525
|
-
console.log(`Saved to: ${chalk.bold(outputPath)}`);
|
|
526
|
-
console.log();
|
|
527
|
-
}
|
|
528
|
-
catch (error) {
|
|
529
|
-
spinner.fail("FFmpeg restoration failed");
|
|
530
|
-
exitWithError(generalError(`FFmpeg restoration failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
531
|
-
}
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
// Replicate AI mode
|
|
535
|
-
const apiKey = await getApiKey("REPLICATE_API_TOKEN", "Replicate", options.apiKey);
|
|
536
|
-
if (!apiKey) {
|
|
537
|
-
exitWithError(authError("REPLICATE_API_TOKEN", "Replicate"));
|
|
538
|
-
}
|
|
539
|
-
const replicate = new ReplicateProvider();
|
|
540
|
-
await replicate.initialize({ apiKey });
|
|
541
|
-
// For Replicate, we need a publicly accessible URL
|
|
542
|
-
// This is a limitation - users need to upload their file first
|
|
543
|
-
exitWithError(usageError("Replicate requires a publicly accessible audio URL. For local files, use --ffmpeg for free local processing.", `pnpm vibe ai audio-restore ${audioPath} --ffmpeg`));
|
|
544
|
-
}
|
|
545
|
-
catch (error) {
|
|
546
|
-
exitWithError(apiError(`Audio restoration failed: ${error instanceof Error ? error.message : String(error)}`, true));
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
aiCommand
|
|
550
|
-
.command("dub")
|
|
551
|
-
.description("Dub audio/video to another language (transcribe, translate, TTS)")
|
|
552
|
-
.argument("<media>", "Input media file (video or audio)")
|
|
553
|
-
.option("-l, --language <lang>", "Target language code (e.g., es, ko, ja) (required)")
|
|
554
|
-
.option("--source <lang>", "Source language code (default: auto-detect)")
|
|
555
|
-
.option("-v, --voice <id>", "ElevenLabs voice ID for output")
|
|
556
|
-
.option("--analyze-only", "Only analyze and show timing, don't generate audio")
|
|
557
|
-
.option("-o, --output <path>", "Output file path")
|
|
558
|
-
.option("--dry-run", "Preview parameters without executing")
|
|
559
|
-
.action(async (mediaPath, options) => {
|
|
560
|
-
try {
|
|
561
|
-
if (options.output) {
|
|
562
|
-
validateOutputPath(options.output);
|
|
563
|
-
}
|
|
564
|
-
if (!options.language) {
|
|
565
|
-
exitWithError(usageError("Target language is required. Use -l or --language"));
|
|
566
|
-
}
|
|
567
|
-
if (options.dryRun) {
|
|
568
|
-
outputResult({ dryRun: true, command: "ai dub", params: { media: mediaPath, output: options.output, language: options.language, source: options.source, voice: options.voice, analyzeOnly: options.analyzeOnly } });
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
const absPath = resolve(process.cwd(), mediaPath);
|
|
572
|
-
if (!existsSync(absPath)) {
|
|
573
|
-
exitWithError(notFoundError(mediaPath));
|
|
574
|
-
}
|
|
575
|
-
// Check required API keys
|
|
576
|
-
const openaiKey = await getApiKey("OPENAI_API_KEY", "OpenAI", undefined);
|
|
577
|
-
const anthropicKey = await getApiKey("ANTHROPIC_API_KEY", "Anthropic", undefined);
|
|
578
|
-
const elevenlabsKey = await getApiKey("ELEVENLABS_API_KEY", "ElevenLabs", undefined);
|
|
579
|
-
if (!openaiKey) {
|
|
580
|
-
exitWithError(authError("OPENAI_API_KEY", "OpenAI"));
|
|
581
|
-
}
|
|
582
|
-
if (!anthropicKey) {
|
|
583
|
-
exitWithError(authError("ANTHROPIC_API_KEY", "Anthropic"));
|
|
584
|
-
}
|
|
585
|
-
if (!options.analyzeOnly && !elevenlabsKey) {
|
|
586
|
-
exitWithError(authError("ELEVENLABS_API_KEY", "ElevenLabs"));
|
|
587
|
-
}
|
|
588
|
-
const spinner = ora("Extracting audio...").start();
|
|
589
|
-
// Check if input is video
|
|
590
|
-
const ext = extname(absPath).toLowerCase();
|
|
591
|
-
const isVideo = [".mp4", ".mov", ".avi", ".mkv", ".webm"].includes(ext);
|
|
592
|
-
// Step 1: Extract audio if video
|
|
593
|
-
let audioPath = absPath;
|
|
594
|
-
if (isVideo) {
|
|
595
|
-
const tempAudioPath = resolve(dirname(absPath), `temp-audio-${Date.now()}.mp3`);
|
|
596
|
-
try {
|
|
597
|
-
execSafeSync("ffmpeg", ["-i", absPath, "-vn", "-acodec", "mp3", "-y", tempAudioPath]);
|
|
598
|
-
audioPath = tempAudioPath;
|
|
599
|
-
}
|
|
600
|
-
catch (error) {
|
|
601
|
-
spinner.fail("Failed to extract audio from video");
|
|
602
|
-
exitWithError(generalError(`Failed to extract audio from video: ${error instanceof Error ? error.message : String(error)}`));
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
// Step 2: Transcribe with Whisper
|
|
606
|
-
spinner.text = "Transcribing audio...";
|
|
607
|
-
const whisper = new WhisperProvider();
|
|
608
|
-
await whisper.initialize({ apiKey: openaiKey });
|
|
609
|
-
const audioBuffer = await readFile(audioPath);
|
|
610
|
-
const audioBlob = new Blob([audioBuffer]);
|
|
611
|
-
const transcriptResult = await whisper.transcribe(audioBlob, options.source);
|
|
612
|
-
if (transcriptResult.status === "failed" || !transcriptResult.segments) {
|
|
613
|
-
spinner.fail("Transcription failed");
|
|
614
|
-
exitWithError(apiError(`Transcription failed: ${transcriptResult.error}`, true));
|
|
615
|
-
}
|
|
616
|
-
// Step 3: Translate with Claude
|
|
617
|
-
spinner.text = "Translating...";
|
|
618
|
-
const claude = new ClaudeProvider();
|
|
619
|
-
await claude.initialize({ apiKey: anthropicKey });
|
|
620
|
-
// Build translation prompt
|
|
621
|
-
const segments = transcriptResult.segments;
|
|
622
|
-
const segmentTexts = segments.map((s, i) => `[${i}] ${s.text}`).join("\n");
|
|
623
|
-
// Language names for better translation context
|
|
624
|
-
const languageNames = {
|
|
625
|
-
en: "English", es: "Spanish", fr: "French", de: "German",
|
|
626
|
-
it: "Italian", pt: "Portuguese", ja: "Japanese", ko: "Korean",
|
|
627
|
-
zh: "Chinese", ar: "Arabic", ru: "Russian", hi: "Hindi",
|
|
628
|
-
};
|
|
629
|
-
const targetLangName = languageNames[options.language] || options.language;
|
|
630
|
-
// Use Claude's analyzeContent method to translate the segments
|
|
631
|
-
// The segments maintain their timing, we just need translated text
|
|
632
|
-
let translatedSegments = [];
|
|
633
|
-
try {
|
|
634
|
-
// For translation, we use analyzeContent with a custom prompt
|
|
635
|
-
// This returns storyboard segments which we can adapt for translation
|
|
636
|
-
const storyboard = await claude.analyzeContent(`TRANSLATE to ${targetLangName}. Return the translated text only, preserving segment numbers:\n\n${segmentTexts}`, segments[segments.length - 1]?.endTime || 60);
|
|
637
|
-
// Map storyboard results to translated segments
|
|
638
|
-
// If storyboard returned results, use descriptions as translations
|
|
639
|
-
if (storyboard && storyboard.length > 0) {
|
|
640
|
-
translatedSegments = segments.map((s, i) => ({
|
|
641
|
-
index: i,
|
|
642
|
-
text: storyboard[i]?.description || s.text,
|
|
643
|
-
startTime: s.startTime,
|
|
644
|
-
endTime: s.endTime,
|
|
645
|
-
}));
|
|
646
|
-
}
|
|
647
|
-
else {
|
|
648
|
-
// Fallback: use original text
|
|
649
|
-
translatedSegments = segments.map((s, i) => ({
|
|
650
|
-
index: i,
|
|
651
|
-
text: s.text,
|
|
652
|
-
startTime: s.startTime,
|
|
653
|
-
endTime: s.endTime,
|
|
654
|
-
}));
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
catch {
|
|
658
|
-
// Fallback: just show original text
|
|
659
|
-
translatedSegments = segments.map((s, i) => ({
|
|
660
|
-
index: i,
|
|
661
|
-
text: s.text,
|
|
662
|
-
startTime: s.startTime,
|
|
663
|
-
endTime: s.endTime,
|
|
664
|
-
}));
|
|
665
|
-
}
|
|
666
|
-
spinner.succeed(chalk.green("Transcription and translation complete"));
|
|
667
|
-
// Display timing analysis
|
|
668
|
-
console.log();
|
|
669
|
-
console.log(chalk.bold.cyan("Dubbing Analysis"));
|
|
670
|
-
console.log(chalk.dim("─".repeat(60)));
|
|
671
|
-
console.log(`Source language: ${transcriptResult.detectedLanguage || options.source || "auto"}`);
|
|
672
|
-
console.log(`Target language: ${targetLangName}`);
|
|
673
|
-
console.log(`Segments: ${segments.length}`);
|
|
674
|
-
console.log();
|
|
675
|
-
console.log(chalk.bold("Segment Timing:"));
|
|
676
|
-
for (let i = 0; i < Math.min(5, segments.length); i++) {
|
|
677
|
-
const seg = segments[i];
|
|
678
|
-
const time = `[${formatTime(seg.startTime)} - ${formatTime(seg.endTime)}]`;
|
|
679
|
-
console.log(`${chalk.dim(time)} ${seg.text}`);
|
|
680
|
-
console.log(`${chalk.dim(" →")} ${chalk.green(translatedSegments[i]?.text || seg.text)}`);
|
|
681
|
-
console.log();
|
|
682
|
-
}
|
|
683
|
-
if (segments.length > 5) {
|
|
684
|
-
console.log(chalk.dim(`... and ${segments.length - 5} more segments`));
|
|
685
|
-
}
|
|
686
|
-
if (options.analyzeOnly) {
|
|
687
|
-
console.log();
|
|
688
|
-
console.log(chalk.dim("Use without --analyze-only to generate dubbed audio"));
|
|
689
|
-
// Save timing to JSON if output specified
|
|
690
|
-
if (options.output) {
|
|
691
|
-
const timingPath = resolve(process.cwd(), options.output);
|
|
692
|
-
const timingData = {
|
|
693
|
-
sourcePath: absPath,
|
|
694
|
-
sourceLanguage: transcriptResult.detectedLanguage || options.source || "auto",
|
|
695
|
-
targetLanguage: options.language,
|
|
696
|
-
segments: segments.map((s, i) => ({
|
|
697
|
-
index: i,
|
|
698
|
-
startTime: s.startTime,
|
|
699
|
-
endTime: s.endTime,
|
|
700
|
-
original: s.text,
|
|
701
|
-
translated: translatedSegments[i]?.text || s.text,
|
|
702
|
-
})),
|
|
703
|
-
};
|
|
704
|
-
await writeFile(timingPath, JSON.stringify(timingData, null, 2));
|
|
705
|
-
console.log(`Timing saved to: ${chalk.bold(timingPath)}`);
|
|
706
|
-
}
|
|
707
|
-
return;
|
|
708
|
-
}
|
|
709
|
-
// Step 4: Generate TTS for each segment
|
|
710
|
-
spinner.start("Generating dubbed audio...");
|
|
711
|
-
const elevenlabs = new ElevenLabsProvider();
|
|
712
|
-
await elevenlabs.initialize({ apiKey: elevenlabsKey });
|
|
713
|
-
const dubbedAudioBuffers = [];
|
|
714
|
-
for (let i = 0; i < translatedSegments.length; i++) {
|
|
715
|
-
spinner.text = `Generating audio segment ${i + 1}/${translatedSegments.length}...`;
|
|
716
|
-
const seg = translatedSegments[i];
|
|
717
|
-
const ttsResult = await elevenlabs.textToSpeech(seg.text, {
|
|
718
|
-
voiceId: options.voice,
|
|
719
|
-
});
|
|
720
|
-
if (ttsResult.success && ttsResult.audioBuffer) {
|
|
721
|
-
dubbedAudioBuffers.push({
|
|
722
|
-
buffer: ttsResult.audioBuffer,
|
|
723
|
-
startTime: seg.startTime,
|
|
724
|
-
});
|
|
725
|
-
}
|
|
726
|
-
}
|
|
727
|
-
// Step 5: Combine and save
|
|
728
|
-
spinner.text = "Combining audio...";
|
|
729
|
-
// For simplicity, just concatenate the audio buffers
|
|
730
|
-
// In production, you'd use FFmpeg to properly place them at timestamps
|
|
731
|
-
const combinedBuffer = Buffer.concat(dubbedAudioBuffers.map((a) => a.buffer));
|
|
732
|
-
const outputExt = isVideo ? ".mp3" : extname(absPath);
|
|
733
|
-
const defaultOutputPath = resolve(dirname(absPath), `${basename(absPath, extname(absPath))}-${options.language}${outputExt}`);
|
|
734
|
-
const finalOutputPath = resolve(process.cwd(), options.output || defaultOutputPath);
|
|
735
|
-
await writeFile(finalOutputPath, combinedBuffer);
|
|
736
|
-
spinner.succeed(chalk.green("Dubbing complete"));
|
|
737
|
-
console.log();
|
|
738
|
-
console.log(`Saved to: ${chalk.bold(finalOutputPath)}`);
|
|
739
|
-
console.log();
|
|
740
|
-
// Clean up temp audio if we extracted from video
|
|
741
|
-
if (isVideo && audioPath !== absPath) {
|
|
742
|
-
try {
|
|
743
|
-
const { unlink } = await import("node:fs/promises");
|
|
744
|
-
await unlink(audioPath);
|
|
745
|
-
}
|
|
746
|
-
catch {
|
|
747
|
-
// Ignore cleanup errors
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
catch (error) {
|
|
752
|
-
exitWithError(apiError(`Dubbing failed: ${error instanceof Error ? error.message : String(error)}`, true));
|
|
753
|
-
}
|
|
754
|
-
});
|
|
755
|
-
// ============================================
|
|
756
|
-
// Smart Editing Commands
|
|
757
|
-
// ============================================
|
|
758
|
-
// Audio Ducking (FFmpeg only)
|
|
759
|
-
aiCommand
|
|
760
|
-
.command("duck")
|
|
761
|
-
.description("Auto-duck background music when voice is present (FFmpeg)")
|
|
762
|
-
.argument("<music>", "Background music file path")
|
|
763
|
-
.option("-v, --voice <path>", "Voice/narration track (required)")
|
|
764
|
-
.option("-o, --output <path>", "Output audio file path")
|
|
765
|
-
.option("-t, --threshold <dB>", "Sidechain threshold in dB", "-30")
|
|
766
|
-
.option("-r, --ratio <ratio>", "Compression ratio", "3")
|
|
767
|
-
.option("-a, --attack <ms>", "Attack time in ms", "20")
|
|
768
|
-
.option("-l, --release <ms>", "Release time in ms", "200")
|
|
769
|
-
.option("--dry-run", "Preview parameters without executing")
|
|
770
|
-
.action(async (musicPath, options) => {
|
|
771
|
-
try {
|
|
772
|
-
if (options.output) {
|
|
773
|
-
validateOutputPath(options.output);
|
|
774
|
-
}
|
|
775
|
-
if (!options.voice) {
|
|
776
|
-
exitWithError(usageError("Voice track required. Use --voice <path>"));
|
|
777
|
-
}
|
|
778
|
-
if (options.dryRun) {
|
|
779
|
-
outputResult({ dryRun: true, command: "ai duck", params: { music: musicPath, output: options.output, voice: options.voice, threshold: options.threshold, ratio: options.ratio, attack: options.attack, release: options.release } });
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
// Check FFmpeg availability
|
|
783
|
-
if (!commandExists("ffmpeg")) {
|
|
784
|
-
exitWithError(generalError("FFmpeg not found. Please install FFmpeg."));
|
|
785
|
-
}
|
|
786
|
-
const spinner = ora("Processing audio ducking...").start();
|
|
787
|
-
const absMusic = resolve(process.cwd(), musicPath);
|
|
788
|
-
const absVoice = resolve(process.cwd(), options.voice);
|
|
789
|
-
const outputPath = options.output
|
|
790
|
-
? resolve(process.cwd(), options.output)
|
|
791
|
-
: absMusic.replace(/(\.[^.]+)$/, "-ducked$1");
|
|
792
|
-
// Convert threshold from dB to linear (0-1 scale)
|
|
793
|
-
const thresholdDb = parseFloat(options.threshold);
|
|
794
|
-
const thresholdLinear = Math.pow(10, thresholdDb / 20);
|
|
795
|
-
const ratio = parseFloat(options.ratio);
|
|
796
|
-
const attack = parseFloat(options.attack);
|
|
797
|
-
const release = parseFloat(options.release);
|
|
798
|
-
// FFmpeg sidechain compress filter
|
|
799
|
-
const filterComplex = `[0:a][1:a]sidechaincompress=threshold=${thresholdLinear}:ratio=${ratio}:attack=${attack}:release=${release}[out]`;
|
|
800
|
-
await execSafe("ffmpeg", ["-i", absMusic, "-i", absVoice, "-filter_complex", filterComplex, "-map", "[out]", outputPath, "-y"]);
|
|
801
|
-
spinner.succeed(chalk.green("Audio ducking complete"));
|
|
802
|
-
console.log();
|
|
803
|
-
console.log(chalk.dim("─".repeat(60)));
|
|
804
|
-
console.log(`Music: ${musicPath}`);
|
|
805
|
-
console.log(`Voice: ${options.voice}`);
|
|
806
|
-
console.log(`Threshold: ${thresholdDb}dB`);
|
|
807
|
-
console.log(`Ratio: ${ratio}:1`);
|
|
808
|
-
console.log(`Attack/Release: ${attack}ms / ${release}ms`);
|
|
809
|
-
console.log();
|
|
810
|
-
console.log(chalk.green(`Output: ${outputPath}`));
|
|
811
|
-
console.log();
|
|
812
|
-
}
|
|
813
|
-
catch (error) {
|
|
814
|
-
exitWithError(generalError(`Audio ducking failed: ${error instanceof Error ? error.message : String(error)}`));
|
|
815
|
-
}
|
|
816
|
-
});
|
|
817
|
-
// AI Color Grading
|
|
818
|
-
}
|
|
819
|
-
/**
|
|
820
|
-
* Register all audio sub-commands on the given parent command.
|
|
821
|
-
* Called from ai.ts: registerAudioCommands(aiCommand)
|
|
822
|
-
*/
|
|
823
|
-
export function registerAudioCommands(aiCommand) {
|
|
824
|
-
_registerAudioCommands(aiCommand);
|
|
825
|
-
}
|
|
826
|
-
export async function executeTranscribe(options) {
|
|
827
|
-
const { audioPath, language, output, format, apiKey } = options;
|
|
828
|
-
try {
|
|
829
|
-
const key = apiKey || process.env.OPENAI_API_KEY;
|
|
830
|
-
if (!key)
|
|
831
|
-
return { success: false, error: "OPENAI_API_KEY required" };
|
|
832
|
-
const absPath = resolve(process.cwd(), audioPath);
|
|
833
|
-
if (!existsSync(absPath))
|
|
834
|
-
return { success: false, error: `File not found: ${absPath}` };
|
|
835
|
-
const whisper = new WhisperProvider();
|
|
836
|
-
await whisper.initialize({ apiKey: key });
|
|
837
|
-
const audioBuffer = await readFile(absPath);
|
|
838
|
-
const audioBlob = new Blob([audioBuffer]);
|
|
839
|
-
const result = await whisper.transcribe(audioBlob, language);
|
|
840
|
-
if (result.status === "failed") {
|
|
841
|
-
return { success: false, error: result.error || "Transcription failed" };
|
|
842
|
-
}
|
|
843
|
-
let outputPath;
|
|
844
|
-
if (output) {
|
|
845
|
-
outputPath = resolve(process.cwd(), output);
|
|
846
|
-
const fmt = detectFormat(output, format);
|
|
847
|
-
const content = formatTranscript(result, fmt);
|
|
848
|
-
await writeFile(outputPath, content, "utf-8");
|
|
849
|
-
}
|
|
850
|
-
return {
|
|
851
|
-
success: true,
|
|
852
|
-
text: result.fullText,
|
|
853
|
-
segments: result.segments?.map(s => ({ startTime: s.startTime, endTime: s.endTime, text: s.text })),
|
|
854
|
-
detectedLanguage: result.detectedLanguage,
|
|
855
|
-
outputPath,
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
catch (error) {
|
|
859
|
-
return { success: false, error: `Transcription failed: ${error instanceof Error ? error.message : String(error)}` };
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
export async function executeIsolate(options) {
|
|
863
|
-
const { audioPath, output = "vocals.mp3", apiKey } = options;
|
|
864
|
-
try {
|
|
865
|
-
const key = apiKey || process.env.ELEVENLABS_API_KEY;
|
|
866
|
-
if (!key)
|
|
867
|
-
return { success: false, error: "ELEVENLABS_API_KEY required" };
|
|
868
|
-
const absPath = resolve(process.cwd(), audioPath);
|
|
869
|
-
if (!existsSync(absPath))
|
|
870
|
-
return { success: false, error: `File not found: ${absPath}` };
|
|
871
|
-
const audioBuffer = await readFile(absPath);
|
|
872
|
-
const elevenlabs = new ElevenLabsProvider();
|
|
873
|
-
await elevenlabs.initialize({ apiKey: key });
|
|
874
|
-
const result = await elevenlabs.isolateVocals(audioBuffer);
|
|
875
|
-
if (!result.success || !result.audioBuffer) {
|
|
876
|
-
return { success: false, error: result.error || "Audio isolation failed" };
|
|
877
|
-
}
|
|
878
|
-
const outputPath = resolve(process.cwd(), output);
|
|
879
|
-
await writeFile(outputPath, result.audioBuffer);
|
|
880
|
-
return { success: true, outputPath };
|
|
881
|
-
}
|
|
882
|
-
catch (error) {
|
|
883
|
-
return { success: false, error: `Audio isolation failed: ${error instanceof Error ? error.message : String(error)}` };
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
export async function executeVoiceClone(options) {
|
|
887
|
-
const { samplePaths, name, description, labels, removeNoise, apiKey } = options;
|
|
888
|
-
try {
|
|
889
|
-
const key = apiKey || process.env.ELEVENLABS_API_KEY;
|
|
890
|
-
if (!key)
|
|
891
|
-
return { success: false, error: "ELEVENLABS_API_KEY required" };
|
|
892
|
-
if (!samplePaths || samplePaths.length === 0) {
|
|
893
|
-
return { success: false, error: "At least one audio sample is required" };
|
|
894
|
-
}
|
|
895
|
-
const audioBuffers = [];
|
|
896
|
-
for (const samplePath of samplePaths) {
|
|
897
|
-
const absPath = resolve(process.cwd(), samplePath);
|
|
898
|
-
if (!existsSync(absPath))
|
|
899
|
-
return { success: false, error: `File not found: ${samplePath}` };
|
|
900
|
-
const buffer = await readFile(absPath);
|
|
901
|
-
audioBuffers.push(buffer);
|
|
902
|
-
}
|
|
903
|
-
const elevenlabs = new ElevenLabsProvider();
|
|
904
|
-
await elevenlabs.initialize({ apiKey: key });
|
|
905
|
-
const result = await elevenlabs.cloneVoice(audioBuffers, {
|
|
906
|
-
name,
|
|
907
|
-
description,
|
|
908
|
-
labels,
|
|
909
|
-
removeBackgroundNoise: removeNoise,
|
|
910
|
-
});
|
|
911
|
-
if (!result.success)
|
|
912
|
-
return { success: false, error: result.error || "Voice cloning failed" };
|
|
913
|
-
return { success: true, voiceId: result.voiceId, name };
|
|
914
|
-
}
|
|
915
|
-
catch (error) {
|
|
916
|
-
return { success: false, error: `Voice cloning failed: ${error instanceof Error ? error.message : String(error)}` };
|
|
917
|
-
}
|
|
918
|
-
}
|
|
919
|
-
export async function executeDub(options) {
|
|
920
|
-
const { mediaPath, language, source, voice, analyzeOnly, output } = options;
|
|
921
|
-
try {
|
|
922
|
-
const absPath = resolve(process.cwd(), mediaPath);
|
|
923
|
-
if (!existsSync(absPath))
|
|
924
|
-
return { success: false, error: `File not found: ${absPath}` };
|
|
925
|
-
const openaiKey = process.env.OPENAI_API_KEY;
|
|
926
|
-
const anthropicKey = process.env.ANTHROPIC_API_KEY;
|
|
927
|
-
const elevenlabsKey = process.env.ELEVENLABS_API_KEY;
|
|
928
|
-
if (!openaiKey)
|
|
929
|
-
return { success: false, error: "OPENAI_API_KEY required for Whisper transcription" };
|
|
930
|
-
if (!anthropicKey)
|
|
931
|
-
return { success: false, error: "ANTHROPIC_API_KEY required for Claude translation" };
|
|
932
|
-
if (!analyzeOnly && !elevenlabsKey)
|
|
933
|
-
return { success: false, error: "ELEVENLABS_API_KEY required for TTS" };
|
|
934
|
-
// Extract audio if video
|
|
935
|
-
const ext = extname(absPath).toLowerCase();
|
|
936
|
-
const isVideo = [".mp4", ".mov", ".avi", ".mkv", ".webm"].includes(ext);
|
|
937
|
-
let audioPath = absPath;
|
|
938
|
-
if (isVideo) {
|
|
939
|
-
const tempAudioPath = resolve(dirname(absPath), `temp-audio-${Date.now()}.mp3`);
|
|
940
|
-
execSafeSync("ffmpeg", ["-i", absPath, "-vn", "-acodec", "mp3", "-y", tempAudioPath]);
|
|
941
|
-
audioPath = tempAudioPath;
|
|
942
|
-
}
|
|
943
|
-
// Transcribe
|
|
944
|
-
const whisper = new WhisperProvider();
|
|
945
|
-
await whisper.initialize({ apiKey: openaiKey });
|
|
946
|
-
const audioBuffer = await readFile(audioPath);
|
|
947
|
-
const audioBlob = new Blob([audioBuffer]);
|
|
948
|
-
const transcriptResult = await whisper.transcribe(audioBlob, source);
|
|
949
|
-
if (transcriptResult.status === "failed" || !transcriptResult.segments) {
|
|
950
|
-
return { success: false, error: `Transcription failed: ${transcriptResult.error}` };
|
|
951
|
-
}
|
|
952
|
-
const segments = transcriptResult.segments;
|
|
953
|
-
// Translate
|
|
954
|
-
const claude = new ClaudeProvider();
|
|
955
|
-
await claude.initialize({ apiKey: anthropicKey });
|
|
956
|
-
const languageNames = {
|
|
957
|
-
en: "English", es: "Spanish", fr: "French", de: "German",
|
|
958
|
-
it: "Italian", pt: "Portuguese", ja: "Japanese", ko: "Korean",
|
|
959
|
-
zh: "Chinese", ar: "Arabic", ru: "Russian", hi: "Hindi",
|
|
960
|
-
};
|
|
961
|
-
const targetLangName = languageNames[language] || language;
|
|
962
|
-
const segmentTexts = segments.map((s, i) => `[${i}] ${s.text}`).join("\n");
|
|
963
|
-
let translatedSegments = [];
|
|
964
|
-
try {
|
|
965
|
-
const storyboard = await claude.analyzeContent(`TRANSLATE to ${targetLangName}. Return the translated text only, preserving segment numbers:\n\n${segmentTexts}`, segments[segments.length - 1]?.endTime || 60);
|
|
966
|
-
translatedSegments = segments.map((s, i) => ({
|
|
967
|
-
text: storyboard[i]?.description || s.text,
|
|
968
|
-
startTime: s.startTime,
|
|
969
|
-
endTime: s.endTime,
|
|
970
|
-
}));
|
|
971
|
-
}
|
|
972
|
-
catch {
|
|
973
|
-
translatedSegments = segments.map(s => ({ text: s.text, startTime: s.startTime, endTime: s.endTime }));
|
|
974
|
-
}
|
|
975
|
-
if (analyzeOnly) {
|
|
976
|
-
if (output) {
|
|
977
|
-
const timingPath = resolve(process.cwd(), output);
|
|
978
|
-
const timingData = {
|
|
979
|
-
sourcePath: absPath,
|
|
980
|
-
sourceLanguage: transcriptResult.detectedLanguage || source || "auto",
|
|
981
|
-
targetLanguage: language,
|
|
982
|
-
segments: segments.map((s, i) => ({
|
|
983
|
-
startTime: s.startTime, endTime: s.endTime,
|
|
984
|
-
original: s.text, translated: translatedSegments[i]?.text || s.text,
|
|
985
|
-
})),
|
|
986
|
-
};
|
|
987
|
-
await writeFile(timingPath, JSON.stringify(timingData, null, 2));
|
|
988
|
-
}
|
|
989
|
-
return {
|
|
990
|
-
success: true,
|
|
991
|
-
sourceLanguage: transcriptResult.detectedLanguage || source || "auto",
|
|
992
|
-
targetLanguage: language,
|
|
993
|
-
segmentCount: segments.length,
|
|
994
|
-
outputPath: output ? resolve(process.cwd(), output) : undefined,
|
|
995
|
-
};
|
|
996
|
-
}
|
|
997
|
-
// Generate TTS
|
|
998
|
-
const elevenlabs = new ElevenLabsProvider();
|
|
999
|
-
await elevenlabs.initialize({ apiKey: elevenlabsKey });
|
|
1000
|
-
const dubbedBuffers = [];
|
|
1001
|
-
for (const seg of translatedSegments) {
|
|
1002
|
-
const ttsResult = await elevenlabs.textToSpeech(seg.text, { voiceId: voice });
|
|
1003
|
-
if (ttsResult.success && ttsResult.audioBuffer) {
|
|
1004
|
-
dubbedBuffers.push(ttsResult.audioBuffer);
|
|
1005
|
-
}
|
|
1006
|
-
}
|
|
1007
|
-
const combinedBuffer = Buffer.concat(dubbedBuffers);
|
|
1008
|
-
const outputExt = isVideo ? ".mp3" : extname(absPath);
|
|
1009
|
-
const defaultOutputPath = resolve(dirname(absPath), `${basename(absPath, extname(absPath))}-${language}${outputExt}`);
|
|
1010
|
-
const finalOutputPath = resolve(process.cwd(), output || defaultOutputPath);
|
|
1011
|
-
await writeFile(finalOutputPath, combinedBuffer);
|
|
1012
|
-
// Cleanup temp
|
|
1013
|
-
if (isVideo && audioPath !== absPath) {
|
|
1014
|
-
try {
|
|
1015
|
-
const { unlink } = await import("node:fs/promises");
|
|
1016
|
-
await unlink(audioPath);
|
|
1017
|
-
}
|
|
1018
|
-
catch { /* cleanup best-effort */ }
|
|
1019
|
-
}
|
|
1020
|
-
return {
|
|
1021
|
-
success: true,
|
|
1022
|
-
outputPath: finalOutputPath,
|
|
1023
|
-
sourceLanguage: transcriptResult.detectedLanguage || source || "auto",
|
|
1024
|
-
targetLanguage: language,
|
|
1025
|
-
segmentCount: segments.length,
|
|
1026
|
-
};
|
|
1027
|
-
}
|
|
1028
|
-
catch (error) {
|
|
1029
|
-
return { success: false, error: `Dubbing failed: ${error instanceof Error ? error.message : String(error)}` };
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
export async function executeDuck(options) {
|
|
1033
|
-
const { musicPath, voicePath, output, threshold = "-30", ratio = "3", attack = "20", release = "200", } = options;
|
|
1034
|
-
try {
|
|
1035
|
-
if (!commandExists("ffmpeg"))
|
|
1036
|
-
return { success: false, error: "FFmpeg not found" };
|
|
1037
|
-
const absMusicPath = resolve(process.cwd(), musicPath);
|
|
1038
|
-
const absVoicePath = resolve(process.cwd(), voicePath);
|
|
1039
|
-
if (!existsSync(absMusicPath))
|
|
1040
|
-
return { success: false, error: `Music file not found: ${absMusicPath}` };
|
|
1041
|
-
if (!existsSync(absVoicePath))
|
|
1042
|
-
return { success: false, error: `Voice file not found: ${absVoicePath}` };
|
|
1043
|
-
const defaultOutput = resolve(dirname(absMusicPath), `${basename(absMusicPath, extname(absMusicPath))}-ducked${extname(absMusicPath)}`);
|
|
1044
|
-
const outputPath = resolve(process.cwd(), output || defaultOutput);
|
|
1045
|
-
const filter = `[1:a]asplit=2[sc][mix];[0:a][sc]sidechaincompress=threshold=${threshold}dB:ratio=${ratio}:attack=${attack}:release=${release}[ducked];[ducked][mix]amix=inputs=2:duration=longest`;
|
|
1046
|
-
await execSafe("ffmpeg", [
|
|
1047
|
-
"-i", absMusicPath, "-i", absVoicePath,
|
|
1048
|
-
"-filter_complex", filter,
|
|
1049
|
-
"-y", outputPath,
|
|
1050
|
-
], { timeout: 120000, maxBuffer: 50 * 1024 * 1024 });
|
|
1051
|
-
if (!existsSync(outputPath))
|
|
1052
|
-
return { success: false, error: "FFmpeg failed to create output" };
|
|
1053
|
-
return { success: true, outputPath };
|
|
1054
|
-
}
|
|
1055
|
-
catch (error) {
|
|
1056
|
-
return { success: false, error: `Audio ducking failed: ${error instanceof Error ? error.message : String(error)}` };
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
//# sourceMappingURL=ai-audio.js.map
|