diff --git a/scripts/fabric_sync.py b/scripts/fabric_sync.py index 6b1e32e..fb0c02e 100755 --- a/scripts/fabric_sync.py +++ b/scripts/fabric_sync.py @@ -94,11 +94,28 @@ def run_ai_scrutiny_review(scrutiny_report: dict, config: dict, tool_name: str, "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 try: result = subprocess.run( [ - "cmdforge", "run", "scrutiny-ai-review", + cmdforge_exe, "run", "scrutiny-ai-review", "--warnings", json.dumps(warnings), "--tool-config", json.dumps(tool_config), ], diff --git a/src/cmdforge/registry/app.py b/src/cmdforge/registry/app.py index feaa69a..be9fc87 100644 --- a/src/cmdforge/registry/app.py +++ b/src/cmdforge/registry/app.py @@ -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 """ import subprocess + import sys from pathlib import Path # 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", []), } + # 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 try: result = subprocess.run( [ - "cmdforge", "run", "scrutiny-ai-review", + cmdforge_exe, "run", "scrutiny-ai-review", "--warnings", json.dumps(warnings), "--tool-config", json.dumps(tool_config), ],