enhanced-git 1.0.2__tar.gz → 1.0.5__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.
Files changed (28) hide show
  1. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/PKG-INFO +35 -1
  2. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/README.md +34 -0
  3. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/config.py +26 -8
  4. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/pyproject.toml +1 -1
  5. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/.gitai.toml +0 -0
  6. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/.github/workflows/ci.yml +0 -0
  7. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/.github/workflows/release.yml +0 -0
  8. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/.gitignore +0 -0
  9. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/.pre-commit-config.yaml +0 -0
  10. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/CONTRIBUTING.md +0 -0
  11. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/LICENSE +0 -0
  12. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/Makefile +0 -0
  13. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/__init__.py +0 -0
  14. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/changelog.py +0 -0
  15. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/cli.py +0 -0
  16. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/commit.py +0 -0
  17. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/constants.py +0 -0
  18. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/diff.py +0 -0
  19. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/hook.py +0 -0
  20. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/providers/__init__.py +0 -0
  21. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/providers/base.py +0 -0
  22. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/providers/ollama_provider.py +0 -0
  23. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/providers/openai_provider.py +0 -0
  24. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/gitai/util.py +0 -0
  25. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/tests/__init__.py +0 -0
  26. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/tests/test_changelog.py +0 -0
  27. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/tests/test_diff.py +0 -0
  28. {enhanced_git-1.0.2 → enhanced_git-1.0.5}/tests/test_hook_integration.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: enhanced-git
3
- Version: 1.0.2
3
+ Version: 1.0.5
4
4
  Summary: Generate Conventional Commit messages and changelog sections using AI
5
5
  Project-URL: Homepage, https://github.com/mxzahid/git-ai
6
6
  Project-URL: Repository, https://github.com/mxzahid/git-ai
@@ -168,6 +168,40 @@ git-ai changelog --since v1.0.0 --to main
168
168
  - `OLLAMA_BASE_URL`: Ollama server URL (default: http://localhost:11434)
169
169
  - `OLLAMA_MODEL`: Ollama model name (default: qwen2.5-coder:3b)
170
170
 
171
+ ### Configuration File
172
+
173
+ GitAI supports optional configuration via a `.gitai.toml` file in your git repository root. This allows you to customize behavior beyond environment variables.
174
+
175
+ **Auto-detection**: GitAI automatically detects your LLM provider based on environment variables (no config file needed!):
176
+ - If `OPENAI_API_KEY` is set → uses OpenAI
177
+ - If `OLLAMA_BASE_URL` or `OLLAMA_MODEL` is set → uses Ollama
178
+ - Otherwise → falls back to OpenAI
179
+
180
+ **Custom configuration**: Create `.gitai.toml` in your project root for advanced settings:
181
+
182
+ ```toml
183
+ [llm]
184
+ provider = "ollama" # "openai" | "ollama"
185
+ model = "qwen2.5-coder:3b" # I suggest using one of: qwen2.5-coder:3b, qwen2.5-coder:1.5b, codellama:7b, deepseek-coder:6.7b
186
+ max_tokens = 300
187
+ temperature = 0.1
188
+ timeout_seconds = 45
189
+
190
+ [commit]
191
+ style = "conventional" # "conventional" | "plain"
192
+ scope_detection = true
193
+ include_body = true
194
+ include_footers = true
195
+ wrap_width = 72
196
+
197
+ [changelog]
198
+ grouping = "type" # group by Conventional Commit type
199
+ heading_style = "keep-a-changelog"
200
+
201
+ [debug]
202
+ debug_mode = false
203
+ ```
204
+
171
205
  ## How It Works
172
206
 
173
207
  ### Commit Message Generation
@@ -127,6 +127,40 @@ git-ai changelog --since v1.0.0 --to main
127
127
  - `OLLAMA_BASE_URL`: Ollama server URL (default: http://localhost:11434)
128
128
  - `OLLAMA_MODEL`: Ollama model name (default: qwen2.5-coder:3b)
129
129
 
130
+ ### Configuration File
131
+
132
+ GitAI supports optional configuration via a `.gitai.toml` file in your git repository root. This allows you to customize behavior beyond environment variables.
133
+
134
+ **Auto-detection**: GitAI automatically detects your LLM provider based on environment variables (no config file needed!):
135
+ - If `OPENAI_API_KEY` is set → uses OpenAI
136
+ - If `OLLAMA_BASE_URL` or `OLLAMA_MODEL` is set → uses Ollama
137
+ - Otherwise → falls back to OpenAI
138
+
139
+ **Custom configuration**: Create `.gitai.toml` in your project root for advanced settings:
140
+
141
+ ```toml
142
+ [llm]
143
+ provider = "ollama" # "openai" | "ollama"
144
+ model = "qwen2.5-coder:3b" # I suggest using one of: qwen2.5-coder:3b, qwen2.5-coder:1.5b, codellama:7b, deepseek-coder:6.7b
145
+ max_tokens = 300
146
+ temperature = 0.1
147
+ timeout_seconds = 45
148
+
149
+ [commit]
150
+ style = "conventional" # "conventional" | "plain"
151
+ scope_detection = true
152
+ include_body = true
153
+ include_footers = true
154
+ wrap_width = 72
155
+
156
+ [changelog]
157
+ grouping = "type" # group by Conventional Commit type
158
+ heading_style = "keep-a-changelog"
159
+
160
+ [debug]
161
+ debug_mode = false
162
+ ```
163
+
130
164
  ## How It Works
131
165
 
132
166
  ### Commit Message Generation
@@ -66,20 +66,36 @@ class Config:
66
66
  config_data = load_toml_config(config_path)
67
67
 
68
68
  llm_data = config_data.get("llm", {})
69
+
70
+ # auto-detect provider based on available environment variables
71
+ configured_provider = llm_data.get("provider")
72
+ if configured_provider is None:
73
+ if os.getenv("OPENAI_API_KEY"):
74
+ configured_provider = "openai"
75
+ elif os.getenv("OLLAMA_BASE_URL") or os.getenv("OLLAMA_MODEL"):
76
+ configured_provider = "ollama"
77
+ else:
78
+ configured_provider = None # fallback
79
+
69
80
  llm_config = LLMConfig(
70
- provider=llm_data.get("provider", "openai"),
71
- model=llm_data.get("model", "gpt-4o-mini"),
81
+ provider=configured_provider,
82
+ model=llm_data.get(
83
+ "model",
84
+ (
85
+ "gpt-4o-mini"
86
+ if configured_provider == "openai"
87
+ else "qwen2.5-coder:3b"
88
+ ),
89
+ ),
72
90
  max_tokens=llm_data.get("max_tokens", 300),
73
91
  temperature=llm_data.get("temperature", 0.0),
74
92
  timeout_seconds=llm_data.get("timeout_seconds", 45),
75
93
  api_key=(
76
- os.getenv("OPENAI_API_KEY")
77
- if llm_data.get("provider") == "openai"
78
- else None
94
+ os.getenv("OPENAI_API_KEY") if configured_provider == "openai" else None
79
95
  ),
80
96
  base_url=(
81
97
  os.getenv("OLLAMA_BASE_URL", "http://localhost:11434")
82
- if llm_data.get("provider") == "ollama"
98
+ if configured_provider == "ollama"
83
99
  else None
84
100
  ),
85
101
  )
@@ -115,6 +131,8 @@ class Config:
115
131
  if self.llm.provider == "openai":
116
132
  return self.llm.api_key is not None
117
133
  elif self.llm.provider == "ollama":
118
- # for Ollama, we assume it's available if base_url is set
119
- return self.llm.base_url is not None
134
+ # for ollama we assume it's available if base_url is set or model is configured
135
+ return (
136
+ self.llm.base_url is not None or os.getenv("OLLAMA_MODEL") is not None
137
+ )
120
138
  return False
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "enhanced-git"
7
- version = "1.0.2"
7
+ version = "1.0.5"
8
8
  description = "Generate Conventional Commit messages and changelog sections using AI"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes