-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
47 lines (41 loc) · 1.18 KB
/
main.py
File metadata and controls
47 lines (41 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import argparse
import json
import logging
import sys
from pathlib import Path
from src.crew import run_review
logging.basicConfig(
level=logging.INFO,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
)
logger = logging.getLogger(__name__)
def main() -> None:
parser = argparse.ArgumentParser(
description="AI-Powered multi-agent code review"
)
parser.add_argument(
"repo_path",
type=str,
help="Path to the repository to review",
)
parser.add_argument(
"--output", "-o",
type=str,
default=None,
help="Output file path (JSON). Defaults to stdout.",
)
args = parser.parse_args()
repo = Path(args.repo_path)
if not repo.is_dir():
logger.error(f"Not a valid directory: {args.repo_path}")
sys.exit(1)
logger.info(f"Reviewing repository: {repo.resolve()}")
report = run_review(str(repo.resolve()))
output_json = report.model_dump_json(indent=2)
if args.output:
Path(args.output).write_text(output_json, encoding="utf-8")
logger.info(f"Report saved to: {args.output}")
else:
print(output_json)
if __name__ == "__main__":
main()