Fix cmdforge executable path for AI review
Find cmdforge in venv or PATH instead of assuming it's in PATH. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8471480aa7
commit
e1cae5ffda
|
|
@ -94,11 +94,28 @@ def run_ai_scrutiny_review(scrutiny_report: dict, config: dict, tool_name: str,
|
||||||
"arguments": config.get("arguments", []),
|
"arguments": config.get("arguments", []),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Find cmdforge executable - try venv first, then PATH
|
||||||
|
cmdforge_paths = [
|
||||||
|
Path(sys.executable).parent / "cmdforge", # Same venv as current Python
|
||||||
|
Path("/srv/mergerfs/data_pool/home/rob/cmdforge-registry/venv/bin/cmdforge"), # Server venv
|
||||||
|
"cmdforge", # PATH
|
||||||
|
]
|
||||||
|
|
||||||
|
cmdforge_exe = None
|
||||||
|
for p in cmdforge_paths:
|
||||||
|
p = Path(p) if not isinstance(p, Path) else p
|
||||||
|
if p.exists() if isinstance(p, Path) and p.is_absolute() else True:
|
||||||
|
cmdforge_exe = str(p)
|
||||||
|
break
|
||||||
|
|
||||||
|
if not cmdforge_exe:
|
||||||
|
return None
|
||||||
|
|
||||||
# Run the tool
|
# Run the tool
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
[
|
[
|
||||||
"cmdforge", "run", "scrutiny-ai-review",
|
cmdforge_exe, "run", "scrutiny-ai-review",
|
||||||
"--warnings", json.dumps(warnings),
|
"--warnings", json.dumps(warnings),
|
||||||
"--tool-config", json.dumps(tool_config),
|
"--tool-config", json.dumps(tool_config),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,7 @@ def run_ai_scrutiny_review(scrutiny_report: dict, config: dict, tool_name: str,
|
||||||
AI review result dict, or None if review fails
|
AI review result dict, or None if review fails
|
||||||
"""
|
"""
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
# Check if the AI review tool exists
|
# Check if the AI review tool exists
|
||||||
|
|
@ -233,11 +234,28 @@ def run_ai_scrutiny_review(scrutiny_report: dict, config: dict, tool_name: str,
|
||||||
"arguments": config.get("arguments", []),
|
"arguments": config.get("arguments", []),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Find cmdforge executable - try venv first, then PATH
|
||||||
|
cmdforge_paths = [
|
||||||
|
Path(sys.executable).parent / "cmdforge", # Same venv as current Python
|
||||||
|
Path("/srv/mergerfs/data_pool/home/rob/cmdforge-registry/venv/bin/cmdforge"), # Server venv
|
||||||
|
"cmdforge", # PATH
|
||||||
|
]
|
||||||
|
|
||||||
|
cmdforge_exe = None
|
||||||
|
for p in cmdforge_paths:
|
||||||
|
p = Path(p) if not isinstance(p, Path) else p
|
||||||
|
if p.exists() if isinstance(p, Path) and p.is_absolute() else True:
|
||||||
|
cmdforge_exe = str(p)
|
||||||
|
break
|
||||||
|
|
||||||
|
if not cmdforge_exe:
|
||||||
|
return None
|
||||||
|
|
||||||
# Run the tool
|
# Run the tool
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
[
|
[
|
||||||
"cmdforge", "run", "scrutiny-ai-review",
|
cmdforge_exe, "run", "scrutiny-ai-review",
|
||||||
"--warnings", json.dumps(warnings),
|
"--warnings", json.dumps(warnings),
|
||||||
"--tool-config", json.dumps(tool_config),
|
"--tool-config", json.dumps(tool_config),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue