mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-05 02:40:55 -07:00
docs: fix inconsistent commandRegex example in policy engine (#19027)
This commit is contained in:
@@ -111,6 +111,24 @@ priority = 100
|
||||
expect(result.errors).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should NOT match if ^ is used in commandRegex because it matches against full JSON', async () => {
|
||||
const result = await runLoadPoliciesFromToml(`
|
||||
[[rule]]
|
||||
toolName = "run_shell_command"
|
||||
commandRegex = "^git status"
|
||||
decision = "allow"
|
||||
priority = 100
|
||||
`);
|
||||
|
||||
expect(result.rules).toHaveLength(1);
|
||||
// The generated pattern is "command":"^git status
|
||||
// This will NOT match '{"command":"git status"}' because of the '{"' at the start.
|
||||
expect(
|
||||
result.rules[0].argsPattern?.test('{"command":"git status"}'),
|
||||
).toBe(false);
|
||||
expect(result.errors).toHaveLength(0);
|
||||
});
|
||||
|
||||
it('should expand toolName array', async () => {
|
||||
const result = await runLoadPoliciesFromToml(`
|
||||
[[rule]]
|
||||
|
||||
Reference in New Issue
Block a user