Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·54 lines (41 loc) · 1.45 KB
/
Copy pathmain.py
File metadata and controls
executable file
·54 lines (41 loc) · 1.45 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
48
49
50
51
52
53
54
#!/usr/bin/env python3
"""Main CLI entry point for AI PR Review Agent."""
import argparse
import logging
import sys
from src.config import load_config
from src.agent import PRAgent
def main():
parser = argparse.ArgumentParser(description="AI PR Review Agent with Telegram alerts")
parser.add_argument("--repo", help="Target GitHub repository (owner/repo)")
parser.add_argument("--pr", type=int, help="Target Pull Request number")
parser.add_argument("--provider", help="LLM provider (gemini, deepseek, groq, openai)")
parser.add_argument("--model", help="LLM model name")
parser.add_argument("--verbose", action="store_true", help="Enable verbose debug logging")
args = parser.parse_args()
# Logging setup
log_level = logging.DEBUG if args.verbose else logging.INFO
logging.basicConfig(
level=log_level,
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
)
config = load_config()
if args.repo:
config.github_repository = args.repo
if args.pr:
config.pr_number = args.pr
if args.provider:
config.llm_provider = args.provider
if args.model:
config.llm_model = args.model
try:
config.validate()
except ValueError as e:
logging.error("Configuration error: %s", e)
sys.exit(1)
agent = PRAgent(config)
success = agent.run(pr_number=args.pr)
if not success:
sys.exit(1)
if __name__ == "__main__":
main()