Expand description
Per-step, per-file hook result cache.
Tracks which staged files have already passed each hook step (by content hash), enabling partial retries and skipping unchanged work on big merges.
Cache location: ~/.cache/sr/hooks/<repo-id>/step-cache.json
Structs§
- Step
Cache - Per-step cache of file content hashes that have passed hook checks.
- Step
Diff - Result of checking which files need re-running for a step.
Functions§
- cache_
dir - Resolve cache directory:
~/.cache/sr/hooks/<repo-id>/ - changed_
files_ for_ step - Determine which files have changed since they were last cached for a step.
- hash_
staged_ files - Compute content hashes for a set of staged files.
- load_
step_ cache - Load the step cache from disk. Returns
Defaulton any error (graceful degradation — worst case is a full re-run). - record_
step_ pass - Record that all files with the given hashes passed a step.
- save_
step_ cache - Save the step cache to disk.
- staged_
content_ hash - Hash the staged blob content for a file using
git show :0:<path>.