You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DiffCraft is a smart command-line tool that uses Google's Gemini to instantly generate high-quality, conventional commit messages from your staged code changes.
8
+
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.
9
+
-`craft`: Instantly generate high-quality, conventional commit messages from your code changes.
10
+
-`gencraft`: Generate essential repository files like README.md, LICENSE, and .gitignore with AI assistance.
9
11
10
12
Install:
11
13
```bash
12
14
pip install diffcraft
13
15
```
14
16
15
17
## Features:
16
-
17
-
* 🤖 **AI-Powered Commits:** Analyzes your `git diff` to create meaningful and descriptive commit messages that truly reflect your changes.
18
-
* ✅ **Enforce Best Practices:** Automatically follows the [Conventional Commits](https://www.conventionalcommits.org/) standard, improving your project's readability and making it easier to automate releases.
19
-
* ⚙️ **You're Always in Control:** Interactively **[A]ccept** the suggestion, **[E]dit** it in your own editor, **[R]egenerate** a new one, or **[Q]uit**.
18
+
`craft`: AI-Powered Commits
19
+
* 🤖 **Intelligent Commit Generation:** Analyzes your `git diff` to create meaningful and descriptive commit messages that truly reflect your changes.
20
+
* ✅ **Conventional Commits Standard:** Automatically follows the [Conventional Commits](https://www.conventionalcommits.org/) standard, improving your project's readability and making it easier to automate releases.
21
+
* ⚙️ **Full User Control:** Interactively **[A]ccept** the suggestion, **[E]dit** it in your own editor, **[R]egenerate** a new one, or **[Q]uit**.
20
22
* 🌍 **Flexible & Powerful:** Generate commits in different languages (`--lang`), provide context from your commit history (`--history`), and force specific types (`--type`).
21
23
24
+
`gencraft`: AI-Powered Repository Scaffolding
25
+
- 📄 **Smart README Generation:** Scans your project's file structure (respecting `.gitignore`) to create a comprehensive and well-structured `README.md` file automatically.
26
+
- ⚖️ **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.
27
+
- 🙈 **`.gitignore` Creation:** Bootstrap a robust `.gitignore` file with sensible defaults for Python projects, and easily append your own custom rules.
28
+
22
29
## Installation
23
30
24
31
DiffCraft is available on PyPI and can be installed with a single pip command.
@@ -43,10 +50,7 @@ This method is easy and keeps your API key specific to your project.
43
50
GEMINI_API_KEY="YOUR_API_KEY_HERE"
44
51
```
45
52
🔒 Important Security Note
46
-
Remember to add the .env file to your project's .gitignore to ensure your secret API key is never committed to your repository! If your .gitignore doesn't have it, add this line:
47
-
```code
48
-
.env
49
-
```
53
+
Remember to add `.env` file to ensure your secret API key is never committed to your repository!
50
54
51
55
### Method 2: Environment Variable (Advanced)
52
56
@@ -71,43 +75,65 @@ set GEMINI_API_KEY="YOUR_API_KEY_HERE"
71
75
*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.*
72
76
73
77
## Usage
74
-
The workflow is designed to be seamless.
78
+
DiffCraft provides two primary commands: `craft` for commits and `gencraft` for file generation.
75
79
76
-
1. Stage your files as you normally would:
77
-
```Bash
78
-
git add README.md
79
-
git add .
80
-
git add src/
81
-
```
82
-
2. Run the craft command:
83
-
```Bash
80
+
### Using `craft`
81
+
The `craft` workflow is designed to be seamless
82
+
1. Stage your files as you normally would: (`git add ...`)
83
+
2. Run the `craft` command
84
+
```bash
85
+
# Generate a commit for already-staged changes
84
86
craft
85
-
```
86
-
This will generate a commit message and present you with the interactive prompt.
87
87
88
-
Or,
89
-
```Bash
90
-
craft README.md
88
+
# Stage all files and then generate a commit
91
89
craft .
92
-
craft src/
90
+
91
+
# Stage specific files and generate a commit
92
+
craft src/main.py
93
93
```
94
-
This will both stage the files and generate a commit message.
95
-
### Command-Line Options
96
-
For a full list of commands and detailed explanations, use the `--help` flag:
94
+
This will generate a commit message and present you with the interactive prompt.
95
+
96
+
### `craft` Command-Line Options
97
97
```Bash
98
+
# Generate a 'fix' commit and open it directly in your editor
99
+
craft --type fix --edit
100
+
101
+
# Generate a commit in Spanish using the last 3 commits for context
102
+
craft --lang Spanish --history 3
103
+
104
+
# For a full list of commands, use the --help flag
98
105
craft --help
99
106
```
100
-
**Example: Generate a 'fix' commit and edit it immediately**
101
-
```Bash
102
-
craft --type fix --edit
107
+
### Using `gencraft`
108
+
The `gencraft` command helps you create essential project files.
109
+
Generate a `.gitignore`
110
+
```bash
111
+
# Create a .gitignore with Python defaults
112
+
gencraft gitignore
113
+
114
+
# Add custom entries to the .gitignore
115
+
gencraft gitignore node_modules/ .env.local
103
116
```
104
-
**Example: Generate a commit in Spanish using the last 3 commits for context**
105
-
```Bash
106
-
craft --lang Spanish --history 3
117
+
If a `.gitignore` already exists, gencraft will intelligently append new rules.
118
+
### Generate a `LICENSE` file
119
+
```bash
120
+
# See a list of available licenses
121
+
gencraft license
122
+
123
+
# Generate an MIT license (will prompt for author name)
124
+
gencraft license mit
107
125
```
126
+
### Generate a `README.md`
127
+
```bash
128
+
# Let the AI scan your project and generate a standard README
129
+
gencraft readme
108
130
131
+
# Provide the AI with a custom prompt for more specific results
132
+
gencraft readme "A short and friendly one-paragraph readme"
133
+
```
109
134
## Contributing
110
135
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](https://github.com/bvrvl/diffcraft)
111
136
137
+
> Led and maintained by [@bvrvl](https://github.com/bvrvl/)
112
138
## License
113
139
This project is licensed under the MIT License. See the LICENSE file for details.
0 commit comments