From 574d47abfc0cf4fff544502f3c45f66d46533203 Mon Sep 17 00:00:00 2001 From: "Jeffrey.Cao" Date: Tue, 30 Sep 2025 08:11:40 +0800 Subject: [PATCH] refactor: remove claudeCodeEnv option and update environment variable handling --- README.md | 12 ++++++++++-- src/start.ts | 13 +++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index c36301dd7..b81f0340f 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,6 @@ The following command line options are available for the `start` command: | --wait | Wait instead of error when rate limit is hit | false | -w | | --github-token | Provide GitHub token directly (must be generated using the `auth` subcommand) | none | -g | | --claude-code | Generate a command to launch Claude Code with Copilot API config | false | -c | -| --claude-code-env | Generate Claude Code Environment variables | true | none | | --show-token | Show GitHub and Copilot tokens on fetch and refresh | false | none | ### Auth Command Options @@ -305,7 +304,16 @@ Here is an example `.claude/settings.json` file: "ANTHROPIC_BASE_URL": "http://localhost:4141", "ANTHROPIC_AUTH_TOKEN": "dummy", "ANTHROPIC_MODEL": "gpt-4.1", - "ANTHROPIC_SMALL_FAST_MODEL": "gpt-4.1" + "ANTHROPIC_DEFAULT_SONNET_MODEL": "gpt-4.1", + "ANTHROPIC_SMALL_FAST_MODEL": "gpt-4.1", + "ANTHROPIC_DEFAULT_HAIKU_MODEL": "gpt-4.1", + "DISABLE_NON_ESSENTIAL_MODEL_CALLS": "1", + "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1" + }, + "permissions": { + "deny": [ + "WebSearch" + ] } } ``` diff --git a/src/start.ts b/src/start.ts index 737da7719..46798ad87 100644 --- a/src/start.ts +++ b/src/start.ts @@ -23,7 +23,6 @@ interface RunServerOptions { githubToken?: string claudeCode: boolean showToken: boolean - claudeCodeEnv?: boolean } export async function runServer(options: RunServerOptions): Promise { @@ -61,7 +60,7 @@ export async function runServer(options: RunServerOptions): Promise { const serverUrl = `http://localhost:${options.port}` - if (options.claudeCode && options.claudeCodeEnv) { + if (options.claudeCode) { invariant(state.models, "Models should be loaded by now") const selectedModel = await consola.prompt( @@ -85,7 +84,11 @@ export async function runServer(options: RunServerOptions): Promise { ANTHROPIC_BASE_URL: serverUrl, ANTHROPIC_AUTH_TOKEN: "dummy", ANTHROPIC_MODEL: selectedModel, + ANTHROPIC_DEFAULT_SONNET_MODEL: selectedModel, ANTHROPIC_SMALL_FAST_MODEL: selectedSmallModel, + ANTHROPIC_DEFAULT_HAIKU_MODEL: selectedSmallModel, + DISABLE_NON_ESSENTIAL_MODEL_CALLS: "1", + CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC: "1", }, "claude", ) @@ -170,11 +173,6 @@ export const start = defineCommand({ default: false, description: "Show GitHub and Copilot tokens on fetch and refresh", }, - "claude-code-env": { - type: "boolean", - default: true, - description: "Generate Claude Code Environment variables", - }, }, run({ args }) { const rateLimitRaw = args["rate-limit"] @@ -192,7 +190,6 @@ export const start = defineCommand({ githubToken: args["github-token"], claudeCode: args["claude-code"], showToken: args["show-token"], - claudeCodeEnv: args["claude-code-env"], }) }, })