grip_hook.config¶
grip_hook.config ¶
Configuration loading.
Precedence, highest first:
- Command-line flags.
GRIP_*environment variables..grip.tomlat the repository root.[tool.grip]inpyproject.tomlat the repository root.- Built-in defaults.
Config
dataclass
¶
Resolved grip configuration.
Source code in src/grip_hook/config.py
passing_score
class-attribute
instance-attribute
¶
Minimum Grip Score (0-100) required to let the commit or push through.
provider
class-attribute
instance-attribute
¶
Provider name: anthropic, openai, ollama, claude-code, codex,
gemini or fake.
model
class-attribute
instance-attribute
¶
Model identifier passed to the provider. Empty means the provider's default.
effort
class-attribute
instance-attribute
¶
Reasoning effort for providers that support it. none disables the parameter.
api_key_env
class-attribute
instance-attribute
¶
Environment variable holding the API key. Empty means the provider's default.
base_url
class-attribute
instance-attribute
¶
Override the provider's API base URL (Ollama, proxies, OpenAI-compatible servers).
difficulty
class-attribute
instance-attribute
¶
How demanding the questions and grading are.
max_diff_bytes
class-attribute
instance-attribute
¶
Diffs larger than this are truncated before being sent to the provider.
exclude
class-attribute
instance-attribute
¶
Path globs excluded from the diff (lockfiles, generated code).
remember_passes_hours
class-attribute
instance-attribute
¶
How long a passed diff stays valid without re-quizzing. 0 disables.
require_tty
class-attribute
instance-attribute
¶
Fail instead of skipping when no interactive terminal is available.
fail_open
class-attribute
instance-attribute
¶
Let the commit or push through when the provider errors out instead of blocking.
timeout
class-attribute
instance-attribute
¶
Per-request timeout in seconds for provider calls.
validate ¶
Raise :class:ConfigError for out-of-range values and return self.
Source code in src/grip_hook/config.py
load_config ¶
load_config(root: Path | None, *, env: dict[str, str] | None = None, overrides: dict[str, Any] | None = None) -> Config
Build the effective :class:Config for a repository.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root
|
Path | None
|
Repository root (where |
required |
env
|
dict[str, str] | None
|
Environment mapping. Defaults to :data: |
None
|
overrides
|
dict[str, Any] | None
|
Values from command-line flags. |
None
|
Source code in src/grip_hook/config.py
describe ¶
Return (name, value) pairs for display.