mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
rename env vars GEMINI_CODE_{MODEL,SANDBOX,SANDBOX_IMAGE} (#411)
This commit is contained in:
@@ -59,7 +59,7 @@ async function parseArguments(): Promise<CliArgs> {
|
||||
alias: 'm',
|
||||
type: 'string',
|
||||
description: `Model`,
|
||||
default: process.env.GEMINI_CODE_MODEL || DEFAULT_GEMINI_MODEL,
|
||||
default: process.env.GEMINI_MODEL || DEFAULT_GEMINI_MODEL,
|
||||
})
|
||||
.option('prompt', {
|
||||
alias: 'p',
|
||||
|
||||
@@ -24,6 +24,25 @@ const __dirname = dirname(__filename);
|
||||
async function main() {
|
||||
const settings = loadSettings(process.cwd());
|
||||
const config = await loadCliConfig(settings.merged);
|
||||
|
||||
// warn about deprecated environment variables
|
||||
if (process.env.GEMINI_CODE_MODEL) {
|
||||
console.warn('GEMINI_CODE_MODEL is deprecated. Use GEMINI_MODEL instead.');
|
||||
process.env.GEMINI_MODEL = process.env.GEMINI_CODE_MODEL;
|
||||
}
|
||||
if (process.env.GEMINI_CODE_SANDBOX) {
|
||||
console.warn(
|
||||
'GEMINI_CODE_SANDBOX is deprecated. Use GEMINI_SANDBOX instead.',
|
||||
);
|
||||
process.env.GEMINI_SANDBOX = process.env.GEMINI_CODE_SANDBOX;
|
||||
}
|
||||
if (process.env.GEMINI_CODE_SANDBOX_IMAGE) {
|
||||
console.warn(
|
||||
'GEMINI_CODE_SANDBOX_IMAGE is deprecated. Use GEMINI_SANDBOX_IMAGE_NAME instead.',
|
||||
);
|
||||
process.env.GEMINI_SANDBOX_IMAGE = process.env.GEMINI_CODE_SANDBOX_IMAGE;
|
||||
}
|
||||
|
||||
if (settings.merged.theme) {
|
||||
if (!themeManager.setActiveTheme(settings.merged.theme)) {
|
||||
// If the theme is not found during initial load, log a warning and continue.
|
||||
|
||||
@@ -73,7 +73,7 @@ async function shouldUseCurrentUserInSandbox(): Promise<boolean> {
|
||||
// node.js equivalent of scripts/sandbox_command.sh
|
||||
export function sandbox_command(sandbox?: string | boolean): string {
|
||||
// note environment variable takes precedence over argument (from command line or settings)
|
||||
sandbox = process.env.GEMINI_CODE_SANDBOX?.toLowerCase().trim() ?? sandbox;
|
||||
sandbox = process.env.GEMINI_SANDBOX?.toLowerCase().trim() ?? sandbox;
|
||||
if (sandbox === '1' || sandbox === 'true') sandbox = true;
|
||||
else if (sandbox === '0' || sandbox === 'false') sandbox = false;
|
||||
|
||||
@@ -86,7 +86,7 @@ export function sandbox_command(sandbox?: string | boolean): string {
|
||||
} else {
|
||||
console.error(
|
||||
'ERROR: failed to determine command for sandbox; ' +
|
||||
'install docker or podman or specify command in GEMINI_CODE_SANDBOX',
|
||||
'install docker or podman or specify command in GEMINI_SANDBOX',
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ export function sandbox_command(sandbox?: string | boolean): string {
|
||||
return sandbox;
|
||||
} else {
|
||||
console.error(
|
||||
`ERROR: missing sandbox command '${sandbox}' (from GEMINI_CODE_SANDBOX)`,
|
||||
`ERROR: missing sandbox command '${sandbox}' (from GEMINI_SANDBOX)`,
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
@@ -255,7 +255,7 @@ export async function start_sandbox(sandbox: string) {
|
||||
// determine full path for gemini-code to distinguish linked vs installed setting
|
||||
const gcPath = execSync(`realpath $(which gemini)`).toString().trim();
|
||||
|
||||
const image = process.env.GEMINI_CODE_SANDBOX_IMAGE ?? 'gemini-code-sandbox';
|
||||
const image = process.env.GEMINI_SANDBOX_IMAGE ?? 'gemini-code-sandbox';
|
||||
const workdir = process.cwd();
|
||||
|
||||
// if BUILD_SANDBOX is set, then call scripts/build_sandbox.sh under gemini-code repo
|
||||
@@ -383,9 +383,9 @@ export async function start_sandbox(sandbox: string) {
|
||||
args.push('--env', `GEMINI_API_KEY=${process.env.GEMINI_API_KEY}`);
|
||||
}
|
||||
|
||||
// copy GEMINI_CODE_MODEL
|
||||
if (process.env.GEMINI_CODE_MODEL) {
|
||||
args.push('--env', `GEMINI_CODE_MODEL=${process.env.GEMINI_CODE_MODEL}`);
|
||||
// copy GEMINI_MODEL
|
||||
if (process.env.GEMINI_MODEL) {
|
||||
args.push('--env', `GEMINI_MODEL=${process.env.GEMINI_MODEL}`);
|
||||
}
|
||||
|
||||
// copy TERM and COLORTERM to try to maintain terminal setup
|
||||
|
||||
Reference in New Issue
Block a user