diff --git a/plugins/git/.apm/skills/pc-author/references/hooks-by-language.md b/plugins/git/.apm/skills/pc-author/references/hooks-by-language.md index ab8aabe..6276044 100644 --- a/plugins/git/.apm/skills/pc-author/references/hooks-by-language.md +++ b/plugins/git/.apm/skills/pc-author/references/hooks-by-language.md @@ -16,70 +16,34 @@ files but do NOT re-stage them, so the commit is still blocked and the user has again. Say so when proposing one — otherwise the first blocked commit reads as the hook being broken. -## Universal (recommend for every repo) +## `pre-commit/pre-commit-hooks` (rev `v6.0.0`) -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `end-of-file-fixer` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Ensures files end with a newline — prevents spurious diffs | -| `trailing-whitespace` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Strips trailing whitespace — prevents invisible diff noise | -| `check-merge-conflict` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Catches unresolved merge markers before commit | -| `detect-private-key` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks PEM private key material | -| `check-added-large-files` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks accidentally committing large binary files | -| `check-case-conflict` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Catches filenames that would collide on case-insensitive filesystems | -| `mixed-line-ending` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Normalizes line endings | -| `no-commit-to-branch` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks direct commits to protected branches — defaults to blocking `main`+`master` with no args; add `args: [--branch, ]` only to protect additional branch names | +| Hook ID | Language / Context | +|---------|---------------------| +| `end-of-file-fixer` | Universal | +| `trailing-whitespace` | Universal | +| `check-merge-conflict` | Universal | +| `detect-private-key` | Universal | +| `check-added-large-files` | Universal | +| `check-case-conflict` | Universal | +| `mixed-line-ending` | Universal | +| `no-commit-to-branch` | Universal — defaults to blocking `main`+`master` with no args; add `args: [--branch, ]` only to protect additional branch names | +| `check-ast` | Python (`.py`) | +| `check-builtin-literals` | Python (`.py`) | +| `check-json` | JSON (`.json`) | +| `pretty-format-json` | JSON (`.json`) | +| `check-yaml` | YAML (`.yaml`, `.yml`) — for Kubernetes/Helm with custom tags add `args: ['--unsafe']` and `exclude: ^helm/templates/` | +| `check-toml` | TOML (`.toml`) | -## Shell (`.sh`) +Full repo URL: `https://github.com/pre-commit/pre-commit-hooks`. For Python formatting, check if `black`, `ruff`, or `isort` is already configured in `pyproject.toml` before recommending them. -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `shellcheck` | `https://github.com/jumanjihouse/pre-commit-hooks` | `3.0.0` | **Unverified — not in research corpus, verify upstream before use.** Static analysis for shell scripts; catches common errors | +## Other repos -Recommended args: `args: [--severity=warning]` - -## Python (`.py`) - -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `check-ast` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates Python files parse as valid AST | -| `check-builtin-literals` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Enforces literal syntax for `dict()`, `list()` | - -For formatting: check if `black`, `ruff`, or `isort` is already configured in `pyproject.toml` before recommending them. - -## JSON (`.json`) - -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `check-json` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates JSON parses correctly | -| `pretty-format-json` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Auto-formats JSON (fixer — warns user to re-stage after commit) | - -## YAML (`.yaml`, `.yml`) - -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `check-yaml` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates YAML parses correctly | - -For Kubernetes/Helm YAML with custom tags, add `args: ['--unsafe']` and `exclude: ^helm/templates/`. - -## TOML (`.toml`) - -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `check-toml` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates TOML parses correctly | - -## Secrets / security - -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `gitleaks` | `https://github.com/gitleaks/gitleaks` | `v8.30.1` | **Unverified — not in research corpus, verify upstream before use.** Scans for secrets and high-entropy strings | - -## Commit message - -| Hook ID | Repo | Rev | Stage | Rationale | -|---------|------|-----|-------|-----------| -| `conventional-pre-commit` | `https://github.com/compilerla/conventional-pre-commit` | `v2.4.0` | `commit-msg` | Enforces Conventional Commits format | - -When adding commit-msg hooks, also add `default_install_hook_types: [pre-commit, commit-msg]` to the top-level config if not already present. +| Hook ID | Repo | Rev | Notes | +|---------|------|-----|-------| +| `shellcheck` | `https://github.com/jumanjihouse/pre-commit-hooks` | `3.0.0` | **Unverified — not in research corpus, verify upstream before use.** Recommended args: `args: [--severity=warning]` | +| `gitleaks` | `https://github.com/gitleaks/gitleaks` | `v8.30.1` | **Unverified — not in research corpus, verify upstream before use.** | +| `conventional-pre-commit` | `https://github.com/compilerla/conventional-pre-commit` | `v2.4.0` | Stage `commit-msg`; also add `default_install_hook_types: [pre-commit, commit-msg]` to the top-level config if not already present | ## Meta-validation (add last, after all other repos) @@ -125,4 +89,4 @@ Language choices for local hooks: ## Rev pin freshness -The revs above were last verified current at time of writing (matched against the plugin's own research corpus in `docs/research/docs/pre-commit/`; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since the "Rev staleness" check in `references/modify-config.md` treats this table as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat `pre-commit autoupdate`'s own output as the authoritative staleness signal, not a mismatch against this table. +The revs above were last verified current at time of writing (matched against the plugin's own research corpus in `docs/research/docs/pre-commit/`; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since the "Rev staleness" check in `references/modify-config.md` treats these tables as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat `pre-commit autoupdate`'s own output as the authoritative staleness signal, not a mismatch against these tables. diff --git a/plugins/git/.apm/skills/pc-run/references/failure-patterns.md b/plugins/git/.apm/skills/pc-run/references/failure-patterns.md index 5369f84..658bf4e 100644 --- a/plugins/git/.apm/skills/pc-run/references/failure-patterns.md +++ b/plugins/git/.apm/skills/pc-run/references/failure-patterns.md @@ -36,10 +36,7 @@ Suggestions: Cause: shellcheck found a shell script issue. The output includes the file path, line number, and SC-code. -Fix: Look up the SC-code on shellcheck.net or pass `--explain SCxxxx` to shellcheck for a detailed explanation. The most common fixes: -- SC2086 (unquoted variable): wrap in double quotes. -- SC2046 (unquoted command substitution): wrap in double quotes. -- SC2181 (check exit code of `$?`): use `if command; then` directly. +Fix: Look up the SC-code on shellcheck.net or pass `--explain SCxxxx` to shellcheck for a detailed explanation. ## `check-hooks-apply` fails @@ -53,23 +50,6 @@ Cause: An `exclude` pattern matches no files. Fix: Remove or fix the pattern. -## SSH cloning fails in CI - -Cause: The CI environment lacks SSH credentials to clone hook repos over SSH. - -Fix: Export `SSH_AUTH_SOCK` in the CI environment, or switch hook repo URLs to HTTPS. - -## HTTP proxy needed - -Cause: The CI/sandbox network requires a proxy to reach hook repos. - -Fix: -```bash -export http_proxy=http://proxy.example.com:3128 -export https_proxy=http://proxy.example.com:3128 -export no_proxy=localhost,127.0.0.1 -``` - ## `rev` is a branch name — `autoupdate` broke it Cause: Branch refs are mutable and drift over time; pre-commit resolves them once at install time, so pinning to a branch name (instead of a tag or commit SHA) leads to silent version drift. @@ -126,8 +106,4 @@ Or add `default_install_hook_types` to `.pre-commit-config.yaml` and re-run `pre ## `validate-config` schema error -Common causes: -- Missing `id` under a hook block -- Missing `rev` under a non-local repo block -- `repo: local` hook missing `language` or `entry` -- Indentation error (valid YAML but invalid pre-commit schema) +Common causes: missing `id` under a hook block, missing `rev` under a non-local repo block, a `repo: local` hook missing `language` or `entry`, or an indentation error (valid YAML but invalid pre-commit schema). diff --git a/plugins/git/skills/pc-author/references/hooks-by-language.md b/plugins/git/skills/pc-author/references/hooks-by-language.md index ab8aabe..6276044 100644 --- a/plugins/git/skills/pc-author/references/hooks-by-language.md +++ b/plugins/git/skills/pc-author/references/hooks-by-language.md @@ -16,70 +16,34 @@ files but do NOT re-stage them, so the commit is still blocked and the user has again. Say so when proposing one — otherwise the first blocked commit reads as the hook being broken. -## Universal (recommend for every repo) +## `pre-commit/pre-commit-hooks` (rev `v6.0.0`) -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `end-of-file-fixer` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Ensures files end with a newline — prevents spurious diffs | -| `trailing-whitespace` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Strips trailing whitespace — prevents invisible diff noise | -| `check-merge-conflict` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Catches unresolved merge markers before commit | -| `detect-private-key` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks PEM private key material | -| `check-added-large-files` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks accidentally committing large binary files | -| `check-case-conflict` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Catches filenames that would collide on case-insensitive filesystems | -| `mixed-line-ending` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Normalizes line endings | -| `no-commit-to-branch` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Blocks direct commits to protected branches — defaults to blocking `main`+`master` with no args; add `args: [--branch, ]` only to protect additional branch names | +| Hook ID | Language / Context | +|---------|---------------------| +| `end-of-file-fixer` | Universal | +| `trailing-whitespace` | Universal | +| `check-merge-conflict` | Universal | +| `detect-private-key` | Universal | +| `check-added-large-files` | Universal | +| `check-case-conflict` | Universal | +| `mixed-line-ending` | Universal | +| `no-commit-to-branch` | Universal — defaults to blocking `main`+`master` with no args; add `args: [--branch, ]` only to protect additional branch names | +| `check-ast` | Python (`.py`) | +| `check-builtin-literals` | Python (`.py`) | +| `check-json` | JSON (`.json`) | +| `pretty-format-json` | JSON (`.json`) | +| `check-yaml` | YAML (`.yaml`, `.yml`) — for Kubernetes/Helm with custom tags add `args: ['--unsafe']` and `exclude: ^helm/templates/` | +| `check-toml` | TOML (`.toml`) | -## Shell (`.sh`) +Full repo URL: `https://github.com/pre-commit/pre-commit-hooks`. For Python formatting, check if `black`, `ruff`, or `isort` is already configured in `pyproject.toml` before recommending them. -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `shellcheck` | `https://github.com/jumanjihouse/pre-commit-hooks` | `3.0.0` | **Unverified — not in research corpus, verify upstream before use.** Static analysis for shell scripts; catches common errors | +## Other repos -Recommended args: `args: [--severity=warning]` - -## Python (`.py`) - -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `check-ast` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates Python files parse as valid AST | -| `check-builtin-literals` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Enforces literal syntax for `dict()`, `list()` | - -For formatting: check if `black`, `ruff`, or `isort` is already configured in `pyproject.toml` before recommending them. - -## JSON (`.json`) - -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `check-json` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates JSON parses correctly | -| `pretty-format-json` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Auto-formats JSON (fixer — warns user to re-stage after commit) | - -## YAML (`.yaml`, `.yml`) - -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `check-yaml` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates YAML parses correctly | - -For Kubernetes/Helm YAML with custom tags, add `args: ['--unsafe']` and `exclude: ^helm/templates/`. - -## TOML (`.toml`) - -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `check-toml` | `https://github.com/pre-commit/pre-commit-hooks` | `v6.0.0` | Validates TOML parses correctly | - -## Secrets / security - -| Hook ID | Repo | Rev | Rationale | -|---------|------|-----|-----------| -| `gitleaks` | `https://github.com/gitleaks/gitleaks` | `v8.30.1` | **Unverified — not in research corpus, verify upstream before use.** Scans for secrets and high-entropy strings | - -## Commit message - -| Hook ID | Repo | Rev | Stage | Rationale | -|---------|------|-----|-------|-----------| -| `conventional-pre-commit` | `https://github.com/compilerla/conventional-pre-commit` | `v2.4.0` | `commit-msg` | Enforces Conventional Commits format | - -When adding commit-msg hooks, also add `default_install_hook_types: [pre-commit, commit-msg]` to the top-level config if not already present. +| Hook ID | Repo | Rev | Notes | +|---------|------|-----|-------| +| `shellcheck` | `https://github.com/jumanjihouse/pre-commit-hooks` | `3.0.0` | **Unverified — not in research corpus, verify upstream before use.** Recommended args: `args: [--severity=warning]` | +| `gitleaks` | `https://github.com/gitleaks/gitleaks` | `v8.30.1` | **Unverified — not in research corpus, verify upstream before use.** | +| `conventional-pre-commit` | `https://github.com/compilerla/conventional-pre-commit` | `v2.4.0` | Stage `commit-msg`; also add `default_install_hook_types: [pre-commit, commit-msg]` to the top-level config if not already present | ## Meta-validation (add last, after all other repos) @@ -125,4 +89,4 @@ Language choices for local hooks: ## Rev pin freshness -The revs above were last verified current at time of writing (matched against the plugin's own research corpus in `docs/research/docs/pre-commit/`; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since the "Rev staleness" check in `references/modify-config.md` treats this table as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat `pre-commit autoupdate`'s own output as the authoritative staleness signal, not a mismatch against this table. +The revs above were last verified current at time of writing (matched against the plugin's own research corpus in `docs/research/docs/pre-commit/`; rows marked "Unverified" have no such backing and must be checked against upstream before use). Since the "Rev staleness" check in `references/modify-config.md` treats these tables as ground truth, a pin that goes stale here produces false-positive staleness warnings for users who already have a newer, correct rev. Re-verify these pins periodically (e.g. against each repo's latest release tag). When in doubt, treat `pre-commit autoupdate`'s own output as the authoritative staleness signal, not a mismatch against these tables. diff --git a/plugins/git/skills/pc-run/references/failure-patterns.md b/plugins/git/skills/pc-run/references/failure-patterns.md index 5369f84..658bf4e 100644 --- a/plugins/git/skills/pc-run/references/failure-patterns.md +++ b/plugins/git/skills/pc-run/references/failure-patterns.md @@ -36,10 +36,7 @@ Suggestions: Cause: shellcheck found a shell script issue. The output includes the file path, line number, and SC-code. -Fix: Look up the SC-code on shellcheck.net or pass `--explain SCxxxx` to shellcheck for a detailed explanation. The most common fixes: -- SC2086 (unquoted variable): wrap in double quotes. -- SC2046 (unquoted command substitution): wrap in double quotes. -- SC2181 (check exit code of `$?`): use `if command; then` directly. +Fix: Look up the SC-code on shellcheck.net or pass `--explain SCxxxx` to shellcheck for a detailed explanation. ## `check-hooks-apply` fails @@ -53,23 +50,6 @@ Cause: An `exclude` pattern matches no files. Fix: Remove or fix the pattern. -## SSH cloning fails in CI - -Cause: The CI environment lacks SSH credentials to clone hook repos over SSH. - -Fix: Export `SSH_AUTH_SOCK` in the CI environment, or switch hook repo URLs to HTTPS. - -## HTTP proxy needed - -Cause: The CI/sandbox network requires a proxy to reach hook repos. - -Fix: -```bash -export http_proxy=http://proxy.example.com:3128 -export https_proxy=http://proxy.example.com:3128 -export no_proxy=localhost,127.0.0.1 -``` - ## `rev` is a branch name — `autoupdate` broke it Cause: Branch refs are mutable and drift over time; pre-commit resolves them once at install time, so pinning to a branch name (instead of a tag or commit SHA) leads to silent version drift. @@ -126,8 +106,4 @@ Or add `default_install_hook_types` to `.pre-commit-config.yaml` and re-run `pre ## `validate-config` schema error -Common causes: -- Missing `id` under a hook block -- Missing `rev` under a non-local repo block -- `repo: local` hook missing `language` or `entry` -- Indentation error (valid YAML but invalid pre-commit schema) +Common causes: missing `id` under a hook block, missing `rev` under a non-local repo block, a `repo: local` hook missing `language` or `entry`, or an indentation error (valid YAML but invalid pre-commit schema).