Explainer videos and product demos made by your AI agent. Free and open source: a local voice (Kokoro), word timing (Whisper) and a canvas renderer turn a script into a narrated MP4.
JavaScript ai-agentsanimationcanvasclaude-codecodexexplainer-videoffmpegjavascriptkokoroproduct-demotext-to-speechvideo-generationwhisper
Report a numeric or output flag given without a value
Vincent Schmalbach94da0fb4a1e5
diff --git a/src/cli.js b/src/cli.jsindex 6cd4404..5fd2817 100644--- a/src/cli.js+++ b/src/cli.js@@ -64,6 +64,7 @@ const BOOL = new Set(['json', 'draft', 'force', 'fetch', 'help', 'version', 'quifunction num(v, name) {if (v === undefined) return undefined;+ if (v === true) throw new ProjectError(`--${name} needs a value`);const n = Number(v);if (!Number.isFinite(n)) throw new ProjectError(`--${name} must be a number`);return n;@@ -288,11 +289,11 @@ async function preview(dir, flags, log) {async function say(text, flags, log, print) {if (!text) throw new ProjectError('usage: explainroo say "text to speak" [--voice af_heart] [--speed 1] [--out sample.wav]');- const voice = flags.voice || 'af_heart';+ const voice = textFlag(flags, 'voice') || 'af_heart';if (!VOICES[voice]) throw new ProjectError(`voice "${voice}" does not exist. Run "explainroo voices".`);const tts = await loadTTS({ log });const audio = await tts.generate(text, { voice, speed: num(flags.speed, 'speed') ?? 1 });- const out = path.resolve(flags.out || `${voice}.wav`);+ const out = path.resolve(textFlag(flags, 'out') || `${voice}.wav`);writeWav(out, audio.audio, audio.sampling_rate || TTS_SAMPLE_RATE);print(out, { file: out, voice });return 0;diff --git a/test/cli.test.js b/test/cli.test.jsindex a13bec1..d2852b4 100644--- a/test/cli.test.js+++ b/test/cli.test.js@@ -49,6 +49,13 @@ test('init names a text flag that was given without a value', async () => {assert.equal(fs.existsSync(target), false);});+test('a numeric flag without a value is an error, not 1', async () => {+ const base = tempDir();+ const r = await run(['init', path.join(base, 'video'), '--pace']);+ assert.equal(r.code, 1);+ assert.match(r.err, /--pace needs a value/);+});+test('init with valid settings writes video.json and the starter files', async () => {const base = tempDir();const target = path.join(base, 'my-first-video');