Skip to main content

CLI co-pilot for Git and repository management.

Project description

DiffCraft

CLI co-pilot for Git and repository management

PyPI version License: MIT GitHub Repo

DiffCraft is a smart command-line tool that uses Google's Gemini to streamline your development workflow. It started as a tool to craft the perfect git commit and has evolved into a powerful assistant for bootstrapping and managing your repository.

  • craft: Instantly generate high-quality, conventional commit messages from your code changes.
  • gencraft: Generate essential repository files like README.md, LICENSE, and .gitignore with AI assistance.

Install:

pip install diffcraft

Features:

craft: AI-Powered Commits

  • 🤖 Intelligent Commit Generation: Analyzes your git diff to create meaningful and descriptive commit messages that truly reflect your changes.
  • Conventional Commits Standard: Automatically follows the Conventional Commits standard, improving your project's readability and making it easier to automate releases.
  • ⚙️ Full User Control: Interactively [A]ccept the suggestion, [E]dit it in your own editor, [R]egenerate a new one, or [Q]uit.
  • 🌍 Flexible & Powerful: Generate commits in different languages (--lang), provide context from your commit history (--history), and force specific types (--type).

gencraft: AI-Powered Repository Scaffolding

  • 📄 Smart README Generation: Scans your project's file structure (respecting .gitignore) to create a comprehensive and well-structured README.md file automatically.
  • ⚖️ License Generation: Quickly generate a LICENSE file from a list of popular open-source licenses (MIT, Apache 2.0, GPLv3, and more) with your name and the current year.
  • 🙈 .gitignore Creation: Bootstrap a robust .gitignore file with sensible defaults for Python projects, and easily append your own custom rules.

Installation

DiffCraft is available on PyPI and can be installed with a single pip command.

pip install diffcraft

Setup & Configuration

To use DiffCraft, you need a Google Gemini API key.

Method 1: .env File (Recommended)

This method is easy and keeps your API key specific to your project.

  1. Get your free API key from Google AI Studio.

  2. In the root directory of your git project, create a new file named .env.

  3. Add the following line to the .env file, pasting your own key:

GEMINI_API_KEY="YOUR_API_KEY_HERE"

🔒 Important Security Note Remember to add .env file to ensure your secret API key is never committed to your repository!

Method 2: Environment Variable (Advanced)

This method is ideal for servers, CI/CD pipelines, Docker containers, or any user who prefers to manage API keys globally. DiffCraft will always prioritize a system-wide environment variable over a local .env file. Open your terminal and use the appropriate command for your operating system.

macOS / Linux

export GEMINI_API_KEY="YOUR_API_KEY_HERE"

To make this permanent, add the command to your ~/.zshrc or ~/.bashrc file.

Windows (PowerShell)

$env:GEMINI_API_KEY="YOUR_API_KEY_HERE"

Windows (CMD)

set GEMINI_API_KEY="YOUR_API_KEY_HERE"

For permanent setup on Windows, search for "Edit the system environment variables" in the Start Menu. You will need to close and reopen your terminal for the changes to take effect.

Usage

DiffCraft provides two primary commands: craft for commits and gencraft for file generation.

Using craft

The craft workflow is designed to be seamless

  1. Stage your files as you normally would: (git add ...)
  2. Run the craft command
# Generate a commit for already-staged changes
craft

# Stage all files and then generate a commit
craft .

# Stage specific files and generate a commit
craft src/main.py

This will generate a commit message and present you with the interactive prompt.

craft Command-Line Options

# Generate a 'fix' commit and open it directly in your editor
craft --type fix --edit

# Generate a commit in Spanish using the last 3 commits for context
craft --lang Spanish --history 3

# For a full list of commands, use the --help flag
craft --help

Using gencraft

The gencraft command helps you create essential project files. Generate a .gitignore

# Create a .gitignore with Python defaults
gencraft gitignore

# Add custom entries to the .gitignore
gencraft gitignore node_modules/ .env.local

If a .gitignore already exists, gencraft will intelligently append new rules.

Generate a LICENSE file

# See a list of available licenses
gencraft license

# Generate an MIT license (will prompt for author name)
gencraft license mit

Generate a README.md

# Let the AI scan your project and generate a standard README
gencraft readme

# Provide the AI with a custom prompt for more specific results
gencraft readme "A short and friendly one-paragraph readme"

Contributing

Found a bug or have a feature request? We'd love your help! Please open an issue or submit a pull request on our GitHub Repository

Led and maintained by @bvrvl

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diffcraft-2.1.3.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diffcraft-2.1.3-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file diffcraft-2.1.3.tar.gz.

File metadata

  • Download URL: diffcraft-2.1.3.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for diffcraft-2.1.3.tar.gz
Algorithm Hash digest
SHA256 2f6d61f2cc0ca4a31583ef198e4465ccf70e3f156d6cf570c5411e3548400086
MD5 79fec52333f02d4132754f5b0c4a84b2
BLAKE2b-256 84b575e363844a1887784b55b3281c1aa375823bcd96a6d6f32045a12f7d3859

See more details on using hashes here.

File details

Details for the file diffcraft-2.1.3-py3-none-any.whl.

File metadata

  • Download URL: diffcraft-2.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for diffcraft-2.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c19871b8dc25999f8568b2edd09a5b242d6f783e2fa532f789e31e5af4c5efeb
MD5 bed99ee13ae3af7f8d362a7c4e75369b
BLAKE2b-256 5891bc00271a5903763bbac4ab0cda6cd2d96de48f2285cd6a3e5a82a93bd6a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page