monitor session file

This commit is contained in:
Pinghua
2026-06-11 17:26:45 +08:00
parent 89709cec6e
commit c44f83c4c9
2 changed files with 213 additions and 0 deletions
+9
View File
@@ -24,6 +24,8 @@ import time
import urllib.error
import urllib.request
from monitor_session import SessionMonitor
MAX_DIFF_CHARS = 200_000 # ~50k words, safe for Claude context
@@ -573,12 +575,17 @@ def main():
else:
print("[review_pr] No --repo-dir provided — skipping global impact analysis")
mon = None
prompt_file = os.path.join(diff_dir, f"{prefix}_prompt.txt")
try:
# ── 5. Build prompt & run Claude ─────────────────────────────────
prompt = build_prompt(meta, files, diff_path, agent_md, impact_report_path)
print("[review_pr] Invoking Claude for analysis...")
mon = SessionMonitor(project_root)
mon.start()
stdout = run_claude(claude_bin, project_root, prompt, extra_dir=repo_dir, prompt_file=prompt_file)
mon.stop()
# ── 6. Parse Claude output ───────────────────────────────────────
review = extract_json_from_output(stdout)
@@ -593,6 +600,8 @@ def main():
print("[review_pr] Done.")
finally:
if mon:
mon.stop()
# Clean up temp files
if os.path.exists(diff_path):
os.unlink(diff_path)