From 3fa91f56e5e77857cb61b3a7425eaab898911d33 Mon Sep 17 00:00:00 2001 From: Ben Vargas Date: Tue, 17 Jun 2025 14:47:45 -0600 Subject: [PATCH] fix(models): add missing --claude-code flag to models command The models command was missing the --claude-code provider flag, preventing users from setting Claude Code models via CLI. While the backend already supported claude-code as a provider hint, there was no command-line flag to trigger it. Changes: - Added --claude-code option to models command alongside existing provider flags - Updated provider flags validation to include claudeCode option - Added claude-code to providerHint logic for all three model roles (main, research, fallback) - Updated error message to include --claude-code in list of mutually exclusive flags - Added example usage in help text This allows users to properly set Claude Code models using commands like: task-master models --set-main sonnet --claude-code task-master models --set-main opus --claude-code Without this flag, users would get "Model ID not found" errors when trying to set claude-code models, as the system couldn't determine the correct provider for generic model names like "sonnet" or "opus". --- scripts/modules/commands.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/scripts/modules/commands.js b/scripts/modules/commands.js index 76bbbd01..643b855f 100644 --- a/scripts/modules/commands.js +++ b/scripts/modules/commands.js @@ -3404,6 +3404,10 @@ ${result.result} '--bedrock', 'Allow setting a custom Bedrock model ID (use with --set-*) ' ) + .option( + '--claude-code', + 'Allow setting a Claude Code model ID (use with --set-*)' + ) .option( '--azure', 'Allow setting a custom Azure OpenAI model ID (use with --set-*) ' @@ -3423,6 +3427,7 @@ Examples: $ task-master models --set-main my-custom-model --ollama # Set custom Ollama model for main role $ task-master models --set-main anthropic.claude-3-sonnet-20240229-v1:0 --bedrock # Set custom Bedrock model for main role $ task-master models --set-main some/other-model --openrouter # Set custom OpenRouter model for main role + $ task-master models --set-main sonnet --claude-code # Set Claude Code model for main role $ task-master models --set-main gpt-4o --azure # Set custom Azure OpenAI model for main role $ task-master models --set-main claude-3-5-sonnet@20241022 --vertex # Set custom Vertex AI model for main role $ task-master models --setup # Run interactive setup` @@ -3437,12 +3442,13 @@ Examples: const providerFlags = [ options.openrouter, options.ollama, - options.bedrock + options.bedrock, + options.claudeCode ].filter(Boolean).length; if (providerFlags > 1) { console.error( chalk.red( - 'Error: Cannot use multiple provider flags (--openrouter, --ollama, --bedrock) simultaneously.' + 'Error: Cannot use multiple provider flags (--openrouter, --ollama, --bedrock, --claude-code) simultaneously.' ) ); process.exit(1); @@ -3484,7 +3490,9 @@ Examples: ? 'ollama' : options.bedrock ? 'bedrock' - : undefined + : options.claudeCode + ? 'claude-code' + : undefined }); if (result.success) { console.log(chalk.green(`✅ ${result.data.message}`)); @@ -3506,7 +3514,9 @@ Examples: ? 'ollama' : options.bedrock ? 'bedrock' - : undefined + : options.claudeCode + ? 'claude-code' + : undefined }); if (result.success) { console.log(chalk.green(`✅ ${result.data.message}`)); @@ -3530,7 +3540,9 @@ Examples: ? 'ollama' : options.bedrock ? 'bedrock' - : undefined + : options.claudeCode + ? 'claude-code' + : undefined }); if (result.success) { console.log(chalk.green(`✅ ${result.data.message}`));