Skip to content

Commit 9aaa3ed

Browse files
committed
Use JSON schema only for legacy unified review path
1 parent 66fdece commit 9aaa3ed

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

claudecode/github_action_audit.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,13 @@ def __init__(self, timeout_minutes: Optional[int] = None):
335335
else:
336336
self.timeout_seconds = SUBPROCESS_TIMEOUT
337337

338-
def run_prompt(self, repo_dir: Path, prompt: str, model: Optional[str] = None) -> Tuple[bool, str, Any]:
338+
def run_prompt(
339+
self,
340+
repo_dir: Path,
341+
prompt: str,
342+
model: Optional[str] = None,
343+
json_schema: Optional[Dict[str, Any]] = None,
344+
) -> Tuple[bool, str, Any]:
339345
"""Run a single Claude prompt and return parsed JSON payload or text."""
340346
if not repo_dir.exists():
341347
return False, f"Repository directory does not exist: {repo_dir}", {}
@@ -351,8 +357,9 @@ def run_prompt(self, repo_dir: Path, prompt: str, model: Optional[str] = None) -
351357
'--output-format', 'json',
352358
'--model', model_name,
353359
'--disallowed-tools', 'Bash(ps:*)',
354-
'--json-schema', json.dumps(REVIEW_OUTPUT_SCHEMA),
355360
]
361+
if json_schema:
362+
cmd.extend(['--json-schema', json.dumps(json_schema)])
356363

357364
NUM_RETRIES = 3
358365
for attempt in range(NUM_RETRIES):
@@ -407,7 +414,12 @@ def run_prompt(self, repo_dir: Path, prompt: str, model: Optional[str] = None) -
407414

408415
def run_code_review(self, repo_dir: Path, prompt: str, model: Optional[str] = None) -> Tuple[bool, str, Dict[str, Any]]:
409416
"""Run code review prompt and normalize to findings payload."""
410-
success, error_msg, parsed = self.run_prompt(repo_dir, prompt, model=model or DEFAULT_CLAUDE_MODEL)
417+
success, error_msg, parsed = self.run_prompt(
418+
repo_dir,
419+
prompt,
420+
model=model or DEFAULT_CLAUDE_MODEL,
421+
json_schema=REVIEW_OUTPUT_SCHEMA,
422+
)
411423
if not success:
412424
return False, error_msg, {}
413425
if isinstance(parsed, dict) and 'findings' in parsed:

0 commit comments

Comments
 (0)