diff --git a/cmd/hyprvoice/main.go b/cmd/hyprvoice/main.go index f017140..12b2342 100644 --- a/cmd/hyprvoice/main.go +++ b/cmd/hyprvoice/main.go @@ -405,6 +405,7 @@ func modelCmd() *cobra.Command { cmd.AddCommand(modelListCmd()) cmd.AddCommand(modelDownloadCmd()) + cmd.AddCommand(modelRemoveCmd()) return cmd } @@ -586,3 +587,41 @@ func runModelDownload(ctx context.Context, modelName string) error { fmt.Printf("\ndownload complete: %s\n", path) return nil } + +func modelRemoveCmd() *cobra.Command { + return &cobra.Command{ + Use: "remove ", + Short: "Remove a downloaded local model", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + return runModelRemove(args[0]) + }, + } +} + +func runModelRemove(modelName string) error { + // find the model across all providers + model, _, err := provider.FindModelByID(modelName) + if err != nil { + return fmt.Errorf("unknown model: %s", modelName) + } + + // check if it's a cloud model (nothing to remove) + if !model.NeedsDownload() { + fmt.Printf("model '%s' is a cloud model, nothing to remove\n", modelName) + return nil + } + + // check if installed + if !whisper.IsInstalled(modelName) { + return fmt.Errorf("model '%s' is not installed", modelName) + } + + // remove the model + if err := whisper.Remove(modelName); err != nil { + return fmt.Errorf("failed to remove model: %w", err) + } + + fmt.Printf("model '%s' removed successfully\n", modelName) + return nil +} diff --git a/progress.txt b/progress.txt index 66411c2..add4920 100644 --- a/progress.txt +++ b/progress.txt @@ -255,4 +255,12 @@ Started: Sun Feb 1 12:22:47 AM CET 2026 - Downloads with progress callback showing percentage (10%, 20%, ...) - Prints success message with full model path - Tested: cloud model rejection, unknown model error, download with progress, already installed -- All tests passing, typecheck passes \ No newline at end of file +- All tests passing, typecheck passes + +### Task 26: Add model remove CLI command +- Created `modelRemoveCmd()` subcommand with Use: 'remove ' +- Uses `provider.FindModelByID()` to find model across all providers +- Cloud models: prints 'nothing to remove' +- Not installed: returns error 'model is not installed' +- Installed: calls `whisper.Remove()`, prints success message +- All verification scenarios tested, typecheck passes \ No newline at end of file diff --git a/tasks/prd.jsonc b/tasks/prd.jsonc index 5b507b3..57830f8 100644 --- a/tasks/prd.jsonc +++ b/tasks/prd.jsonc @@ -616,7 +616,7 @@ "Shows success message after removal", "Typecheck passes" ], - "passes": false + "passes": true }, // ============================================================================ // PHASE 6: TUI IMPROVEMENTS