Skip to content

Commit ccd2ca5

Browse files
authored
Merge pull request #257 from Coldaine/chore/migrate-git-hooks
chore: migrate to mise + lint-staged git hooks
2 parents 7231ea6 + 73a018d commit ccd2ca5

File tree

8 files changed

+84
-317
lines changed

8 files changed

+84
-317
lines changed

.git-hooks/pre-commit-injection-tests

Lines changed: 0 additions & 52 deletions
This file was deleted.

.githooks/pre-commit

Lines changed: 0 additions & 26 deletions
This file was deleted.

.lintstagedrc.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"*.rs": [
3+
"cargo fmt --"
4+
],
5+
"{package.json,package-lock.json,Cargo.toml,Cargo.lock}": [
6+
"mise run check:lockfiles"
7+
],
8+
".github/workflows/*.{yml,yaml}": [
9+
"mise run actionlint"
10+
],
11+
"*": [
12+
"mise run typos"
13+
]
14+
}

.pre-commit-config.yaml

Lines changed: 0 additions & 172 deletions
This file was deleted.

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@
44
- Install Rust (stable) and required system dependencies for your platform.
55
- Use the provided scripts in `scripts/` to help with local environment setup.
66

7-
### Developer Git Hooks (optional but recommended)
7+
### Developer Git Hooks
88

9-
To reduce the chance of CI failures from formatting, this repository includes a small pre-commit hook that runs `cargo fmt --all` before each commit and blocks the commit if `rustfmt` makes changes. To enable it for your local clone:
9+
This project uses a "Zero-Latency" git hook standard powered by **[mise](https://mise.jdx.dev)** and **lint-staged**.
1010

11+
### Setup
12+
1. **Install mise**: `curl https://mise.run | sh` (or see [docs](https://mise.jdx.dev/getting-started.html))
13+
2. **Install dependencies**: `mise install`
14+
3. **Activate hooks**: `mise run prepare` (runs automatically on `npm install`)
15+
16+
Hooks will now run automatically on `git commit`. To run manually:
1117
```bash
12-
cd <repo-root>
13-
./scripts/install-githooks.sh
18+
mise run pre-commit
1419
```
1520

16-
This copies the hooks from `.githooks/` into `.git/hooks/` and makes them executable. You can remove or modify the hook if you want a different behavior.
17-
1821
# ColdVox
1922

2023
> ⚠️ **Internal Alpha** - This project is in early development and not ready for production use.

mise.toml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# mise.toml
2+
# Universal Toolchain Standard - Nov 2025
3+
# Context: Solo Developer / 50+ Repos
4+
5+
min_version = "2024.11.1"
6+
7+
[tools]
8+
# --- Core Runtimes ---
9+
# Pinned to latest stable versions as of Nov 2025
10+
node = "22" # LTS
11+
python = "3.13" # Stable (Performance Improvements)
12+
rust = "stable" # Latest Stable
13+
# go = "1.23" # Not currently used in ColdVox
14+
15+
# --- Utility Toolchain ---
16+
# High-performance replacements for legacy tools
17+
uv = "latest" # Replaces pip/poetry (Rust-based)
18+
ripgrep = "latest" # Fast search
19+
jq = "latest" # JSON processor
20+
actionlint = "latest" # GitHub Actions linter
21+
typos = "latest" # Source code spell checker
22+
23+
[env]
24+
# --- Environment Consistency ---
25+
# Prioritize local node_modules binaries.
26+
# This allows running 'eslint' directly without 'npx', saving network/startup time.
27+
_.path = ["{{config_root}}/node_modules/.bin"]
28+
PYTHONIOENCODING = "utf-8"
29+
30+
[tasks.pre-commit]
31+
description = "Universal Git Pre-commit Hook"
32+
# CRITICAL: Invokes the local lint-staged binary directly via mise exec.
33+
# Avoids 'npx' to prevent registry lookup latency.
34+
run = "lint-staged"
35+
36+
# --- TASK DELEGATION LAYER ---
37+
# lint-staged delegates logic here.
38+
39+
[tasks."fmt:rust"]
40+
description = "Format & Lint Rust (Cargo)"
41+
run = """
42+
cargo fmt --
43+
# --allow-dirty is required because hooks run on dirty states by definition
44+
cargo clippy --fix --allow-dirty --allow-staged --all-targets --locked -- -D warnings
45+
"""
46+
47+
[tasks."check:lockfiles"]
48+
description = "Prevent Lockfile Drift"
49+
# Runs a dry-run install to verify lockfiles match manifests.
50+
run = """
51+
#!/bin/bash
52+
if [ -f package-lock.json ]; then npm ci --dry-run; fi
53+
"""
54+
55+
[tasks.actionlint]
56+
description = "Lint GitHub Actions"
57+
run = "actionlint"
58+
59+
[tasks.typos]
60+
description = "Spell Check"
61+
run = "typos"

scripts/install-githooks.sh

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)