Two-layer structure: Sources (raw notes) + Wiki (compile output) Four domains: Dev (40), Venture (3), Homelab (23), Reference (0) Includes CLAUDE.md spec, index pages at all levels, compile log Co-Authored-By: Lovebug <lovebug@herbylab.dev>
6.4 KiB
6.4 KiB
| created | path | project | status | tags | type | updated | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-05-03 | Sources/Dev | pre-commit-framework-migration | active |
|
project-plan | 2026-05-03 |
pre-commit framework migration
Goal
Replace the raw .git/hooks/pre-commit bash script (currently shared via
core.hooksPath) with the pre-commit framework,
and adopt it as the standard for all new repos. Codify a curated set of
checks that catch the mistakes most likely to bite a solo homelab operator
working across Python, Go, Ansible, and YAML-heavy infra repos.
Why
The current raw hook works but has limits:
- not version-controlled (lives in
.git/hooks/, not tracked) - single-purpose (vault encryption check only)
- adding more checks means growing a bash script
- no portability across machines without re-running the
core.hooksPathsetup
The framework solves all four: config lives in .pre-commit-config.yaml at
the repo root, gets committed, and gives access to a large ecosystem of
pre-built hooks.
Scope
In scope
- Install
pre-commitframework on dev machines - Migrate the existing ansible-vault check from raw bash to a framework hook
- Curate a default
.pre-commit-config.yamltemplate covering Python, Go, Ansible, YAML, and secret-detection - Document the install/onboarding flow as the standard for new repos
- Decide how the framework coexists with (or replaces) the current
core.hooksPathsetup - Add the template to project scaffolding so new repos start with it pre-wired
Out of scope
- Migrating every existing repo today (do them as they're touched)
- Full CI integration (pre-commit can also run in GitHub Actions, but that's a follow-up)
- Replacing
zero-checkor other post-generation validation skills
Decisions to confirm
- Coexistence with
core.hooksPath— once the framework is in a repo, itspre-commit installwill overwrite.git/hooks/pre-commitfor that repo. Need to decide: leavecore.hooksPathas a fallback for repos without.pre-commit-config.yaml, or unset it once all active repos are migrated? - Vault check location — keep the bash script in-repo at
scripts/check-vault.sh(referenced as alocalhook), or rewrite as a tiny standalone repo and pin like other framework hooks? - Template repo or scaffold-generated — does the default
.pre-commit-config.yamllive in ahomelab-templatesrepo forweb_fetchaccess, or get generated by the project scaffolding tool?
Curated check list
Grouped by category. Each is a separate hook entry; opt in per repo by what's actually relevant.
Universal (every repo)
trailing-whitespace— strip trailing spacesend-of-file-fixer— ensure files end with a newlinecheck-merge-conflict— block commits with unresolved conflict markerscheck-added-large-files— block accidental large file commits (default 500KB)mixed-line-ending— enforce LFdetect-private-key— block committing SSH/TLS private keys
Secrets & sensitive data
detect-secrets(Yelp) — broader secret scanning beyond just private keys; catches AWS keys, API tokens, high-entropy stringsgitleaks— alternative or complement; well-maintained, fast- Custom: ansible-vault encryption check — port of the existing bash hook
YAML / config
check-yaml— basic YAML syntax validationyamllint— style + structure (line length, indentation, truthy values)check-json— JSON syntaxcheck-toml— TOML syntax
Python
ruff— lint + format in one tool (replaces flake8, isort, black for most cases)ruff-format— formattermypy— optional, type-checking (heavier; opt in per project)
Go
go-fmt— gofmt enforcementgo-vet— basic static analysisgolangci-lint— broader linting (opt in per project)
Ansible-specific
- Custom: ansible-vault encryption check (existing logic, ported)
ansible-lint— full Ansible playbook/role lintingyamllint(already covered above, but Ansible repos lean on it heavily)
Shell scripts
shellcheck— catches common bash bugs and bad patternsshfmt— formatter for shell scripts
Markdown / docs
markdownlint— style/structure for.mdfiles- (Skip if it gets noisy on Obsidian-flavored markdown — the project notes use front-matter and Obsidian syntax that vanilla markdownlint may complain about.)
Migration path
- Pick one active repo as the pilot — likely the new project where this conversation started.
pip install pre-commit(oruv tool install pre-commit) on the dev machine.- Drop in a starter
.pre-commit-config.yamlcovering universal + secrets
- ansible + relevant language checks.
- Port the vault check as a
localhook pointing atscripts/check-vault.sh. pre-commit installto wire it up.pre-commit run --all-filesto flush out anything the existing code violates.- Iterate on the config until baseline is clean.
- Once stable, copy
.pre-commit-config.yamlto the template location (TBD — see decisions). - Decide on
core.hooksPath— leave or unset. - Add
pre-commit installto the project scaffolding flow so new repos get it automatically.
Tasks
- Confirm decisions: coexistence with
core.hooksPath, vault check location, template hosting - Install
pre-commitframework on dev machines - Pilot on one active repo
- Port vault encryption check as a
localhook - Build default
.pre-commit-config.yamltemplate covering universal + secrets + Python + Go + Ansible + YAML - Run
pre-commit run --all-fileson pilot, fix or ignore findings - Document the install/onboarding flow (README section or standalone doc)
- Decide whether to keep or unset
core.hooksPath - Migrate active repos one by one as they're touched
- Add template to scaffolding tool or
homelab-templatesrepo - Evaluate whether to add CI run of
pre-commit run --all-fileson PRs (follow-up)
Open questions
- Does
pre-commitplay well with thezero-checkskill, or is there overlap to resolve? - For Obsidian-flavored markdown, is
markdownlintworth the noise or skip entirely? - Should
mypybe in the default Python config, or opt-in per project?
References
- pre-commit docs: https://pre-commit.com
- Hook list: https://pre-commit.com/hooks.html
- Existing raw hook: stored at
~/.config/git-hooks/pre-commit(percore.hooksPathsetup)
...sent from Jenny & Travis