code-review-ai-cli 1.3.3__tar.gz → 1.3.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 (25) hide show
  1. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/PKG-INFO +12 -5
  2. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/README.md +12 -5
  3. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/code_review_ai_cli.egg-info/PKG-INFO +12 -5
  4. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/pyproject.toml +1 -1
  5. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/src/ai_review.py +14 -12
  6. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/src/config.py +7 -2
  7. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/src/llm_client.py +222 -288
  8. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/src/prompts/config.yaml.template +5 -4
  9. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/src/tfs_client.py +19 -16
  10. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/tests/test_ai_review.py +7 -9
  11. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/tests/test_config.py +8 -2
  12. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/tests/test_llm_client.py +106 -89
  13. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/tests/test_tfs_client.py +15 -8
  14. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/code_review_ai_cli.egg-info/SOURCES.txt +0 -0
  15. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/code_review_ai_cli.egg-info/dependency_links.txt +0 -0
  16. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/code_review_ai_cli.egg-info/entry_points.txt +0 -0
  17. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/code_review_ai_cli.egg-info/requires.txt +0 -0
  18. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/code_review_ai_cli.egg-info/top_level.txt +0 -0
  19. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/setup.cfg +0 -0
  20. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/src/__init__.py +0 -0
  21. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/src/formatter.py +0 -0
  22. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/src/git_utils.py +0 -0
  23. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/src/prompts/review_prompt.md.template +0 -0
  24. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/tests/test_formatter.py +0 -0
  25. {code_review_ai_cli-1.3.3 → code_review_ai_cli-1.3.5}/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.3.3
3
+ Version: 1.3.5
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
@@ -126,7 +126,6 @@ tfs:
126
126
  # ca_bundle: C:/certs/corporate-root-ca.pem
127
127
 
128
128
  review:
129
- language: pt
130
129
  verbosity: detailed
131
130
  scope: diff_only
132
131
  custom_prompt_file: review_prompt.md
@@ -351,9 +350,8 @@ flowchart TD
351
350
  R --> S[Limit files with max_diff_files]
352
351
  S --> T[Build changed-files summary]
353
352
  T --> U[Truncate each file with max_diff_lines]
354
- U --> V[Run AI general review]
355
- V --> W[Run AI structured comment generation]
356
- W --> X[Preview review and suggested comments]
353
+ U --> V[Run single AI call: narrative review + structured comments]
354
+ V --> X[Preview review and suggested comments]
357
355
  X --> Y{Dry-run enabled?}
358
356
  Y -->|Yes| Z[Stop after preview]
359
357
  Y -->|No| AA{Auto-post enabled?}
@@ -392,6 +390,7 @@ Options:
392
390
  - `--format {terminal,markdown,json}`
393
391
  - `--output`, `-o`
394
392
  - `--no-color`
393
+ - `--debug-dump`
395
394
  - `--model`, `-m`
396
395
  - `--provider`, `-p`
397
396
  - `--config`
@@ -428,3 +427,11 @@ tfs:
428
427
  ```
429
428
 
430
429
  Avoid `verify_ssl: false` except for temporary troubleshooting.
430
+
431
+ ### Debug Dump
432
+
433
+ ```yaml
434
+ debug:
435
+ dump: true
436
+ dump_file: logs/llm_prompt_debug.log
437
+ ```
@@ -89,7 +89,6 @@ tfs:
89
89
  # ca_bundle: C:/certs/corporate-root-ca.pem
90
90
 
91
91
  review:
92
- language: pt
93
92
  verbosity: detailed
94
93
  scope: diff_only
95
94
  custom_prompt_file: review_prompt.md
@@ -314,9 +313,8 @@ flowchart TD
314
313
  R --> S[Limit files with max_diff_files]
315
314
  S --> T[Build changed-files summary]
316
315
  T --> U[Truncate each file with max_diff_lines]
317
- U --> V[Run AI general review]
318
- V --> W[Run AI structured comment generation]
319
- W --> X[Preview review and suggested comments]
316
+ U --> V[Run single AI call: narrative review + structured comments]
317
+ V --> X[Preview review and suggested comments]
320
318
  X --> Y{Dry-run enabled?}
321
319
  Y -->|Yes| Z[Stop after preview]
322
320
  Y -->|No| AA{Auto-post enabled?}
@@ -355,6 +353,7 @@ Options:
355
353
  - `--format {terminal,markdown,json}`
356
354
  - `--output`, `-o`
357
355
  - `--no-color`
356
+ - `--debug-dump`
358
357
  - `--model`, `-m`
359
358
  - `--provider`, `-p`
360
359
  - `--config`
@@ -390,4 +389,12 @@ tfs:
390
389
  ca_bundle: C:/certs/corporate-root-ca.pem
391
390
  ```
392
391
 
393
- Avoid `verify_ssl: false` except for temporary troubleshooting.
392
+ Avoid `verify_ssl: false` except for temporary troubleshooting.
393
+
394
+ ### Debug Dump
395
+
396
+ ```yaml
397
+ debug:
398
+ dump: true
399
+ dump_file: logs/llm_prompt_debug.log
400
+ ```
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: code-review-ai-cli
3
- Version: 1.3.3
3
+ Version: 1.3.5
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
@@ -126,7 +126,6 @@ tfs:
126
126
  # ca_bundle: C:/certs/corporate-root-ca.pem
127
127
 
128
128
  review:
129
- language: pt
130
129
  verbosity: detailed
131
130
  scope: diff_only
132
131
  custom_prompt_file: review_prompt.md
@@ -351,9 +350,8 @@ flowchart TD
351
350
  R --> S[Limit files with max_diff_files]
352
351
  S --> T[Build changed-files summary]
353
352
  T --> U[Truncate each file with max_diff_lines]
354
- U --> V[Run AI general review]
355
- V --> W[Run AI structured comment generation]
356
- W --> X[Preview review and suggested comments]
353
+ U --> V[Run single AI call: narrative review + structured comments]
354
+ V --> X[Preview review and suggested comments]
357
355
  X --> Y{Dry-run enabled?}
358
356
  Y -->|Yes| Z[Stop after preview]
359
357
  Y -->|No| AA{Auto-post enabled?}
@@ -392,6 +390,7 @@ Options:
392
390
  - `--format {terminal,markdown,json}`
393
391
  - `--output`, `-o`
394
392
  - `--no-color`
393
+ - `--debug-dump`
395
394
  - `--model`, `-m`
396
395
  - `--provider`, `-p`
397
396
  - `--config`
@@ -428,3 +427,11 @@ tfs:
428
427
  ```
429
428
 
430
429
  Avoid `verify_ssl: false` except for temporary troubleshooting.
430
+
431
+ ### Debug Dump
432
+
433
+ ```yaml
434
+ debug:
435
+ dump: true
436
+ dump_file: logs/llm_prompt_debug.log
437
+ ```
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "code-review-ai-cli"
7
- version = "1.3.3"
7
+ version = "1.3.5"
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"
@@ -45,6 +45,7 @@ import os
45
45
  import sys
46
46
  import time
47
47
  import threading
48
+ from datetime import datetime
48
49
 
49
50
 
50
51
  def _configure_console_streams() -> None:
@@ -254,6 +255,10 @@ def _add_global_options(parser: argparse.ArgumentParser) -> None:
254
255
  "--no-color", action="store_true",
255
256
  help="Disable terminal colors"
256
257
  )
258
+ group_output.add_argument(
259
+ "--debug-dump", action="store_true",
260
+ help="Dump the diff and full LLM prompt/context sent to the LLM into a debug log file"
261
+ )
257
262
 
258
263
  group_config = parser.add_argument_group("Configuration")
259
264
  group_config.add_argument(
@@ -321,6 +326,8 @@ def run_review(args: argparse.Namespace) -> int:
321
326
  config.dry_run = True
322
327
  if getattr(args, "auto_post", False):
323
328
  config.auto_post_comments = True
329
+ if getattr(args, "debug_dump", False):
330
+ config.debug_dump = True
324
331
 
325
332
  # --- Validate configuration ---
326
333
  issues = config.validate()
@@ -410,6 +417,12 @@ def run_pr_review_workflow(args: argparse.Namespace, config: ReviewConfig,
410
417
  # Show PR details
411
418
  print(formatter.format_pr_details(pr_details))
412
419
 
420
+ if config.debug_dump and not config.debug_dump_file:
421
+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
422
+ config.debug_dump_file = os.path.join("logs", f"pr_{pr_id}_{timestamp}_debug.log")
423
+ os.makedirs(os.path.dirname(config.debug_dump_file), exist_ok=True)
424
+ print(formatter.format_info(f"🐛 Debug dump enabled: {config.debug_dump_file}"))
425
+
413
426
  # --- Get PR diff ---
414
427
  print(formatter.format_progress("Getting Pull Request diff"))
415
428
 
@@ -492,17 +505,7 @@ def run_pr_review_workflow(args: argparse.Namespace, config: ReviewConfig,
492
505
 
493
506
  try:
494
507
  llm = LLMClient(config)
495
-
496
- # Get general review as text
497
- review_text = llm.review(
498
- diff=diff_truncated,
499
- files_summary=files_summary,
500
- context=getattr(args, "context", ""),
501
- review_scope=config.review_scope,
502
- )
503
-
504
- # Get structured comments to post
505
- structured_comments = llm.review_pr_structured(
508
+ review_text, structured_comments = llm.review_pr(
506
509
  diff=diff_truncated,
507
510
  files_summary=files_summary,
508
511
  context=getattr(args, "context", ""),
@@ -855,7 +858,6 @@ def _show_config(config: ReviewConfig) -> None:
855
858
  print(f" {c.CYAN}API Key:{c.RESET} {'✅ Configured' if has_effective_key else '❌ Not configured'}")
856
859
  print(f" {c.CYAN}Temperature:{c.RESET} {config.temperature}")
857
860
  print(f" {c.CYAN}Max Tokens:{c.RESET} {config.max_tokens}")
858
- print(f" {c.CYAN}Language:{c.RESET} {config.review_language}")
859
861
  print(f" {c.CYAN}Verbosity:{c.RESET} {config.verbosity}")
860
862
  print(f" {c.CYAN}Format:{c.RESET} {config.output_format}")
861
863
  print(f"\n {c.CYAN}TFS URL:{c.RESET} {config.tfs_base_url or '(not configured)'}")
@@ -85,7 +85,6 @@ class ReviewConfig:
85
85
  tfs_repository: str = "" # Default repository (empty = all)
86
86
 
87
87
  # --- Review -------------------------------------------------------
88
- review_language: str = "pt" # Review language (pt/en)
89
88
  verbosity: str = "detailed" # "quick" | "detailed" | "security"
90
89
  review_scope: str = "diff_only" # "diff_only" | "full_code"
91
90
  max_diff_files: int = 50 # Max diff files sent to LLM
@@ -103,6 +102,10 @@ class ReviewConfig:
103
102
  output_file: str = "" # Path to save output
104
103
  color_output: bool = True # Terminal colors
105
104
 
105
+ # --- Debug ----------------------------------------------------------
106
+ debug_dump: bool = False # Dump diff and full LLM prompt to a log file
107
+ debug_dump_file: str = "" # Custom path (empty = logs/pr_<id>_debug.log)
108
+
106
109
  def get_effective_model(self) -> str:
107
110
  """Returns the effective model (configured or provider default)."""
108
111
  if self.model:
@@ -207,7 +210,6 @@ class ReviewConfig:
207
210
  "tfs_ca_bundle": ("tfs", "ca_bundle"),
208
211
  "tfs_repository": ("tfs", "repository"),
209
212
  # Review
210
- "review_language": ("review", "language"),
211
213
  "verbosity": ("review", "verbosity"),
212
214
  "review_scope": ("review", "scope"),
213
215
  "max_diff_files": ("review", "max_diff_files"),
@@ -222,6 +224,9 @@ class ReviewConfig:
222
224
  "output_format": ("output", "format"),
223
225
  "output_file": ("output", "file"),
224
226
  "color_output": ("output", "color"),
227
+ # Debug
228
+ "debug_dump": ("debug", "dump"),
229
+ "debug_dump_file": ("debug", "dump_file"),
225
230
  }
226
231
 
227
232
  for attr, keys in mapping.items():