ITADN

Reorganize CLI into command groups

#317Closedmattpocock 创建于 2026-01-28
M
mattpocockcommented
NOTE: Make sure that when you delete files, you are extremely aggressive in searching for orphans further down the chain inside the ffmpeg package. ## Problem Statement The internal CLI has all 23 commands in a flat list, making it hard to navigate and discover related functionality. Commands have verbose names like `send-clips-to-davinci-resolve` that repeat context unnecessarily. ## Solution Reorganize commands into logical groups with shorter names. Delete 12 unused commands and their orphaned dependencies. The new structure uses Commander.js subcommands: ``` pnpm cli resolve create-timeline pnpm cli clips detect pnpm cli queue status pnpm cli notify "message" ``` ## User Stories 1. As a CLI user, I want commands grouped by domain, so that I can discover related functionality 2. As a CLI user, I want shorter command names, so that I type less 3. As a CLI user, I want `pnpm cli resolve --help` to show all Resolve commands, so that I can see available options 4. As a CLI user, I want `pnpm cli queue --help` to show all queue commands, so that I can manage the processing queue 5. As a CLI user, I want `pnpm cli clips --help` to show clip operations, so that I can work with video clips 6. As a CLI user, I want `pnpm cli notify` at top-level, so that I can quickly send notifications 7. As a developer, I want command files organized by group in directories, so that the codebase is easier to navigate 8. As a developer, I want unused commands deleted, so that there's less code to maintain 9. As a developer, I want orphaned modules removed, so that the codebase stays clean ## Implementation Decisions ### New Command Structure | Group | Command | Old Name | Description | |-------|---------|----------|-------------| | **resolve** | `create-timeline` | `create-timeline` | Create empty timeline in current project | | | `append-video` | `append-video-to-timeline` | Append video file to current timeline | | | `send-clips` | `send-clips-to-davinci-resolve` | Send clips to timeline with frame-based positioning | | **clips** | `detect` | `get-clips-from-latest-video` | Detect clip boundaries in a video | | | `transcribe` | `transcribe-clips` | Transcribe clips with word-level timing | | **queue** | `process` | `process-queue` | Run all pending queue items | | | `status` | `queue-status` | Show queue status and workflow progress | | | `retry` | `retry-queue-item` | Retry most recent failed item | | | `from-clips` | `create-video-from-clips` | Queue video creation from JSON clip definitions | | | `concat` | `concatenate-videos` | Queue concatenation of multiple completed videos | | *(top-level)* | `notify` | `notify` | Send notification to Zapier webhook | ### Commands to Delete (12) - `add-current-timeline-to-render-queue` - `export-subtitles` - `create-auto-edited-video` - `transcribe-video` - `article-from-transcript` - `edit-interview` - `export-interview` - `move-interview-to-davinci-resolve` - `process-information-requests` - `log-latest-obs-video` - `move-raw-footage-to-long-term-storage` - `queue-auto-edited-video-for-course` ### Directory Structure ``` apps/internal-cli/src/ commands/ resolve/ index.ts # exports register(program) for group create-timeline.ts append-video.ts send-clips.ts clips/ index.ts detect.ts transcribe.ts queue/ index.ts process.ts status.ts retry.ts from-clips.ts concat.ts notify.ts # top-level command bin.ts # imports group registers + notify ``` ### Registration Pattern Each group's `index.ts` creates a subcommand and registers commands to it: ```ts export function register(program: Command): void { const resolve = program .command('resolve') .description('DaVinci Resolve operations'); registerCreateTimeline(resolve); registerAppendVideo(resolve); registerSendClips(resolve); } ``` ### Cleanup - Delete command files for removed commands - Trace imports to find orphaned modules in `@total-typescript/ffmpeg` - Delete orphaned modules and their tests - Keep any modules still used by remaining commands ## Testing Decisions - No new tests required for this refactor (structural change only) - Delete tests for removed functionality (e.g., `article-from-transcript.test.ts` if orphaned) - Existing tests for kept commands should continue to pass - Manual verification: run each reorganized command to confirm it works ## Out of Scope - Adding new commands - Changing command behavior or options - Updating command implementations - Adding new tests for existing commands - Backwards compatibility / aliases for old command names ## Further Notes - This is internal software, no changeset needed - Existing aliases (like `a` for append) will be removed - Commander.js handles help output automatically for subcommands
关闭于 2026-01-28 9 条评论