Skip to content

rodeyseijkens/gen-commit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

gen-commit

generate conventional commit messages using LLM

Let's be honest. We've all been there:

  • git commit -m "update"
  • git commit -m "fixed stuff"
  • git commit -m "asdfghjkl" (in a moment of pure despair)

gen-commit was born from the tears of countless mysterious merge conflicts and the desperate need for someone (or something) to make our commit history look like we actually know what we're doing. You're welcome.


πŸ§‘β€πŸ’» Usage

gen-commit [OPTIONS]

Options

  • -h, --help: Show help message
  • -m, --model MODEL: Specify the model to use with llm command
  • -p, --print: Print the generated message only
  • -D, --debug: Special debug mode (no real committing etc.)
  • -v, --verbose: Show all output
  • -a, --all: Analyze all changes (staged + unstaged + untracked)
  • -c, --commit: Automatically commit without confirmation
  • -s, --scope SCOPE: Specify scope for commit message
  • -n, --note NOTE: Provide additional context/hint for the LLM

Examples

# Interactive mode
gen-commit

# Analyze all changes (staged, unstaged & untracked)
gen-commit -a

# Auto-commit changes
gen-commit -c

# Print only (no commit)
gen-commit -p

# Use specific scope
gen-commit -s frontend

# Provide additional context to the LLM
gen-commit -n "focus on performance improvements"

πŸ› οΈ Prerequisites

  • Nix (with flake support)
  • llm command-line tool
  • git

⚑ Installation

Global Command Installation

System-wide (NixOS Configuration)

Add to your NixOS configuration:

{
  inputs = {
    gen-commit = {
      url = "github:rodeyseijkens/gen-commit";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
}

{ inputs, ... }:
{
  # In your NixOS module
  programs.gen-commit.enable = true;
}

User-level (Home Manager)

Add to your Home Manager configuration:

{
  inputs = {
    gen-commit = {
      url = "github:rodeyseijkens/gen-commit";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
}

{ inputs, ... }:
{
  imports = [inputs.gen-commit.homeManagerModules.default];

  programs.gen-commit.enable = true;
}

Via nix profile (Quick Installation)

For a quick installation without modifying your configuration:

nix profile install github:rodeyseijkens/gen-commit

To use it temporarily in a shell:

nix shell github:rodeyseijkens/gen-commit -c gen-commit [OPTIONS]

Using Nix Flake

{
  inputs = {
    gen-commit = {
      url = "github:rodeyseijkens/gen-commit";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, gen-commit, ... }:
  {
    nixosConfigurations.yourHost = nixpkgs.lib.nixosSystem {
      modules = [
        {
          environment.systemPackages = [
            gen-commit.packages.x86_64-linux.default
          ];
        }
      ];
    };

    # Or in a devShell
    devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.mkShell {
      packages = [
        gen-commit.packages.x86_64-linux.default
      ];
    };
  };
}

Using Overlay (pkgs.gen-commit)

If you prefer using pkgs.gen-commit, add this flake's overlay:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    gen-commit.url = "github:rodeyseijkens/gen-commit";
  };

  outputs = { self, nixpkgs, gen-commit, ... }:
  {
    nixosConfigurations.yourHost = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        {
          nixpkgs.overlays = [gen-commit.overlays.default];
          environment.systemPackages = [
            pkgs.gen-commit
          ];
        }
      ];
    };
  };
}

🧠 How it works

The tool analyzes your git changes (staged, unstaged, or untracked files) and uses the llm command to generate an appropriate commit message following the Conventional Commits specification with gitmoji. You can optionally provide additional context using the -n, --note option to guide the LLM's message generation.

Commit Message Format

<type>[scope]: <gitmoji> <description>

πŸ”§ Development

See scripts/README.md for detailed information on development, testing, and release workflows.


πŸ“œ License

MIT β€” see the LICENSE file for details.


Made with ❀️ by @rodeyseijkens

About

Generate conventional commit messages with LLM

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors