Skip to content

NormVg/cookcommit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CookCommit CLI

A modular CLI tool for AI-powered git commit and PR message generation using Gemini AI.

πŸ—οΈ Project Structure

cookcommit/
β”œβ”€β”€ src/
β”‚   └── cookcommit/
β”‚       β”œβ”€β”€ __init__.py
β”‚       β”œβ”€β”€ config.py              # Configuration constants
β”‚       β”œβ”€β”€ commands/
β”‚       β”‚   β”œβ”€β”€ __init__.py
β”‚       β”‚   β”œβ”€β”€ save.py            # Save diff command
β”‚       β”‚   β”œβ”€β”€ commit.py          # Generate commit command
β”‚       β”‚   └── pr.py              # Generate PR command
β”‚       β”œβ”€β”€ services/
β”‚       β”‚   β”œβ”€β”€ __init__.py
β”‚       β”‚   β”œβ”€β”€ git_service.py     # Git operations
β”‚       β”‚   └── ai_service.py      # AI message generation
β”‚       └── utils/
β”‚           β”œβ”€β”€ __init__.py
β”‚           β”œβ”€β”€ text_utils.py      # Text processing
β”‚           β”œβ”€β”€ file_utils.py      # File operations
β”‚           └── output_utils.py    # Output formatting
β”œβ”€β”€ cli.py                         # Main entry point
β”œβ”€β”€ setup.py                       # Package setup
β”œβ”€β”€ requirements.txt               # Dependencies
└── README.md                      # This file

πŸš€ Installation

pip install -r requirements.txt

🎯 Usage

Basic Commands

# Save git diff to file
python cli.py save -o my-diff.txt

# Generate commit message
python cli.py commit

# Generate commit message and auto-commit
python cli.py commit --commit

# Generate PR message
python cli.py pr

# Generate PR title only
python cli.py pr --title-only

Advanced Usage

# Generate commit message with output file
python cli.py commit -o commit-msg.txt

# Auto-commit with AI-generated message
python cli.py commit --commit

# Generate PR message and save to file
python cli.py pr -o pr-message.md

πŸ”§ Features

Save Command

  • βœ… Saves git diff --cached to text file
  • βœ… Checks for git repository
  • βœ… Handles empty staged changes

Commit Command

  • βœ… Generates AI-powered commit messages
  • βœ… Uses conventional commit format
  • βœ… Automatic chunking for large diffs
  • βœ… Auto-commit flag (--commit)
  • βœ… Save to file option
  • βœ… Clean, minimal output

PR Command

  • βœ… Generates comprehensive PR messages
  • βœ… Title-only option
  • βœ… Markdown formatting
  • βœ… Handles large codebases
  • βœ… Save to file option

πŸ€– AI Features

  • Smart Chunking: Automatically handles large diffs
  • Conventional Commits: Follows industry standards
  • Context-Aware: Understands code changes
  • Multi-Model: Uses different models for speed/quality

πŸ“‹ Command Reference

save

python cli.py save [OPTIONS]

Options:
  -o, --output TEXT  Output file name [default: diff.txt]

commit

python cli.py commit [OPTIONS]

Options:
  -o, --output TEXT  Save commit message to file
  -c, --commit       Automatically commit with generated message

pr

python cli.py pr [OPTIONS]

Options:
  -o, --output TEXT  Save PR message to file
  --title-only       Generate only PR title

πŸ”„ Complete Workflow

# 1. Make changes and stage them
git add src/feature.py

# 2. Generate and auto-commit
python cli.py commit --commit

# 3. Generate PR message for GitHub
python cli.py pr -o pr-template.md

🏭 Architecture Benefits

  • Modular Design: Separated concerns across multiple files
  • Service Layer: Clean separation of git and AI operations
  • Utility Functions: Reusable components
  • Type Hints: Better code documentation and IDE support
  • Error Handling: Comprehensive error management
  • Extensible: Easy to add new commands and features

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published