# Pre-commit hooks for this repo. # # Created when the shared markdown-naming gate was rolled out. The checks # are `language: system` because they are plain bash already on this # machine; pre-commit must not build an isolated env for them. default_install_hook_types: [pre-commit, post-commit, post-merge, post-rewrite] repos: - repo: local hooks: # Four markdown namespaces (README / CLAUDE* / DOCS* / TODO*), plus the # rule that a TODO carries "REMOVE ME AFTER FINISH" and nothing else may. # Shared gate in ~/src/utils owns the namespaces and the exemption list, so # one repo's idea of a valid name cannot drift from every other repo's. - id: md-naming name: markdown naming convention entry: scripts/check_md_naming.sh language: system files: \.(md|markdown)$ - id: todo-closer name: close Todo trailer tasks entry: scripts/todo_hooks.sh closer language: system stages: [post-commit] always_run: true pass_filenames: false - id: todo-import-pr-merge name: import PR Todo sections (pull) entry: scripts/todo_hooks.sh import-pr post-merge language: system stages: [post-merge] always_run: true pass_filenames: false - id: todo-import-pr-rewrite name: import PR Todo sections (pull --rebase) entry: scripts/todo_hooks.sh import-pr post-rewrite language: system stages: [post-rewrite] always_run: true pass_filenames: false # Shared 250-line cap on every file in the commit, code and prose alike. # Checks only what is staged, so an unrelated commit never goes red, and # it fails rather than warns: no baseline, no allowlist. - id: file-length name: files at most 250 lines entry: scripts/check_file_length.sh language: system types: [text] # Every dependency on its ecosystem's newest STABLE release, exact-pinned # so the question is mechanically answerable at all. # # `files:` is what keeps this cheap: a commit touching only source makes # ZERO network requests, and manifest commits mostly hit a 6h disk cache. # # Runs WITHOUT --strict on purpose. Offline it degrades to the cached # answer and passes with a loud banner; `--no-verify` is banned here, so # a hook that hard-failed on a flaky connection would leave no way to # commit at all. CI, always online, is the strict authority. - id: dependency-freshness name: dependencies on newest stable entry: scripts/check_dependency_freshness.sh language: system pass_filenames: true files: >- (pubspec\.(yaml|lock)|pyproject\.toml|requirements.*\.txt|uv\.lock |package\.json|package-lock\.json|pnpm-lock\.yaml |Cargo\.(toml|lock)|go\.(mod|sum) |\.fvmrc|\.nvmrc|\.python-version |\.github/workflows/.*\.ya?ml)$ - id: repo-contract name: repo contract (CLAUDE.md Commands + test_changed) entry: scripts/check_repo_contract.sh language: system pass_filenames: false files: ^(CLAUDE\.md|AGENTS\.md|scripts/test_changed\.sh)$