diff --git a/docs/cli/configuration.md b/docs/cli/configuration.md index 1b2f9680..83678f2e 100644 --- a/docs/cli/configuration.md +++ b/docs/cli/configuration.md @@ -291,13 +291,13 @@ Arguments passed directly when running the CLI can override other configurations - Enables sandbox mode for this session. - **`--sandbox-image`**: - Sets the sandbox image URI. -- **`--debug_mode`** (**`-d`**): +- **`--debug`** (**`-d`**): - Enables debug mode for this session, providing more verbose output. -- **`--all_files`** (**`-a`**): +- **`--all-files`** (**`-a`**): - If set, recursively includes all files within the current directory as context for the prompt. - **`--help`** (or **`-h`**): - Displays help information about command-line arguments. -- **`--show_memory_usage`**: +- **`--show-memory-usage`**: - Displays the current memory usage. - **`--yolo`**: - Enables YOLO mode, which automatically approves all tool calls. diff --git a/packages/cli/src/config/config.test.ts b/packages/cli/src/config/config.test.ts index 1ea48760..35b420e9 100644 --- a/packages/cli/src/config/config.test.ts +++ b/packages/cli/src/config/config.test.ts @@ -62,8 +62,8 @@ describe('loadCliConfig', () => { vi.restoreAllMocks(); }); - it('should set showMemoryUsage to true when --memory flag is present', async () => { - process.argv = ['node', 'script.js', '--show_memory_usage']; + it('should set showMemoryUsage to true when --show-memory-usage flag is present', async () => { + process.argv = ['node', 'script.js', '--show-memory-usage']; const settings: Settings = {}; const config = await loadCliConfig(settings, [], 'test-session'); expect(config.getShowMemoryUsage()).toBe(true); @@ -84,7 +84,7 @@ describe('loadCliConfig', () => { }); it('should prioritize CLI flag over settings for showMemoryUsage (CLI true, settings false)', async () => { - process.argv = ['node', 'script.js', '--show_memory_usage']; + process.argv = ['node', 'script.js', '--show-memory-usage']; const settings: Settings = { showMemoryUsage: false }; const config = await loadCliConfig(settings, [], 'test-session'); expect(config.getShowMemoryUsage()).toBe(true); diff --git a/packages/cli/src/config/config.ts b/packages/cli/src/config/config.ts index 15ae713e..e3cf9326 100644 --- a/packages/cli/src/config/config.ts +++ b/packages/cli/src/config/config.ts @@ -37,10 +37,12 @@ const logger = { interface CliArgs { model: string | undefined; sandbox: boolean | string | undefined; - 'sandbox-image': string | undefined; + sandboxImage: string | undefined; debug: boolean | undefined; prompt: string | undefined; + allFiles: boolean | undefined; all_files: boolean | undefined; + showMemoryUsage: boolean | undefined; show_memory_usage: boolean | undefined; yolo: boolean | undefined; telemetry: boolean | undefined; @@ -48,7 +50,7 @@ interface CliArgs { telemetryTarget: string | undefined; telemetryOtlpEndpoint: string | undefined; telemetryLogPrompts: boolean | undefined; - 'allowed-mcp-server-names': string | undefined; + allowedMcpServerNames: string | undefined; extensions: string[] | undefined; listExtensions: boolean | undefined; } @@ -86,17 +88,35 @@ async function parseArguments(): Promise { description: 'Run in debug mode?', default: false, }) - .option('all_files', { - alias: 'a', + .option('all-files', { + alias: ['a'], type: 'boolean', description: 'Include ALL files in context?', default: false, }) + .option('all_files', { + type: 'boolean', + description: 'Include ALL files in context?', + default: false, + }) + .deprecateOption( + 'all_files', + 'Use --all-files instead. We will be removing --all_files in the coming weeks.', + ) + .option('show-memory-usage', { + type: 'boolean', + description: 'Show memory usage in status bar', + default: false, + }) .option('show_memory_usage', { type: 'boolean', description: 'Show memory usage in status bar', default: false, }) + .deprecateOption( + 'show_memory_usage', + 'Use --show-memory-usage instead. We will be removing --show_memory_usage in the coming weeks.', + ) .option('yolo', { alias: 'y', type: 'boolean', @@ -224,9 +244,9 @@ export async function loadCliConfig( let mcpServers = mergeMcpServers(settings, activeExtensions); const excludeTools = mergeExcludeTools(settings, activeExtensions); - if (argv['allowed-mcp-server-names']) { + if (argv.allowedMcpServerNames) { const allowedNames = new Set( - argv['allowed-mcp-server-names'].split(',').filter(Boolean), + argv.allowedMcpServerNames.split(',').filter(Boolean), ); if (allowedNames.size > 0) { mcpServers = Object.fromEntries( @@ -246,7 +266,7 @@ export async function loadCliConfig( targetDir: process.cwd(), debugMode, question: argv.prompt || '', - fullContext: argv.all_files || false, + fullContext: argv.allFiles || argv.all_files || false, coreTools: settings.coreTools || undefined, excludeTools, toolDiscoveryCommand: settings.toolDiscoveryCommand, @@ -257,7 +277,10 @@ export async function loadCliConfig( geminiMdFileCount: fileCount, approvalMode: argv.yolo || false ? ApprovalMode.YOLO : ApprovalMode.DEFAULT, showMemoryUsage: - argv.show_memory_usage || settings.showMemoryUsage || false, + argv.showMemoryUsage || + argv.show_memory_usage || + settings.showMemoryUsage || + false, accessibility: settings.accessibility, telemetry: { enabled: argv.telemetry ?? settings.telemetry?.enabled, diff --git a/packages/cli/src/config/sandboxConfig.ts b/packages/cli/src/config/sandboxConfig.ts index 5334c64b..c4ae50c4 100644 --- a/packages/cli/src/config/sandboxConfig.ts +++ b/packages/cli/src/config/sandboxConfig.ts @@ -14,7 +14,7 @@ import { Settings } from './settings.js'; // to avoid circular dependencies. interface SandboxCliArgs { sandbox?: boolean | string; - 'sandbox-image'?: string; + sandboxImage?: string; } const VALID_SANDBOX_COMMANDS: ReadonlyArray = [ @@ -99,7 +99,7 @@ export async function loadSandboxConfig( const packageJson = await getPackageJson(); const image = - argv['sandbox-image'] ?? + argv.sandboxImage ?? process.env.GEMINI_SANDBOX_IMAGE ?? packageJson?.config?.sandboxImageUri;