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:
@@ -10,5 +10,8 @@ source_keys:
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `failure-patterns.md` | Hook failure causes and concrete fix suggestions — loaded when hooks fail |
|
||||
| `install.md` | The install flow — read when the user asks to install or set up hooks |
|
||||
| `autoupdate.md` | The autoupdate flow — read when the user asks to bump hook revs |
|
||||
| `clean.md` | The clean flow — read when the user asks to wipe the cache or rebuild environments |
|
||||
| `failure-patterns.md` | Hook failure causes and concrete fix suggestions — read when a hook fails or never fires |
|
||||
| `sources.md` | Provenance: research sources that informed this skill |
|
||||
|
||||
17
plugins/git/skills/pc-run/references/autoupdate.md
Normal file
17
plugins/git/skills/pc-run/references/autoupdate.md
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
source_keys:
|
||||
- context7-pre-commit-com
|
||||
- pre-commit-com
|
||||
---
|
||||
|
||||
# Bumping hook revs with `autoupdate`
|
||||
|
||||
Reached from `SKILL.md`'s Route table when the user asks to update hook versions or bump revs. Self-contained.
|
||||
|
||||
```bash
|
||||
pre-commit autoupdate
|
||||
```
|
||||
|
||||
This rewrites `.pre-commit-config.yaml` in place, so re-read the file afterwards and report which `rev` values changed. It is the one operation in this skill that writes that file, and the exception is deliberate: the rewrite is pre-commit's own, resolved against the hook repos, not a hand edit — which is why `pc-author` hands rev bumps here rather than making them itself.
|
||||
|
||||
Add `--freeze` when the user wants exact SHAs pinned for reproducibility.
|
||||
21
plugins/git/skills/pc-run/references/clean.md
Normal file
21
plugins/git/skills/pc-run/references/clean.md
Normal file
@@ -0,0 +1,21 @@
|
||||
---
|
||||
source_keys:
|
||||
- context7-pre-commit-com
|
||||
- pre-commit-com
|
||||
---
|
||||
|
||||
# Wiping the pre-commit cache
|
||||
|
||||
Reached from `SKILL.md`'s Route table when the user asks to clean the cache or rebuild environments from scratch. Self-contained.
|
||||
|
||||
## Gate — confirm first
|
||||
|
||||
`pre-commit clean` wipes the whole cache at `~/.cache/pre-commit`, forcing every hook environment to be re-downloaded on the next run. Require explicit confirmation before executing it:
|
||||
|
||||
> "This will wipe the entire pre-commit cache. All hook environments will be re-downloaded on next run. Proceed?"
|
||||
|
||||
```bash
|
||||
pre-commit clean
|
||||
```
|
||||
|
||||
Prefer `pre-commit gc` when the goal is only to reclaim disk — it drops unused environments and leaves the ones in use intact, so it needs no confirmation.
|
||||
@@ -18,6 +18,8 @@ git add -u
|
||||
git commit -m "same message"
|
||||
```
|
||||
|
||||
Do NOT reach for `pre-commit install -f` here. That flag overwrites existing hook files in `.git/hooks/`; it has nothing to do with re-staging.
|
||||
|
||||
## Secret detected (gitleaks)
|
||||
|
||||
> Not sourced from the pre-commit research corpus (`context7-pre-commit-com`/`pre-commit-com` cover pre-commit itself, not gitleaks) — general tool knowledge, verify against gitleaks' own docs if precision matters.
|
||||
|
||||
31
plugins/git/skills/pc-run/references/install.md
Normal file
31
plugins/git/skills/pc-run/references/install.md
Normal 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
|
||||
```
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
- **URL:** context7:/pre-commit/pre-commit.com
|
||||
- **Description:** Official pre-commit.com documentation — installation, configuration schema, CLI reference, hook authoring, advanced features, troubleshooting
|
||||
- **Contributing files:** SKILL.md, references/failure-patterns.md
|
||||
- **Contributing files:** SKILL.md, references/install.md, references/autoupdate.md, references/clean.md, references/failure-patterns.md
|
||||
- **Research doc:** plugins/git/docs/research/docs/pre-commit/{overview,cli-reference,troubleshooting}.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
- **URL:** https://pre-commit.com/
|
||||
- **Description:** Pre-commit framework homepage — full docs covering install, config, CLI, hook authoring, stages, local hooks, meta hooks, hazmat helpers, CI integration
|
||||
- **Contributing files:** SKILL.md, references/failure-patterns.md
|
||||
- **Contributing files:** SKILL.md, references/install.md, references/autoupdate.md, references/clean.md, references/failure-patterns.md
|
||||
- **Research doc:** plugins/git/docs/research/docs/pre-commit/{overview,cli-reference,troubleshooting}.md
|
||||
- **Status:** `extracted`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user