Releases: pplmx/husky-rs
Releases · pplmx/husky-rs
v0.3.3
🐛 Bug Fixes
cargo:rerun-if-changedwatched wrong directory: The build script monitored husky-rs's own.husky/instead of the user's project.husky/. Ifcargo build/cargo testran before.husky/existed, subsequent runs were cached and never re-ran —core.hooksPathwas never set, hooks never triggered. (#15)- Submodule and worktree support:
.gitfiles were not correctly parsed (missinggitdir:prefix stripping). Hooks were silently never installed in submodules and git worktrees. GitConfigFailednow tolerated: Build no longer fails ifgitis unavailable on PATH (e.g. NixOS without nix-shell). Users can fall back tohusky initmanually.
✨ Improvements
- Windows compatibility: Hook trigger tests now convert backslashes to forward slashes for Git Bash compatibility.
- Comprehensive test coverage: Added 17 new tests covering lazy hook creation, idempotent repeated execution, mixed
cargo test/cargo build, hook triggering (pre-commit, commit-msg, post-commit, failure abort), CLI full workflow, andgitfailure graceful degradation.
v0.3.2
🚀 Improvements & Refinements
- Lean Implementation: Removed
.husky/_/husky.shin favor of direct skip logic in hook templates, keeping the.husky/directory clean. - Improved templates:
husky addnow generates hooks with[ "$HUSKY" = "0" ] && exit 0for explicit and transparent skip logic. - Robustness: Enhanced
build.rsandhusky initto gracefully handle environments without Git or outside a Git repository. - Incremental efficiency:
build.rsnow skips redundantgit configcalls ifcore.hooksPathis already correctly set.
v0.3.1
Some minor fixes and improvements
- Just linting and clippy updates, no major changes since 0.3.0
v0.3.0
🎯 Highlights
This release marks a significant architectural shift to the Modern Husky approach, using Git's native
core.hooksPathconfiguration for better performance, flexibility, and support for auxiliary scripts.
⚠️ Breaking Changes
- Hook Location: Hooks are now stored directly in
.husky/instead of.husky/hooks/. - Mechanism Shift: Switched from copying/wrapping hooks to using
git config core.hooksPath .husky. - Directory Structure: The
.husky/hooks/subdirectory is no longer used; move your hooks to.husky/. - CLI Feature: The
clifeature has been removed. Thehuskybinary is now included by default without extra configuration.
✨ New Features
- Helper Script Support: Arbitrary files (like
_helpers.sh) can now be stored in.husky/and sourced from hooks. - Runtime Control: Support for
HUSKY=0environment variable to skip hooks at runtime (e.g.,HUSKY=0 git commit). - Runtime Helper: Added
.husky/_/husky.shwhich can be sourced by hooks for standardized behavior. - CLI Enhancements:
husky init: Now configurescore.hooksPathimmediately and creates the_/husky.shhelper.husky uninstall: New command to unsetcore.hooksPath.husky add: Templates updated to include_/husky.shsourcing example.
🚀 Performance & Robustness
- Incremental Builds:
build.rsnow checkscore.hooksPathbefore callinggit config, speeding up builds. - Graceful Degradation: Better handling of environments without
gitcommand or outside git repositories.
v0.2.2
🧪 Testing
- Test infrastructure refactoring: Consolidated test utilities into
tests/common/mod.rs - Test reorganization: Merged 4 test files into 2 clear files (
test_installation.rs,test_hooks.rs) - New test scenarios: Git worktrees, multiple hooks (10 types), error message validation
- Total: 41 tests covering submodules, workspaces, worktrees, and edge cases
🔧 CI/CD
- Code coverage: Added
coverage.ymlworkflow with tarpaulin and Codecov integration - Coverage badge: Added to README
📦 Build
- Makefile improvements:
- Added
make coveragetarget - Added
make doc-checktarget - Included
doc-checkinmake ci - Fixed CRLF line endings
- Added
- .gitignore: Added coverage report files
v0.2.1
🐛 Bug Fixes
- CI/Cross-platform: Fixed lint errors, MSRV compliance (Rust 1.70), and race conditions in tests.
- Windows Support: Improved test stability on Windows by skipping shell syntax validation where
shis unavailable. - Makefile: Added
make ciand updated test commands to consistent with CI configuration.
v0.2.0
🎯 Highlights
This release transforms husky-rs into a production-ready Git hooks manager with optional advanced features while maintaining the zero-config philosophy.
Key additions:
- 🔄 Smart hook change detection (no more
cargo clean) - 🛠️ Optional CLI tool (
husky init/add/list) - 📚 Optional library API for advanced use cases
- 📖 Comprehensive documentation suite
✨ New Features
Build Script Improvements
- Granular rerun triggers — Individual hook file monitoring
- Hooks automatically reinstall when modified
- No more
cargo cleanrequired
- Validation & warnings — Helpful feedback during build
- Empty hook detection with clear warnings
- Missing shebang detection with suggested defaults
- Improved logging — Clear, informative output
- Per-hook status:
✓ pre-commit,✓ pre-push - Summary:
Installed 3 Git hook(s)
- Per-hook status:
Optional CLI Tool
Install with:
cargo install husky-rs --features=cli
| Command | Description |
|---|---|
husky init |
Create .husky/hooks directory |
husky add <hook> |
Create hook from smart template |
husky list |
List installed hooks with status |
husky help |
Show help message |
husky version |
Display version |
Optional Library API
use husky_rs::{hooks_dir, should_skip_installation, is_valid_hook_name};hooks_dir(path)— Get hooks directory pathshould_skip_installation()— CheckNO_HUSKY_HOOKSenv varis_valid_hook_name(name)— Validate Git hook namesSUPPORTED_HOOKS— All 27 supported hook names
📚 Documentation
| Document | Description |
|---|---|
| Usage Guide | Installation, configuration, advanced usage |
| Examples | 13 ready-to-use hook examples |
| Troubleshooting | Common issues and solutions |
| Contributing | Development guide |
Example collection includes:
- Running tests before commit
- Code formatting check
- Clippy linting
- Conventional commits validation
- Branch protection
- Comprehensive pre-push checks
- CI environment detection
- Multi-language project support
- And more...
🧪 Testing
| Metric | Before | After | Change |
|---|---|---|---|
| Total tests | 13 | 48 | +269% |
| CLI coverage | 0% | 90% | — |
| Lib coverage | 40% | 100% | — |
| Example validation | 0% | 54% | — |
⚠️ Breaking Changes
Build script auto-detection: Hooks now automatically reinstall when source files change.
- Impact: Workflows relying on manual hook reinstallation may behave differently
- Migration: Use
NO_HUSKY_HOOKS=1if you need manual control - Benefit: Significantly improved developer experience
📦 Package Updates
- Version:
0.1.5→0.2.0 - MSRV: Rust 1.70+
- Keywords:
git,hooks,husky,development-tools,pre-commit - Categories:
development-tools,command-line-utilities
v0.1.5
0.1.5 - 2025-06-03
🐛 Bug Fixes
- (ci) Resolve cross-drive temp dir issue on Windows runners - (5d0fa86)
- Simplify build script testing - (3788868)
🧪 Testing
- Improve test coverage for different dependency types and scenarios - (5bc771e)
⚙️ Miscellaneous Tasks
- (config) Migrate config .github/renovate.json - (d31336b)
New Contributors ❤️
v0.1.4
0.1.4 - 2025-05-30
🚀 Features
- Refactor build script, enhance test coverage and fix symlink handling - (3268b99)
- Enhance test coverage and cleanup build script - (c055073)
🐛 Bug Fixes
- Ensure NO_HUSKY_HOOKS respected in test environment - (c7bdbb4)
- Address clippy lints in test suite - (cba70f1)
⚙️ Miscellaneous Tasks
- (release) Bump version to 0.1.4 - (436cf97)
New Contributors ❤️
- @google-labs-jules[bot] made their first contribution in #4