refined cli (#365)

This commit is contained in:
Olcan 2025-05-15 11:38:33 -07:00 committed by GitHub
parent f3d9a499dd
commit 4cc1dde625
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 18 deletions

View File

@ -48,8 +48,8 @@ const DEFAULT_IGNORE_DIRECTORIES = [
interface CliArgs { interface CliArgs {
model: string | undefined; model: string | undefined;
sandbox: boolean | string | undefined; sandbox: boolean | string | undefined;
debug_mode: boolean | undefined; debug: boolean | undefined;
question: string | undefined; prompt: string | undefined;
full_context: boolean | undefined; full_context: boolean | undefined;
} }
@ -58,31 +58,29 @@ async function parseArguments(): Promise<CliArgs> {
.option('model', { .option('model', {
alias: 'm', alias: 'm',
type: 'string', type: 'string',
description: `The Gemini model to use. Defaults to ${DEFAULT_GEMINI_MODEL}.`, description: `Model`,
default: process.env.GEMINI_CODE_MODEL || DEFAULT_GEMINI_MODEL, default: process.env.GEMINI_CODE_MODEL || DEFAULT_GEMINI_MODEL,
}) })
.option('prompt', {
alias: 'p',
type: 'string',
description: 'Prompt. Appended to input on stdin (if any).',
})
.option('sandbox', { .option('sandbox', {
alias: 's', alias: 's',
type: 'boolean', type: 'boolean',
description: 'Whether to run in sandbox mode. Defaults to false.', description: 'Run in sandbox?',
}) })
.option('debug_mode', { .option('debug', {
alias: 'z', alias: 'd',
type: 'boolean', type: 'boolean',
description: 'Whether to run in debug mode. Defaults to false.', description: 'Run in debug mode?',
default: false, default: false,
}) })
.option('question', {
alias: 'q',
type: 'string',
description:
'The question to pass to the command when using piped input.',
})
.option('full_context', { .option('full_context', {
alias: 'f', alias: 'a',
type: 'boolean', type: 'boolean',
description: description: 'Include ALL files in context?',
'Recursively include all files within the current directory as context.',
default: false, default: false,
}) })
.help() .help()
@ -366,7 +364,7 @@ export async function loadCliConfig(settings: Settings): Promise<Config> {
} }
const argv = await parseArguments(); const argv = await parseArguments();
const debugMode = argv.debug_mode || false; const debugMode = argv.debug || false;
const { memoryContent, fileCount } = await loadHierarchicalGeminiMemory( const { memoryContent, fileCount } = await loadHierarchicalGeminiMemory(
process.cwd(), process.cwd(),
@ -382,7 +380,7 @@ export async function loadCliConfig(settings: Settings): Promise<Config> {
argv.sandbox ?? settings.sandbox ?? false, argv.sandbox ?? settings.sandbox ?? false,
process.cwd(), process.cwd(),
debugMode, debugMode,
argv.question || '', argv.prompt || '',
argv.full_context || false, argv.full_context || false,
settings.toolDiscoveryCommand, settings.toolDiscoveryCommand,
settings.toolCallCommand, settings.toolCallCommand,