devcommit 0.1.4.5__tar.gz → 0.1.4.7__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.5 → devcommit-0.1.4.7}/PKG-INFO +90 -29
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/README.md +89 -28
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/devcommit/app/ai_providers.py +2 -2
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/devcommit/app/gemini_ai.py +1 -1
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/devcommit/app/prompt.py +4 -1
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/devcommit/main.py +187 -19
- devcommit-0.1.4.7/devcommit/utils/git.py +326 -0
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/devcommit/utils/parser.py +12 -0
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/pyproject.toml +1 -1
- devcommit-0.1.4.5/devcommit/utils/git.py +0 -170
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/COPYING +0 -0
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/devcommit/__init__.py +0 -0
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/devcommit/app/__init__.py +0 -0
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/devcommit/utils/__init__.py +0 -0
- {devcommit-0.1.4.5 → devcommit-0.1.4.7}/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.7
|
|
4
4
|
Summary: AI-powered git commit message generator
|
|
5
5
|
License: GNU GENERAL PUBLIC LICENSE
|
|
6
6
|
Version 3, 29 June 2007
|
|
@@ -721,24 +721,27 @@ A command-line AI tool for autocommits.
|
|
|
721
721
|
|
|
722
722
|
## Installation
|
|
723
723
|
|
|
724
|
-
1. **Install DevCommit**
|
|
725
|
-
|
|
724
|
+
1. **Install DevCommit**
|
|
725
|
+
|
|
726
726
|
**Option 1: Using pip (local installation)**
|
|
727
|
+
|
|
727
728
|
```bash
|
|
728
729
|
pip install devcommit
|
|
729
730
|
```
|
|
730
|
-
|
|
731
|
+
|
|
731
732
|
**Option 2: Using pipx (global installation, recommended)**
|
|
733
|
+
|
|
732
734
|
```bash
|
|
733
735
|
# Install pipx if you don't have it
|
|
734
736
|
python3 -m pip install --user pipx
|
|
735
737
|
python3 -m pipx ensurepath
|
|
736
|
-
|
|
738
|
+
|
|
737
739
|
# Install DevCommit globally
|
|
738
740
|
pipx install devcommit
|
|
739
741
|
```
|
|
742
|
+
|
|
740
743
|
> **💡 Why pipx?** pipx installs CLI tools in isolated environments, preventing dependency conflicts while making them globally available.
|
|
741
|
-
|
|
744
|
+
|
|
742
745
|
**All AI providers are included by default!** ✅ Gemini, OpenAI, Groq, Anthropic, Ollama, and Custom API support.
|
|
743
746
|
|
|
744
747
|
2. **Set Up Configuration (Required: API Key)**
|
|
@@ -747,31 +750,34 @@ A command-line AI tool for autocommits.
|
|
|
747
750
|
**Priority Order:** `.dcommit` file → Environment Variables → Defaults
|
|
748
751
|
|
|
749
752
|
### Option 1: Environment Variables (Quickest)
|
|
753
|
+
|
|
750
754
|
```bash
|
|
751
755
|
# Using Gemini (default)
|
|
752
756
|
export GEMINI_API_KEY='your-api-key-here'
|
|
753
|
-
|
|
757
|
+
|
|
754
758
|
# Or using Groq (recommended for free tier)
|
|
755
759
|
export AI_PROVIDER='groq'
|
|
756
760
|
export GROQ_API_KEY='your-groq-key'
|
|
757
|
-
|
|
761
|
+
|
|
758
762
|
# Add to ~/.bashrc or ~/.zshrc for persistence
|
|
759
763
|
echo "export GEMINI_API_KEY='your-key'" >> ~/.bashrc
|
|
760
764
|
```
|
|
761
765
|
|
|
762
766
|
### Option 2: .dcommit File (Home Directory)
|
|
767
|
+
|
|
763
768
|
```bash
|
|
764
769
|
cat > ~/.dcommit << 'EOF'
|
|
765
770
|
GEMINI_API_KEY = your-api-key-here
|
|
766
771
|
LOCALE = en
|
|
767
772
|
MAX_NO = 1
|
|
768
773
|
COMMIT_TYPE = conventional
|
|
769
|
-
MODEL_NAME = gemini-
|
|
774
|
+
MODEL_NAME = gemini-2.5-flash
|
|
770
775
|
COMMIT_MODE = auto
|
|
771
776
|
EOF
|
|
772
777
|
```
|
|
773
778
|
|
|
774
779
|
### Option 3: .dcommit File (Virtual Environment)
|
|
780
|
+
|
|
775
781
|
```bash
|
|
776
782
|
mkdir -p $VIRTUAL_ENV/config
|
|
777
783
|
cat > $VIRTUAL_ENV/config/.dcommit << 'EOF'
|
|
@@ -779,7 +785,7 @@ A command-line AI tool for autocommits.
|
|
|
779
785
|
LOCALE = en
|
|
780
786
|
MAX_NO = 1
|
|
781
787
|
COMMIT_TYPE = conventional
|
|
782
|
-
MODEL_NAME = gemini-
|
|
788
|
+
MODEL_NAME = gemini-2.0-flash-exp
|
|
783
789
|
COMMIT_MODE = auto
|
|
784
790
|
EOF
|
|
785
791
|
```
|
|
@@ -797,6 +803,7 @@ devcommit
|
|
|
797
803
|
### Basic Usage
|
|
798
804
|
|
|
799
805
|
- **Stage all changes and commit:**
|
|
806
|
+
|
|
800
807
|
```bash
|
|
801
808
|
devcommit --stageAll
|
|
802
809
|
```
|
|
@@ -823,6 +830,7 @@ You can set your preferred commit mode in the `.dcommit` configuration file usin
|
|
|
823
830
|
#### Command-Line Usage
|
|
824
831
|
|
|
825
832
|
- **Interactive mode (auto):** When you have changes in multiple directories, DevCommit will automatically ask if you want to:
|
|
833
|
+
|
|
826
834
|
- Create one commit for all changes (global commit)
|
|
827
835
|
- Create separate commits per directory
|
|
828
836
|
|
|
@@ -834,10 +842,40 @@ You can set your preferred commit mode in the `.dcommit` configuration file usin
|
|
|
834
842
|
```
|
|
835
843
|
|
|
836
844
|
When using directory-based commits, you can:
|
|
845
|
+
|
|
837
846
|
1. Select which directories to commit (use Space to select, Enter to confirm)
|
|
838
847
|
2. For each selected directory, review and choose a commit message
|
|
839
848
|
3. Each directory gets its own commit with AI-generated messages based on its changes
|
|
840
849
|
|
|
850
|
+
### Commit Specific Files or Folders
|
|
851
|
+
|
|
852
|
+
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.
|
|
853
|
+
|
|
854
|
+
**Usage:**
|
|
855
|
+
|
|
856
|
+
```bash
|
|
857
|
+
# Commit specific files (must be staged first)
|
|
858
|
+
git add file1.py file2.py
|
|
859
|
+
devcommit --files file1.py file2.py
|
|
860
|
+
|
|
861
|
+
# Stage and commit specific files in one command
|
|
862
|
+
devcommit --stageAll --files file1.py file2.py
|
|
863
|
+
|
|
864
|
+
# Commit specific folders (must be staged first)
|
|
865
|
+
git add src/ tests/
|
|
866
|
+
devcommit --files src/ tests/
|
|
867
|
+
|
|
868
|
+
# Short form
|
|
869
|
+
devcommit -s -f file1.py file2.py
|
|
870
|
+
```
|
|
871
|
+
|
|
872
|
+
When using `--files` or `-f`:
|
|
873
|
+
|
|
874
|
+
- Without `--stageAll`: Only commits files that are already staged (filters staged files to match specified paths)
|
|
875
|
+
- With `--stageAll`: Stages the specified files/folders and then commits them
|
|
876
|
+
- AI generates commit messages based on changes in those files
|
|
877
|
+
- Works with both individual files and entire directories
|
|
878
|
+
|
|
841
879
|
### Additional Options
|
|
842
880
|
|
|
843
881
|
- `--excludeFiles` or `-e`: Exclude specific files from the diff
|
|
@@ -845,6 +883,8 @@ When using directory-based commits, you can:
|
|
|
845
883
|
- `--commitType` or `-t`: Specify the type of commit (e.g., conventional)
|
|
846
884
|
- `--stageAll` or `-s`: Stage all changes before committing
|
|
847
885
|
- `--directory` or `-d`: Force directory-based commits
|
|
886
|
+
- `--files` or `-f`: Stage and commit specific files or folders (can specify multiple)
|
|
887
|
+
- `--push` or `-p`: Push commits to remote after committing
|
|
848
888
|
|
|
849
889
|
### Examples
|
|
850
890
|
|
|
@@ -857,24 +897,40 @@ devcommit --commitType conventional
|
|
|
857
897
|
|
|
858
898
|
# Exclude lock files
|
|
859
899
|
devcommit --excludeFiles package-lock.json yarn.lock
|
|
900
|
+
|
|
901
|
+
# Stage and commit specific files
|
|
902
|
+
devcommit --files file1.py file2.py
|
|
903
|
+
|
|
904
|
+
# Stage and commit specific folders
|
|
905
|
+
devcommit --files src/ tests/
|
|
906
|
+
|
|
907
|
+
# Stage and commit multiple files and folders at once
|
|
908
|
+
devcommit --files src/ file1.py tests/ config.json
|
|
909
|
+
|
|
910
|
+
# Commit and push
|
|
911
|
+
devcommit --push
|
|
912
|
+
|
|
913
|
+
# Commit specific files and push
|
|
914
|
+
devcommit --files file1.py file2.py --push
|
|
860
915
|
```
|
|
861
916
|
|
|
862
917
|
## AI Provider Support
|
|
863
918
|
|
|
864
919
|
DevCommit now supports **multiple AI providers**! Choose from:
|
|
865
920
|
|
|
866
|
-
| Provider
|
|
867
|
-
|
|
868
|
-
| 🆓 **Gemini**
|
|
869
|
-
| ⚡ **Groq**
|
|
870
|
-
| 🤖 **OpenAI**
|
|
871
|
-
| 🧠 **Anthropic** | Limited trial
|
|
872
|
-
| 🏠 **Ollama**
|
|
873
|
-
| 🔧 **Custom**
|
|
921
|
+
| Provider | Free Tier | Speed | Quality | Get API Key |
|
|
922
|
+
| ---------------- | ------------------ | ----------- | --------- | ------------------------------------------------- |
|
|
923
|
+
| 🆓 **Gemini** | 15 req/min, 1M/day | Fast | Good | [Get Key](https://aistudio.google.com/app/apikey) |
|
|
924
|
+
| ⚡ **Groq** | Very generous | **Fastest** | Good | [Get Key](https://console.groq.com/keys) |
|
|
925
|
+
| 🤖 **OpenAI** | $5 trial | Medium | **Best** | [Get Key](https://platform.openai.com/api-keys) |
|
|
926
|
+
| 🧠 **Anthropic** | Limited trial | Medium | Excellent | [Get Key](https://console.anthropic.com/) |
|
|
927
|
+
| 🏠 **Ollama** | **Unlimited** | Medium | Good | [Install](https://ollama.ai/) |
|
|
928
|
+
| 🔧 **Custom** | Varies | Varies | Varies | Your server |
|
|
874
929
|
|
|
875
930
|
### Quick Setup Examples
|
|
876
931
|
|
|
877
932
|
**Using Groq (Recommended for free tier):**
|
|
933
|
+
|
|
878
934
|
```bash
|
|
879
935
|
export AI_PROVIDER=groq
|
|
880
936
|
export GROQ_API_KEY='your-groq-api-key'
|
|
@@ -882,6 +938,7 @@ devcommit
|
|
|
882
938
|
```
|
|
883
939
|
|
|
884
940
|
**Using Ollama (Local, no API key needed):**
|
|
941
|
+
|
|
885
942
|
```bash
|
|
886
943
|
# Install Ollama: https://ollama.ai/
|
|
887
944
|
ollama pull llama3
|
|
@@ -890,6 +947,7 @@ devcommit
|
|
|
890
947
|
```
|
|
891
948
|
|
|
892
949
|
**Using Custom API:**
|
|
950
|
+
|
|
893
951
|
```bash
|
|
894
952
|
export AI_PROVIDER=custom
|
|
895
953
|
export CUSTOM_API_URL='http://localhost:8000/v1'
|
|
@@ -904,8 +962,8 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
|
|
|
904
962
|
|
|
905
963
|
### AI Provider Settings
|
|
906
964
|
|
|
907
|
-
| Variable
|
|
908
|
-
|
|
965
|
+
| Variable | Description | Default | Options |
|
|
966
|
+
| ------------- | ----------------------- | -------- | ----------------------------------------------------------- |
|
|
909
967
|
| `AI_PROVIDER` | Which AI service to use | `gemini` | `gemini`, `openai`, `groq`, `anthropic`, `ollama`, `custom` |
|
|
910
968
|
|
|
911
969
|
### Provider-Specific Settings
|
|
@@ -914,7 +972,7 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
|
|
|
914
972
|
| Variable | Description | Default |
|
|
915
973
|
|----------|-------------|---------|
|
|
916
974
|
| `GEMINI_API_KEY` | Google Gemini API key | - |
|
|
917
|
-
| `GEMINI_MODEL` | Model name | `gemini-
|
|
975
|
+
| `GEMINI_MODEL` | Model name | `gemini-2.0-flash-exp` |
|
|
918
976
|
|
|
919
977
|
**OpenAI:**
|
|
920
978
|
| Variable | Description | Default |
|
|
@@ -949,21 +1007,23 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
|
|
|
949
1007
|
|
|
950
1008
|
### General Settings
|
|
951
1009
|
|
|
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`
|
|
1010
|
+
| Variable | Description | Default | Options |
|
|
1011
|
+
| --------------- | ------------------------------------ | ------------------------------------------------------ | ---------------------------------------- |
|
|
1012
|
+
| `LOCALE` | Language for commit messages | `en-US` | Any locale code (e.g., `en`, `es`, `fr`) |
|
|
1013
|
+
| `MAX_NO` | Number of commit message suggestions | `1` | Any positive integer |
|
|
1014
|
+
| `COMMIT_TYPE` | Style of commit messages | `general` | `general`, `conventional`, etc. |
|
|
1015
|
+
| `COMMIT_MODE` | Default commit strategy | `auto` | `auto`, `directory`, `global` |
|
|
1016
|
+
| `EXCLUDE_FILES` | Files to exclude from diff | `package-lock.json, pnpm-lock.yaml, yarn.lock, *.lock` | Comma-separated file patterns |
|
|
1017
|
+
| `MAX_TOKENS` | Maximum tokens for AI response | `8192` | Any positive integer |
|
|
960
1018
|
|
|
961
1019
|
### Configuration Priority
|
|
1020
|
+
|
|
962
1021
|
1. **`.dcommit` file** (highest priority)
|
|
963
1022
|
2. **Environment variables**
|
|
964
1023
|
3. **Built-in defaults** (lowest priority)
|
|
965
1024
|
|
|
966
1025
|
### Using Environment Variables
|
|
1026
|
+
|
|
967
1027
|
```bash
|
|
968
1028
|
# Basic setup with Gemini (default)
|
|
969
1029
|
export GEMINI_API_KEY='your-api-key-here'
|
|
@@ -978,6 +1038,7 @@ export GROQ_API_KEY='your-groq-key'
|
|
|
978
1038
|
```
|
|
979
1039
|
|
|
980
1040
|
### Using .dcommit File
|
|
1041
|
+
|
|
981
1042
|
See `.dcommit.example` for a complete configuration template with all providers.
|
|
982
1043
|
|
|
983
1044
|
**Note:** The `.dcommit` file is **optional**. DevCommit will work with just environment variables!
|
|
@@ -16,24 +16,27 @@ A command-line AI tool for autocommits.
|
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
|
-
1. **Install DevCommit**
|
|
20
|
-
|
|
19
|
+
1. **Install DevCommit**
|
|
20
|
+
|
|
21
21
|
**Option 1: Using pip (local installation)**
|
|
22
|
+
|
|
22
23
|
```bash
|
|
23
24
|
pip install devcommit
|
|
24
25
|
```
|
|
25
|
-
|
|
26
|
+
|
|
26
27
|
**Option 2: Using pipx (global installation, recommended)**
|
|
28
|
+
|
|
27
29
|
```bash
|
|
28
30
|
# Install pipx if you don't have it
|
|
29
31
|
python3 -m pip install --user pipx
|
|
30
32
|
python3 -m pipx ensurepath
|
|
31
|
-
|
|
33
|
+
|
|
32
34
|
# Install DevCommit globally
|
|
33
35
|
pipx install devcommit
|
|
34
36
|
```
|
|
37
|
+
|
|
35
38
|
> **💡 Why pipx?** pipx installs CLI tools in isolated environments, preventing dependency conflicts while making them globally available.
|
|
36
|
-
|
|
39
|
+
|
|
37
40
|
**All AI providers are included by default!** ✅ Gemini, OpenAI, Groq, Anthropic, Ollama, and Custom API support.
|
|
38
41
|
|
|
39
42
|
2. **Set Up Configuration (Required: API Key)**
|
|
@@ -42,31 +45,34 @@ A command-line AI tool for autocommits.
|
|
|
42
45
|
**Priority Order:** `.dcommit` file → Environment Variables → Defaults
|
|
43
46
|
|
|
44
47
|
### Option 1: Environment Variables (Quickest)
|
|
48
|
+
|
|
45
49
|
```bash
|
|
46
50
|
# Using Gemini (default)
|
|
47
51
|
export GEMINI_API_KEY='your-api-key-here'
|
|
48
|
-
|
|
52
|
+
|
|
49
53
|
# Or using Groq (recommended for free tier)
|
|
50
54
|
export AI_PROVIDER='groq'
|
|
51
55
|
export GROQ_API_KEY='your-groq-key'
|
|
52
|
-
|
|
56
|
+
|
|
53
57
|
# Add to ~/.bashrc or ~/.zshrc for persistence
|
|
54
58
|
echo "export GEMINI_API_KEY='your-key'" >> ~/.bashrc
|
|
55
59
|
```
|
|
56
60
|
|
|
57
61
|
### Option 2: .dcommit File (Home Directory)
|
|
62
|
+
|
|
58
63
|
```bash
|
|
59
64
|
cat > ~/.dcommit << 'EOF'
|
|
60
65
|
GEMINI_API_KEY = your-api-key-here
|
|
61
66
|
LOCALE = en
|
|
62
67
|
MAX_NO = 1
|
|
63
68
|
COMMIT_TYPE = conventional
|
|
64
|
-
MODEL_NAME = gemini-
|
|
69
|
+
MODEL_NAME = gemini-2.5-flash
|
|
65
70
|
COMMIT_MODE = auto
|
|
66
71
|
EOF
|
|
67
72
|
```
|
|
68
73
|
|
|
69
74
|
### Option 3: .dcommit File (Virtual Environment)
|
|
75
|
+
|
|
70
76
|
```bash
|
|
71
77
|
mkdir -p $VIRTUAL_ENV/config
|
|
72
78
|
cat > $VIRTUAL_ENV/config/.dcommit << 'EOF'
|
|
@@ -74,7 +80,7 @@ A command-line AI tool for autocommits.
|
|
|
74
80
|
LOCALE = en
|
|
75
81
|
MAX_NO = 1
|
|
76
82
|
COMMIT_TYPE = conventional
|
|
77
|
-
MODEL_NAME = gemini-
|
|
83
|
+
MODEL_NAME = gemini-2.0-flash-exp
|
|
78
84
|
COMMIT_MODE = auto
|
|
79
85
|
EOF
|
|
80
86
|
```
|
|
@@ -92,6 +98,7 @@ devcommit
|
|
|
92
98
|
### Basic Usage
|
|
93
99
|
|
|
94
100
|
- **Stage all changes and commit:**
|
|
101
|
+
|
|
95
102
|
```bash
|
|
96
103
|
devcommit --stageAll
|
|
97
104
|
```
|
|
@@ -118,6 +125,7 @@ You can set your preferred commit mode in the `.dcommit` configuration file usin
|
|
|
118
125
|
#### Command-Line Usage
|
|
119
126
|
|
|
120
127
|
- **Interactive mode (auto):** When you have changes in multiple directories, DevCommit will automatically ask if you want to:
|
|
128
|
+
|
|
121
129
|
- Create one commit for all changes (global commit)
|
|
122
130
|
- Create separate commits per directory
|
|
123
131
|
|
|
@@ -129,10 +137,40 @@ You can set your preferred commit mode in the `.dcommit` configuration file usin
|
|
|
129
137
|
```
|
|
130
138
|
|
|
131
139
|
When using directory-based commits, you can:
|
|
140
|
+
|
|
132
141
|
1. Select which directories to commit (use Space to select, Enter to confirm)
|
|
133
142
|
2. For each selected directory, review and choose a commit message
|
|
134
143
|
3. Each directory gets its own commit with AI-generated messages based on its changes
|
|
135
144
|
|
|
145
|
+
### Commit Specific Files or Folders
|
|
146
|
+
|
|
147
|
+
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.
|
|
148
|
+
|
|
149
|
+
**Usage:**
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
# Commit specific files (must be staged first)
|
|
153
|
+
git add file1.py file2.py
|
|
154
|
+
devcommit --files file1.py file2.py
|
|
155
|
+
|
|
156
|
+
# Stage and commit specific files in one command
|
|
157
|
+
devcommit --stageAll --files file1.py file2.py
|
|
158
|
+
|
|
159
|
+
# Commit specific folders (must be staged first)
|
|
160
|
+
git add src/ tests/
|
|
161
|
+
devcommit --files src/ tests/
|
|
162
|
+
|
|
163
|
+
# Short form
|
|
164
|
+
devcommit -s -f file1.py file2.py
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
When using `--files` or `-f`:
|
|
168
|
+
|
|
169
|
+
- Without `--stageAll`: Only commits files that are already staged (filters staged files to match specified paths)
|
|
170
|
+
- With `--stageAll`: Stages the specified files/folders and then commits them
|
|
171
|
+
- AI generates commit messages based on changes in those files
|
|
172
|
+
- Works with both individual files and entire directories
|
|
173
|
+
|
|
136
174
|
### Additional Options
|
|
137
175
|
|
|
138
176
|
- `--excludeFiles` or `-e`: Exclude specific files from the diff
|
|
@@ -140,6 +178,8 @@ When using directory-based commits, you can:
|
|
|
140
178
|
- `--commitType` or `-t`: Specify the type of commit (e.g., conventional)
|
|
141
179
|
- `--stageAll` or `-s`: Stage all changes before committing
|
|
142
180
|
- `--directory` or `-d`: Force directory-based commits
|
|
181
|
+
- `--files` or `-f`: Stage and commit specific files or folders (can specify multiple)
|
|
182
|
+
- `--push` or `-p`: Push commits to remote after committing
|
|
143
183
|
|
|
144
184
|
### Examples
|
|
145
185
|
|
|
@@ -152,24 +192,40 @@ devcommit --commitType conventional
|
|
|
152
192
|
|
|
153
193
|
# Exclude lock files
|
|
154
194
|
devcommit --excludeFiles package-lock.json yarn.lock
|
|
195
|
+
|
|
196
|
+
# Stage and commit specific files
|
|
197
|
+
devcommit --files file1.py file2.py
|
|
198
|
+
|
|
199
|
+
# Stage and commit specific folders
|
|
200
|
+
devcommit --files src/ tests/
|
|
201
|
+
|
|
202
|
+
# Stage and commit multiple files and folders at once
|
|
203
|
+
devcommit --files src/ file1.py tests/ config.json
|
|
204
|
+
|
|
205
|
+
# Commit and push
|
|
206
|
+
devcommit --push
|
|
207
|
+
|
|
208
|
+
# Commit specific files and push
|
|
209
|
+
devcommit --files file1.py file2.py --push
|
|
155
210
|
```
|
|
156
211
|
|
|
157
212
|
## AI Provider Support
|
|
158
213
|
|
|
159
214
|
DevCommit now supports **multiple AI providers**! Choose from:
|
|
160
215
|
|
|
161
|
-
| Provider
|
|
162
|
-
|
|
163
|
-
| 🆓 **Gemini**
|
|
164
|
-
| ⚡ **Groq**
|
|
165
|
-
| 🤖 **OpenAI**
|
|
166
|
-
| 🧠 **Anthropic** | Limited trial
|
|
167
|
-
| 🏠 **Ollama**
|
|
168
|
-
| 🔧 **Custom**
|
|
216
|
+
| Provider | Free Tier | Speed | Quality | Get API Key |
|
|
217
|
+
| ---------------- | ------------------ | ----------- | --------- | ------------------------------------------------- |
|
|
218
|
+
| 🆓 **Gemini** | 15 req/min, 1M/day | Fast | Good | [Get Key](https://aistudio.google.com/app/apikey) |
|
|
219
|
+
| ⚡ **Groq** | Very generous | **Fastest** | Good | [Get Key](https://console.groq.com/keys) |
|
|
220
|
+
| 🤖 **OpenAI** | $5 trial | Medium | **Best** | [Get Key](https://platform.openai.com/api-keys) |
|
|
221
|
+
| 🧠 **Anthropic** | Limited trial | Medium | Excellent | [Get Key](https://console.anthropic.com/) |
|
|
222
|
+
| 🏠 **Ollama** | **Unlimited** | Medium | Good | [Install](https://ollama.ai/) |
|
|
223
|
+
| 🔧 **Custom** | Varies | Varies | Varies | Your server |
|
|
169
224
|
|
|
170
225
|
### Quick Setup Examples
|
|
171
226
|
|
|
172
227
|
**Using Groq (Recommended for free tier):**
|
|
228
|
+
|
|
173
229
|
```bash
|
|
174
230
|
export AI_PROVIDER=groq
|
|
175
231
|
export GROQ_API_KEY='your-groq-api-key'
|
|
@@ -177,6 +233,7 @@ devcommit
|
|
|
177
233
|
```
|
|
178
234
|
|
|
179
235
|
**Using Ollama (Local, no API key needed):**
|
|
236
|
+
|
|
180
237
|
```bash
|
|
181
238
|
# Install Ollama: https://ollama.ai/
|
|
182
239
|
ollama pull llama3
|
|
@@ -185,6 +242,7 @@ devcommit
|
|
|
185
242
|
```
|
|
186
243
|
|
|
187
244
|
**Using Custom API:**
|
|
245
|
+
|
|
188
246
|
```bash
|
|
189
247
|
export AI_PROVIDER=custom
|
|
190
248
|
export CUSTOM_API_URL='http://localhost:8000/v1'
|
|
@@ -199,8 +257,8 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
|
|
|
199
257
|
|
|
200
258
|
### AI Provider Settings
|
|
201
259
|
|
|
202
|
-
| Variable
|
|
203
|
-
|
|
260
|
+
| Variable | Description | Default | Options |
|
|
261
|
+
| ------------- | ----------------------- | -------- | ----------------------------------------------------------- |
|
|
204
262
|
| `AI_PROVIDER` | Which AI service to use | `gemini` | `gemini`, `openai`, `groq`, `anthropic`, `ollama`, `custom` |
|
|
205
263
|
|
|
206
264
|
### Provider-Specific Settings
|
|
@@ -209,7 +267,7 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
|
|
|
209
267
|
| Variable | Description | Default |
|
|
210
268
|
|----------|-------------|---------|
|
|
211
269
|
| `GEMINI_API_KEY` | Google Gemini API key | - |
|
|
212
|
-
| `GEMINI_MODEL` | Model name | `gemini-
|
|
270
|
+
| `GEMINI_MODEL` | Model name | `gemini-2.0-flash-exp` |
|
|
213
271
|
|
|
214
272
|
**OpenAI:**
|
|
215
273
|
| Variable | Description | Default |
|
|
@@ -244,21 +302,23 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
|
|
|
244
302
|
|
|
245
303
|
### General Settings
|
|
246
304
|
|
|
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`
|
|
305
|
+
| Variable | Description | Default | Options |
|
|
306
|
+
| --------------- | ------------------------------------ | ------------------------------------------------------ | ---------------------------------------- |
|
|
307
|
+
| `LOCALE` | Language for commit messages | `en-US` | Any locale code (e.g., `en`, `es`, `fr`) |
|
|
308
|
+
| `MAX_NO` | Number of commit message suggestions | `1` | Any positive integer |
|
|
309
|
+
| `COMMIT_TYPE` | Style of commit messages | `general` | `general`, `conventional`, etc. |
|
|
310
|
+
| `COMMIT_MODE` | Default commit strategy | `auto` | `auto`, `directory`, `global` |
|
|
311
|
+
| `EXCLUDE_FILES` | Files to exclude from diff | `package-lock.json, pnpm-lock.yaml, yarn.lock, *.lock` | Comma-separated file patterns |
|
|
312
|
+
| `MAX_TOKENS` | Maximum tokens for AI response | `8192` | Any positive integer |
|
|
255
313
|
|
|
256
314
|
### Configuration Priority
|
|
315
|
+
|
|
257
316
|
1. **`.dcommit` file** (highest priority)
|
|
258
317
|
2. **Environment variables**
|
|
259
318
|
3. **Built-in defaults** (lowest priority)
|
|
260
319
|
|
|
261
320
|
### Using Environment Variables
|
|
321
|
+
|
|
262
322
|
```bash
|
|
263
323
|
# Basic setup with Gemini (default)
|
|
264
324
|
export GEMINI_API_KEY='your-api-key-here'
|
|
@@ -273,6 +333,7 @@ export GROQ_API_KEY='your-groq-key'
|
|
|
273
333
|
```
|
|
274
334
|
|
|
275
335
|
### Using .dcommit File
|
|
336
|
+
|
|
276
337
|
See `.dcommit.example` for a complete configuration template with all providers.
|
|
277
338
|
|
|
278
339
|
**Note:** The `.dcommit` file is **optional**. DevCommit will work with just environment variables!
|
|
@@ -47,7 +47,7 @@ class AIProvider(ABC):
|
|
|
47
47
|
class GeminiProvider(AIProvider):
|
|
48
48
|
"""Google Gemini AI provider"""
|
|
49
49
|
|
|
50
|
-
def __init__(self, api_key: str, model: str = "gemini-
|
|
50
|
+
def __init__(self, api_key: str, model: str = "gemini-2.0-flash-exp"):
|
|
51
51
|
if not genai:
|
|
52
52
|
raise ImportError("google-generativeai not installed. Run: pip install google-generativeai")
|
|
53
53
|
|
|
@@ -235,7 +235,7 @@ def get_ai_provider(config) -> AIProvider:
|
|
|
235
235
|
if not api_key:
|
|
236
236
|
raise ValueError("GEMINI_API_KEY not set")
|
|
237
237
|
# Support legacy MODEL_NAME for backward compatibility
|
|
238
|
-
model = config("GEMINI_MODEL", default=None) or config("MODEL_NAME", default="gemini-
|
|
238
|
+
model = config("GEMINI_MODEL", default=None) or config("MODEL_NAME", default="gemini-2.0-flash-exp")
|
|
239
239
|
return GeminiProvider(api_key, model)
|
|
240
240
|
|
|
241
241
|
elif provider_name == "openai":
|
|
@@ -61,7 +61,7 @@ def generateCommitMessage(diff: str) -> str:
|
|
|
61
61
|
# Load Configuration Values
|
|
62
62
|
max_no = config("MAX_NO", default=1, cast=int)
|
|
63
63
|
locale = config("LOCALE", default="en-US")
|
|
64
|
-
commit_type = config("COMMIT_TYPE", default="
|
|
64
|
+
commit_type = config("COMMIT_TYPE", default="normal")
|
|
65
65
|
max_tokens = config("MAX_TOKENS", default=8192, cast=int)
|
|
66
66
|
|
|
67
67
|
# Generate prompt
|
|
@@ -46,10 +46,13 @@ commit_types: Dict[CommitType, str] = {
|
|
|
46
46
|
|
|
47
47
|
def specify_commit_format(commit_type: CommitType) -> str:
|
|
48
48
|
"""Specify the commit format for the given commit type"""
|
|
49
|
+
|
|
50
|
+
# Map "normal" to empty string format
|
|
51
|
+
format_key = "" if commit_type == "normal" else commit_type
|
|
49
52
|
|
|
50
53
|
return (
|
|
51
54
|
f"The output response must be in format:\n"
|
|
52
|
-
f"{commit_type_formats[
|
|
55
|
+
f"{commit_type_formats[format_key]}"
|
|
53
56
|
)
|
|
54
57
|
|
|
55
58
|
|