{"id":36597568,"url":"https://github.com/pplmx/husky-rs","last_synced_at":"2026-02-11T13:03:38.436Z","repository":{"id":257803956,"uuid":"860942827","full_name":"pplmx/husky-rs","owner":"pplmx","description":"A husky-like hook for Rust.","archived":false,"fork":false,"pushed_at":"2026-01-12T07:59:29.000Z","size":147,"stargazers_count":31,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-12T16:35:30.825Z","etag":null,"topics":["git-hook","git-hooks","hooks","husky","husky-rs"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/husky-rs","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pplmx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-21T15:23:55.000Z","updated_at":"2026-01-12T07:59:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"6c9a03ec-7c30-4b42-9d7f-fa5fbea2c661","html_url":"https://github.com/pplmx/husky-rs","commit_stats":null,"previous_names":["pplmx/husky-rs"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/pplmx/husky-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplmx%2Fhusky-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplmx%2Fhusky-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplmx%2Fhusky-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplmx%2Fhusky-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pplmx","download_url":"https://codeload.github.com/pplmx/husky-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pplmx%2Fhusky-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29333155,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T12:42:24.625Z","status":"ssl_error","status_checked_at":"2026-02-11T12:41:23.344Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git-hook","git-hooks","hooks","husky","husky-rs"],"created_at":"2026-01-12T08:31:22.080Z","updated_at":"2026-02-11T13:03:38.431Z","avatar_url":"https://github.com/pplmx.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# husky-rs\n\n[![CI](https://github.com/pplmx/husky-rs/workflows/CI/badge.svg)](https://github.com/pplmx/husky-rs/actions)\n[![Coverage](https://codecov.io/gh/pplmx/husky-rs/graph/badge.svg)](https://codecov.io/gh/pplmx/husky-rs)\n[![Crates.io](https://img.shields.io/crates/v/husky-rs.svg)](https://crates.io/crates/husky-rs)\n[![Documentation](https://docs.rs/husky-rs/badge.svg)](https://docs.rs/husky-rs)\n[![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)](#license)\n\n`husky-rs` is a Git hooks management tool for Rust projects, inspired by Husky.\n\n## Features\n\n- 🚀 **Zero-configuration** - Just add the dependency and create hooks\n- ⚡ **Automatic installation** - Hooks configure on `cargo build` or `cargo test`\n- 🔄 **Smart rerun detection** - No need for `cargo clean` when updating hooks\n- 🎯 **All 27 Git hooks supported** - Client-side and server-side hooks\n- 🌍 **Cross-platform** - Works on Unix-like systems and Windows\n- 🛠️ **Optional CLI tool** - `husky init`, `husky add`, `husky list` commands\n- 📚 **Optional library API** - Helper functions for advanced use cases\n\n## Quick Start\n\n1. Adding `husky-rs` to your project:\n\n   You have several options:\n\n   ```sh\n   # Option 1: Add as a Regular Dependency\n   cargo add husky-rs\n\n   # Option 2: Add as a Dev Dependency\n   cargo add --dev husky-rs\n\n   # Option 3: Use the Main Branch\n   cargo add --git https://github.com/pplmx/husky-rs --branch main\n   cargo add --dev --git https://github.com/pplmx/husky-rs --branch main\n   ```\n\n2. Create hooks directory:\n\n   ```sh\n   mkdir -p .husky\n   ```\n\n3. Add a hook (e.g., `pre-commit`):\n\n   ```sh\n   echo '#!/bin/sh\\necho \"Running pre-commit hook\"' \u003e .husky/pre-commit\n   ```\n\n4. Install hooks:\n\n   ```sh\n   cargo build\n   ```\n\n   Or if you're using as a dev-dependency:\n\n   ```sh\n   cargo test\n   ```\n\n**Tip:** If you add this library to the `[dependencies]` section, both `cargo build` and `cargo test` will work. However, if it's added under `[dev-dependencies]`, only `cargo test` will function as expected.\n\n## Usage\n\n### Supported Git Hooks\n\n`husky-rs` supports all standard Git hooks by setting `core.hooksPath` to `.husky`. This means you can also place helper scripts (e.g., `.husky/_helpers.sh`) in the same directory and source them from your hooks.\n\nFor a complete list, refer to the [Git documentation](https://git-scm.com/docs/githooks).\n\nIf you encounter any unsupported hooks, please [open an issue](https://github.com/pplmx/husky-rs/issues).\n\n### Configuration\n\nTo skip hook installation (useful in CI environments):\n\n```sh\nNO_HUSKY_HOOKS=1 cargo build\n```\n\nYou can also set this in your environment or CI configuration.\n\n## Optional Tools\n\n### CLI Tool\n\nFor added convenience, install the `husky` command-line tool:\n\n```sh\ncargo install husky-rs\n```\n\nThe CLI provides helpful commands:\n\n```sh\nhusky init              # Create .husky directory\nhusky add pre-commit    # Add hook from smart template\nhusky list              # List all installed hooks\nhusky help              # Show help\n```\n\n*Note*: The CLI is completely optional - the core functionality works without it!\n\n### Library API\n\nFor advanced use cases, husky-rs exposes utility functions:\n\n```rust\nuse husky_rs::{hooks_dir, should_skip_installation, is_valid_hook_name};\n\n// Check if hook installation should be skipped\nif !should_skip_installation() {\n    let hooks_path = hooks_dir(\".\");\n    println!(\"Hooks directory: {}\", hooks_path.display());\n}\n\n// Validate a hook name\nif is_valid_hook_name(\"pre-commit\") {\n    println!(\"Valid hook!\");\n}\n```\n\nSee [API documentation](https://docs.rs/husky-rs) for more details.\n\n*Note*: You don't need to call any functions for basic usage - just add the dependency!\n\n## Best Practices\n\n- Keep hooks lightweight to avoid slowing down Git operations\n- Use hooks for tasks like running tests, linting code, and validating commit messages\n- Non-zero exit status in a hook script will abort the Git operation\n\n## Documentation\n\n📖 **Complete guides for all users:**\n\n- [Usage Guide](docs/usage.md) - Installation, configuration, and advanced usage\n- [Examples](docs/examples.md) - 13 ready-to-use hook examples\n- [Troubleshooting](docs/troubleshooting.md) - Solutions to common issues\n- [Development](docs/development.md) - Contributing guide\n\n## Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on how to submit pull requests, report issues, or suggest improvements.\n\n## License\n\nThis project is licensed under either of:\n\n- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or \u003chttp://www.apache.org/licenses/LICENSE-2.0\u003e)\n- MIT license ([LICENSE-MIT](LICENSE-MIT) or \u003chttp://opensource.org/licenses/MIT\u003e)\n\nat your option.\n\n## Changelog\n\nFor a detailed history of changes to this project, please refer to our [CHANGELOG.md](CHANGELOG.md).\n\n## Acknowledgments\n\n- Inspired by [cargo-husky](https://github.com/rhysd/cargo-husky)\n- Thanks to the Rust community for their amazing tools and libraries\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpplmx%2Fhusky-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpplmx%2Fhusky-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpplmx%2Fhusky-rs/lists"}