code-review-ai-cli 2.0.1__tar.gz → 2.1.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 (30) hide show
  1. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/PKG-INFO +24 -10
  2. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/README.md +20 -9
  3. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/code_review_ai_cli.egg-info/PKG-INFO +24 -10
  4. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/code_review_ai_cli.egg-info/SOURCES.txt +2 -0
  5. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/code_review_ai_cli.egg-info/requires.txt +4 -0
  6. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/pyproject.toml +3 -1
  7. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/src/config.py +6 -0
  8. code_review_ai_cli-2.1.0/src/context_extractor.py +728 -0
  9. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/src/git_utils.py +18 -219
  10. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/src/llm_client.py +118 -30
  11. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/src/prompt_utils.py +2 -2
  12. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/src/prompts/config.yaml.template +10 -0
  13. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/src/prompts/review_prompt.md.template +0 -6
  14. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/src/tfs_client.py +42 -87
  15. code_review_ai_cli-2.1.0/tests/test_context_extractor.py +573 -0
  16. code_review_ai_cli-2.1.0/tests/test_git_utils.py +162 -0
  17. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/tests/test_llm_client.py +16 -9
  18. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/tests/test_tfs_client.py +40 -37
  19. code_review_ai_cli-2.0.1/tests/test_git_utils.py +0 -334
  20. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/code_review_ai_cli.egg-info/dependency_links.txt +0 -0
  21. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/code_review_ai_cli.egg-info/entry_points.txt +0 -0
  22. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/code_review_ai_cli.egg-info/top_level.txt +0 -0
  23. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/setup.cfg +0 -0
  24. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/src/__init__.py +0 -0
  25. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/src/ai_review.py +0 -0
  26. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/src/formatter.py +0 -0
  27. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/tests/test_ai_review.py +0 -0
  28. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/tests/test_config.py +0 -0
  29. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/tests/test_formatter.py +0 -0
  30. {code_review_ai_cli-2.0.1 → code_review_ai_cli-2.1.0}/tests/test_prompt_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-review-ai-cli
3
- Version: 2.0.1
3
+ Version: 2.1.0
4
4
  Summary: Automated AI-powered code review CLI for Azure DevOps / TFS Pull Requests
5
5
  License: MIT
6
6
  Keywords: code-review,ai,azure-devops,tfs,pull-request,llm
@@ -25,11 +25,14 @@ Provides-Extra: gemini
25
25
  Requires-Dist: google-generativeai>=0.3.0; extra == "gemini"
26
26
  Provides-Extra: claude
27
27
  Requires-Dist: anthropic>=0.18.0; extra == "claude"
28
+ Provides-Extra: tree-sitter
29
+ Requires-Dist: tree-sitter-languages>=1.10.2; extra == "tree-sitter"
28
30
  Provides-Extra: all
29
31
  Requires-Dist: boto3>=1.34.0; extra == "all"
30
32
  Requires-Dist: openai>=1.0.0; extra == "all"
31
33
  Requires-Dist: google-generativeai>=0.3.0; extra == "all"
32
34
  Requires-Dist: anthropic>=0.18.0; extra == "all"
35
+ Requires-Dist: tree-sitter-languages>=1.10.2; extra == "all"
33
36
  Provides-Extra: dev
34
37
  Requires-Dist: pytest>=8.3.0; extra == "dev"
35
38
  Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
@@ -39,8 +42,6 @@ Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
39
42
 
40
43
  Automated code review tool with Pull Request integration for Azure DevOps/TFS and support for multiple LLM providers.
41
44
 
42
- The main entry point is in `src/ai_review.py`. The project also includes dedicated modules for configuration, output formatting, Git diff capture, TFS/Azure DevOps integration, and communication with the LLM provider.
43
-
44
45
  ## Features
45
46
 
46
47
  - AI Pull Request review (`pr-review`)
@@ -61,11 +62,12 @@ pip install code-review-ai-cli
61
62
  Or install with optional LLM SDK extras:
62
63
 
63
64
  ```bash
64
- pip install "code-review-ai-cli[bedrock]" # AWS Bedrock
65
- pip install "code-review-ai-cli[openai]" # OpenAI SDK
66
- pip install "code-review-ai-cli[gemini]" # Google Gemini SDK
67
- pip install "code-review-ai-cli[claude]" # Anthropic Claude SDK
68
- pip install "code-review-ai-cli[all]" # All optional SDKs
65
+ pip install "code-review-ai-cli[bedrock]" # AWS Bedrock
66
+ pip install "code-review-ai-cli[openai]" # OpenAI SDK
67
+ pip install "code-review-ai-cli[gemini]" # Google Gemini SDK
68
+ pip install "code-review-ai-cli[claude]" # Anthropic Claude SDK
69
+ pip install "code-review-ai-cli[tree-sitter]" # AST context extraction (C#/Java/JS/TS/Python/SQL)
70
+ pip install "code-review-ai-cli[all]" # All optional SDKs
69
71
  ```
70
72
 
71
73
  All providers also work without their optional SDK — the tool communicates via HTTP directly.
@@ -140,10 +142,22 @@ output:
140
142
 
141
143
  | Scope | Description |
142
144
  |---|---|
143
- | `diff_only` | Default. Unified diff (changed lines only) + full file content as read-only context. |
145
+ | `diff_only` | Default. Unified diff (changed lines only) + AST-based context block (Enclosing Scopes, File Skeleton, or Adaptive Diff). |
144
146
  | `full_code` | All lines of the new file version, every line prefixed with `+`. No baseline. |
145
147
 
146
- #### `diff_only` — diff with context (default)
148
+ #### `diff_only` — diff with AST context (default)
149
+
150
+ In `diff_only` mode the tool automatically selects the most token-efficient context
151
+ strategy for each changed file:
152
+
153
+ | Strategy | When used | XML tag |
154
+ |---|---|---|
155
+ | **Enclosing Scopes** | ≤ 3 distinct changed blocks | `<enclosing_scopes file="...">` |
156
+ | **File Skeleton** | > 3 distinct changed blocks | `<file_skeleton file="...">` |
157
+ | **SQL Statement** | SQL files | `<sql_statement file="...">` |
158
+ | **Adaptive Diff** | Tree-sitter unavailable / unsupported language | `<adaptive_diff file="...">` |
159
+
160
+ Supported languages for AST parsing: **Python, JavaScript, TypeScript, TSX, C#, Java, SQL**.
147
161
 
148
162
  ```yaml
149
163
  review:
@@ -2,8 +2,6 @@
2
2
 
3
3
  Automated code review tool with Pull Request integration for Azure DevOps/TFS and support for multiple LLM providers.
4
4
 
5
- The main entry point is in `src/ai_review.py`. The project also includes dedicated modules for configuration, output formatting, Git diff capture, TFS/Azure DevOps integration, and communication with the LLM provider.
6
-
7
5
  ## Features
8
6
 
9
7
  - AI Pull Request review (`pr-review`)
@@ -24,11 +22,12 @@ pip install code-review-ai-cli
24
22
  Or install with optional LLM SDK extras:
25
23
 
26
24
  ```bash
27
- pip install "code-review-ai-cli[bedrock]" # AWS Bedrock
28
- pip install "code-review-ai-cli[openai]" # OpenAI SDK
29
- pip install "code-review-ai-cli[gemini]" # Google Gemini SDK
30
- pip install "code-review-ai-cli[claude]" # Anthropic Claude SDK
31
- pip install "code-review-ai-cli[all]" # All optional SDKs
25
+ pip install "code-review-ai-cli[bedrock]" # AWS Bedrock
26
+ pip install "code-review-ai-cli[openai]" # OpenAI SDK
27
+ pip install "code-review-ai-cli[gemini]" # Google Gemini SDK
28
+ pip install "code-review-ai-cli[claude]" # Anthropic Claude SDK
29
+ pip install "code-review-ai-cli[tree-sitter]" # AST context extraction (C#/Java/JS/TS/Python/SQL)
30
+ pip install "code-review-ai-cli[all]" # All optional SDKs
32
31
  ```
33
32
 
34
33
  All providers also work without their optional SDK — the tool communicates via HTTP directly.
@@ -103,10 +102,22 @@ output:
103
102
 
104
103
  | Scope | Description |
105
104
  |---|---|
106
- | `diff_only` | Default. Unified diff (changed lines only) + full file content as read-only context. |
105
+ | `diff_only` | Default. Unified diff (changed lines only) + AST-based context block (Enclosing Scopes, File Skeleton, or Adaptive Diff). |
107
106
  | `full_code` | All lines of the new file version, every line prefixed with `+`. No baseline. |
108
107
 
109
- #### `diff_only` — diff with context (default)
108
+ #### `diff_only` — diff with AST context (default)
109
+
110
+ In `diff_only` mode the tool automatically selects the most token-efficient context
111
+ strategy for each changed file:
112
+
113
+ | Strategy | When used | XML tag |
114
+ |---|---|---|
115
+ | **Enclosing Scopes** | ≤ 3 distinct changed blocks | `<enclosing_scopes file="...">` |
116
+ | **File Skeleton** | > 3 distinct changed blocks | `<file_skeleton file="...">` |
117
+ | **SQL Statement** | SQL files | `<sql_statement file="...">` |
118
+ | **Adaptive Diff** | Tree-sitter unavailable / unsupported language | `<adaptive_diff file="...">` |
119
+
120
+ Supported languages for AST parsing: **Python, JavaScript, TypeScript, TSX, C#, Java, SQL**.
110
121
 
111
122
  ```yaml
112
123
  review:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-review-ai-cli
3
- Version: 2.0.1
3
+ Version: 2.1.0
4
4
  Summary: Automated AI-powered code review CLI for Azure DevOps / TFS Pull Requests
5
5
  License: MIT
6
6
  Keywords: code-review,ai,azure-devops,tfs,pull-request,llm
@@ -25,11 +25,14 @@ Provides-Extra: gemini
25
25
  Requires-Dist: google-generativeai>=0.3.0; extra == "gemini"
26
26
  Provides-Extra: claude
27
27
  Requires-Dist: anthropic>=0.18.0; extra == "claude"
28
+ Provides-Extra: tree-sitter
29
+ Requires-Dist: tree-sitter-languages>=1.10.2; extra == "tree-sitter"
28
30
  Provides-Extra: all
29
31
  Requires-Dist: boto3>=1.34.0; extra == "all"
30
32
  Requires-Dist: openai>=1.0.0; extra == "all"
31
33
  Requires-Dist: google-generativeai>=0.3.0; extra == "all"
32
34
  Requires-Dist: anthropic>=0.18.0; extra == "all"
35
+ Requires-Dist: tree-sitter-languages>=1.10.2; extra == "all"
33
36
  Provides-Extra: dev
34
37
  Requires-Dist: pytest>=8.3.0; extra == "dev"
35
38
  Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
@@ -39,8 +42,6 @@ Requires-Dist: pytest-mock>=3.14.0; extra == "dev"
39
42
 
40
43
  Automated code review tool with Pull Request integration for Azure DevOps/TFS and support for multiple LLM providers.
41
44
 
42
- The main entry point is in `src/ai_review.py`. The project also includes dedicated modules for configuration, output formatting, Git diff capture, TFS/Azure DevOps integration, and communication with the LLM provider.
43
-
44
45
  ## Features
45
46
 
46
47
  - AI Pull Request review (`pr-review`)
@@ -61,11 +62,12 @@ pip install code-review-ai-cli
61
62
  Or install with optional LLM SDK extras:
62
63
 
63
64
  ```bash
64
- pip install "code-review-ai-cli[bedrock]" # AWS Bedrock
65
- pip install "code-review-ai-cli[openai]" # OpenAI SDK
66
- pip install "code-review-ai-cli[gemini]" # Google Gemini SDK
67
- pip install "code-review-ai-cli[claude]" # Anthropic Claude SDK
68
- pip install "code-review-ai-cli[all]" # All optional SDKs
65
+ pip install "code-review-ai-cli[bedrock]" # AWS Bedrock
66
+ pip install "code-review-ai-cli[openai]" # OpenAI SDK
67
+ pip install "code-review-ai-cli[gemini]" # Google Gemini SDK
68
+ pip install "code-review-ai-cli[claude]" # Anthropic Claude SDK
69
+ pip install "code-review-ai-cli[tree-sitter]" # AST context extraction (C#/Java/JS/TS/Python/SQL)
70
+ pip install "code-review-ai-cli[all]" # All optional SDKs
69
71
  ```
70
72
 
71
73
  All providers also work without their optional SDK — the tool communicates via HTTP directly.
@@ -140,10 +142,22 @@ output:
140
142
 
141
143
  | Scope | Description |
142
144
  |---|---|
143
- | `diff_only` | Default. Unified diff (changed lines only) + full file content as read-only context. |
145
+ | `diff_only` | Default. Unified diff (changed lines only) + AST-based context block (Enclosing Scopes, File Skeleton, or Adaptive Diff). |
144
146
  | `full_code` | All lines of the new file version, every line prefixed with `+`. No baseline. |
145
147
 
146
- #### `diff_only` — diff with context (default)
148
+ #### `diff_only` — diff with AST context (default)
149
+
150
+ In `diff_only` mode the tool automatically selects the most token-efficient context
151
+ strategy for each changed file:
152
+
153
+ | Strategy | When used | XML tag |
154
+ |---|---|---|
155
+ | **Enclosing Scopes** | ≤ 3 distinct changed blocks | `<enclosing_scopes file="...">` |
156
+ | **File Skeleton** | > 3 distinct changed blocks | `<file_skeleton file="...">` |
157
+ | **SQL Statement** | SQL files | `<sql_statement file="...">` |
158
+ | **Adaptive Diff** | Tree-sitter unavailable / unsupported language | `<adaptive_diff file="...">` |
159
+
160
+ Supported languages for AST parsing: **Python, JavaScript, TypeScript, TSX, C#, Java, SQL**.
147
161
 
148
162
  ```yaml
149
163
  review:
@@ -9,6 +9,7 @@ code_review_ai_cli.egg-info/top_level.txt
9
9
  src/__init__.py
10
10
  src/ai_review.py
11
11
  src/config.py
12
+ src/context_extractor.py
12
13
  src/formatter.py
13
14
  src/git_utils.py
14
15
  src/llm_client.py
@@ -18,6 +19,7 @@ src/prompts/config.yaml.template
18
19
  src/prompts/review_prompt.md.template
19
20
  tests/test_ai_review.py
20
21
  tests/test_config.py
22
+ tests/test_context_extractor.py
21
23
  tests/test_formatter.py
22
24
  tests/test_git_utils.py
23
25
  tests/test_llm_client.py
@@ -6,6 +6,7 @@ boto3>=1.34.0
6
6
  openai>=1.0.0
7
7
  google-generativeai>=0.3.0
8
8
  anthropic>=0.18.0
9
+ tree-sitter-languages>=1.10.2
9
10
 
10
11
  [bedrock]
11
12
  boto3>=1.34.0
@@ -23,3 +24,6 @@ google-generativeai>=0.3.0
23
24
 
24
25
  [openai]
25
26
  openai>=1.0.0
27
+
28
+ [tree-sitter]
29
+ tree-sitter-languages>=1.10.2
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "code-review-ai-cli"
7
- version = "2.0.1"
7
+ version = "2.1.0"
8
8
  description = "Automated AI-powered code review CLI for Azure DevOps / TFS Pull Requests"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -31,11 +31,13 @@ bedrock = ["boto3>=1.34.0"]
31
31
  openai = ["openai>=1.0.0"]
32
32
  gemini = ["google-generativeai>=0.3.0"]
33
33
  claude = ["anthropic>=0.18.0"]
34
+ tree-sitter = ["tree-sitter-languages>=1.10.2"]
34
35
  all = [
35
36
  "boto3>=1.34.0",
36
37
  "openai>=1.0.0",
37
38
  "google-generativeai>=0.3.0",
38
39
  "anthropic>=0.18.0",
40
+ "tree-sitter-languages>=1.10.2",
39
41
  ]
40
42
  dev = [
41
43
  "pytest>=8.3.0",
@@ -89,6 +89,9 @@ class ReviewConfig:
89
89
  review_scope: str = "diff_only" # "diff_only" | "full_code"
90
90
  max_diff_files: int = 50 # Max diff files sent to LLM
91
91
  max_diff_lines: int = 2000 # Max diff lines
92
+ max_scope_blocks: int = 3 # Max changed blocks for Enclosing Scopes strategy
93
+ max_scope_lines: int = 250 # Max lines in a single scope block before fallback to file_skeleton
94
+ adaptive_context_lines: int = 10 # Context lines for Adaptive Diff fallback
92
95
  custom_prompt_file: str = "review_prompt.md" # Markdown file with extra rules/context
93
96
  file_extensions_filter: list = field(default_factory=list)
94
97
 
@@ -214,6 +217,9 @@ class ReviewConfig:
214
217
  "review_scope": ("review", "scope"),
215
218
  "max_diff_files": ("review", "max_diff_files"),
216
219
  "max_diff_lines": ("review", "max_diff_lines"),
220
+ "max_scope_blocks": ("review", "max_scope_blocks"),
221
+ "max_scope_lines": ("review", "max_scope_lines"),
222
+ "adaptive_context_lines": ("review", "adaptive_context_lines"),
217
223
  "custom_prompt_file": ("review", "custom_prompt_file"),
218
224
  "file_extensions_filter": ("review", "file_extensions_filter"),
219
225
  # PR