Skip to content

Commit 66b80ba

Browse files
committed
docs: document pre-commit hooks in Contributing section
1 parent 089c6f6 commit 66b80ba

1 file changed

Lines changed: 39 additions & 4 deletions

File tree

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,46 @@ before a musl-compatible build is published. Check the CI badge before upgrading
155155
## Contributing
156156

157157
1. Fork and clone
158-
2. Open in the devcontainer (`.devcontainer/devcontainer.json` runs `pre-commit install`
159-
automatically), **or** run `pre-commit install` manually after cloning
158+
2. Install the git hooks (one-time setup):
159+
160+
```bash
161+
pip install pre-commit
162+
pre-commit install # runs on git commit
163+
pre-commit install --hook-type pre-push # runs on git push
164+
```
165+
166+
If you open the repo in the devcontainer, this runs automatically.
167+
160168
3. Changes live in `src/claude-code/install.sh` and `test/claude-code/`
161-
4. Run `pre-commit run --all-files` before committing
162-
5. Open a pull request against `develop`
169+
4. Open a pull request against `develop`
170+
171+
### Pre-commit hooks
172+
173+
The following checks run automatically on every `git commit` and `git push`:
174+
175+
| Hook | What it checks |
176+
| --------------------- | --------------------------------------------- |
177+
| `shellcheck` | Shell script correctness (warnings and above) |
178+
| `shfmt` | Shell script formatting (`-i 4 -ci`) |
179+
| `prettier` | JSON, YAML, and Markdown formatting |
180+
| `markdownlint` | Markdown style rules |
181+
| `check-json` | JSON syntax validity |
182+
| `check-yaml` | YAML syntax validity |
183+
| `trailing-whitespace` | No trailing whitespace |
184+
| `detect-private-key` | No accidentally committed secrets |
185+
| `no-commit-to-branch` | Blocks direct commits to `main` and `develop` |
186+
187+
**Running manually:**
188+
189+
```bash
190+
pre-commit run --all-files # check everything
191+
pre-commit run prettier # check one hook
192+
pre-commit run --files src/claude-code/install.sh # check one file
193+
```
194+
195+
**If a hook fails:** fix the flagged issue and `git add` the changes before retrying. Prettier and
196+
shfmt auto-fix in place — just stage the result. ShellCheck and markdownlint report what to fix but
197+
won't rewrite your code.
163198

164199
## Publishing (Maintainers)
165200

0 commit comments

Comments
 (0)