Skip to main content

Module hook_cache

Module hook_cache 

Source
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§

StepCache
Per-step cache of file content hashes that have passed hook checks.
StepDiff
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 Default on 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>.