-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (28 loc) · 826 Bytes
/
main.py
File metadata and controls
33 lines (28 loc) · 826 Bytes
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
import sys
from git_diff_critique_agent.agent import critique_git_diff
def main() -> None:
"""
CLI entrypoint for git-diff-critique.
Reads git diff from stdin and prints recommendations.
"""
diff = sys.stdin.read()
if not diff.strip():
print(
"Error: No git diff input detected. "
"Pipe a git diff to this command.",
file=sys.stderr,
)
sys.exit(1)
result = critique_git_diff(diff)
if result.get("status") == "success":
print("Recommendations:")
for rec in result.get("recommendations", []):
print(f"- {rec}")
else:
print(
f"Error: {result.get('error_message', 'Unknown error')}",
file=sys.stderr,
)
sys.exit(1)
if __name__ == "__main__":
main()