refactor(pc-run): retrofit to the ADR-0020 context contract

Description 477 -> 211 chars, body 736 -> 367 words. Install, autoupdate,
and clean become flow files behind the Route table.

The audit found no route for 'hooks aren't running': the only pointer to
failure-patterns.md sat inside the failure path, but when hooks never fire
the manual run succeeds, so the request fell to the ambiguity default and
was masked. Restores the disclosure that install -f is not reversible by
uninstall.
This commit is contained in:
2026-08-30 13:10:53 +00:00
parent 7cb8e95379
commit 15ff7417b9
16 changed files with 198 additions and 188 deletions

View File

@@ -0,0 +1,31 @@
---
source_keys:
- context7-pre-commit-com
- pre-commit-com
---
# Installing hooks into `.git/hooks/`
Reached from `SKILL.md`'s Route table when the user asks to install or set up hooks. Self-contained.
Only run this flow when the user explicitly asks for it. Installing rewrites their clone's `.git/hooks/`; it is never a side effect of another request.
## Gate — existing hook files
Check `ls .git/hooks/` first. With hook files already there, `pre-commit install` does not refuse — it silently enters migration mode and runs both. Only `-f` replaces them, and `pre-commit uninstall` cannot restore whatever `-f` overwrote.
So when hook files are present, put the choice to the user in these terms, including the irreversibility, and wait for an answer before passing `-f`:
> "Existing hook files found in `.git/hooks/`. Plain `pre-commit install` runs both; `-f` overwrites them permanently and `pre-commit uninstall` cannot restore them. Plain install, or overwrite?"
## Install
```bash
pre-commit install
```
Re-run with `-t` flags when `default_install_hook_types` changed, or when hooks in a non-default stage never fire — a hook whose stage was never installed cannot run:
```bash
pre-commit install -t pre-commit -t pre-push -t commit-msg
```