#git-hooks #git #manager #cli #hook

bin+lib monk

Monk is a simple Git hooks manager written in Rust. It allows you to manage and automate Git hooks easily using a YAML configuration file.

17 releases

new 0.2.5 May 7, 2025
0.2.4 May 7, 2025
0.2.1 Apr 16, 2025
0.1.10 Sep 23, 2024

#1591 in Command line utilities

Download history 6/week @ 2025-01-18 14/week @ 2025-01-25 28/week @ 2025-02-01 23/week @ 2025-02-08 33/week @ 2025-02-15 98/week @ 2025-02-22 8/week @ 2025-03-01 7/week @ 2025-04-05 267/week @ 2025-04-12 65/week @ 2025-04-19 101/week @ 2025-04-26 400/week @ 2025-05-03

837 downloads per month
Used in rzozowski

MIT license

72KB
135 lines

Monk is a simple Git hooks manager

License GitHub Issues Crates.io Downloads

Monk's features:

  • 🦀 Easily set up in your Rust project. No need to install additional package managers.
  • ⚙️ Works with custom build.rs files. Automate the hooks installation process.
  • 💻 Run your hooks via CLI. Test your hooks without triggering them via Git.

Keep calm, monk will protect your repo!

Installation

You can install it using cargo:

cargo install monk

Or

You can add it as a build dependency:

cargo add --build monk

Then create a build.rs file:

pub fn main() {
    monk::init();
}

In this case, monk will be installed automatically and will initialize all hooks from monk.yaml . This is the most convenient option for Rust projects, as it doesn't require contributors to install monk manually.

Installing monk with Nix

You can also install monk using Nix:

nix profile install github:daynin/monk

Usage

Create a configuration file named monk.yaml in your project root:

pre-commit:
  commands:
    - cargo fmt -- --check
    - cargo clippy -- -D warnings

pre-push:
  commands:
    - cargo test

If you installed monk manually, run:

monk install

If you added it as a build dependency and set up build.rs as shown above, the hooks will be installed automatically when you build your project.

Running hooks manually

To run specific hooks manually, use the run command

monk run pre-commit

Removing Hooks

monk automatically creates backup files for existing hooks and restores them when you remove monk's hooks.

To remove the hooks, run:

monk uninstall

Dependencies

~2.6–3.5MB
~71K SLoC