fix(cli): fix toolName type and resolve '*' to 'all tools' in policies dialog

This commit is contained in:
Jack Wotherspoon
2026-03-31 16:00:02 -04:00
parent d5da95eb5c
commit f518fd6004
2 changed files with 5 additions and 4 deletions
@@ -65,7 +65,7 @@ describe('buildPolicyListItems', () => {
const rules = [
{ decision: PolicyDecision.ALLOW, toolName: 'run_shell_command' },
{ decision: PolicyDecision.ALLOW, toolName: 'unknown_tool' },
{ decision: PolicyDecision.ALLOW },
{ decision: PolicyDecision.ALLOW, toolName: '*' },
];
const items = buildPolicyListItems(
+4 -3
View File
@@ -38,9 +38,10 @@ export function buildPolicyListItems(
.filter(({ rule }) => rule.decision === decision)
.sort((a, b) => (b.rule.priority ?? 0) - (a.rule.priority ?? 0))
.map(({ rule, index }) => {
const toolDisplayName = rule.toolName
? (toolDisplayNames.get(rule.toolName) ?? rule.toolName)
: 'all tools';
const toolDisplayName =
!rule.toolName || rule.toolName === '*'
? 'all tools'
: (toolDisplayNames.get(rule.toolName) ?? rule.toolName);
const constraint = rule.constraintDisplay;
const source = rule.source ?? '';