feat(cli): configure policy engine from existing settings (#8348)

This commit is contained in:
Allen Hutchison
2025-09-18 13:44:23 -07:00
committed by GitHub
parent ec0acc486e
commit afba59a953
7 changed files with 1149 additions and 2 deletions
+10 -2
View File
@@ -18,8 +18,16 @@ function ruleMatches(
stringifiedArgs: string | undefined,
): boolean {
// Check tool name if specified
if (rule.toolName && toolCall.name !== rule.toolName) {
return false;
if (rule.toolName) {
// Support wildcard patterns: "serverName__*" matches "serverName__anyTool"
if (rule.toolName.endsWith('__*')) {
const prefix = rule.toolName.slice(0, -3); // Remove "__*"
if (!toolCall.name || !toolCall.name.startsWith(prefix + '__')) {
return false;
}
} else if (toolCall.name !== rule.toolName) {
return false;
}
}
// Check args pattern if specified