Commit ec070be31471

Vincent Demeester <vincent@sbr.pm>
2026-02-20 07:17:09
feat(guardrails): add gh CLI interception rule
Added confirm rule for direct gh pr/issue/run/release/repo commands, suggesting the github tool instead for structured output and approval gates.
1 parent ab1079c
Changed files (1)
dots
pi
agent
extensions
guardrails
dots/pi/agent/extensions/guardrails/index.ts
@@ -68,6 +68,9 @@ const commandRules: CommandRule[] = [
 	{ pattern: /\bnixos-rebuild\s+(switch|boot|test)/, desc: "direct nixos-rebuild", action: "block", suggestion: "Use 'make switch', 'make boot', or 'make host/<hostname>/switch' instead" },
 	{ pattern: /\bhome-manager\s+switch\b/, desc: "direct home-manager switch", action: "block", suggestion: "Use 'make switch' or appropriate make target instead" },
 
+	// gh CLI (confirm: use the github tool instead)
+	{ pattern: /\bgh\s+(pr|issue|run|release|repo)\b/, desc: "gh CLI (use the `github` tool instead for structured output and approval gates)", action: "confirm", suggestion: "Use the `github` tool with the appropriate resource/action instead of direct gh CLI" },
+
 	// Nix commands (confirm)
 	{ pattern: /\bnix\s+eval\b/, desc: "nix eval (arbitrary code execution)", action: "confirm" },
 	{ pattern: /\bnix-build\b/, desc: "nix-build (builds derivations)", action: "confirm" },