commitguard-ai 0.1.0__tar.gz → 0.2.0__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,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commitguard-ai
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: AI-powered tool to analyze Git commits for bugs and issues
5
5
  Author: CommitGuard
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/PierrunoYT/commitguard
8
8
  Project-URL: Repository, https://github.com/PierrunoYT/commitguard
9
9
  Project-URL: Issues, https://github.com/PierrunoYT/commitguard/issues
10
- Keywords: git,commit,ai,code-review,openai,cli,commitguard,commitguard-ai
10
+ Keywords: git,commit,ai,code-review,openrouter,openai,claude,gemini,cli,commitguard,commitguard-ai
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Environment :: Console
13
13
  Classifier: Intended Audience :: Developers
@@ -39,7 +39,7 @@ AI-powered CLI that analyzes Git commits for bugs, security issues, and code qua
39
39
  ## Requirements
40
40
 
41
41
  - Python 3.9+
42
- - OpenAI API key
42
+ - [OpenRouter](https://openrouter.ai/) API key (supports GPT-4, Claude, Gemini, and more)
43
43
 
44
44
  ## Installation
45
45
 
@@ -63,14 +63,14 @@ pip install -r requirements.txt
63
63
 
64
64
  ## Configuration
65
65
 
66
- Set your OpenAI API key:
66
+ Get an API key at [openrouter.ai/keys](https://openrouter.ai/keys), then set it:
67
67
 
68
68
  ```bash
69
69
  # Linux / macOS
70
- export OPENAI_API_KEY=sk-...
70
+ export OPENROUTER_API_KEY=sk-or-...
71
71
 
72
72
  # Windows (PowerShell)
73
- $env:OPENAI_API_KEY = "sk-..."
73
+ $env:OPENROUTER_API_KEY = "sk-or-..."
74
74
  ```
75
75
 
76
76
  Or pass it via `--api-key` when running commands.
@@ -102,8 +102,8 @@ commitguard check
102
102
  | Option | Description |
103
103
  |--------|-------------|
104
104
  | `-r, --repo PATH` | Path to Git repository (default: current dir) |
105
- | `--api-key KEY` | OpenAI API key (or use `OPENAI_API_KEY` env) |
106
- | `--model MODEL` | Model to use (default: `gpt-4o-mini`) |
105
+ | `--api-key KEY` | OpenRouter API key (or use `OPENROUTER_API_KEY` env) |
106
+ | `--model MODEL` | Model to use (default: `openai/gpt-4o-mini`). Examples: `openai/gpt-4o`, `anthropic/claude-3.5-sonnet`, `google/gemini-pro` |
107
107
 
108
108
  ## Development
109
109
 
@@ -7,7 +7,7 @@ AI-powered CLI that analyzes Git commits for bugs, security issues, and code qua
7
7
  ## Requirements
8
8
 
9
9
  - Python 3.9+
10
- - OpenAI API key
10
+ - [OpenRouter](https://openrouter.ai/) API key (supports GPT-4, Claude, Gemini, and more)
11
11
 
12
12
  ## Installation
13
13
 
@@ -31,14 +31,14 @@ pip install -r requirements.txt
31
31
 
32
32
  ## Configuration
33
33
 
34
- Set your OpenAI API key:
34
+ Get an API key at [openrouter.ai/keys](https://openrouter.ai/keys), then set it:
35
35
 
36
36
  ```bash
37
37
  # Linux / macOS
38
- export OPENAI_API_KEY=sk-...
38
+ export OPENROUTER_API_KEY=sk-or-...
39
39
 
40
40
  # Windows (PowerShell)
41
- $env:OPENAI_API_KEY = "sk-..."
41
+ $env:OPENROUTER_API_KEY = "sk-or-..."
42
42
  ```
43
43
 
44
44
  Or pass it via `--api-key` when running commands.
@@ -70,8 +70,8 @@ commitguard check
70
70
  | Option | Description |
71
71
  |--------|-------------|
72
72
  | `-r, --repo PATH` | Path to Git repository (default: current dir) |
73
- | `--api-key KEY` | OpenAI API key (or use `OPENAI_API_KEY` env) |
74
- | `--model MODEL` | Model to use (default: `gpt-4o-mini`) |
73
+ | `--api-key KEY` | OpenRouter API key (or use `OPENROUTER_API_KEY` env) |
74
+ | `--model MODEL` | Model to use (default: `openai/gpt-4o-mini`). Examples: `openai/gpt-4o`, `anthropic/claude-3.5-sonnet`, `google/gemini-pro` |
75
75
 
76
76
  ## Development
77
77
 
@@ -1,3 +1,3 @@
1
1
  """CommitGuard - AI-powered Git commit analysis for bugs and issues."""
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.2.0"
@@ -1,8 +1,9 @@
1
- """Commit analysis using AI."""
1
+ """Commit analysis using AI via OpenRouter."""
2
2
 
3
3
  from git import Repo
4
4
  from openai import OpenAI
5
5
 
6
+ OPENROUTER_BASE_URL = "https://openrouter.ai/api/v1"
6
7
 
7
8
  SYSTEM_PROMPT = """You are a code review assistant. Analyze Git commits for:
8
9
  1. Potential bugs and logic errors
@@ -25,8 +26,11 @@ def _get_diff(repo: Repo, commit) -> str:
25
26
 
26
27
 
27
28
  def _call_ai(diff: str, message: str, files: list[str], api_key: str, model: str) -> str:
28
- """Call OpenAI API for analysis."""
29
- client = OpenAI(api_key=api_key)
29
+ """Call OpenRouter API for analysis (supports multiple models)."""
30
+ client = OpenAI(
31
+ base_url=OPENROUTER_BASE_URL,
32
+ api_key=api_key,
33
+ )
30
34
  user_content = f"""Analyze this commit:
31
35
 
32
36
  **Message:** {message}
@@ -52,7 +56,7 @@ def analyze_commit(
52
56
  ref: str = "HEAD",
53
57
  *,
54
58
  api_key: str,
55
- model: str = "gpt-4o-mini",
59
+ model: str = "openai/gpt-4o-mini",
56
60
  ) -> str:
57
61
  """Analyze a specific commit."""
58
62
  repo = Repo(repo_path)
@@ -66,7 +70,7 @@ def analyze_staged(
66
70
  repo_path: str,
67
71
  *,
68
72
  api_key: str,
69
- model: str = "gpt-4o-mini",
73
+ model: str = "openai/gpt-4o-mini",
70
74
  ) -> str:
71
75
  """Analyze staged changes."""
72
76
  repo = Repo(repo_path)
@@ -43,13 +43,13 @@ def main() -> None:
43
43
  )
44
44
  @click.option(
45
45
  "--api-key",
46
- envvar="OPENAI_API_KEY",
47
- help="OpenAI API key (or set OPENAI_API_KEY).",
46
+ envvar="OPENROUTER_API_KEY",
47
+ help="OpenRouter API key (or set OPENROUTER_API_KEY).",
48
48
  )
49
49
  @click.option(
50
50
  "--model",
51
- default="gpt-4o-mini",
52
- help="OpenAI model to use.",
51
+ default="openai/gpt-4o-mini",
52
+ help="Model to use (e.g. openai/gpt-4o, anthropic/claude-3.5-sonnet, google/gemini-pro).",
53
53
  )
54
54
  def analyze(
55
55
  commit: str,
@@ -60,10 +60,10 @@ def analyze(
60
60
  ) -> None:
61
61
  """Analyze one or more commits for bugs and issues."""
62
62
  repo = get_repo_path(str(repo_path))
63
- key = api_key or os.environ.get("OPENAI_API_KEY")
63
+ key = api_key or os.environ.get("OPENROUTER_API_KEY")
64
64
  if not key:
65
65
  raise click.ClickException(
66
- "OpenAI API key required. Set OPENAI_API_KEY or use --api-key."
66
+ "OpenRouter API key required. Set OPENROUTER_API_KEY or use --api-key."
67
67
  )
68
68
 
69
69
  refs = [commit] if count == 1 else [f"HEAD~{i}" for i in range(count)]
@@ -89,13 +89,13 @@ def analyze(
89
89
  )
90
90
  @click.option(
91
91
  "--api-key",
92
- envvar="OPENAI_API_KEY",
93
- help="OpenAI API key (or set OPENAI_API_KEY).",
92
+ envvar="OPENROUTER_API_KEY",
93
+ help="OpenRouter API key (or set OPENROUTER_API_KEY).",
94
94
  )
95
95
  @click.option(
96
96
  "--model",
97
- default="gpt-4o-mini",
98
- help="OpenAI model to use.",
97
+ default="openai/gpt-4o-mini",
98
+ help="Model to use (e.g. openai/gpt-4o, anthropic/claude-3.5-sonnet).",
99
99
  )
100
100
  def check(
101
101
  repo_path: Path,
@@ -104,10 +104,10 @@ def check(
104
104
  ) -> None:
105
105
  """Analyze staged changes (before commit)."""
106
106
  repo = get_repo_path(str(repo_path))
107
- key = api_key or os.environ.get("OPENAI_API_KEY")
107
+ key = api_key or os.environ.get("OPENROUTER_API_KEY")
108
108
  if not key:
109
109
  raise click.ClickException(
110
- "OpenAI API key required. Set OPENAI_API_KEY or use --api-key."
110
+ "OpenRouter API key required. Set OPENROUTER_API_KEY or use --api-key."
111
111
  )
112
112
 
113
113
  click.echo("Analyzing staged changes...")
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: commitguard-ai
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: AI-powered tool to analyze Git commits for bugs and issues
5
5
  Author: CommitGuard
6
6
  License-Expression: MIT
7
7
  Project-URL: Homepage, https://github.com/PierrunoYT/commitguard
8
8
  Project-URL: Repository, https://github.com/PierrunoYT/commitguard
9
9
  Project-URL: Issues, https://github.com/PierrunoYT/commitguard/issues
10
- Keywords: git,commit,ai,code-review,openai,cli,commitguard,commitguard-ai
10
+ Keywords: git,commit,ai,code-review,openrouter,openai,claude,gemini,cli,commitguard,commitguard-ai
11
11
  Classifier: Development Status :: 4 - Beta
12
12
  Classifier: Environment :: Console
13
13
  Classifier: Intended Audience :: Developers
@@ -39,7 +39,7 @@ AI-powered CLI that analyzes Git commits for bugs, security issues, and code qua
39
39
  ## Requirements
40
40
 
41
41
  - Python 3.9+
42
- - OpenAI API key
42
+ - [OpenRouter](https://openrouter.ai/) API key (supports GPT-4, Claude, Gemini, and more)
43
43
 
44
44
  ## Installation
45
45
 
@@ -63,14 +63,14 @@ pip install -r requirements.txt
63
63
 
64
64
  ## Configuration
65
65
 
66
- Set your OpenAI API key:
66
+ Get an API key at [openrouter.ai/keys](https://openrouter.ai/keys), then set it:
67
67
 
68
68
  ```bash
69
69
  # Linux / macOS
70
- export OPENAI_API_KEY=sk-...
70
+ export OPENROUTER_API_KEY=sk-or-...
71
71
 
72
72
  # Windows (PowerShell)
73
- $env:OPENAI_API_KEY = "sk-..."
73
+ $env:OPENROUTER_API_KEY = "sk-or-..."
74
74
  ```
75
75
 
76
76
  Or pass it via `--api-key` when running commands.
@@ -102,8 +102,8 @@ commitguard check
102
102
  | Option | Description |
103
103
  |--------|-------------|
104
104
  | `-r, --repo PATH` | Path to Git repository (default: current dir) |
105
- | `--api-key KEY` | OpenAI API key (or use `OPENAI_API_KEY` env) |
106
- | `--model MODEL` | Model to use (default: `gpt-4o-mini`) |
105
+ | `--api-key KEY` | OpenRouter API key (or use `OPENROUTER_API_KEY` env) |
106
+ | `--model MODEL` | Model to use (default: `openai/gpt-4o-mini`). Examples: `openai/gpt-4o`, `anthropic/claude-3.5-sonnet`, `google/gemini-pro` |
107
107
 
108
108
  ## Development
109
109
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "commitguard-ai"
7
- version = "0.1.0"
7
+ version = "0.2.0"
8
8
  description = "AI-powered tool to analyze Git commits for bugs and issues"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -12,7 +12,7 @@ requires-python = ">=3.9"
12
12
  authors = [
13
13
  {name = "CommitGuard"}
14
14
  ]
15
- keywords = ["git", "commit", "ai", "code-review", "openai", "cli", "commitguard", "commitguard-ai"]
15
+ keywords = ["git", "commit", "ai", "code-review", "openrouter", "openai", "claude", "gemini", "cli", "commitguard", "commitguard-ai"]
16
16
  classifiers = [
17
17
  "Development Status :: 4 - Beta",
18
18
  "Environment :: Console",
File without changes
File without changes