feat(policy): add source tracking to policy rules (#16670)

This commit is contained in:
Allen Hutchison
2026-01-15 08:06:07 -08:00
committed by GitHub
parent fa3981990c
commit f909c9ef90
6 changed files with 25 additions and 1 deletions
@@ -72,6 +72,7 @@ describe('policiesCommand', () => {
{
decision: PolicyDecision.ALLOW,
argsPattern: /safe/,
source: 'test.toml',
},
{
decision: PolicyDecision.ASK_USER,
@@ -101,7 +102,9 @@ describe('policiesCommand', () => {
expect(content).toContain(
'1. **DENY** tool: `dangerousTool` [Priority: 10]',
);
expect(content).toContain('2. **ALLOW** all tools (args match: `safe`)');
expect(content).toContain(
'2. **ALLOW** all tools (args match: `safe`) [Source: `test.toml`]',
);
expect(content).toContain('3. **ASK_USER** all tools');
});
});
@@ -53,6 +53,9 @@ const listPoliciesCommand: SlashCommand = {
if (rule.priority !== undefined) {
content += ` [Priority: ${rule.priority}]`;
}
if (rule.source) {
content += ` [Source: \`${rule.source}\`]`;
}
content += '\n';
});