pre-commitlisted
Install: claude install-skill TsukiNi22/ai-utils
# xstyle pre-commit hook
`SKILL_DIR` = the directory of this file.
- `templates/pre-commit`: the hook (bash, config block at the top, readable by the user).
- `scripts/install_hook.sh install|remove|status [options]` (`--help`), also `curl -fsSL https://raw.githubusercontent.com/TsukiNi22/ai-utils/main/setup.sh | bash -s -- hook [command] [options]`
run from the repository.
- `scripts/demo_repo.sh [dir] [options]`: throwaway repository (`/tmp/xstyle-hook-demo`) with one file per verdict
and `TRY.md` listing the scenarios.
The hook runs **locally** at each `git commit` (before the commit exists), never on GitHub: the remote check is the
style job of `ci-cd` (`templates/style.yml`). Both are complementary (local = fast feedback, skippable; CI = enforced).
## Behavior (defaults)
| Case | Result |
|---|---|
| xstyle not installed | warning `xstyle not found`, commit accepted (`--missing warn`) |
| unforgivable / major issue | issues listed, **commit refused** (`--fail-on major`) |
| minor issue only | issues listed + warning, commit accepted (`--warn-on minor`) |
| negligible only / clean | silent, commit accepted |
| mandatory rule (R34) | never counted: neither refuses nor warns; shown with the issues when xstyle prints them (`--r34` / `XSTYLE_R34=1` or `--extra "--r34"` hides it) |
| xstyle crashes | warning, commit accepted (never blocks on a tool error) |
Skip once: `git commit --no-verify` or `XSTYLE_HOOK=0 git commit ...`. Fix: `xstyle --fix --staged` then `git add