GM-004: Invalid Gemini Hooks Configuration - Gemini CLI
Summary
- Rule ID:
GM-004 - Severity:
MEDIUM - Category:
Gemini CLI - Normative Level:
MUST - Auto-Fix:
No - Verified On:
2026-10-17
Applicability
- Tool:
gemini-cli - Version Range:
unspecified - Spec Revision:
unspecified
Evidence Sources
- https://geminicli.com/docs/hooks
- https://geminicli.com/docs/hooks/reference
- https://geminicli.com/docs/reference/configuration
- https://geminicli.com/docs/extensions/reference
- https://raw.githubusercontent.com/google-gemini/gemini-cli/main/packages/cli/src/config/extension-manager.ts
Test Coverage Metadata
- Unit tests:
true - Fixture tests:
true - E2E tests:
false
Examples
The following examples demonstrate what triggers this rule and how to fix it.
Invalid
{"hooksConfig":{"BeforeTool":[{"type":"command","command":"echo test"}]},"hooks":{"PreToolUse":[{"hooks":[{"type":"prompt"}]}]}}
Valid
{"hooksConfig":{"enabled":true,"disabled":[]},"hooks":{"BeforeTool":[{"matcher":"write_file|replace","hooks":[{"name":"security-check","type":"command","command":"$GEMINI_PROJECT_DIR/.gemini/hooks/security.sh","timeout":5000}]}]}}