From b61330163e89b10c540f8a4ec83615b7cb05bbc5 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Thu, 12 Mar 2026 22:07:17 -0500 Subject: [PATCH] tests/gemini-cli: add policy assertions Signed-off-by: Austin Horstman --- tests/modules/programs/gemini-cli/my-rules.toml | 5 +++++ .../programs/gemini-cli/other-rules.toml | 4 ++++ tests/modules/programs/gemini-cli/settings.nix | 17 +++++++++++++++++ 3 files changed, 26 insertions(+) create mode 100644 tests/modules/programs/gemini-cli/my-rules.toml create mode 100644 tests/modules/programs/gemini-cli/other-rules.toml diff --git a/tests/modules/programs/gemini-cli/my-rules.toml b/tests/modules/programs/gemini-cli/my-rules.toml new file mode 100644 index 00000000..0d8b2ad9 --- /dev/null +++ b/tests/modules/programs/gemini-cli/my-rules.toml @@ -0,0 +1,5 @@ +[[rule]] +commandPrefix = "git " +decision = "ask_user" +priority = 100 +toolName = "run_shell_command" diff --git a/tests/modules/programs/gemini-cli/other-rules.toml b/tests/modules/programs/gemini-cli/other-rules.toml new file mode 100644 index 00000000..30b1911d --- /dev/null +++ b/tests/modules/programs/gemini-cli/other-rules.toml @@ -0,0 +1,4 @@ +[[rule]] +toolName = "read_file" +decision = "allow" +priority = 50 diff --git a/tests/modules/programs/gemini-cli/settings.nix b/tests/modules/programs/gemini-cli/settings.nix index 80a4344a..92ced6b9 100644 --- a/tests/modules/programs/gemini-cli/settings.nix +++ b/tests/modules/programs/gemini-cli/settings.nix @@ -20,6 +20,19 @@ description = "Generates a fix for a given GitHub issue."; }; }; + policies = { + "my-rules" = { + rule = [ + { + toolName = "run_shell_command"; + commandPrefix = "git "; + decision = "ask_user"; + priority = 100; + } + ]; + }; + "other-rules" = ./other-rules.toml; + }; }; nmt.script = '' assertFileExists home-files/.gemini/settings.json @@ -29,6 +42,10 @@ ${./changelog.toml} assertFileContent home-files/.gemini/commands/git/fix.toml \ ${./fix.toml} + assertFileContent home-files/.gemini/policies/my-rules.toml \ + ${./my-rules.toml} + assertFileContent home-files/.gemini/policies/other-rules.toml \ + ${./other-rules.toml} assertFileExists home-path/etc/profile.d/hm-session-vars.sh assertFileContains home-path/etc/profile.d/hm-session-vars.sh \