Remove unused code from ffmpeg-commands.ts
## Problem Statement
`packages/ffmpeg/src/ffmpeg-commands.ts` contains dead code that increases maintenance burden without providing value. Analysis shows ~70 lines of unused methods and error classes.
## Solution
Remove the unused code and associated imports.
## Implementation Plan
### Step 1: Remove `CouldNotEncodeVideoError` error class
- Delete the error class definition (lines 31-35)
- Commit: "Remove unused CouldNotEncodeVideoError"
### Step 2: Remove `CouldNotFigureOutWhichCTAToShowError` error class
- Delete the error class definition (lines 67-71)
- Commit: "Remove unused CouldNotFigureOutWhichCTAToShowError"
### Step 3: Remove `figureOutWhichCTAToShow` method
- Delete the method from FFmpegCommandsService (lines 514-546)
- Remove the commented-out call in `workflows.ts` that references it
- Commit: "Remove unused figureOutWhichCTAToShow method"
### Step 4: Remove `combineAudioAndVideo` method
- Delete the method from FFmpegCommandsService (lines 549-559)
- Commit: "Remove unused combineAudioAndVideo method"
### Step 5: Clean up unused imports
- Remove `import { openai } from "@ai-sdk/openai";`
- Remove `import { generateObject } from "ai";`
- Commit: "Remove unused imports from ffmpeg-commands.ts"
## Decision Document
- **Modules modified:** `packages/ffmpeg/src/ffmpeg-commands.ts`, `packages/ffmpeg/src/workflows.ts`
- **No interface changes:** All removed code is internal/unused
- **No behavioral changes:** Removing dead code only
- **CTA logic:** Currently hardcoded to `"ai"` in workflows.ts; this refactor accepts that decision
## Testing Decisions
- `ffmpeg-commands.ts` is a shim over FFmpeg CLI commands; not designed for unit testing
- Methods are tested indirectly via workflow integration tests
- No new tests required; existing workflow tests provide coverage for remaining methods
- Run `pnpm run ci` to verify no regressions
## Out of Scope
- Refactoring the CTA selection logic (currently hardcoded to "ai")
- Adding tests for ffmpeg-commands.ts
- Other cleanup in the ffmpeg package
关闭于 2026-01-27 1 条评论