mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-03 00:14:28 -07:00
feat: Deprecate tool args in favor of policy engine
Deprecate `--allowedTools`, `--excludeTools`, and `--coreTools` in favor of the Policy Engine. Display a warning when `allowed-tools` CLI argument is used. Fixes #11302
This commit is contained in:
@@ -177,7 +177,8 @@ export async function parseArguments(
|
|||||||
type: 'array',
|
type: 'array',
|
||||||
string: true,
|
string: true,
|
||||||
nargs: 1,
|
nargs: 1,
|
||||||
description: 'Tools that are allowed to run without confirmation',
|
description:
|
||||||
|
'[DEPRECATED: Use Policy Engine instead See https://geminicli.com/docs/core/policy-engine] Tools that are allowed to run without confirmation.',
|
||||||
coerce: (tools: string[]) =>
|
coerce: (tools: string[]) =>
|
||||||
// Handle comma-separated values
|
// Handle comma-separated values
|
||||||
tools.flatMap((tool) => tool.split(',').map((t) => t.trim())),
|
tools.flatMap((tool) => tool.split(',').map((t) => t.trim())),
|
||||||
|
|||||||
@@ -518,6 +518,16 @@ export async function main() {
|
|||||||
|
|
||||||
adminControlsListner.setConfig(config);
|
adminControlsListner.setConfig(config);
|
||||||
|
|
||||||
|
// Show deprecation warning only for allowedTools as that's the only one set by the user currently via command line args
|
||||||
|
if (config.getAllowedTools() !== undefined) {
|
||||||
|
setTimeout(() => {
|
||||||
|
coreEvents.emitFeedback(
|
||||||
|
'warning',
|
||||||
|
`The allowed-tools cli argument is deprecated and will be removed in Gemini CLI 1.0: Please use the Policy Engine to manage tool permissions instead: https://geminicli.com/docs/core/policy-engine/`,
|
||||||
|
);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (config.isInteractive() && config.storage && config.getDebugMode()) {
|
if (config.isInteractive() && config.storage && config.getDebugMode()) {
|
||||||
const { registerActivityLogger } = await import(
|
const { registerActivityLogger } = await import(
|
||||||
'./utils/activityLogger.js'
|
'./utils/activityLogger.js'
|
||||||
|
|||||||
@@ -376,8 +376,11 @@ export interface ConfigParameters {
|
|||||||
debugMode: boolean;
|
debugMode: boolean;
|
||||||
question?: string;
|
question?: string;
|
||||||
|
|
||||||
|
/** @deprecated Use the Policy System instead. See https://geminicli.com/docs/core/policy-engine/ */
|
||||||
coreTools?: string[];
|
coreTools?: string[];
|
||||||
|
/** @deprecated Use the Policy System instead. See https://geminicli.com/docs/core/policy-engine/ */
|
||||||
allowedTools?: string[];
|
allowedTools?: string[];
|
||||||
|
/** @deprecated Use the Policy System instead. See https://geminicli.com/docs/core/policy-engine/ */
|
||||||
excludeTools?: string[];
|
excludeTools?: string[];
|
||||||
toolDiscoveryCommand?: string;
|
toolDiscoveryCommand?: string;
|
||||||
toolCallCommand?: string;
|
toolCallCommand?: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user