devcommit 0.1.4.9__tar.gz → 0.1.5.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devcommit
3
- Version: 0.1.4.9
3
+ Version: 0.1.5.1
4
4
  Summary: AI-powered git commit message generator
5
5
  License: GNU GENERAL PUBLIC LICENSE
6
6
  Version 3, 29 June 2007
@@ -711,6 +711,7 @@ A command-line AI tool for autocommits.
711
711
 
712
712
  - 🤖 **Multi-AI Provider Support** - Choose from Gemini, Groq, OpenAI, Claude, Ollama, or custom APIs
713
713
  - 🚀 Automatic commit generation using AI
714
+ - 📝 **Changelog Generation** - Automatically generate markdown changelogs from your changes
714
715
  - 📁 Directory-based commits - create separate commits for each root directory
715
716
  - 🎯 Interactive mode to choose between global or directory-based commits
716
717
  - 📄 **Commit specific files or folders** - Stage and commit only selected files/directories
@@ -745,7 +746,7 @@ A command-line AI tool for autocommits.
745
746
 
746
747
  > **💡 Why pipx?** pipx installs CLI tools in isolated environments, preventing dependency conflicts while making them globally available.
747
748
 
748
- **All AI providers are included by default!** ✅ Gemini, OpenAI, Groq, Anthropic, Ollama, and Custom API support.
749
+ **All AI providers are included by default!** ✅ Gemini, OpenAI, Groq, OpenRouter, Anthropic, Ollama, and Custom API support.
749
750
 
750
751
  2. **Set Up Configuration (Required: API Key)**
751
752
  DevCommit requires an API key for your chosen AI provider. You can configure it using **any** of these methods:
@@ -761,6 +762,9 @@ A command-line AI tool for autocommits.
761
762
  # Or using Groq (recommended for free tier)
762
763
  export AI_PROVIDER='groq'
763
764
  export GROQ_API_KEY='your-groq-key'
765
+ # Optional: set model (provider-specific key or MODEL_NAME as a fallback)
766
+ export GROQ_MODEL='llama-3.3-70b-versatile' # or
767
+ export MODEL_NAME='llama-3.3-70b-versatile'
764
768
 
765
769
  # Add to ~/.bashrc or ~/.zshrc for persistence
766
770
  echo "export GEMINI_API_KEY='your-key'" >> ~/.bashrc
@@ -774,6 +778,8 @@ A command-line AI tool for autocommits.
774
778
  LOCALE = en
775
779
  MAX_NO = 1
776
780
  COMMIT_TYPE = conventional
781
+ # Model selection (provider-specific key takes priority, MODEL_NAME is the fallback)
782
+ # GEMINI_MODEL / OPENAI_MODEL / GROQ_MODEL / OPENROUTER_MODEL / ANTHROPIC_MODEL / OLLAMA_MODEL / CUSTOM_MODEL
777
783
  MODEL_NAME = gemini-2.5-flash
778
784
  COMMIT_MODE = auto
779
785
  EOF
@@ -827,6 +833,7 @@ You can set your preferred commit mode in the `.dcommit` configuration file usin
827
833
  - **`COMMIT_MODE = auto`** (default): Automatically prompts when multiple directories are detected
828
834
  - **`COMMIT_MODE = directory`**: Always use directory-based commits for multiple directories
829
835
  - **`COMMIT_MODE = global`**: Always create one commit for all changes
836
+ - **`COMMIT_MODE = related`**: Group related changes together using AI analysis
830
837
 
831
838
  **Priority order:** CLI flag (`--directory`) → Config file (`COMMIT_MODE`) → Interactive prompt (if `auto`)
832
839
 
@@ -834,8 +841,9 @@ You can set your preferred commit mode in the `.dcommit` configuration file usin
834
841
 
835
842
  - **Interactive mode (auto):** When you have changes in multiple directories, DevCommit will automatically ask if you want to:
836
843
 
837
- - Create one commit for all changes (global commit)
838
- - Create separate commits per directory
844
+ - 🌐 Create one commit for all changes (global commit)
845
+ - 📁 Create separate commits per directory
846
+ - 🔗 Group related changes together (AI-powered)
839
847
 
840
848
  - **Force directory-based commits:**
841
849
  ```bash
@@ -850,6 +858,172 @@ When using directory-based commits, you can:
850
858
  2. For each selected directory, review and choose a commit message
851
859
  3. Each directory gets its own commit with AI-generated messages based on its changes
852
860
 
861
+ ### Related Changes Grouping (AI-Powered)
862
+
863
+ DevCommit can intelligently group related changes together based on **semantic relationships**, regardless of directory structure. This creates clean, logical commits that reflect what you actually changed.
864
+
865
+ #### Grouping Principles
866
+
867
+ The AI analyzes your changes using these priorities:
868
+
869
+ 1. **Feature/Intent-Based Grouping** (Highest Priority)
870
+ - All files implementing the SAME feature go together
871
+ - Example: Adding "User Comments" groups schema + endpoints + migrations + tests + services = **1 commit**
872
+
873
+ 2. **Entity/Domain-Based Grouping**
874
+ - Changes to the same domain entity belong together
875
+ - Looks for: shared entity names, table names, class names, import relationships
876
+
877
+ 3. **Bug Fix Grouping**
878
+ - A bug fix touching multiple areas stays as one logical fix
879
+ - Grouped by the bug being fixed, not file location
880
+
881
+ 4. **Refactoring Grouping**
882
+ - Renaming across 10 files = 1 commit, not 10 separate commits
883
+
884
+ 5. **Configuration Grouping**
885
+ - Config changes + code that uses that config = 1 commit
886
+
887
+ #### How It Works
888
+
889
+ 1. DevCommit analyzes all staged file diffs
890
+ 2. AI examines the **content** of changes to find relationships:
891
+ - Shared entity/class names
892
+ - Import relationships between files
893
+ - Shared database tables
894
+ - Shared API endpoints
895
+ - Test-to-implementation relationships
896
+ - Naming conventions (user_model.py, user_controller.py → same entity)
897
+ 3. Files are grouped by **what they accomplish together**, not by directory
898
+ 4. Each group gets a commit with type badge: ✨ feature, 🐛 bugfix, ♻️ refactor, etc.
899
+
900
+ #### Performance Considerations
901
+
902
+ **Token Usage:** The "Group related changes together" feature analyzes all file diffs in a single AI call to understand relationships, which consumes more tokens than other commit modes. This is because:
903
+
904
+ - All file diffs are sent to the AI simultaneously for semantic analysis
905
+ - The AI generates commit messages for each group in the same call
906
+ - Larger changesets (many files or large diffs) will use proportionally more tokens
907
+
908
+ **When to Use:**
909
+ - ✅ Best for: Medium-sized changesets (5-50 files) where logical grouping matters
910
+ - ✅ Ideal when: You want semantically coherent commits regardless of directory structure
911
+ - ⚠️ Consider alternatives for: Very large changesets (100+ files) or when token costs are a concern
912
+
913
+ For large changesets, you might prefer:
914
+ - **Directory-based commits** (`COMMIT_MODE=directory`) - processes each directory separately
915
+ - **Global commit** (`COMMIT_MODE=global`) - one commit for everything
916
+
917
+ #### Configuration
918
+
919
+ Set `COMMIT_MODE = related` in your `.dcommit` file to always use related grouping:
920
+
921
+ ```bash
922
+ cat > ~/.dcommit << 'EOF'
923
+ GEMINI_API_KEY = your-api-key-here
924
+ COMMIT_MODE = related
925
+ EOF
926
+ ```
927
+
928
+ Or select it interactively when prompted (with `COMMIT_MODE = auto`):
929
+
930
+ ```
931
+ ❯ Commit strategy (Use arrow keys)
932
+ 🌐 One commit for all changes
933
+ 📁 Separate commits per directory
934
+ ❯ 🔗 Group related changes together
935
+ ```
936
+
937
+ #### Real-World Example
938
+
939
+ You're working on multiple things and have changes across many files and directories:
940
+
941
+ **Staged files:**
942
+ ```
943
+ schema/appointment.py # New appointment model
944
+ src/api/appointments.py # Appointment endpoints
945
+ src/services/booking_service.py # Booking logic
946
+ migrations/003_appointments.sql # Database migration
947
+ tests/test_appointments.py # Feature tests
948
+ src/auth/session.py # Fixed session timeout (unrelated)
949
+ src/middleware/auth.py # Fixed session timeout (unrelated)
950
+ config/redis.py # Updated cache settings (unrelated)
951
+ ```
952
+
953
+ **DevCommit analyzes the code and groups by semantic relationship:**
954
+
955
+ ```
956
+ ╭────────────────────────────────────────────────────────────╮
957
+ │ ✅ Found 3 logical group(s) │
958
+ ╰────────────────────────────────────────────────────────────╯
959
+
960
+ ✨ add-appointment-booking [feature] (5 files)
961
+ Add appointment booking system with scheduling functionality
962
+ └─ schema/appointment.py
963
+ └─ src/api/appointments.py
964
+ └─ src/services/booking_service.py
965
+ └─ migrations/003_appointments.sql
966
+ └─ tests/test_appointments.py
967
+
968
+ 🐛 fix-session-timeout [bugfix] (2 files)
969
+ Fix user session expiring prematurely on idle
970
+ └─ src/auth/session.py
971
+ └─ src/middleware/auth.py
972
+
973
+ ⚙️ update-redis-config [config] (1 file)
974
+ Update Redis cache TTL and connection pool settings
975
+ └─ config/redis.py
976
+ ```
977
+
978
+ **Result:** 3 focused, logical commits instead of 8 directory-based commits!
979
+
980
+ The AI identifies relationships by analyzing:
981
+ - Shared class/function names in the diffs
982
+ - Import statements connecting files
983
+ - Database table names
984
+ - API endpoint patterns
985
+ - File naming conventions
986
+
987
+ #### Group Selection Options
988
+
989
+ After DevCommit analyzes and groups your changes, you'll see three options:
990
+
991
+ 1. **✅ Commit all groups** - Automatically processes all groups sequentially (no prompts between groups)
992
+ 2. **📋 Select specific groups** - Choose which groups to commit:
993
+ - No groups are pre-selected (you must explicitly select with Space)
994
+ - If you press Enter without selecting any, you'll be re-prompted with: "⚠️ You need to select at least one group to continue"
995
+ - After committing each selected group, you'll be asked if you want to continue to the next
996
+ 3. **🔄 Regenerate grouping** - Re-runs the AI analysis to create new groups (useful if the initial grouping isn't ideal)
997
+
998
+ **Example workflow:**
999
+ ```
1000
+ ✅ Found 5 logical group(s)
1001
+
1002
+ ? What would you like to do?
1003
+ ✅ Commit all groups
1004
+ 📋 Select specific groups
1005
+ 🔄 Regenerate grouping
1006
+
1007
+ [User selects "Select specific groups"]
1008
+
1009
+ ? Select groups to commit
1010
+ (none selected - use Space to toggle)
1011
+
1012
+ [User presses Enter without selecting]
1013
+ ⚠️ You need to select at least one group to continue
1014
+ Use Space to select groups, then press Enter
1015
+
1016
+ ? Select groups to commit
1017
+ [✓] ✨ add-user-feature [feature] (4 files)
1018
+ [ ] 🐛 fix-bug [bugfix] (2 files)
1019
+ [✓] 📝 update-docs [docs] (3 files)
1020
+
1021
+ ✓ Selected 2 group(s) to commit
1022
+
1023
+ [After committing first group]
1024
+ ? Continue to next group (1 remaining)? (y/n)
1025
+ ```
1026
+
853
1027
  ### Commit Specific Files or Folders
854
1028
 
855
1029
  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.
@@ -942,6 +1116,47 @@ Selecting "Regenerate commit messages" will:
942
1116
 
943
1117
  This works for all commit modes (global, directory, and per-file commits).
944
1118
 
1119
+ ### Changelog Generation
1120
+
1121
+ DevCommit can automatically generate markdown changelog files from your changes using AI.
1122
+
1123
+ **Usage:**
1124
+
1125
+ ```bash
1126
+ # Generate changelog after committing
1127
+ devcommit --changelog
1128
+
1129
+ # Generate changelog before staging (recommended)
1130
+ devcommit --stageAll --changelog
1131
+
1132
+ # Short form
1133
+ devcommit -s -c
1134
+
1135
+ # With specific files
1136
+ devcommit --stageAll --changelog --files src/
1137
+ ```
1138
+
1139
+ **How it works:**
1140
+
1141
+ - **With `--stageAll`**: Changelog is generated from unstaged changes **before** staging
1142
+ - **Without `--stageAll`**: Changelog is generated from the last commit **after** committing
1143
+ - Changelogs are saved as markdown files with datetime-based names (e.g., `2026-01-28_00-55-30.md`)
1144
+ - Default directory: `changelogs/` (configurable via `CHANGELOG_DIR` in `.dcommit`)
1145
+ - Uses Keep a Changelog format with AI-generated content
1146
+
1147
+ **Example workflow:**
1148
+
1149
+ ```bash
1150
+ # Make changes to your code
1151
+ # ...
1152
+
1153
+ # Stage all changes and generate changelog before committing
1154
+ devcommit --stageAll --changelog
1155
+
1156
+ # The changelog file is created in changelogs/ directory
1157
+ # Then changes are staged and committed
1158
+ ```
1159
+
945
1160
  ### Additional Options
946
1161
 
947
1162
  - `--excludeFiles` or `-e`: Exclude specific files from the diff
@@ -951,6 +1166,7 @@ This works for all commit modes (global, directory, and per-file commits).
951
1166
  - `--directory` or `-d`: Force directory-based commits
952
1167
  - `--files` or `-f`: Stage and commit specific files or folders (can specify multiple)
953
1168
  - `--push` or `-p`: Push commits to remote after committing
1169
+ - `--changelog` or `-c`: Generate changelog file from changes
954
1170
 
955
1171
  ### Examples
956
1172
 
@@ -984,6 +1200,15 @@ devcommit -s -f src/core src/modules/account/ --directory
984
1200
 
985
1201
  # Stage and commit, then push
986
1202
  devcommit -s -f src/core src/modules/account/ -p
1203
+
1204
+ # Generate changelog before staging and committing
1205
+ devcommit --stageAll --changelog
1206
+
1207
+ # Generate changelog after committing
1208
+ devcommit --changelog
1209
+
1210
+ # Generate changelog with specific files
1211
+ devcommit -s -c -f src/
987
1212
  ```
988
1213
 
989
1214
  ## AI Provider Support
@@ -994,6 +1219,7 @@ DevCommit now supports **multiple AI providers**! Choose from:
994
1219
  | ---------------- | ------------------ | ----------- | --------- | ------------------------------------------------- |
995
1220
  | 🆓 **Gemini** | 15 req/min, 1M/day | Fast | Good | [Get Key](https://aistudio.google.com/app/apikey) |
996
1221
  | ⚡ **Groq** | Very generous | **Fastest** | Good | [Get Key](https://console.groq.com/keys) |
1222
+ | 🌐 **OpenRouter**| Free models available | Fast | Good | [Get Key](https://openrouter.ai/keys) |
997
1223
  | 🤖 **OpenAI** | $5 trial | Medium | **Best** | [Get Key](https://platform.openai.com/api-keys) |
998
1224
  | 🧠 **Anthropic** | Limited trial | Medium | Excellent | [Get Key](https://console.anthropic.com/) |
999
1225
  | 🏠 **Ollama** | **Unlimited** | Medium | Good | [Install](https://ollama.ai/) |
@@ -1009,6 +1235,35 @@ export GROQ_API_KEY='your-groq-api-key'
1009
1235
  devcommit
1010
1236
  ```
1011
1237
 
1238
+ **Using OpenRouter.ai (Access to multiple free models):**
1239
+
1240
+ ```bash
1241
+ export AI_PROVIDER=openrouter
1242
+ export OPENROUTER_API_KEY='your-openrouter-api-key'
1243
+ # Optional: specify model (default: meta-llama/llama-3.3-70b-instruct:free)
1244
+ export OPENROUTER_MODEL='meta-llama/llama-3.3-70b-instruct:free'
1245
+ devcommit
1246
+ ```
1247
+
1248
+ **Popular free models on OpenRouter (add `:free` suffix):**
1249
+
1250
+ **Recommended Models:**
1251
+ - `meta-llama/llama-3.3-70b-instruct:free` - Llama 3.3 70B Instruct (Powerful & General Purpose)
1252
+ - `google/gemma-3-27b-it:free` - Google Gemma 3 27B Instruct (Efficient & Capable)
1253
+ - `openai/gpt-oss-120b:free` - OpenAI GPT-OSS 120B (Large & Experimental)
1254
+ - `tngtech/deepseek-r1t-chimera:free` - DeepSeek R1T Chimera (Strong Reasoning)
1255
+ - `qwen/qwen3-next-80b-a3b-instruct:free` - Qwen3 Next 80B (Advanced Instruction Following)
1256
+
1257
+ **Important Notes:**
1258
+ - **Logging Requirements:** Some free models may log your prompts and responses for model improvement purposes. This means:
1259
+ - Your code diffs and commit messages may be stored by the provider
1260
+ - **Do NOT use free models with logging for sensitive/confidential code**
1261
+ - Check each model's documentation on OpenRouter for specific logging policies
1262
+ - **Rate Limits:** Free models typically have rate limits (requests per minute/day)
1263
+ - **Trial Use:** Some free models are marked as "trial use only" - not for production
1264
+
1265
+ Check [OpenRouter's models page](https://openrouter.ai/models?q=%3Afree) for the latest list, restrictions, and logging policies for each model.
1266
+
1012
1267
  **Using Ollama (Local, no API key needed):**
1013
1268
 
1014
1269
  ```bash
@@ -1036,7 +1291,7 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
1036
1291
 
1037
1292
  | Variable | Description | Default | Options |
1038
1293
  | ------------- | ----------------------- | -------- | ----------------------------------------------------------- |
1039
- | `AI_PROVIDER` | Which AI service to use | `gemini` | `gemini`, `openai`, `groq`, `anthropic`, `ollama`, `custom` |
1294
+ | `AI_PROVIDER` | Which AI service to use | `gemini` | `gemini`, `openai`, `groq`, `openrouter`, `anthropic`, `ollama`, `custom` |
1040
1295
 
1041
1296
  ### Provider-Specific Settings
1042
1297
 
@@ -1058,6 +1313,12 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
1058
1313
  | `GROQ_API_KEY` | Groq API key ([Get it here](https://console.groq.com/)) | - |
1059
1314
  | `GROQ_MODEL` | Model name | `llama-3.3-70b-versatile` |
1060
1315
 
1316
+ **OpenRouter:**
1317
+ | Variable | Description | Default |
1318
+ |----------|-------------|---------|
1319
+ | `OPENROUTER_API_KEY` | OpenRouter API key ([Get it here](https://openrouter.ai/keys)) | - |
1320
+ | `OPENROUTER_MODEL` | Model name (add `:free` suffix for free models) | `meta-llama/llama-3.3-70b-instruct:free` |
1321
+
1061
1322
  **Anthropic:**
1062
1323
  | Variable | Description | Default |
1063
1324
  |----------|-------------|---------|
@@ -1084,9 +1345,10 @@ All configuration can be set via **environment variables** or **`.dcommit` file*
1084
1345
  | `LOCALE` | Language for commit messages | `en-US` | Any locale code (e.g., `en`, `es`, `fr`) |
1085
1346
  | `MAX_NO` | Number of commit message suggestions | `1` | Any positive integer |
1086
1347
  | `COMMIT_TYPE` | Style of commit messages | `general` | `general`, `conventional`, etc. |
1087
- | `COMMIT_MODE` | Default commit strategy | `auto` | `auto`, `directory`, `global` |
1348
+ | `COMMIT_MODE` | Default commit strategy | `auto` | `auto`, `directory`, `global`, `related` |
1088
1349
  | `EXCLUDE_FILES` | Files to exclude from diff | `package-lock.json, pnpm-lock.yaml, yarn.lock, *.lock` | Comma-separated file patterns |
1089
1350
  | `MAX_TOKENS` | Maximum tokens for AI response | `8192` | Any positive integer |
1351
+ | `CHANGELOG_DIR` | Directory for changelog files | `changelogs` | Any directory path |
1090
1352
 
1091
1353
  ### Configuration Priority
1092
1354