feat(cli): add cn config command for model management#9960
feat(cli): add cn config command for model management#9960aaronlippold wants to merge 7 commits intocontinuedev:mainfrom
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.
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.
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
RomneyDa
left a comment
There was a problem hiding this comment.
@aaronlippold this is a neat set of features which would expand configurability quite a bit. I think we could merge a subset of this but would exclude most of the commands. Some thoughts:
- I think the
show,test,add, andremoveoptions would be great sections- I think we could unify intoshowsomehow- verify/list/sync/diff/generate - these are interesting but I think we won't commit to maintaining this for now.
- validate - this can remain incorporated into config loading, if any validation is unsatisfactory during config loading let's tweak it to account for it
- backups/restore - let's skip these for now
Note comment about process.env vs .env loading, can also simplify by removing that
| } | ||
|
|
||
| // Then check in priority order: ~/.continue/.env, <workspace>/.continue/.env, <workspace>/.env | ||
| // Check .env files FIRST (highest priority), matching IDE behavior |
There was a problem hiding this comment.
process.env should stay top priority here, IDEs don't have access to process.env the same way CLI does; it's a CLI-only thing unless people are building their own vscode etc
| }); | ||
| }); | ||
|
|
||
| it("prioritizes .env file over process.env when both have the secret", async () => { |
There was a problem hiding this comment.
can remove this test, see other comment
|
Hello, happy to let you guys cherry pick whatever you think is useful.
Basically what I did was whatever I had to script up to help my developers
in the house make it easier to add and remove things and not have to think
too hard about saying I want this or that I just integrated into the
application directly, so there wasn’t a point of failure.
Perfectly happy with a no on anything you guys don’t want to support
…--------
Aaron Lippold
***@***.***
260-255-4779
twitter/aim/yahoo,etc.
'aaronlippold'
On Tue, Feb 3, 2026 at 14:58 Dallin Romney ***@***.***> wrote:
***@***.**** requested changes on this pull request.
@aaronlippold <https://github.com/aaronlippold> this is a neat set of
features which would expand configurability quite a bit. I think we could
merge a subset of this but would exclude most of the commands. Some
thoughts:
- I think the show, test, add, and remove options would be great
- sections - I think we could unify into show somehow
- verify/list/sync/diff/generate - these are interesting but I think
we won't commit to maintaining this for now.
- validate - this can remain incorporated into config loading, if any
validation is unsatisfactory during config loading let's tweak it to
account for it
- backups/restore - let's skip these for now
Note comment about process.env vs .env loading, can also simplify by
removing that
------------------------------
In extensions/cli/src/CLIPlatformClient.ts
<#9960 (comment)>
:
> @@ -55,13 +55,8 @@ export class CLIPlatformClient implements PlatformClient {
}
private findSecretInLocalEnvFiles(fqsn: FQSN): SecretResult | undefined {
- // First check process.env (highest priority)
- const processEnvSecret = this.findSecretInProcessEnv(fqsn);
- if (processEnvSecret) {
- return processEnvSecret;
- }
-
- // Then check in priority order: ~/.continue/.env, <workspace>/.continue/.env, <workspace>/.env
+ // Check .env files FIRST (highest priority), matching IDE behavior
process.env should stay top priority here, IDEs don't have access to
process.env the same way CLI does; it's a CLI-only thing unless people are
building their own vscode etc
------------------------------
In extensions/cli/src/CLIPlatformClient.test.ts
<#9960 (comment)>
:
> @@ -337,6 +337,70 @@ describe("CLIPlatformClient", () => {
});
});
+ it("prioritizes .env file over process.env when both have the secret", async () => {
can remove this test, see other comment
—
Reply to this email directly, view it on GitHub
<#9960 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AALK42AUEY46G2V5JPBB5OT4KD4YDAVCNFSM6AAAAACTCT3OVCVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTONBXGI2DQOBRHA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
@aaronlippold sounds good. I think in the near future we won't make the call on a broad set of I've opened a discussion to get community feedback on this. Closing this for now; it's also implemented cleanly enough that we could easily pick it up later with minimal conflicts. |
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.