code-review-ai-cli 1.0.2__tar.gz → 1.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.
Files changed (32) hide show
  1. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/PKG-INFO +45 -3
  2. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/README.md +45 -3
  3. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/code_review_ai_cli.egg-info/PKG-INFO +45 -3
  4. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/code_review_ai_cli.egg-info/SOURCES.txt +4 -2
  5. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/pyproject.toml +1 -1
  6. code_review_ai_cli-1.2.0/src/ai_review.py +2274 -0
  7. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/src/config.py +150 -4
  8. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/src/formatter.py +3 -3
  9. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/src/llm_client.py +958 -98
  10. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/src/prompts/config.yaml.template +90 -6
  11. code_review_ai_cli-1.2.0/src/prompts/review_context.example.md +59 -0
  12. code_review_ai_cli-1.2.0/src/tfs_client.py +1919 -0
  13. code_review_ai_cli-1.2.0/src/usage_tracker.py +374 -0
  14. code_review_ai_cli-1.2.0/tests/test_ai_review.py +1105 -0
  15. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/tests/test_config.py +80 -1
  16. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/tests/test_llm_client.py +232 -12
  17. code_review_ai_cli-1.2.0/tests/test_tfs_client.py +947 -0
  18. code_review_ai_cli-1.2.0/tests/test_usage_tracker.py +195 -0
  19. code_review_ai_cli-1.0.2/src/ai_review.py +0 -969
  20. code_review_ai_cli-1.0.2/src/prompts/review_prompt.md.template +0 -42
  21. code_review_ai_cli-1.0.2/src/tfs_client.py +0 -751
  22. code_review_ai_cli-1.0.2/tests/test_ai_review.py +0 -554
  23. code_review_ai_cli-1.0.2/tests/test_tfs_client.py +0 -436
  24. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/code_review_ai_cli.egg-info/dependency_links.txt +0 -0
  25. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/code_review_ai_cli.egg-info/entry_points.txt +0 -0
  26. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/code_review_ai_cli.egg-info/requires.txt +0 -0
  27. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/code_review_ai_cli.egg-info/top_level.txt +0 -0
  28. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/setup.cfg +0 -0
  29. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/src/__init__.py +0 -0
  30. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/src/git_utils.py +0 -0
  31. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/tests/test_formatter.py +0 -0
  32. {code_review_ai_cli-1.0.2 → code_review_ai_cli-1.2.0}/tests/test_git_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-review-ai-cli
3
- Version: 1.0.2
3
+ Version: 1.2.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
@@ -47,7 +47,9 @@ Automated code review tool with Pull Request integration for Azure DevOps/TFS an
47
47
  - **Dry-run Mode** — Validate reviews before posting
48
48
  - **Multiple LLM Providers** — OpenAI, Azure OpenAI, Gemini, Claude, Ollama, GitHub Copilot, AWS Bedrock
49
49
  - **Smart Filtering** — Filter by file extensions, limit diff size
50
- - **Customizable Prompts** — Markdown-based review guidelines
50
+ - **Project-aware PR Context** — Sends repository and linked work item context while restricting findings to modified PR lines
51
+ - **Single Reviewer Context** — One Markdown context file with local override support
52
+ - **Usage Tracking** — Store per-PR token usage and optional cost estimates
51
53
  - **Interactive CLI** — Menu-driven selection and confirmation
52
54
 
53
55
  ## Installation & Quick Start
@@ -87,7 +89,9 @@ ai-review init
87
89
 
88
90
  Creates:
89
91
  - `config.yaml` — LLM and review settings
90
- - `review_prompt.md` — Customizable review guidelines
92
+ - `review_context.example.md` — Canonical example reviewer context
93
+ - `review_context.local.md` — Local reviewer context override, ignored by git
94
+ - `.gitignore` entry for `review_context.local.md`
91
95
 
92
96
  ### 3. Run Your First Review
93
97
 
@@ -100,6 +104,9 @@ ai-review pr-review 42
100
104
 
101
105
  # Dry-run (preview without posting)
102
106
  ai-review pr-review 42 --dry-run
107
+
108
+ # Check stored token/cost usage
109
+ ai-review usage
103
110
  ```
104
111
 
105
112
  ## Configuration File
@@ -122,10 +129,45 @@ tfs:
122
129
  review:
123
130
  language: pt
124
131
  verbosity: detailed # or: quick, security
132
+ scope: diff_with_context # diff_with_context, diff_only, full_code
125
133
  file_extensions_filter: [".cs", ".ts", ".py"]
126
134
  max_diff_files: 50
135
+ max_comments_to_post: 20
136
+ custom_prompt_file: review_context.local.md
137
+ project_context:
138
+ enabled: true
139
+ mode: on_demand # on_demand, full
140
+ manifest_max_chars: 60000
141
+ retrieval_max_rounds: 2
142
+ retrieval_max_files: 20
143
+ retrieval_max_chars: 120000
144
+ retrieval_file_max_chars: 30000
145
+ work_item_context:
146
+ enabled: true
147
+ max_items: 20
127
148
  ```
128
149
 
150
+ By default, repository context is loaded on demand: the prompt includes explicit
151
+ source-branch change packets, full changed-file contents as read-only context,
152
+ linked work item documentation, and a repository manifest, then the model
153
+ requests any extra files it needs. Inline PR comments must still be grounded in
154
+ actual changed lines from the change packets. Set
155
+ `review.project_context.mode: full` to send the full eligible repository
156
+ snapshot instead. Bedrock uses a default estimated prompt budget of 180000
157
+ tokens; override it with `llm.max_prompt_tokens` if your model supports more or
158
+ less.
159
+
160
+ Reviewer context is loaded from exactly one Markdown file. By default the CLI
161
+ uses `review_context.local.md` when it exists, otherwise it falls back to the
162
+ packaged `src/prompts/review_context.example.md`. Keep local team tweaks in
163
+ `review_context.local.md`; it is gitignored so the canonical context cannot
164
+ drift across machines.
165
+
166
+ For Copilot-backed reviews, Claude Sonnet models are often strong choices for
167
+ large PR validation, for example `llm.provider: copilot` with a Claude Sonnet
168
+ model available to your organization. The tool still enforces the same
169
+ source-branch grounding, duplicate checks, and comment cap regardless of model.
170
+
129
171
  ## Development & Testing
130
172
 
131
173
  This is a standard Python project with the following structure:
@@ -10,7 +10,9 @@ Automated code review tool with Pull Request integration for Azure DevOps/TFS an
10
10
  - **Dry-run Mode** — Validate reviews before posting
11
11
  - **Multiple LLM Providers** — OpenAI, Azure OpenAI, Gemini, Claude, Ollama, GitHub Copilot, AWS Bedrock
12
12
  - **Smart Filtering** — Filter by file extensions, limit diff size
13
- - **Customizable Prompts** — Markdown-based review guidelines
13
+ - **Project-aware PR Context** — Sends repository and linked work item context while restricting findings to modified PR lines
14
+ - **Single Reviewer Context** — One Markdown context file with local override support
15
+ - **Usage Tracking** — Store per-PR token usage and optional cost estimates
14
16
  - **Interactive CLI** — Menu-driven selection and confirmation
15
17
 
16
18
  ## Installation & Quick Start
@@ -50,7 +52,9 @@ ai-review init
50
52
 
51
53
  Creates:
52
54
  - `config.yaml` — LLM and review settings
53
- - `review_prompt.md` — Customizable review guidelines
55
+ - `review_context.example.md` — Canonical example reviewer context
56
+ - `review_context.local.md` — Local reviewer context override, ignored by git
57
+ - `.gitignore` entry for `review_context.local.md`
54
58
 
55
59
  ### 3. Run Your First Review
56
60
 
@@ -63,6 +67,9 @@ ai-review pr-review 42
63
67
 
64
68
  # Dry-run (preview without posting)
65
69
  ai-review pr-review 42 --dry-run
70
+
71
+ # Check stored token/cost usage
72
+ ai-review usage
66
73
  ```
67
74
 
68
75
  ## Configuration File
@@ -85,10 +92,45 @@ tfs:
85
92
  review:
86
93
  language: pt
87
94
  verbosity: detailed # or: quick, security
95
+ scope: diff_with_context # diff_with_context, diff_only, full_code
88
96
  file_extensions_filter: [".cs", ".ts", ".py"]
89
97
  max_diff_files: 50
98
+ max_comments_to_post: 20
99
+ custom_prompt_file: review_context.local.md
100
+ project_context:
101
+ enabled: true
102
+ mode: on_demand # on_demand, full
103
+ manifest_max_chars: 60000
104
+ retrieval_max_rounds: 2
105
+ retrieval_max_files: 20
106
+ retrieval_max_chars: 120000
107
+ retrieval_file_max_chars: 30000
108
+ work_item_context:
109
+ enabled: true
110
+ max_items: 20
90
111
  ```
91
112
 
113
+ By default, repository context is loaded on demand: the prompt includes explicit
114
+ source-branch change packets, full changed-file contents as read-only context,
115
+ linked work item documentation, and a repository manifest, then the model
116
+ requests any extra files it needs. Inline PR comments must still be grounded in
117
+ actual changed lines from the change packets. Set
118
+ `review.project_context.mode: full` to send the full eligible repository
119
+ snapshot instead. Bedrock uses a default estimated prompt budget of 180000
120
+ tokens; override it with `llm.max_prompt_tokens` if your model supports more or
121
+ less.
122
+
123
+ Reviewer context is loaded from exactly one Markdown file. By default the CLI
124
+ uses `review_context.local.md` when it exists, otherwise it falls back to the
125
+ packaged `src/prompts/review_context.example.md`. Keep local team tweaks in
126
+ `review_context.local.md`; it is gitignored so the canonical context cannot
127
+ drift across machines.
128
+
129
+ For Copilot-backed reviews, Claude Sonnet models are often strong choices for
130
+ large PR validation, for example `llm.provider: copilot` with a Claude Sonnet
131
+ model available to your organization. The tool still enforces the same
132
+ source-branch grounding, duplicate checks, and comment cap regardless of model.
133
+
92
134
  ## Development & Testing
93
135
 
94
136
  This is a standard Python project with the following structure:
@@ -155,4 +197,4 @@ Predefined tasks for quick execution in VS Code:
155
197
  In VS Code:
156
198
  1. `Ctrl+Shift+P` → "Tasks: Run Task"
157
199
  2. Select the desired task
158
- 3. Fill in parameters if needed
200
+ 3. Fill in parameters if needed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-review-ai-cli
3
- Version: 1.0.2
3
+ Version: 1.2.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
@@ -47,7 +47,9 @@ Automated code review tool with Pull Request integration for Azure DevOps/TFS an
47
47
  - **Dry-run Mode** — Validate reviews before posting
48
48
  - **Multiple LLM Providers** — OpenAI, Azure OpenAI, Gemini, Claude, Ollama, GitHub Copilot, AWS Bedrock
49
49
  - **Smart Filtering** — Filter by file extensions, limit diff size
50
- - **Customizable Prompts** — Markdown-based review guidelines
50
+ - **Project-aware PR Context** — Sends repository and linked work item context while restricting findings to modified PR lines
51
+ - **Single Reviewer Context** — One Markdown context file with local override support
52
+ - **Usage Tracking** — Store per-PR token usage and optional cost estimates
51
53
  - **Interactive CLI** — Menu-driven selection and confirmation
52
54
 
53
55
  ## Installation & Quick Start
@@ -87,7 +89,9 @@ ai-review init
87
89
 
88
90
  Creates:
89
91
  - `config.yaml` — LLM and review settings
90
- - `review_prompt.md` — Customizable review guidelines
92
+ - `review_context.example.md` — Canonical example reviewer context
93
+ - `review_context.local.md` — Local reviewer context override, ignored by git
94
+ - `.gitignore` entry for `review_context.local.md`
91
95
 
92
96
  ### 3. Run Your First Review
93
97
 
@@ -100,6 +104,9 @@ ai-review pr-review 42
100
104
 
101
105
  # Dry-run (preview without posting)
102
106
  ai-review pr-review 42 --dry-run
107
+
108
+ # Check stored token/cost usage
109
+ ai-review usage
103
110
  ```
104
111
 
105
112
  ## Configuration File
@@ -122,10 +129,45 @@ tfs:
122
129
  review:
123
130
  language: pt
124
131
  verbosity: detailed # or: quick, security
132
+ scope: diff_with_context # diff_with_context, diff_only, full_code
125
133
  file_extensions_filter: [".cs", ".ts", ".py"]
126
134
  max_diff_files: 50
135
+ max_comments_to_post: 20
136
+ custom_prompt_file: review_context.local.md
137
+ project_context:
138
+ enabled: true
139
+ mode: on_demand # on_demand, full
140
+ manifest_max_chars: 60000
141
+ retrieval_max_rounds: 2
142
+ retrieval_max_files: 20
143
+ retrieval_max_chars: 120000
144
+ retrieval_file_max_chars: 30000
145
+ work_item_context:
146
+ enabled: true
147
+ max_items: 20
127
148
  ```
128
149
 
150
+ By default, repository context is loaded on demand: the prompt includes explicit
151
+ source-branch change packets, full changed-file contents as read-only context,
152
+ linked work item documentation, and a repository manifest, then the model
153
+ requests any extra files it needs. Inline PR comments must still be grounded in
154
+ actual changed lines from the change packets. Set
155
+ `review.project_context.mode: full` to send the full eligible repository
156
+ snapshot instead. Bedrock uses a default estimated prompt budget of 180000
157
+ tokens; override it with `llm.max_prompt_tokens` if your model supports more or
158
+ less.
159
+
160
+ Reviewer context is loaded from exactly one Markdown file. By default the CLI
161
+ uses `review_context.local.md` when it exists, otherwise it falls back to the
162
+ packaged `src/prompts/review_context.example.md`. Keep local team tweaks in
163
+ `review_context.local.md`; it is gitignored so the canonical context cannot
164
+ drift across machines.
165
+
166
+ For Copilot-backed reviews, Claude Sonnet models are often strong choices for
167
+ large PR validation, for example `llm.provider: copilot` with a Claude Sonnet
168
+ model available to your organization. The tool still enforces the same
169
+ source-branch grounding, duplicate checks, and comment cap regardless of model.
170
+
129
171
  ## Development & Testing
130
172
 
131
173
  This is a standard Python project with the following structure:
@@ -13,11 +13,13 @@ src/formatter.py
13
13
  src/git_utils.py
14
14
  src/llm_client.py
15
15
  src/tfs_client.py
16
+ src/usage_tracker.py
16
17
  src/prompts/config.yaml.template
17
- src/prompts/review_prompt.md.template
18
+ src/prompts/review_context.example.md
18
19
  tests/test_ai_review.py
19
20
  tests/test_config.py
20
21
  tests/test_formatter.py
21
22
  tests/test_git_utils.py
22
23
  tests/test_llm_client.py
23
- tests/test_tfs_client.py
24
+ tests/test_tfs_client.py
25
+ tests/test_usage_tracker.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "code-review-ai-cli"
7
- version = "1.0.2"
7
+ version = "1.2.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"