codespy-ai 0.2.2__tar.gz → 0.3.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.
Files changed (74) hide show
  1. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/PKG-INFO +138 -33
  2. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/README.md +137 -32
  3. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/pyproject.toml +1 -1
  4. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/__init__.py +1 -1
  5. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/__init__.py +6 -0
  6. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/models.py +20 -1
  7. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/modules/code_and_doc_reviewer.py +72 -53
  8. codespy_ai-0.3.0/src/codespy/agents/reviewer/modules/helpers.py +189 -0
  9. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/modules/supply_chain_auditor.py +101 -44
  10. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/reviewer.py +52 -8
  11. codespy_ai-0.3.0/src/codespy/agents/reviewer/server.py +203 -0
  12. codespy_ai-0.3.0/src/codespy/cli.py +109 -0
  13. codespy_ai-0.3.0/src/codespy/cli_local.py +258 -0
  14. codespy_ai-0.3.0/src/codespy/cli_mcp_server.py +56 -0
  15. codespy_ai-0.2.2/src/codespy/cli.py → codespy_ai-0.3.0/src/codespy/cli_remote.py +7 -99
  16. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/config.py +1 -1
  17. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/git/__init__.py +2 -0
  18. codespy_ai-0.3.0/src/codespy/tools/git/local_diff.py +219 -0
  19. codespy_ai-0.2.2/src/codespy/agents/reviewer/modules/helpers.py +0 -65
  20. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/LICENSE +0 -0
  21. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/__init__.py +0 -0
  22. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/cost_tracker.py +0 -0
  23. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/dspy_config.py +0 -0
  24. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/modules/__init__.py +0 -0
  25. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/modules/deduplicator.py +0 -0
  26. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/modules/scope_identifier.py +0 -0
  27. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/reporters/__init__.py +0 -0
  28. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/reporters/base.py +0 -0
  29. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/reporters/git.py +0 -0
  30. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/agents/reviewer/reporters/stdout.py +0 -0
  31. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/config_dspy.py +0 -0
  32. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/config_git.py +0 -0
  33. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/config_io.py +0 -0
  34. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/config_llm.py +0 -0
  35. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/__init__.py +0 -0
  36. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/cyber/__init__.py +0 -0
  37. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/cyber/osv/__init__.py +0 -0
  38. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/cyber/osv/client.py +0 -0
  39. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/cyber/osv/models.py +0 -0
  40. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/cyber/osv/server.py +0 -0
  41. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/filesystem/__init__.py +0 -0
  42. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/filesystem/client.py +0 -0
  43. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/filesystem/models.py +0 -0
  44. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/filesystem/server.py +0 -0
  45. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/git/base.py +0 -0
  46. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/git/client.py +0 -0
  47. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/git/github_client.py +0 -0
  48. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/git/gitlab_client.py +0 -0
  49. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/git/models.py +0 -0
  50. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/git/server.py +0 -0
  51. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/mcp_utils.py +0 -0
  52. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/__init__.py +0 -0
  53. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/ripgrep/__init__.py +0 -0
  54. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/ripgrep/client.py +0 -0
  55. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/ripgrep/server.py +0 -0
  56. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/__init__.py +0 -0
  57. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/base_extractor.py +0 -0
  58. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/extractors/__init__.py +0 -0
  59. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/extractors/go.py +0 -0
  60. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/extractors/java.py +0 -0
  61. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/extractors/javascript.py +0 -0
  62. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/extractors/kotlin.py +0 -0
  63. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/extractors/objc.py +0 -0
  64. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/extractors/python.py +0 -0
  65. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/extractors/rust.py +0 -0
  66. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/extractors/swift.py +0 -0
  67. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/extractors/terraform.py +0 -0
  68. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/models.py +0 -0
  69. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/parser.py +0 -0
  70. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/parsers/treesitter/server.py +0 -0
  71. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/web/__init__.py +0 -0
  72. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/web/client.py +0 -0
  73. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/web/models.py +0 -0
  74. {codespy_ai-0.2.2 → codespy_ai-0.3.0}/src/codespy/tools/web/server.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codespy-ai
3
- Version: 0.2.2
3
+ Version: 0.3.0
4
4
  Summary: Code review agent powered by DSPy
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -55,15 +55,9 @@ Description-Content-Type: text/markdown
55
55
 
56
56
  <h1 align="center">Code<a href="https://github.com/khezen/codespy">Spy</a></h1>
57
57
 
58
- <p align="center">
59
- <strong>Automated code reviews for teams who care about correctness.</strong>
60
- </p>
61
58
  <p align="center">
62
59
  An open-source AI reviewer that catches bugs, improves code quality, and integrates directly into your PR workflow, without sacrificing control or security.
63
60
  </p>
64
- <p align="center">
65
- <i>"Fast feedback. No black box. No vendor lock-in."</i>
66
- </p>
67
61
 
68
62
  <p align="center">
69
63
  <a href="https://github.com/khezen/codespy/actions">
@@ -82,6 +76,42 @@ Description-Content-Type: text/markdown
82
76
 
83
77
  ---
84
78
 
79
+ ## Table of Contents
80
+
81
+ - [Table of Contents](#table-of-contents)
82
+ - [Why CodeSpy?](#why-codespy)
83
+ - [Features](#features)
84
+ - [Installation](#installation)
85
+ - [Using pip](#using-pip)
86
+ - [Using Homebrew (macOS/Linux)](#using-homebrew-macoslinux)
87
+ - [Using Docker](#using-docker)
88
+ - [Using Poetry (for development)](#using-poetry-for-development)
89
+ - [Quick Start](#quick-start)
90
+ - [Usage](#usage)
91
+ - [Command Line](#command-line)
92
+ - [IDE Integration (MCP Server)](#ide-integration-mcp-server)
93
+ - [Using Docker](#using-docker-1)
94
+ - [GitHub Action](#github-action)
95
+ - [Configuration](#configuration)
96
+ - [Setup](#setup)
97
+ - [Git Platform Tokens](#git-platform-tokens)
98
+ - [GitHub Token](#github-token)
99
+ - [GitLab Token](#gitlab-token)
100
+ - [LLM Provider](#llm-provider)
101
+ - [Advanced Configuration (YAML)](#advanced-configuration-yaml)
102
+ - [Recommended Model Strategy](#recommended-model-strategy)
103
+ - [Output](#output)
104
+ - [Markdown (default)](#markdown-default)
105
+ - [GitHub/GitLab Review Comments](#githubgitlab-review-comments)
106
+ - [Architecture](#architecture)
107
+ - [DSPy Signatures](#dspy-signatures)
108
+ - [Supported Languages](#supported-languages)
109
+ - [Development](#development)
110
+ - [Contributors](#contributors)
111
+ - [License](#license)
112
+
113
+ ---
114
+
85
115
  ## Why CodeSpy?
86
116
 
87
117
  Most AI code reviewers are:
@@ -115,6 +145,8 @@ Built for **engineering teams that care about correctness, security, and control
115
145
  - 🤖 **Model Agnostic** - Works with OpenAI, AWS Bedrock, Anthropic, Ollama, and more via LiteLLM
116
146
  - 🐳 **Docker Ready** - Run locally or in the cloud with Docker
117
147
  - <img src="assets/GitHub_Invertocat_Black.svg" height="20" alt="GitHub"> <img src="assets/gitlab-logo-500-rgb.png" height="20" alt="GitLab"> **GitHub & GitLab** - Works with both platforms, auto-detects from URL
148
+ - 🖥️ **Local Reviews** - Review local git changes without GitHub/GitLab — diff against any branch, ref, or review uncommitted work
149
+ - 🧩 **MCP Server** - IDE integration via Model Context Protocol — trigger reviews from AI coding assistants like Cline without leaving your editor
118
150
  - 🔌 **GitHub Action** - One-line integration for automatic PR reviews
119
151
 
120
152
 
@@ -173,7 +205,7 @@ export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx # For GitHub
173
205
  export GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx # For GitLab
174
206
 
175
207
  # 2. Set your LLM provider (example with Anthropic)
176
- export DEFAULT_MODEL=claude-opus-4-6
208
+ export DEFAULT_MODEL=anthropic/claude-opus-4-6
177
209
  export ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxx
178
210
 
179
211
  # 3. Review a PR or MR!
@@ -207,7 +239,7 @@ codespy review https://gitlab.mycompany.com/team/project/-/merge_requests/123
207
239
  codespy review https://github.com/owner/repo/pull/123 --output json
208
240
 
209
241
  # Use a specific model
210
- codespy review https://github.com/owner/repo/pull/123 --model claude-opus-4-6
242
+ codespy review https://github.com/owner/repo/pull/123 --model anthropic/claude-opus-4-6
211
243
 
212
244
  # Use a custom config file
213
245
  codespy review https://github.com/owner/repo/pull/123 --config path/to/config.yaml
@@ -230,22 +262,89 @@ codespy config --config path/to/config.yaml
230
262
 
231
263
  # Show version
232
264
  codespy --version
265
+
266
+ # Review local git changes (no GitHub/GitLab needed)
267
+ codespy review-local # Review current dir vs main
268
+ codespy review-local /path/to/repo # Review specific repo
269
+ codespy review-local --base develop # Compare against develop
270
+ codespy review-local --base origin/main # Compare against origin/main
271
+ codespy review-local --base HEAD~5 # Compare against 5 commits back
272
+
273
+ # Review uncommitted changes (staged + unstaged)
274
+ codespy review-uncommitted # Review current dir
275
+ codespy review-uncommitted /path/to/repo
276
+ codespy review-uncommitted --output json
277
+ ```
278
+
279
+ ### IDE Integration (MCP Server)
280
+
281
+ CodeSpy can run as an MCP (Model Context Protocol) server for integration with AI coding assistants like Cline, enabling code reviews directly from your editor without leaving your workflow.
282
+
283
+ ```bash
284
+ # Start the MCP server
285
+ codespy serve
286
+
287
+ # Use a custom config file
288
+ codespy serve --config path/to/config.yaml
289
+ ```
290
+
291
+ **Configure your IDE** (example for Cline in VS Code):
292
+
293
+ Add to `cline_mcp_settings.json`:
294
+ ```json
295
+ {
296
+ "mcpServers": {
297
+ "codespy-reviewer": {
298
+ "command": "codespy",
299
+ "args": ["serve"],
300
+ "env": {
301
+ "DEFAULT_MODEL": "anthropic/claude-opus-4-6",
302
+ "ANTHROPIC_API_KEY": "your-key-here"
303
+ }
304
+ }
305
+ }
306
+ }
307
+ ```
308
+
309
+ Or for AWS Bedrock:
310
+ ```json
311
+ {
312
+ "mcpServers": {
313
+ "codespy-reviewer": {
314
+ "command": "codespy",
315
+ "args": ["serve"],
316
+ "env": {
317
+ "DEFAULT_MODEL": "bedrock/us.anthropic.claude-opus-4-6-v1",
318
+ "AWS_REGION": "us-east-1",
319
+ "AWS_ACCESS_KEY_ID": "your-access-key",
320
+ "AWS_SECRET_ACCESS_KEY": "your-secret-key"
321
+ }
322
+ }
323
+ }
324
+ }
233
325
  ```
234
326
 
327
+ **Available MCP Tools:**
328
+ - `review_local_changes(repo_path, base_ref)` — Review branch changes vs base (e.g., vs `main`)
329
+ - `review_uncommitted(repo_path)` — Review staged + unstaged working tree changes
330
+ - `review_pr(mr_url)` — Review a GitHub PR or GitLab MR by URL
331
+
332
+ Then ask your AI assistant: *"Review my local changes"* or *"Review uncommitted work in /path/to/repo"*
333
+
235
334
  ### Using Docker
236
335
 
237
336
  ```bash
238
337
  # With docker run (using GHCR image)
239
338
  docker run --rm \
240
339
  -e GITHUB_TOKEN=$GITHUB_TOKEN \
241
- -e DEFAULT_MODEL=claude-opus-4-6 \
340
+ -e DEFAULT_MODEL=anthropic/claude-opus-4-6 \
242
341
  -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
243
342
  ghcr.io/khezen/codespy:latest review https://github.com/owner/repo/pull/123
244
343
 
245
344
  # Or use a specific version
246
345
  docker run --rm \
247
346
  -e GITHUB_TOKEN=$GITHUB_TOKEN \
248
- -e DEFAULT_MODEL=claude-opus-4-6 \
347
+ -e DEFAULT_MODEL=anthropic/claude-opus-4-6 \
249
348
  -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
250
349
  ghcr.io/khezen/codespy:0.2.1 review https://github.com/owner/repo/pull/123
251
350
  ```
@@ -254,7 +353,7 @@ docker run --rm \
254
353
 
255
354
  Add CodeSpy to your repository for automatic PR reviews:
256
355
 
257
- **Trigger on `@codespy review` comment:**
356
+ **Trigger on `/codespy review` comment:**
258
357
 
259
358
  ```yaml
260
359
  # .github/workflows/codespy-review.yml
@@ -266,10 +365,10 @@ on:
266
365
 
267
366
  jobs:
268
367
  review:
269
- # Only run on PR comments containing '@codespy review'
368
+ # Only run on PR comments containing '/codespy review'
270
369
  if: |
271
370
  github.event.issue.pull_request &&
272
- contains(github.event.comment.body, '@codespy review')
371
+ contains(github.event.comment.body, '/codespy review')
273
372
  runs-on: ubuntu-latest
274
373
  permissions:
275
374
  contents: read
@@ -279,7 +378,7 @@ jobs:
279
378
  - name: Run CodeSpy Review
280
379
  uses: khezen/codespy@v1
281
380
  with:
282
- model: 'claude-opus-4-6'
381
+ model: 'anthropic/claude-opus-4-6'
283
382
  anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
284
383
  ```
285
384
 
@@ -304,7 +403,7 @@ jobs:
304
403
  - name: Run CodeSpy Review
305
404
  uses: khezen/codespy@v1
306
405
  with:
307
- model: 'claude-opus-4-6'
406
+ model: 'anthropic/claude-opus-4-6'
308
407
  anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
309
408
  ```
310
409
 
@@ -380,7 +479,7 @@ codespy auto-discovers credentials for all providers:
380
479
 
381
480
  **Anthropic** (auto-discovers from `$ANTHROPIC_API_KEY`, `~/.config/anthropic/`, `~/.anthropic/`):
382
481
  ```bash
383
- DEFAULT_MODEL=claude-opus-4-6
482
+ DEFAULT_MODEL=anthropic/claude-opus-4-6
384
483
  # Optional - set explicitly or let codespy auto-discover:
385
484
  # ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxx
386
485
  ```
@@ -396,7 +495,7 @@ AWS_REGION=us-east-1
396
495
 
397
496
  **OpenAI** (auto-discovers from `$OPENAI_API_KEY`, `~/.config/openai/`, `~/.openai/`):
398
497
  ```bash
399
- DEFAULT_MODEL=gpt-5
498
+ DEFAULT_MODEL=openai/gpt-5
400
499
  # Optional - set explicitly or let codespy auto-discover:
401
500
  # OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx
402
501
  ```
@@ -434,11 +533,11 @@ Override YAML settings via environment variables using `_` separator:
434
533
 
435
534
  ```bash
436
535
  # Default settings
437
- export DEFAULT_MODEL=claude-opus-4-6
536
+ export DEFAULT_MODEL=anthropic/claude-opus-4-6
438
537
  export DEFAULT_MAX_ITERS=20
439
538
 
440
539
  # Per-signature settings (use signature name, not module name)
441
- export CODE_AND_DOC_REVIEW_MODEL=claude-sonnet-4-5-20250929
540
+ export CODE_AND_DOC_REVIEW_MODEL=anthropic/claude-sonnet-4-5-20250929
442
541
 
443
542
  # Output settings
444
543
  export OUTPUT_STDOUT=false
@@ -453,32 +552,32 @@ codespy uses a tiered model approach to balance review quality and cost:
453
552
 
454
553
  | Tier | Role | Default | Recommended Model | Used By |
455
554
  |------|------|---------|-------------------|---------|
456
- | 🧠 **Smart** | Core analysis & reasoning | `DEFAULT_MODEL` | `claude-opus-4-6` | Code & doc review, supply chain, scope identification |
457
- | ⚡ **Mid-tier** | Extraction & deduplication | Falls back to `DEFAULT_MODEL` | `claude-sonnet-4-5-20250929` | TwoStepAdapter field extraction, issue deduplication |
458
- | 💰 **Cheap** | Summarization | Falls back to `DEFAULT_MODEL` | `claude-haiku-4-5-20251001` | PR summary generation |
555
+ | 🧠 **Smart** | Core analysis & reasoning | `DEFAULT_MODEL` | `anthropic/claude-opus-4-6` | Code & doc review, supply chain, scope identification |
556
+ | ⚡ **Mid-tier** | Extraction & deduplication | Falls back to `DEFAULT_MODEL` | `anthropic/claude-sonnet-4-5-20250929` | TwoStepAdapter field extraction, issue deduplication |
557
+ | 💰 **Cheap** | Summarization | Falls back to `DEFAULT_MODEL` | `anthropic/claude-haiku-4-5-20251001` | PR summary generation |
459
558
 
460
- By default, **all models use `DEFAULT_MODEL`** (`claude-opus-4-6`). This works out of the box — just set your API credentials and go.
559
+ By default, **all models use `DEFAULT_MODEL`** (`anthropic/claude-opus-4-6`). This works out of the box — just set your API credentials and go.
461
560
 
462
561
  To optimize costs, override the mid-tier and cheap models:
463
562
 
464
563
  ```bash
465
564
  # .env or environment variables
466
- DEFAULT_MODEL=claude-opus-4-6 # Smart tier (default)
467
- EXTRACTION_MODEL=claude-sonnet-4-5-20250929 # Mid-tier: field extraction
468
- DEDUPLICATION_MODEL=claude-sonnet-4-5-20250929 # Mid-tier: issue deduplication
469
- SUMMARIZATION_MODEL=claude-haiku-4-5-20251001 # Cheap tier: PR summary
565
+ DEFAULT_MODEL=anthropic/claude-opus-4-6 # Smart tier (default)
566
+ EXTRACTION_MODEL=anthropic/claude-sonnet-4-5-20250929 # Mid-tier: field extraction
567
+ DEDUPLICATION_MODEL=anthropic/claude-sonnet-4-5-20250929 # Mid-tier: issue deduplication
568
+ SUMMARIZATION_MODEL=anthropic/claude-haiku-4-5-20251001 # Cheap tier: PR summary
470
569
  ```
471
570
 
472
571
  Or in `codespy.yaml`:
473
572
 
474
573
  ```yaml
475
- default_model: claude-opus-4-6
476
- extraction_model: claude-sonnet-4-5-20250929
574
+ default_model: anthropic/claude-opus-4-6
575
+ extraction_model: anthropic/claude-sonnet-4-5-20250929
477
576
  signatures:
478
577
  deduplication:
479
- model: claude-sonnet-4-5-20250929
578
+ model: anthropic/claude-sonnet-4-5-20250929
480
579
  summarization:
481
- model: claude-haiku-4-5-20251001
580
+ model: anthropic/claude-haiku-4-5-20251001
482
581
  ```
483
582
 
484
583
  ---
@@ -492,7 +591,7 @@ signatures:
492
591
 
493
592
  **PR:** [owner/repo#123](https://github.com/owner/repo/pull/123)
494
593
  **Reviewed at:** 2024-01-15 10:30 UTC
495
- **Model:** claude-opus-4-6
594
+ **Model:** anthropic/claude-opus-4-6
496
595
 
497
596
  ## Summary
498
597
 
@@ -694,6 +793,12 @@ poetry run mypy src/
694
793
 
695
794
  ---
696
795
 
796
+ ## Contributors
797
+ * @khezen
798
+ * @pranavsriram8
799
+
800
+ ---
801
+
697
802
  ## License
698
803
 
699
804
  MIT
@@ -4,15 +4,9 @@
4
4
 
5
5
  <h1 align="center">Code<a href="https://github.com/khezen/codespy">Spy</a></h1>
6
6
 
7
- <p align="center">
8
- <strong>Automated code reviews for teams who care about correctness.</strong>
9
- </p>
10
7
  <p align="center">
11
8
  An open-source AI reviewer that catches bugs, improves code quality, and integrates directly into your PR workflow, without sacrificing control or security.
12
9
  </p>
13
- <p align="center">
14
- <i>"Fast feedback. No black box. No vendor lock-in."</i>
15
- </p>
16
10
 
17
11
  <p align="center">
18
12
  <a href="https://github.com/khezen/codespy/actions">
@@ -31,6 +25,42 @@
31
25
 
32
26
  ---
33
27
 
28
+ ## Table of Contents
29
+
30
+ - [Table of Contents](#table-of-contents)
31
+ - [Why CodeSpy?](#why-codespy)
32
+ - [Features](#features)
33
+ - [Installation](#installation)
34
+ - [Using pip](#using-pip)
35
+ - [Using Homebrew (macOS/Linux)](#using-homebrew-macoslinux)
36
+ - [Using Docker](#using-docker)
37
+ - [Using Poetry (for development)](#using-poetry-for-development)
38
+ - [Quick Start](#quick-start)
39
+ - [Usage](#usage)
40
+ - [Command Line](#command-line)
41
+ - [IDE Integration (MCP Server)](#ide-integration-mcp-server)
42
+ - [Using Docker](#using-docker-1)
43
+ - [GitHub Action](#github-action)
44
+ - [Configuration](#configuration)
45
+ - [Setup](#setup)
46
+ - [Git Platform Tokens](#git-platform-tokens)
47
+ - [GitHub Token](#github-token)
48
+ - [GitLab Token](#gitlab-token)
49
+ - [LLM Provider](#llm-provider)
50
+ - [Advanced Configuration (YAML)](#advanced-configuration-yaml)
51
+ - [Recommended Model Strategy](#recommended-model-strategy)
52
+ - [Output](#output)
53
+ - [Markdown (default)](#markdown-default)
54
+ - [GitHub/GitLab Review Comments](#githubgitlab-review-comments)
55
+ - [Architecture](#architecture)
56
+ - [DSPy Signatures](#dspy-signatures)
57
+ - [Supported Languages](#supported-languages)
58
+ - [Development](#development)
59
+ - [Contributors](#contributors)
60
+ - [License](#license)
61
+
62
+ ---
63
+
34
64
  ## Why CodeSpy?
35
65
 
36
66
  Most AI code reviewers are:
@@ -64,6 +94,8 @@ Built for **engineering teams that care about correctness, security, and control
64
94
  - 🤖 **Model Agnostic** - Works with OpenAI, AWS Bedrock, Anthropic, Ollama, and more via LiteLLM
65
95
  - 🐳 **Docker Ready** - Run locally or in the cloud with Docker
66
96
  - <img src="assets/GitHub_Invertocat_Black.svg" height="20" alt="GitHub"> <img src="assets/gitlab-logo-500-rgb.png" height="20" alt="GitLab"> **GitHub & GitLab** - Works with both platforms, auto-detects from URL
97
+ - 🖥️ **Local Reviews** - Review local git changes without GitHub/GitLab — diff against any branch, ref, or review uncommitted work
98
+ - 🧩 **MCP Server** - IDE integration via Model Context Protocol — trigger reviews from AI coding assistants like Cline without leaving your editor
67
99
  - 🔌 **GitHub Action** - One-line integration for automatic PR reviews
68
100
 
69
101
 
@@ -122,7 +154,7 @@ export GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxx # For GitHub
122
154
  export GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx # For GitLab
123
155
 
124
156
  # 2. Set your LLM provider (example with Anthropic)
125
- export DEFAULT_MODEL=claude-opus-4-6
157
+ export DEFAULT_MODEL=anthropic/claude-opus-4-6
126
158
  export ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxx
127
159
 
128
160
  # 3. Review a PR or MR!
@@ -156,7 +188,7 @@ codespy review https://gitlab.mycompany.com/team/project/-/merge_requests/123
156
188
  codespy review https://github.com/owner/repo/pull/123 --output json
157
189
 
158
190
  # Use a specific model
159
- codespy review https://github.com/owner/repo/pull/123 --model claude-opus-4-6
191
+ codespy review https://github.com/owner/repo/pull/123 --model anthropic/claude-opus-4-6
160
192
 
161
193
  # Use a custom config file
162
194
  codespy review https://github.com/owner/repo/pull/123 --config path/to/config.yaml
@@ -179,22 +211,89 @@ codespy config --config path/to/config.yaml
179
211
 
180
212
  # Show version
181
213
  codespy --version
214
+
215
+ # Review local git changes (no GitHub/GitLab needed)
216
+ codespy review-local # Review current dir vs main
217
+ codespy review-local /path/to/repo # Review specific repo
218
+ codespy review-local --base develop # Compare against develop
219
+ codespy review-local --base origin/main # Compare against origin/main
220
+ codespy review-local --base HEAD~5 # Compare against 5 commits back
221
+
222
+ # Review uncommitted changes (staged + unstaged)
223
+ codespy review-uncommitted # Review current dir
224
+ codespy review-uncommitted /path/to/repo
225
+ codespy review-uncommitted --output json
226
+ ```
227
+
228
+ ### IDE Integration (MCP Server)
229
+
230
+ CodeSpy can run as an MCP (Model Context Protocol) server for integration with AI coding assistants like Cline, enabling code reviews directly from your editor without leaving your workflow.
231
+
232
+ ```bash
233
+ # Start the MCP server
234
+ codespy serve
235
+
236
+ # Use a custom config file
237
+ codespy serve --config path/to/config.yaml
238
+ ```
239
+
240
+ **Configure your IDE** (example for Cline in VS Code):
241
+
242
+ Add to `cline_mcp_settings.json`:
243
+ ```json
244
+ {
245
+ "mcpServers": {
246
+ "codespy-reviewer": {
247
+ "command": "codespy",
248
+ "args": ["serve"],
249
+ "env": {
250
+ "DEFAULT_MODEL": "anthropic/claude-opus-4-6",
251
+ "ANTHROPIC_API_KEY": "your-key-here"
252
+ }
253
+ }
254
+ }
255
+ }
256
+ ```
257
+
258
+ Or for AWS Bedrock:
259
+ ```json
260
+ {
261
+ "mcpServers": {
262
+ "codespy-reviewer": {
263
+ "command": "codespy",
264
+ "args": ["serve"],
265
+ "env": {
266
+ "DEFAULT_MODEL": "bedrock/us.anthropic.claude-opus-4-6-v1",
267
+ "AWS_REGION": "us-east-1",
268
+ "AWS_ACCESS_KEY_ID": "your-access-key",
269
+ "AWS_SECRET_ACCESS_KEY": "your-secret-key"
270
+ }
271
+ }
272
+ }
273
+ }
182
274
  ```
183
275
 
276
+ **Available MCP Tools:**
277
+ - `review_local_changes(repo_path, base_ref)` — Review branch changes vs base (e.g., vs `main`)
278
+ - `review_uncommitted(repo_path)` — Review staged + unstaged working tree changes
279
+ - `review_pr(mr_url)` — Review a GitHub PR or GitLab MR by URL
280
+
281
+ Then ask your AI assistant: *"Review my local changes"* or *"Review uncommitted work in /path/to/repo"*
282
+
184
283
  ### Using Docker
185
284
 
186
285
  ```bash
187
286
  # With docker run (using GHCR image)
188
287
  docker run --rm \
189
288
  -e GITHUB_TOKEN=$GITHUB_TOKEN \
190
- -e DEFAULT_MODEL=claude-opus-4-6 \
289
+ -e DEFAULT_MODEL=anthropic/claude-opus-4-6 \
191
290
  -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
192
291
  ghcr.io/khezen/codespy:latest review https://github.com/owner/repo/pull/123
193
292
 
194
293
  # Or use a specific version
195
294
  docker run --rm \
196
295
  -e GITHUB_TOKEN=$GITHUB_TOKEN \
197
- -e DEFAULT_MODEL=claude-opus-4-6 \
296
+ -e DEFAULT_MODEL=anthropic/claude-opus-4-6 \
198
297
  -e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
199
298
  ghcr.io/khezen/codespy:0.2.1 review https://github.com/owner/repo/pull/123
200
299
  ```
@@ -203,7 +302,7 @@ docker run --rm \
203
302
 
204
303
  Add CodeSpy to your repository for automatic PR reviews:
205
304
 
206
- **Trigger on `@codespy review` comment:**
305
+ **Trigger on `/codespy review` comment:**
207
306
 
208
307
  ```yaml
209
308
  # .github/workflows/codespy-review.yml
@@ -215,10 +314,10 @@ on:
215
314
 
216
315
  jobs:
217
316
  review:
218
- # Only run on PR comments containing '@codespy review'
317
+ # Only run on PR comments containing '/codespy review'
219
318
  if: |
220
319
  github.event.issue.pull_request &&
221
- contains(github.event.comment.body, '@codespy review')
320
+ contains(github.event.comment.body, '/codespy review')
222
321
  runs-on: ubuntu-latest
223
322
  permissions:
224
323
  contents: read
@@ -228,7 +327,7 @@ jobs:
228
327
  - name: Run CodeSpy Review
229
328
  uses: khezen/codespy@v1
230
329
  with:
231
- model: 'claude-opus-4-6'
330
+ model: 'anthropic/claude-opus-4-6'
232
331
  anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
233
332
  ```
234
333
 
@@ -253,7 +352,7 @@ jobs:
253
352
  - name: Run CodeSpy Review
254
353
  uses: khezen/codespy@v1
255
354
  with:
256
- model: 'claude-opus-4-6'
355
+ model: 'anthropic/claude-opus-4-6'
257
356
  anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
258
357
  ```
259
358
 
@@ -329,7 +428,7 @@ codespy auto-discovers credentials for all providers:
329
428
 
330
429
  **Anthropic** (auto-discovers from `$ANTHROPIC_API_KEY`, `~/.config/anthropic/`, `~/.anthropic/`):
331
430
  ```bash
332
- DEFAULT_MODEL=claude-opus-4-6
431
+ DEFAULT_MODEL=anthropic/claude-opus-4-6
333
432
  # Optional - set explicitly or let codespy auto-discover:
334
433
  # ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxx
335
434
  ```
@@ -345,7 +444,7 @@ AWS_REGION=us-east-1
345
444
 
346
445
  **OpenAI** (auto-discovers from `$OPENAI_API_KEY`, `~/.config/openai/`, `~/.openai/`):
347
446
  ```bash
348
- DEFAULT_MODEL=gpt-5
447
+ DEFAULT_MODEL=openai/gpt-5
349
448
  # Optional - set explicitly or let codespy auto-discover:
350
449
  # OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx
351
450
  ```
@@ -383,11 +482,11 @@ Override YAML settings via environment variables using `_` separator:
383
482
 
384
483
  ```bash
385
484
  # Default settings
386
- export DEFAULT_MODEL=claude-opus-4-6
485
+ export DEFAULT_MODEL=anthropic/claude-opus-4-6
387
486
  export DEFAULT_MAX_ITERS=20
388
487
 
389
488
  # Per-signature settings (use signature name, not module name)
390
- export CODE_AND_DOC_REVIEW_MODEL=claude-sonnet-4-5-20250929
489
+ export CODE_AND_DOC_REVIEW_MODEL=anthropic/claude-sonnet-4-5-20250929
391
490
 
392
491
  # Output settings
393
492
  export OUTPUT_STDOUT=false
@@ -402,32 +501,32 @@ codespy uses a tiered model approach to balance review quality and cost:
402
501
 
403
502
  | Tier | Role | Default | Recommended Model | Used By |
404
503
  |------|------|---------|-------------------|---------|
405
- | 🧠 **Smart** | Core analysis & reasoning | `DEFAULT_MODEL` | `claude-opus-4-6` | Code & doc review, supply chain, scope identification |
406
- | ⚡ **Mid-tier** | Extraction & deduplication | Falls back to `DEFAULT_MODEL` | `claude-sonnet-4-5-20250929` | TwoStepAdapter field extraction, issue deduplication |
407
- | 💰 **Cheap** | Summarization | Falls back to `DEFAULT_MODEL` | `claude-haiku-4-5-20251001` | PR summary generation |
504
+ | 🧠 **Smart** | Core analysis & reasoning | `DEFAULT_MODEL` | `anthropic/claude-opus-4-6` | Code & doc review, supply chain, scope identification |
505
+ | ⚡ **Mid-tier** | Extraction & deduplication | Falls back to `DEFAULT_MODEL` | `anthropic/claude-sonnet-4-5-20250929` | TwoStepAdapter field extraction, issue deduplication |
506
+ | 💰 **Cheap** | Summarization | Falls back to `DEFAULT_MODEL` | `anthropic/claude-haiku-4-5-20251001` | PR summary generation |
408
507
 
409
- By default, **all models use `DEFAULT_MODEL`** (`claude-opus-4-6`). This works out of the box — just set your API credentials and go.
508
+ By default, **all models use `DEFAULT_MODEL`** (`anthropic/claude-opus-4-6`). This works out of the box — just set your API credentials and go.
410
509
 
411
510
  To optimize costs, override the mid-tier and cheap models:
412
511
 
413
512
  ```bash
414
513
  # .env or environment variables
415
- DEFAULT_MODEL=claude-opus-4-6 # Smart tier (default)
416
- EXTRACTION_MODEL=claude-sonnet-4-5-20250929 # Mid-tier: field extraction
417
- DEDUPLICATION_MODEL=claude-sonnet-4-5-20250929 # Mid-tier: issue deduplication
418
- SUMMARIZATION_MODEL=claude-haiku-4-5-20251001 # Cheap tier: PR summary
514
+ DEFAULT_MODEL=anthropic/claude-opus-4-6 # Smart tier (default)
515
+ EXTRACTION_MODEL=anthropic/claude-sonnet-4-5-20250929 # Mid-tier: field extraction
516
+ DEDUPLICATION_MODEL=anthropic/claude-sonnet-4-5-20250929 # Mid-tier: issue deduplication
517
+ SUMMARIZATION_MODEL=anthropic/claude-haiku-4-5-20251001 # Cheap tier: PR summary
419
518
  ```
420
519
 
421
520
  Or in `codespy.yaml`:
422
521
 
423
522
  ```yaml
424
- default_model: claude-opus-4-6
425
- extraction_model: claude-sonnet-4-5-20250929
523
+ default_model: anthropic/claude-opus-4-6
524
+ extraction_model: anthropic/claude-sonnet-4-5-20250929
426
525
  signatures:
427
526
  deduplication:
428
- model: claude-sonnet-4-5-20250929
527
+ model: anthropic/claude-sonnet-4-5-20250929
429
528
  summarization:
430
- model: claude-haiku-4-5-20251001
529
+ model: anthropic/claude-haiku-4-5-20251001
431
530
  ```
432
531
 
433
532
  ---
@@ -441,7 +540,7 @@ signatures:
441
540
 
442
541
  **PR:** [owner/repo#123](https://github.com/owner/repo/pull/123)
443
542
  **Reviewed at:** 2024-01-15 10:30 UTC
444
- **Model:** claude-opus-4-6
543
+ **Model:** anthropic/claude-opus-4-6
445
544
 
446
545
  ## Summary
447
546
 
@@ -643,6 +742,12 @@ poetry run mypy src/
643
742
 
644
743
  ---
645
744
 
745
+ ## Contributors
746
+ * @khezen
747
+ * @pranavsriram8
748
+
749
+ ---
750
+
646
751
  ## License
647
752
 
648
753
  MIT
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "codespy-ai"
3
- version = "0.2.2"
3
+ version = "0.3.0"
4
4
  description = "Code review agent powered by DSPy"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,3 +1,3 @@
1
1
  """codespy - Code review agent powered by DSPy."""
2
2
 
3
- __version__ = "0.2.2"
3
+ __version__ = "0.3.0"
@@ -4,6 +4,9 @@ from codespy.agents.reviewer.models import (
4
4
  Issue,
5
5
  IssueCategory,
6
6
  IssueSeverity,
7
+ LocalReviewConfig,
8
+ RemoteReviewConfig,
9
+ ReviewConfig,
7
10
  ReviewResult,
8
11
  )
9
12
  from codespy.agents.reviewer.reviewer import ReviewPipeline
@@ -11,6 +14,9 @@ from codespy.agents.reviewer.reviewer import ReviewPipeline
11
14
  __all__ = [
12
15
  "ReviewPipeline",
13
16
  "ReviewResult",
17
+ "ReviewConfig",
18
+ "RemoteReviewConfig",
19
+ "LocalReviewConfig",
14
20
  "Issue",
15
21
  "IssueCategory",
16
22
  "IssueSeverity",