devcommit 0.1.4.6__tar.gz → 0.1.4.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/PKG-INFO +159 -26
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/README.md +158 -25
- devcommit-0.1.4.8/devcommit/main.py +1008 -0
- devcommit-0.1.4.8/devcommit/utils/git.py +326 -0
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/devcommit/utils/parser.py +12 -0
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/pyproject.toml +1 -1
- devcommit-0.1.4.6/devcommit/main.py +0 -428
- devcommit-0.1.4.6/devcommit/utils/git.py +0 -170
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/COPYING +0 -0
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/devcommit/__init__.py +0 -0
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/devcommit/app/__init__.py +0 -0
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/devcommit/app/ai_providers.py +0 -0
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/devcommit/app/gemini_ai.py +0 -0
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/devcommit/app/prompt.py +0 -0
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/devcommit/utils/__init__.py +0 -0
- {devcommit-0.1.4.6 → devcommit-0.1.4.8}/devcommit/utils/logger.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devcommit
|
|
3
|
-
Version: 0.1.4.
|
|
3
|
+
Version: 0.1.4.8
|
|
4
4
|
Summary: AI-powered git commit message generator
|
|
5
5
|
License: GNU GENERAL PUBLIC LICENSE
|
|
6
6
|
Version 3, 29 June 2007
|
|
@@ -713,6 +713,9 @@ A command-line AI tool for autocommits.
|
|
|
713
713
|
- 🚀 Automatic commit generation using AI
|
|
714
714
|
- 📁 Directory-based commits - create separate commits for each root directory
|
|
715
715
|
- 🎯 Interactive mode to choose between global or directory-based commits
|
|
716
|
+
- 📄 **Commit specific files or folders** - Stage and commit only selected files/directories
|
|
717
|
+
- 🔄 **Regenerate commit messages** - Don't like the suggestions? Regenerate with one click
|
|
718
|
+
- 🚀 **Push to remote** - Automatically push commits after committing
|
|
716
719
|
- ⚙️ Flexible configuration - use environment variables or .dcommit file
|
|
717
720
|
- 🏠 Self-hosted model support - use your own AI infrastructure
|
|
718
721
|
- 🆓 Multiple free tier options available
|
|
@@ -721,24 +724,27 @@ A command-line AI tool for autocommits.
|
|
|
721
724
|
|
|
722
725
|
## Installation
|
|
723
726
|
|
|
724
|
-
1. **Install DevCommit**
|
|
725
|
-
|
|
727
|
+
1. **Install DevCommit**
|
|
728
|
+
|
|
726
729
|
**Option 1: Using pip (local installation)**
|
|
730
|
+
|
|
727
731
|
```bash
|
|
728
732
|
pip install devcommit
|
|
729
733
|
```
|
|
730
|
-
|
|
734
|
+
|
|
731
735
|
**Option 2: Using pipx (global installation, recommended)**
|
|
736
|
+
|
|
732
737
|
```bash
|
|
733
738
|
# Install pipx if you don't have it
|
|
734
739
|
python3 -m pip install --user pipx
|
|
735
740
|
python3 -m pipx ensurepath
|
|
736
|
-
|
|
741
|
+
|
|
737
742
|
# Install DevCommit globally
|
|
738
743
|
pipx install devcommit
|
|
739
744
|
```
|
|
745
|
+
|
|
740
746
|
> **💡 Why pipx?** pipx installs CLI tools in isolated environments, preventing dependency conflicts while making them globally available.
|
|
741
|
-
|
|
747
|
+
|
|
742
748
|
**All AI providers are included by default!** ✅ Gemini, OpenAI, Groq, Anthropic, Ollama, and Custom API support.
|
|
743
749
|
|
|
744
750
|
2. **Set Up Configuration (Required: API Key)**
|
|
@@ -747,19 +753,21 @@ A command-line AI tool for autocommits.
|
|
|
747
753
|
**Priority Order:** `.dcommit` file → Environment Variables → Defaults
|
|
748
754
|
|
|
749
755
|
### Option 1: Environment Variables (Quickest)
|
|
756
|
+
|
|
750
757
|
```bash
|
|
751
758
|
# Using Gemini (default)
|
|
752
759
|
export GEMINI_API_KEY='your-api-key-here'
|
|
753
|
-
|
|
760
|
+
|
|
754
761
|
# Or using Groq (recommended for free tier)
|
|
755
762
|
export AI_PROVIDER='groq'
|
|
756
763
|
export GROQ_API_KEY='your-groq-key'
|
|
757
|
-
|
|
764
|
+
|
|
758
765
|
# Add to ~/.bashrc or ~/.zshrc for persistence
|
|
759
766
|
echo "export GEMINI_API_KEY='your-key'" >> ~/.bashrc
|
|
760
767
|
```
|
|
761
768
|
|
|
762
769
|
### Option 2: .dcommit File (Home Directory)
|
|
770
|
+
|
|
763
771
|
```bash
|
|
764
772
|
cat > ~/.dcommit << 'EOF'
|
|
765
773
|
GEMINI_API_KEY = your-api-key-here
|
|
@@ -772,6 +780,7 @@ A command-line AI tool for autocommits.
|
|
|
772
780
|
```
|
|
773
781
|
|
|
774
782
|
### Option 3: .dcommit File (Virtual Environment)
|
|
783
|
+
|
|
775
784
|
```bash
|
|
776
785
|
mkdir -p $VIRTUAL_ENV/config
|
|
777
786
|
cat > $VIRTUAL_ENV/config/.dcommit << 'EOF'
|
|
@@ -797,6 +806,7 @@ devcommit
|
|
|
797
806
|
### Basic Usage
|
|
798
807
|
|
|
799
808
|
- **Stage all changes and commit:**
|
|
809
|
+
|
|
800
810
|
```bash
|
|
801
811
|
devcommit --stageAll
|
|
802
812
|
```
|
|
@@ -823,6 +833,7 @@ You can set your preferred commit mode in the `.dcommit` configuration file usin
|
|
|
823
833
|
#### Command-Line Usage
|
|
824
834
|
|
|
825
835
|
- **Interactive mode (auto):** When you have changes in multiple directories, DevCommit will automatically ask if you want to:
|
|
836
|
+
|
|
826
837
|
- Create one commit for all changes (global commit)
|
|
827
838
|
- Create separate commits per directory
|
|
828
839
|
|
|
@@ -834,10 +845,103 @@ You can set your preferred commit mode in the `.dcommit` configuration file usin
|
|
|
834
845
|
```
|
|
835
846
|
|
|
836
847
|
When using directory-based commits, you can:
|
|
848
|
+
|
|
837
849
|
1. Select which directories to commit (use Space to select, Enter to confirm)
|
|
838
850
|
2. For each selected directory, review and choose a commit message
|
|
839
851
|
3. Each directory gets its own commit with AI-generated messages based on its changes
|
|
840
852
|
|
|
853
|
+
### Commit Specific Files or Folders
|
|
854
|
+
|
|
855
|
+
DevCommit allows you to commit specific files or folders. This is useful when you want to commit only certain changes without affecting other staged files.
|
|
856
|
+
|
|
857
|
+
**Usage:**
|
|
858
|
+
|
|
859
|
+
```bash
|
|
860
|
+
# Commit specific files (must be staged first)
|
|
861
|
+
git add file1.py file2.py
|
|
862
|
+
devcommit --files file1.py file2.py
|
|
863
|
+
|
|
864
|
+
# Stage and commit specific files in one command
|
|
865
|
+
devcommit --stageAll --files file1.py file2.py
|
|
866
|
+
|
|
867
|
+
# Commit specific folders (must be staged first)
|
|
868
|
+
git add src/ tests/
|
|
869
|
+
devcommit --files src/ tests/
|
|
870
|
+
|
|
871
|
+
# Stage and commit multiple directories
|
|
872
|
+
devcommit -s -f src/core src/modules/account/ src/modules/auth/
|
|
873
|
+
|
|
874
|
+
# Short form
|
|
875
|
+
devcommit -s -f file1.py file2.py
|
|
876
|
+
```
|
|
877
|
+
|
|
878
|
+
When using `--files` or `-f`:
|
|
879
|
+
|
|
880
|
+
- Without `--stageAll`: Only commits files that are already staged (filters staged files to match specified paths)
|
|
881
|
+
- With `--stageAll`: Stages the specified files/folders and then commits them
|
|
882
|
+
- AI generates commit messages based on changes in those files
|
|
883
|
+
- Works with both individual files and entire directories
|
|
884
|
+
- Files with no changes are automatically filtered out
|
|
885
|
+
|
|
886
|
+
#### Commit Mode Behavior with `--files`
|
|
887
|
+
|
|
888
|
+
The `--files` flag respects your `COMMIT_MODE` setting:
|
|
889
|
+
|
|
890
|
+
- **`COMMIT_MODE=directory`** with `--files`:
|
|
891
|
+
- **Individual files**: Each file gets its own separate commit
|
|
892
|
+
- Example: `devcommit -f src/test1.py src/test2.py` creates 2 separate commits
|
|
893
|
+
- **Directories**: Each directory gets one commit containing all its files
|
|
894
|
+
- Example: `devcommit -f src/core src/modules/account/` creates 2 commits (one per directory)
|
|
895
|
+
|
|
896
|
+
- **`COMMIT_MODE=global`** with `--files`:
|
|
897
|
+
- All specified files/directories are committed together in a single commit
|
|
898
|
+
- Example: `devcommit -f src/test1.py src/test2.py` creates 1 commit for both files
|
|
899
|
+
|
|
900
|
+
- **`COMMIT_MODE=auto`** with `--files`:
|
|
901
|
+
- Always prompts you to choose between one commit for all files or separate commits
|
|
902
|
+
- If you select directory mode: individual files get separate commits, directories get one commit each
|
|
903
|
+
- If you select global mode: everything is committed together
|
|
904
|
+
|
|
905
|
+
### Push to Remote
|
|
906
|
+
|
|
907
|
+
DevCommit can automatically push your commits to the remote repository after committing.
|
|
908
|
+
|
|
909
|
+
**Usage:**
|
|
910
|
+
|
|
911
|
+
```bash
|
|
912
|
+
# Commit all staged changes and push
|
|
913
|
+
devcommit --push
|
|
914
|
+
|
|
915
|
+
# Commit specific files and push
|
|
916
|
+
devcommit --files file1.py file2.py --push
|
|
917
|
+
|
|
918
|
+
# Stage, commit, and push in one command
|
|
919
|
+
devcommit --stageAll --push
|
|
920
|
+
|
|
921
|
+
# Short form
|
|
922
|
+
devcommit -p
|
|
923
|
+
devcommit -f file1.py -p
|
|
924
|
+
```
|
|
925
|
+
|
|
926
|
+
**Note:** The push operation will only execute if commits were successfully made. If you cancel the commit, the push will be skipped.
|
|
927
|
+
|
|
928
|
+
### Regenerate Commit Messages
|
|
929
|
+
|
|
930
|
+
Don't like the AI-generated commit messages? You can regenerate them on the fly!
|
|
931
|
+
|
|
932
|
+
When viewing commit message options, you'll see:
|
|
933
|
+
- Numbered commit message suggestions
|
|
934
|
+
- ✏️ Enter custom message
|
|
935
|
+
- 🔄 **Regenerate commit messages** (new!)
|
|
936
|
+
- ❌ Cancel
|
|
937
|
+
|
|
938
|
+
Selecting "Regenerate commit messages" will:
|
|
939
|
+
- Call the AI again to generate new suggestions
|
|
940
|
+
- Show the new messages in the same prompt
|
|
941
|
+
- Allow you to regenerate again or select a message
|
|
942
|
+
|
|
943
|
+
This works for all commit modes (global, directory, and per-file commits).
|
|
944
|
+
|
|
841
945
|
### Additional Options
|
|
842
946
|
|
|
843
947
|
- `--excludeFiles` or `-e`: Exclude specific files from the diff
|
|
@@ -845,6 +949,8 @@ When using directory-based commits, you can:
|
|
|
845
949
|
- `--commitType` or `-t`: Specify the type of commit (e.g., conventional)
|
|
846
950
|
- `--stageAll` or `-s`: Stage all changes before committing
|
|
847
951
|
- `--directory` or `-d`: Force directory-based commits
|
|
952
|
+
- `--files` or `-f`: Stage and commit specific files or folders (can specify multiple)
|
|
953
|
+
- `--push` or `-p`: Push commits to remote after committing
|
|
848
954
|
|
|
849
955
|
### Examples
|
|
850
956
|
|
|
@@ -857,24 +963,46 @@ devcommit --commitType conventional
|
|
|
857
963
|
|
|
858
964
|
# Exclude lock files
|
|
859
965
|
devcommit --excludeFiles package-lock.json yarn.lock
|
|
966
|
+
|
|
967
|
+
# Stage and commit specific files
|
|
968
|
+
devcommit --files file1.py file2.py
|
|
969
|
+
|
|
970
|
+
# Stage and commit specific folders
|
|
971
|
+
devcommit --files src/ tests/
|
|
972
|
+
|
|
973
|
+
# Stage and commit multiple files and folders at once
|
|
974
|
+
devcommit --files src/ file1.py tests/ config.json
|
|
975
|
+
|
|
976
|
+
# Commit and push
|
|
977
|
+
devcommit --push
|
|
978
|
+
|
|
979
|
+
# Commit specific files and push
|
|
980
|
+
devcommit --files file1.py file2.py --push
|
|
981
|
+
|
|
982
|
+
# Stage and commit multiple directories with directory mode
|
|
983
|
+
devcommit -s -f src/core src/modules/account/ --directory
|
|
984
|
+
|
|
985
|
+
# Stage and commit, then push
|
|
986
|
+
devcommit -s -f src/core src/modules/account/ -p
|
|
860
987
|
```
|
|
861
988
|
|
|
862
989
|
## AI Provider Support
|
|
863
990
|
|
|
864
991
|
DevCommit now supports **multiple AI providers**! Choose from:
|
|
865
992
|
|
|
866
|
-
| Provider
|
|
867
|
-
|
|
868
|
-
| 🆓 **Gemini**
|
|
869
|
-
| ⚡ **Groq**
|
|
870
|
-
| 🤖 **OpenAI**
|
|
871
|
-
| 🧠 **Anthropic** | Limited trial
|
|
872
|
-
| 🏠 **Ollama**
|
|
873
|
-
| 🔧 **Custom**
|
|
993
|
+
| Provider | Free Tier | Speed | Quality | Get API Key |
|
|
994
|
+
| ---------------- | ------------------ | ----------- | --------- | ------------------------------------------------- |
|
|
995
|
+
| 🆓 **Gemini** | 15 req/min, 1M/day | Fast | Good | [Get Key](https://aistudio.google.com/app/apikey) |
|
|
996
|
+
| ⚡ **Groq** | Very generous | **Fastest** | Good | [Get Key](https://console.groq.com/keys) |
|
|
997
|
+
| 🤖 **OpenAI** | $5 trial | Medium | **Best** | [Get Key](https://platform.openai.com/api-keys) |
|
|
998
|
+
| 🧠 **Anthropic** | Limited trial | Medium | Excellent | [Get Key](https://console.anthropic.com/) |
|
|
999
|
+
| 🏠 **Ollama** | **Unlimited** | Medium | Good | [Install](https://ollama.ai/) |
|
|
1000
|
+
| 🔧 **Custom** | Varies | Varies | Varies | Your server |
|
|
874
1001
|
|
|
875
1002
|
### Quick Setup Examples
|
|
876
1003
|
|
|
877
1004
|
**Using Groq (Recommended for free tier):**
|
|
1005
|
+
|
|
878
1006
|
```bash
|
|
879
1007
|
export AI_PROVIDER=groq
|
|
880
1008
|
export GROQ_API_KEY='your-groq-api-key'
|
|
@@ -882,6 +1010,7 @@ devcommit
|
|
|
882
1010
|
```
|
|
883
1011
|
|
|
884
1012
|
**Using Ollama (Local, no API key needed):**
|
|
1013
|
+
|
|
885
1014
|
```bash
|
|
886
1015
|
# Install Ollama: https://ollama.ai/
|
|
887
1016
|
ollama pull llama3
|
|
@@ -890,6 +1019,7 @@ devcommit
|
|
|
890
1019
|
```
|
|
891
1020
|
|
|
892
1021
|
**Using Custom API:**
|
|
1022
|
+
|
|
893
1023
|
```bash
|
|
894
1024
|
export AI_PROVIDER=custom
|
|
895
1025
|
export CUSTOM_API_URL='http://localhost:8000/v1'
|
|
@@ -904,8 +1034,8 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
|
|
|
904
1034
|
|
|
905
1035
|
### AI Provider Settings
|
|
906
1036
|
|
|
907
|
-
| Variable
|
|
908
|
-
|
|
1037
|
+
| Variable | Description | Default | Options |
|
|
1038
|
+
| ------------- | ----------------------- | -------- | ----------------------------------------------------------- |
|
|
909
1039
|
| `AI_PROVIDER` | Which AI service to use | `gemini` | `gemini`, `openai`, `groq`, `anthropic`, `ollama`, `custom` |
|
|
910
1040
|
|
|
911
1041
|
### Provider-Specific Settings
|
|
@@ -949,21 +1079,23 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
|
|
|
949
1079
|
|
|
950
1080
|
### General Settings
|
|
951
1081
|
|
|
952
|
-
| Variable
|
|
953
|
-
|
|
954
|
-
| `LOCALE`
|
|
955
|
-
| `MAX_NO`
|
|
956
|
-
| `COMMIT_TYPE`
|
|
957
|
-
| `COMMIT_MODE`
|
|
958
|
-
| `EXCLUDE_FILES` | Files to exclude from diff
|
|
959
|
-
| `MAX_TOKENS`
|
|
1082
|
+
| Variable | Description | Default | Options |
|
|
1083
|
+
| --------------- | ------------------------------------ | ------------------------------------------------------ | ---------------------------------------- |
|
|
1084
|
+
| `LOCALE` | Language for commit messages | `en-US` | Any locale code (e.g., `en`, `es`, `fr`) |
|
|
1085
|
+
| `MAX_NO` | Number of commit message suggestions | `1` | Any positive integer |
|
|
1086
|
+
| `COMMIT_TYPE` | Style of commit messages | `general` | `general`, `conventional`, etc. |
|
|
1087
|
+
| `COMMIT_MODE` | Default commit strategy | `auto` | `auto`, `directory`, `global` |
|
|
1088
|
+
| `EXCLUDE_FILES` | Files to exclude from diff | `package-lock.json, pnpm-lock.yaml, yarn.lock, *.lock` | Comma-separated file patterns |
|
|
1089
|
+
| `MAX_TOKENS` | Maximum tokens for AI response | `8192` | Any positive integer |
|
|
960
1090
|
|
|
961
1091
|
### Configuration Priority
|
|
1092
|
+
|
|
962
1093
|
1. **`.dcommit` file** (highest priority)
|
|
963
1094
|
2. **Environment variables**
|
|
964
1095
|
3. **Built-in defaults** (lowest priority)
|
|
965
1096
|
|
|
966
1097
|
### Using Environment Variables
|
|
1098
|
+
|
|
967
1099
|
```bash
|
|
968
1100
|
# Basic setup with Gemini (default)
|
|
969
1101
|
export GEMINI_API_KEY='your-api-key-here'
|
|
@@ -978,6 +1110,7 @@ export GROQ_API_KEY='your-groq-key'
|
|
|
978
1110
|
```
|
|
979
1111
|
|
|
980
1112
|
### Using .dcommit File
|
|
1113
|
+
|
|
981
1114
|
See `.dcommit.example` for a complete configuration template with all providers.
|
|
982
1115
|
|
|
983
1116
|
**Note:** The `.dcommit` file is **optional**. DevCommit will work with just environment variables!
|
|
@@ -8,6 +8,9 @@ A command-line AI tool for autocommits.
|
|
|
8
8
|
- 🚀 Automatic commit generation using AI
|
|
9
9
|
- 📁 Directory-based commits - create separate commits for each root directory
|
|
10
10
|
- 🎯 Interactive mode to choose between global or directory-based commits
|
|
11
|
+
- 📄 **Commit specific files or folders** - Stage and commit only selected files/directories
|
|
12
|
+
- 🔄 **Regenerate commit messages** - Don't like the suggestions? Regenerate with one click
|
|
13
|
+
- 🚀 **Push to remote** - Automatically push commits after committing
|
|
11
14
|
- ⚙️ Flexible configuration - use environment variables or .dcommit file
|
|
12
15
|
- 🏠 Self-hosted model support - use your own AI infrastructure
|
|
13
16
|
- 🆓 Multiple free tier options available
|
|
@@ -16,24 +19,27 @@ A command-line AI tool for autocommits.
|
|
|
16
19
|
|
|
17
20
|
## Installation
|
|
18
21
|
|
|
19
|
-
1. **Install DevCommit**
|
|
20
|
-
|
|
22
|
+
1. **Install DevCommit**
|
|
23
|
+
|
|
21
24
|
**Option 1: Using pip (local installation)**
|
|
25
|
+
|
|
22
26
|
```bash
|
|
23
27
|
pip install devcommit
|
|
24
28
|
```
|
|
25
|
-
|
|
29
|
+
|
|
26
30
|
**Option 2: Using pipx (global installation, recommended)**
|
|
31
|
+
|
|
27
32
|
```bash
|
|
28
33
|
# Install pipx if you don't have it
|
|
29
34
|
python3 -m pip install --user pipx
|
|
30
35
|
python3 -m pipx ensurepath
|
|
31
|
-
|
|
36
|
+
|
|
32
37
|
# Install DevCommit globally
|
|
33
38
|
pipx install devcommit
|
|
34
39
|
```
|
|
40
|
+
|
|
35
41
|
> **💡 Why pipx?** pipx installs CLI tools in isolated environments, preventing dependency conflicts while making them globally available.
|
|
36
|
-
|
|
42
|
+
|
|
37
43
|
**All AI providers are included by default!** ✅ Gemini, OpenAI, Groq, Anthropic, Ollama, and Custom API support.
|
|
38
44
|
|
|
39
45
|
2. **Set Up Configuration (Required: API Key)**
|
|
@@ -42,19 +48,21 @@ A command-line AI tool for autocommits.
|
|
|
42
48
|
**Priority Order:** `.dcommit` file → Environment Variables → Defaults
|
|
43
49
|
|
|
44
50
|
### Option 1: Environment Variables (Quickest)
|
|
51
|
+
|
|
45
52
|
```bash
|
|
46
53
|
# Using Gemini (default)
|
|
47
54
|
export GEMINI_API_KEY='your-api-key-here'
|
|
48
|
-
|
|
55
|
+
|
|
49
56
|
# Or using Groq (recommended for free tier)
|
|
50
57
|
export AI_PROVIDER='groq'
|
|
51
58
|
export GROQ_API_KEY='your-groq-key'
|
|
52
|
-
|
|
59
|
+
|
|
53
60
|
# Add to ~/.bashrc or ~/.zshrc for persistence
|
|
54
61
|
echo "export GEMINI_API_KEY='your-key'" >> ~/.bashrc
|
|
55
62
|
```
|
|
56
63
|
|
|
57
64
|
### Option 2: .dcommit File (Home Directory)
|
|
65
|
+
|
|
58
66
|
```bash
|
|
59
67
|
cat > ~/.dcommit << 'EOF'
|
|
60
68
|
GEMINI_API_KEY = your-api-key-here
|
|
@@ -67,6 +75,7 @@ A command-line AI tool for autocommits.
|
|
|
67
75
|
```
|
|
68
76
|
|
|
69
77
|
### Option 3: .dcommit File (Virtual Environment)
|
|
78
|
+
|
|
70
79
|
```bash
|
|
71
80
|
mkdir -p $VIRTUAL_ENV/config
|
|
72
81
|
cat > $VIRTUAL_ENV/config/.dcommit << 'EOF'
|
|
@@ -92,6 +101,7 @@ devcommit
|
|
|
92
101
|
### Basic Usage
|
|
93
102
|
|
|
94
103
|
- **Stage all changes and commit:**
|
|
104
|
+
|
|
95
105
|
```bash
|
|
96
106
|
devcommit --stageAll
|
|
97
107
|
```
|
|
@@ -118,6 +128,7 @@ You can set your preferred commit mode in the `.dcommit` configuration file usin
|
|
|
118
128
|
#### Command-Line Usage
|
|
119
129
|
|
|
120
130
|
- **Interactive mode (auto):** When you have changes in multiple directories, DevCommit will automatically ask if you want to:
|
|
131
|
+
|
|
121
132
|
- Create one commit for all changes (global commit)
|
|
122
133
|
- Create separate commits per directory
|
|
123
134
|
|
|
@@ -129,10 +140,103 @@ You can set your preferred commit mode in the `.dcommit` configuration file usin
|
|
|
129
140
|
```
|
|
130
141
|
|
|
131
142
|
When using directory-based commits, you can:
|
|
143
|
+
|
|
132
144
|
1. Select which directories to commit (use Space to select, Enter to confirm)
|
|
133
145
|
2. For each selected directory, review and choose a commit message
|
|
134
146
|
3. Each directory gets its own commit with AI-generated messages based on its changes
|
|
135
147
|
|
|
148
|
+
### Commit Specific Files or Folders
|
|
149
|
+
|
|
150
|
+
DevCommit allows you to commit specific files or folders. This is useful when you want to commit only certain changes without affecting other staged files.
|
|
151
|
+
|
|
152
|
+
**Usage:**
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Commit specific files (must be staged first)
|
|
156
|
+
git add file1.py file2.py
|
|
157
|
+
devcommit --files file1.py file2.py
|
|
158
|
+
|
|
159
|
+
# Stage and commit specific files in one command
|
|
160
|
+
devcommit --stageAll --files file1.py file2.py
|
|
161
|
+
|
|
162
|
+
# Commit specific folders (must be staged first)
|
|
163
|
+
git add src/ tests/
|
|
164
|
+
devcommit --files src/ tests/
|
|
165
|
+
|
|
166
|
+
# Stage and commit multiple directories
|
|
167
|
+
devcommit -s -f src/core src/modules/account/ src/modules/auth/
|
|
168
|
+
|
|
169
|
+
# Short form
|
|
170
|
+
devcommit -s -f file1.py file2.py
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
When using `--files` or `-f`:
|
|
174
|
+
|
|
175
|
+
- Without `--stageAll`: Only commits files that are already staged (filters staged files to match specified paths)
|
|
176
|
+
- With `--stageAll`: Stages the specified files/folders and then commits them
|
|
177
|
+
- AI generates commit messages based on changes in those files
|
|
178
|
+
- Works with both individual files and entire directories
|
|
179
|
+
- Files with no changes are automatically filtered out
|
|
180
|
+
|
|
181
|
+
#### Commit Mode Behavior with `--files`
|
|
182
|
+
|
|
183
|
+
The `--files` flag respects your `COMMIT_MODE` setting:
|
|
184
|
+
|
|
185
|
+
- **`COMMIT_MODE=directory`** with `--files`:
|
|
186
|
+
- **Individual files**: Each file gets its own separate commit
|
|
187
|
+
- Example: `devcommit -f src/test1.py src/test2.py` creates 2 separate commits
|
|
188
|
+
- **Directories**: Each directory gets one commit containing all its files
|
|
189
|
+
- Example: `devcommit -f src/core src/modules/account/` creates 2 commits (one per directory)
|
|
190
|
+
|
|
191
|
+
- **`COMMIT_MODE=global`** with `--files`:
|
|
192
|
+
- All specified files/directories are committed together in a single commit
|
|
193
|
+
- Example: `devcommit -f src/test1.py src/test2.py` creates 1 commit for both files
|
|
194
|
+
|
|
195
|
+
- **`COMMIT_MODE=auto`** with `--files`:
|
|
196
|
+
- Always prompts you to choose between one commit for all files or separate commits
|
|
197
|
+
- If you select directory mode: individual files get separate commits, directories get one commit each
|
|
198
|
+
- If you select global mode: everything is committed together
|
|
199
|
+
|
|
200
|
+
### Push to Remote
|
|
201
|
+
|
|
202
|
+
DevCommit can automatically push your commits to the remote repository after committing.
|
|
203
|
+
|
|
204
|
+
**Usage:**
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
# Commit all staged changes and push
|
|
208
|
+
devcommit --push
|
|
209
|
+
|
|
210
|
+
# Commit specific files and push
|
|
211
|
+
devcommit --files file1.py file2.py --push
|
|
212
|
+
|
|
213
|
+
# Stage, commit, and push in one command
|
|
214
|
+
devcommit --stageAll --push
|
|
215
|
+
|
|
216
|
+
# Short form
|
|
217
|
+
devcommit -p
|
|
218
|
+
devcommit -f file1.py -p
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Note:** The push operation will only execute if commits were successfully made. If you cancel the commit, the push will be skipped.
|
|
222
|
+
|
|
223
|
+
### Regenerate Commit Messages
|
|
224
|
+
|
|
225
|
+
Don't like the AI-generated commit messages? You can regenerate them on the fly!
|
|
226
|
+
|
|
227
|
+
When viewing commit message options, you'll see:
|
|
228
|
+
- Numbered commit message suggestions
|
|
229
|
+
- ✏️ Enter custom message
|
|
230
|
+
- 🔄 **Regenerate commit messages** (new!)
|
|
231
|
+
- ❌ Cancel
|
|
232
|
+
|
|
233
|
+
Selecting "Regenerate commit messages" will:
|
|
234
|
+
- Call the AI again to generate new suggestions
|
|
235
|
+
- Show the new messages in the same prompt
|
|
236
|
+
- Allow you to regenerate again or select a message
|
|
237
|
+
|
|
238
|
+
This works for all commit modes (global, directory, and per-file commits).
|
|
239
|
+
|
|
136
240
|
### Additional Options
|
|
137
241
|
|
|
138
242
|
- `--excludeFiles` or `-e`: Exclude specific files from the diff
|
|
@@ -140,6 +244,8 @@ When using directory-based commits, you can:
|
|
|
140
244
|
- `--commitType` or `-t`: Specify the type of commit (e.g., conventional)
|
|
141
245
|
- `--stageAll` or `-s`: Stage all changes before committing
|
|
142
246
|
- `--directory` or `-d`: Force directory-based commits
|
|
247
|
+
- `--files` or `-f`: Stage and commit specific files or folders (can specify multiple)
|
|
248
|
+
- `--push` or `-p`: Push commits to remote after committing
|
|
143
249
|
|
|
144
250
|
### Examples
|
|
145
251
|
|
|
@@ -152,24 +258,46 @@ devcommit --commitType conventional
|
|
|
152
258
|
|
|
153
259
|
# Exclude lock files
|
|
154
260
|
devcommit --excludeFiles package-lock.json yarn.lock
|
|
261
|
+
|
|
262
|
+
# Stage and commit specific files
|
|
263
|
+
devcommit --files file1.py file2.py
|
|
264
|
+
|
|
265
|
+
# Stage and commit specific folders
|
|
266
|
+
devcommit --files src/ tests/
|
|
267
|
+
|
|
268
|
+
# Stage and commit multiple files and folders at once
|
|
269
|
+
devcommit --files src/ file1.py tests/ config.json
|
|
270
|
+
|
|
271
|
+
# Commit and push
|
|
272
|
+
devcommit --push
|
|
273
|
+
|
|
274
|
+
# Commit specific files and push
|
|
275
|
+
devcommit --files file1.py file2.py --push
|
|
276
|
+
|
|
277
|
+
# Stage and commit multiple directories with directory mode
|
|
278
|
+
devcommit -s -f src/core src/modules/account/ --directory
|
|
279
|
+
|
|
280
|
+
# Stage and commit, then push
|
|
281
|
+
devcommit -s -f src/core src/modules/account/ -p
|
|
155
282
|
```
|
|
156
283
|
|
|
157
284
|
## AI Provider Support
|
|
158
285
|
|
|
159
286
|
DevCommit now supports **multiple AI providers**! Choose from:
|
|
160
287
|
|
|
161
|
-
| Provider
|
|
162
|
-
|
|
163
|
-
| 🆓 **Gemini**
|
|
164
|
-
| ⚡ **Groq**
|
|
165
|
-
| 🤖 **OpenAI**
|
|
166
|
-
| 🧠 **Anthropic** | Limited trial
|
|
167
|
-
| 🏠 **Ollama**
|
|
168
|
-
| 🔧 **Custom**
|
|
288
|
+
| Provider | Free Tier | Speed | Quality | Get API Key |
|
|
289
|
+
| ---------------- | ------------------ | ----------- | --------- | ------------------------------------------------- |
|
|
290
|
+
| 🆓 **Gemini** | 15 req/min, 1M/day | Fast | Good | [Get Key](https://aistudio.google.com/app/apikey) |
|
|
291
|
+
| ⚡ **Groq** | Very generous | **Fastest** | Good | [Get Key](https://console.groq.com/keys) |
|
|
292
|
+
| 🤖 **OpenAI** | $5 trial | Medium | **Best** | [Get Key](https://platform.openai.com/api-keys) |
|
|
293
|
+
| 🧠 **Anthropic** | Limited trial | Medium | Excellent | [Get Key](https://console.anthropic.com/) |
|
|
294
|
+
| 🏠 **Ollama** | **Unlimited** | Medium | Good | [Install](https://ollama.ai/) |
|
|
295
|
+
| 🔧 **Custom** | Varies | Varies | Varies | Your server |
|
|
169
296
|
|
|
170
297
|
### Quick Setup Examples
|
|
171
298
|
|
|
172
299
|
**Using Groq (Recommended for free tier):**
|
|
300
|
+
|
|
173
301
|
```bash
|
|
174
302
|
export AI_PROVIDER=groq
|
|
175
303
|
export GROQ_API_KEY='your-groq-api-key'
|
|
@@ -177,6 +305,7 @@ devcommit
|
|
|
177
305
|
```
|
|
178
306
|
|
|
179
307
|
**Using Ollama (Local, no API key needed):**
|
|
308
|
+
|
|
180
309
|
```bash
|
|
181
310
|
# Install Ollama: https://ollama.ai/
|
|
182
311
|
ollama pull llama3
|
|
@@ -185,6 +314,7 @@ devcommit
|
|
|
185
314
|
```
|
|
186
315
|
|
|
187
316
|
**Using Custom API:**
|
|
317
|
+
|
|
188
318
|
```bash
|
|
189
319
|
export AI_PROVIDER=custom
|
|
190
320
|
export CUSTOM_API_URL='http://localhost:8000/v1'
|
|
@@ -199,8 +329,8 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
|
|
|
199
329
|
|
|
200
330
|
### AI Provider Settings
|
|
201
331
|
|
|
202
|
-
| Variable
|
|
203
|
-
|
|
332
|
+
| Variable | Description | Default | Options |
|
|
333
|
+
| ------------- | ----------------------- | -------- | ----------------------------------------------------------- |
|
|
204
334
|
| `AI_PROVIDER` | Which AI service to use | `gemini` | `gemini`, `openai`, `groq`, `anthropic`, `ollama`, `custom` |
|
|
205
335
|
|
|
206
336
|
### Provider-Specific Settings
|
|
@@ -244,21 +374,23 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
|
|
|
244
374
|
|
|
245
375
|
### General Settings
|
|
246
376
|
|
|
247
|
-
| Variable
|
|
248
|
-
|
|
249
|
-
| `LOCALE`
|
|
250
|
-
| `MAX_NO`
|
|
251
|
-
| `COMMIT_TYPE`
|
|
252
|
-
| `COMMIT_MODE`
|
|
253
|
-
| `EXCLUDE_FILES` | Files to exclude from diff
|
|
254
|
-
| `MAX_TOKENS`
|
|
377
|
+
| Variable | Description | Default | Options |
|
|
378
|
+
| --------------- | ------------------------------------ | ------------------------------------------------------ | ---------------------------------------- |
|
|
379
|
+
| `LOCALE` | Language for commit messages | `en-US` | Any locale code (e.g., `en`, `es`, `fr`) |
|
|
380
|
+
| `MAX_NO` | Number of commit message suggestions | `1` | Any positive integer |
|
|
381
|
+
| `COMMIT_TYPE` | Style of commit messages | `general` | `general`, `conventional`, etc. |
|
|
382
|
+
| `COMMIT_MODE` | Default commit strategy | `auto` | `auto`, `directory`, `global` |
|
|
383
|
+
| `EXCLUDE_FILES` | Files to exclude from diff | `package-lock.json, pnpm-lock.yaml, yarn.lock, *.lock` | Comma-separated file patterns |
|
|
384
|
+
| `MAX_TOKENS` | Maximum tokens for AI response | `8192` | Any positive integer |
|
|
255
385
|
|
|
256
386
|
### Configuration Priority
|
|
387
|
+
|
|
257
388
|
1. **`.dcommit` file** (highest priority)
|
|
258
389
|
2. **Environment variables**
|
|
259
390
|
3. **Built-in defaults** (lowest priority)
|
|
260
391
|
|
|
261
392
|
### Using Environment Variables
|
|
393
|
+
|
|
262
394
|
```bash
|
|
263
395
|
# Basic setup with Gemini (default)
|
|
264
396
|
export GEMINI_API_KEY='your-api-key-here'
|
|
@@ -273,6 +405,7 @@ export GROQ_API_KEY='your-groq-key'
|
|
|
273
405
|
```
|
|
274
406
|
|
|
275
407
|
### Using .dcommit File
|
|
408
|
+
|
|
276
409
|
See `.dcommit.example` for a complete configuration template with all providers.
|
|
277
410
|
|
|
278
411
|
**Note:** The `.dcommit` file is **optional**. DevCommit will work with just environment variables!
|