Installs pre-commit hooks for OCaml projects that run dune fmt automatically
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Update READMEs with current package list

- Root README: Update to 29 packages, remove deleted ocaml-hkdf
- precommit README: Document current implementation (no Python required)

+35 -8
+35 -8
README.md
··· 4 4 5 5 ## Overview 6 6 7 - This tool sets up pre-commit hooks for OCaml projects: 8 - - **dune-format**: Automatically formats OCaml code using `dune fmt --auto` 9 - - **remove-claude-attribution**: Removes Claude co-author lines and rejects emojis in commit messages 7 + This tool sets up git hooks directly for OCaml projects (no Python required): 8 + - **pre-commit hook**: Automatically formats OCaml code using `dune fmt` 9 + - **commit-msg hook**: Removes Claude co-author lines and rejects emojis in commit messages 10 + - **.ocamlformat**: Creates a default `.ocamlformat` file if missing 10 11 11 12 ## Installation 12 13 ··· 15 16 ``` 16 17 17 18 ## Usage 19 + 20 + ### Initialize hooks 18 21 19 22 Run in an OCaml project directory (where `dune-project` exists): 20 23 ··· 23 26 ``` 24 27 25 28 This creates: 26 - - `.pre-commit-config.yaml` - Hook configuration 27 - - `.hooks/remove-claude-lines.py` - Commit message filter 29 + - `.git/hooks/pre-commit` - Runs `dune fmt` on staged OCaml files 30 + - `.git/hooks/commit-msg` - Filters commit messages 31 + - `.ocamlformat` - Default ocamlformat configuration (if missing) 32 + 33 + ### Check status 34 + 35 + ```bash 36 + precommit status 37 + ``` 38 + 39 + Shows which hooks are installed. Exit code is 1 if any OCaml project is missing hooks or `.ocamlformat`. 40 + 41 + ### Check git history 42 + 43 + ```bash 44 + precommit check 45 + ``` 46 + 47 + Scans git history for commits with AI attribution patterns. 48 + 49 + ### Recursive operation 50 + 51 + Use `-r` to operate on all OCaml projects in subdirectories: 28 52 29 - And runs `pre-commit install` to activate the hooks. 53 + ```bash 54 + precommit init -r 55 + precommit status -r 56 + precommit check -r 57 + ``` 30 58 31 59 ### Dry run 32 60 ··· 38 66 39 67 ## Requirements 40 68 41 - - [pre-commit](https://pre-commit.com/) must be installed 42 - - Python 3 (for the commit message hook) 69 + - git 43 70 - dune (for code formatting) 44 71 45 72 ## License