mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 18:14:29 -07:00
feat(cli): sanitize ANSI escape sequences in non-interactive output (#17172)
This commit is contained in:
@@ -83,6 +83,8 @@ export interface CliArgs {
|
||||
outputFormat: string | undefined;
|
||||
fakeResponses: string | undefined;
|
||||
recordResponses: string | undefined;
|
||||
rawOutput: boolean | undefined;
|
||||
acceptRawOutputRisk: boolean | undefined;
|
||||
}
|
||||
|
||||
export async function parseArguments(
|
||||
@@ -248,6 +250,15 @@ export async function parseArguments(
|
||||
type: 'string',
|
||||
description: 'Path to a file to record model responses for testing.',
|
||||
hidden: true,
|
||||
})
|
||||
.option('raw-output', {
|
||||
type: 'boolean',
|
||||
description:
|
||||
'Disable sanitization of model output (e.g. allow ANSI escape sequences). WARNING: This can be a security risk if the model output is untrusted.',
|
||||
})
|
||||
.option('accept-raw-output-risk', {
|
||||
type: 'boolean',
|
||||
description: 'Suppress the security warning when using --raw-output.',
|
||||
}),
|
||||
)
|
||||
// Register MCP subcommands
|
||||
@@ -759,6 +770,8 @@ export async function loadCliConfig(
|
||||
retryFetchErrors: settings.general?.retryFetchErrors,
|
||||
ptyInfo: ptyInfo?.name,
|
||||
disableLLMCorrection: settings.tools?.disableLLMCorrection,
|
||||
rawOutput: argv.rawOutput,
|
||||
acceptRawOutputRisk: argv.acceptRawOutputRisk,
|
||||
modelConfigServiceConfig: settings.modelConfigs,
|
||||
// TODO: loading of hooks based on workspace trust
|
||||
enableHooks:
|
||||
|
||||
Reference in New Issue
Block a user