-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat(cli): add cn config command for model management #9960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
.env files are now checked BEFORE process.env, matching IDE behavior. Previously, process.env took priority which caused inconsistency between CLI and IDE environments. Added tests to verify correct priority order. Authored by: Aaron Lippold<lippold@gmail.com>
Core model management functions for config command: - loadConfigFile/saveConfigFile: YAML handling with comment preservation - getAvailableModels: Fetch models from OpenAI-compatible API - verifyModelsExist: Check if config models exist on provider - syncModelsInConfig: Remove unavailable models from config - addModelToConfig/removeModelFromConfig: CRUD operations - generateConfig: Bootstrap config from available models - diffModels: Compare config vs available models - listBackups/restoreBackup: Backup management - getProviderPreset: Pre-configured provider settings - filterModels: Filter by pattern and type - formatAsJson: JSON output for CI/scripting Features: - PRESERVED_SECTIONS ensures mcpServers, rules, prompts, etc. are never modified - Atomic writes using temp file + rename - Auto-backup before any modification - Provider presets for openai, anthropic, azure, ollama, together, groq, mistral 63 unit tests included. Authored by: Aaron Lippold<lippold@gmail.com>
Commander.js command handlers for config subcommands: Validation commands: - cn config verify - Check if models are available from provider - cn config sync - Remove unavailable models (--dry-run supported) - cn config validate - Validate config structure - cn config sections - Show config sections Discovery commands: - cn config list - List available models from provider - cn config test - Test each chat model with sample prompt Model management: - cn config add - Add model with --name, --role options - cn config remove - Remove model from config - cn config generate - Bootstrap config from available models Inspection commands: - cn config show - Display current config - cn config diff - Compare config vs available models - cn config backups - List backup files - cn config restore - Restore from backup Global options: - --json - Output as JSON for CI/scripting - --provider - Presets: openai, anthropic, azure, ollama, together, groq, mistral - --chat-only, --embed-only, --rerank-only - Filter by model type - --filter <pattern> - Filter by pattern 8 integration tests included. Authored by: Aaron Lippold<lippold@gmail.com>
Adds import and registration for the config command group. Authored by: Aaron Lippold<lippold@gmail.com>
Documents the config command group in the CLI README: - All 13 subcommands with descriptions - Example usage for common workflows - Provider presets and filter options Authored by: Aaron Lippold<lippold@gmail.com>
Use path.join() in test expectations for getConfigPath and getEnvPath tests to handle Windows backslash path separators. Authored by: Aaron Lippold<lippold@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 7 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="extensions/cli/src/commands/config/index.ts">
<violation number="1" location="extensions/cli/src/commands/config/index.ts:127">
P1: Rule violated: **Don't use console.log**
Replace console.log/error with the standard logger (e.g., logger.info/error) per the no-console rule.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| * Verify command - Check if config models are available | ||
| */ | ||
| async function runVerify(options: ConfigCommandOptions): Promise<void> { | ||
| console.log("Verifying config against available models...\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P1: Rule violated: Don't use console.log
Replace console.log/error with the standard logger (e.g., logger.info/error) per the no-console rule.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At extensions/cli/src/commands/config/index.ts, line 127:
<comment>Replace console.log/error with the standard logger (e.g., logger.info/error) per the no-console rule.</comment>
<file context>
@@ -0,0 +1,891 @@
+ * Verify command - Check if config models are available
+ */
+async function runVerify(options: ConfigCommandOptions): Promise<void> {
+ console.log("Verifying config against available models...\n");
+
+ const continueHome = getContinueHome(options.continueHome);
</file context>
- Fix config path resolution test for Windows (use path.join) - Fix TUI special characters test to avoid @ triggering file search - Improve waitForCondition using vi.waitFor for better CI reliability - Increase waitForNextRender delay for slower CI environments - Skip network-dependent hub integration tests in CI Authored by: Aaron Lippold<lippold@gmail.com>
eb0fc5f to
4609b83
Compare
PR: Add
cn configCommand for Model ManagementDescription
Adds a comprehensive
cn configcommand group to the CLI for managing Continue configuration files. This enables users to verify, sync, and manage models in theirconfig.yamlwithout manual editing.Problem
Currently, users must manually edit
config.yamlto add/remove models, and there's no way to verify that configured models actually exist on their provider. This leads to:Solution
The
cn configcommand provides:Commands
cn config verifycn config sync--dry-run)cn config validatecn config sectionscn config listcn config testcn config add <model>--name,--roleoptionscn config remove <model>cn config generatecn config showcn config diffcn config backupscn config restore <backup>Global Options
--json--provider <name>openai,anthropic,azure,ollama,together,groq,mistral--api-base <url>--api-key-env <var>--auth-header <header>Authorization)--chat-only--embed-only--rerank-only--filter <pattern>--dry-runProvider Presets
openaianthropicazureollamatogethergroqmistralExample Usage
Key Features
yamlpackage (eemeli/yaml) to preserve comments in config filesmcpServers,rules,prompts,context,data,docsare never modified by sync/generate--jsonoutput for programmatic useBug Fix
Also includes a fix for
CLIPlatformClient.ts:.envfiles are now checked BEFOREprocess.env, matching IDE behaviorChecklist
Tests
configModels.test.tsindex.test.tsCLIPlatformClient.test.tsAll 1867 tests passing.
Screen recording or screenshot
CLI command - text output only, no UI changes.
Continue Tasks:▶️ 1 queued — View all
Summary by cubic
Adds a new cn config command group to manage models in config.yaml from the CLI, including verification, syncing, discovery, CRUD, and safe backups. Also fixes env loading to prefer .env over process.env for consistent behavior with the IDE.
New Features
Bug Fixes
Written for commit 4609b83. Summary will update on new commits.