mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-29 21:23:29 -07:00
repro: add logging to PolicyEngine and HookRunner conversion
This commit is contained in:
@@ -441,6 +441,9 @@ export class HookRunner {
|
||||
text: string,
|
||||
exitCode: number,
|
||||
): HookOutput {
|
||||
if (process.env['CI'] === 'true' || process.env['VERBOSE'] === 'true') {
|
||||
console.log(`[HookRunner] convertPlainTextToHookOutput: exitCode=${exitCode}, text="${text}"`);
|
||||
}
|
||||
if (exitCode === EXIT_CODE_SUCCESS) {
|
||||
// Success - treat as system message or additional context
|
||||
return {
|
||||
|
||||
@@ -360,9 +360,11 @@ export class PolicyEngine {
|
||||
);
|
||||
|
||||
if (match) {
|
||||
debugLogger.debug(
|
||||
`[PolicyEngine.check] MATCHED rule: toolName=${rule.toolName}, decision=${rule.decision}, priority=${rule.priority}, argsPattern=${rule.argsPattern?.source || 'none'}`,
|
||||
);
|
||||
if (process.env['CI'] === 'true' || process.env['VERBOSE'] === 'true') {
|
||||
console.log(
|
||||
`[PolicyEngine.check] MATCHED rule: toolName=${rule.toolName}, decision=${rule.decision}, priority=${rule.priority}, source=${rule.source}`,
|
||||
);
|
||||
}
|
||||
|
||||
if (isShellCommand && toolName) {
|
||||
const shellResult = await this.checkShellCommand(
|
||||
@@ -389,9 +391,11 @@ export class PolicyEngine {
|
||||
|
||||
// Default if no rule matched
|
||||
if (decision === undefined) {
|
||||
debugLogger.debug(
|
||||
`[PolicyEngine.check] NO MATCH - using default decision: ${this.defaultDecision}`,
|
||||
);
|
||||
if (process.env['CI'] === 'true' || process.env['VERBOSE'] === 'true') {
|
||||
console.log(
|
||||
`[PolicyEngine.check] NO MATCH - using default decision: ${this.defaultDecision}`,
|
||||
);
|
||||
}
|
||||
if (toolName && SHELL_TOOL_NAMES.includes(toolName)) {
|
||||
const shellResult = await this.checkShellCommand(
|
||||
toolName,
|
||||
|
||||
Reference in New Issue
Block a user