diff --git a/_installer_import/.pre-commit-config.yaml b/_installer_import/.pre-commit-config.yaml index 5ad7e44..01e52c5 100644 --- a/_installer_import/.pre-commit-config.yaml +++ b/_installer_import/.pre-commit-config.yaml @@ -3,6 +3,7 @@ # 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: @@ -16,6 +17,30 @@ repos: 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. diff --git a/_installer_import/scripts/todo_hooks.sh b/_installer_import/scripts/todo_hooks.sh new file mode 100755 index 0000000..168dc7b --- /dev/null +++ b/_installer_import/scripts/todo_hooks.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Shim: forward to the shared todo git hooks in ~/src/utils (silent if absent). +set -euo pipefail + +readonly SHARED="${UTILS_ROOT:-$HOME/src/utils}/scripts/todo_hooks.sh" + +main() { + [[ -f "$SHARED" ]] || exit 0 + exec bash "$SHARED" "$@" +} + +main "$@"