2.6 KiB
TTS Language Contract Implementation Plan
For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
Goal: Add ttsText and ttsLanguage to subtitle generation so English subtitles and TTS dubbing language are handled separately.
Architecture: Keep the current subtitle pipeline shape, but thread an optional ttsLanguage through request parsing, prompt creation, and subtitle normalization. Dubbing should use ttsText when available so later UI work can choose a TTS language without reworking the playback layer.
Tech Stack: TypeScript, Vitest, React client services, Node subtitle generation pipeline
Task 1: Lock the new prompt and parsing contract with tests
Files:
- Modify:
E:\Downloads\ai-video-dubbing-&-translation\src\server\videoSubtitleGeneration.test.ts - Modify:
E:\Downloads\ai-video-dubbing-&-translation\src\services\subtitleService.test.ts
Step 1: Write the failing tests
- Assert the user prompt mentions
Subtitle language: EnglishandTTS language. - Assert the system prompt includes
ttsTextandttsLanguage. - Assert normalized subtitles preserve returned
ttsTextandttsLanguage. - Assert the client request forwards
ttsLanguage.
Step 2: Run tests to verify they fail
Run:
npm run test -- src/server/videoSubtitleGeneration.test.ts src/services/subtitleService.test.ts
Step 3: Commit
Skip commit for now.
Task 2: Implement the backend contract
Files:
- Modify:
E:\Downloads\ai-video-dubbing-&-translation\src\server\videoSubtitleGeneration.ts - Modify:
E:\Downloads\ai-video-dubbing-&-translation\src\server\subtitleGeneration.ts - Modify:
E:\Downloads\ai-video-dubbing-&-translation\src\server\subtitleRequest.ts - Modify:
E:\Downloads\ai-video-dubbing-&-translation\src\types.ts - Modify:
E:\Downloads\ai-video-dubbing-&-translation\src\services\subtitleService.ts - Modify:
E:\Downloads\ai-video-dubbing-&-translation\src\components\EditorScreen.tsx
Step 1: Write the minimal implementation
- Add optional
ttsTextandttsLanguageto subtitle types. - Accept optional
ttsLanguagein request parsing and pipeline functions. - Build prompts with English subtitle language plus requested TTS language.
- Normalize model output into subtitle objects with
ttsTextandttsLanguage. - Use
ttsTextfor TTS generation when present.
Step 2: Run tests to verify they pass
Run:
npm run test -- src/server/videoSubtitleGeneration.test.ts src/services/subtitleService.test.ts src/components/EditorScreen.test.tsx
Step 3: Commit
Skip commit for now.