mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 14:10:37 -07:00
feat(policy): Introduce config-based policy engine with TOML configuration (#11992)
This commit is contained in:
@@ -507,7 +507,31 @@ export async function loadCliConfig(
|
||||
throw err;
|
||||
}
|
||||
|
||||
const policyEngineConfig = createPolicyEngineConfig(settings, approvalMode);
|
||||
const policyEngineConfig = await createPolicyEngineConfig(
|
||||
settings,
|
||||
approvalMode,
|
||||
);
|
||||
|
||||
// Debug: Log the merged policy configuration
|
||||
// Only log when message bus integration is enabled (when policies are active)
|
||||
const enableMessageBusIntegration =
|
||||
settings.tools?.enableMessageBusIntegration ?? false;
|
||||
if (enableMessageBusIntegration) {
|
||||
debugLogger.debug('=== Policy Engine Configuration ===');
|
||||
debugLogger.debug(
|
||||
`Default decision: ${policyEngineConfig.defaultDecision}`,
|
||||
);
|
||||
debugLogger.debug(`Total rules: ${policyEngineConfig.rules?.length || 0}`);
|
||||
if (policyEngineConfig.rules && policyEngineConfig.rules.length > 0) {
|
||||
debugLogger.debug('Rules (sorted by priority):');
|
||||
policyEngineConfig.rules.forEach((rule, index) => {
|
||||
debugLogger.debug(
|
||||
` [${index}] toolName: ${rule.toolName || '*'}, decision: ${rule.decision}, priority: ${rule.priority}, argsPattern: ${rule.argsPattern ? rule.argsPattern.source : 'none'}`,
|
||||
);
|
||||
});
|
||||
}
|
||||
debugLogger.debug('===================================');
|
||||
}
|
||||
|
||||
const allowedTools = argv.allowedTools || settings.tools?.allowed || [];
|
||||
const allowedToolsSet = new Set(allowedTools);
|
||||
@@ -672,8 +696,7 @@ export async function loadCliConfig(
|
||||
format: (argv.outputFormat ?? settings.output?.format) as OutputFormat,
|
||||
},
|
||||
useModelRouter,
|
||||
enableMessageBusIntegration:
|
||||
settings.tools?.enableMessageBusIntegration ?? false,
|
||||
enableMessageBusIntegration,
|
||||
codebaseInvestigatorSettings:
|
||||
settings.experimental?.codebaseInvestigatorSettings,
|
||||
fakeResponses: argv.fakeResponses,
|
||||
|
||||
Reference in New Issue
Block a user