From b30f040c7b2f5985460fd968accdf683897a4411 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 2 Mar 2026 16:42:11 -0500 Subject: [PATCH] =?UTF-8?q?fix(mma=5Fexec):=20remove=20hardcoded=20C:\proj?= =?UTF-8?q?ects\misc\setup=5F*.ps1=20paths=20=E2=80=94=20rely=20on=20PATH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/claude_mma_exec.py | 6 +----- scripts/mma_exec.py | 5 +---- tests/test_arch_boundary_phase1.py | 24 ++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/scripts/claude_mma_exec.py b/scripts/claude_mma_exec.py index 8600d94..bc84f36 100644 --- a/scripts/claude_mma_exec.py +++ b/scripts/claude_mma_exec.py @@ -188,11 +188,7 @@ def execute_agent(role: str, prompt: str, docs: list[str], timeout: int | None = print(f"Error inlining {doc}: {e}") command_text += f"\n\nTASK: {prompt}\n\n" # Spawn claude CLI non-interactively via PowerShell - ps_command = ( - "if (Test-Path 'C:\\projects\\misc\\setup_claude.ps1') " - "{ . 'C:\\projects\\misc\\setup_claude.ps1' }; " - f"claude --model {model} --print --dangerously-skip-permissions" - ) + ps_command = f"claude --model {model} --print --dangerously-skip-permissions" cmd = ['powershell.exe', '-NoProfile', '-Command', ps_command] try: env = os.environ.copy() diff --git a/scripts/mma_exec.py b/scripts/mma_exec.py index 3f59d3e..cc44253 100644 --- a/scripts/mma_exec.py +++ b/scripts/mma_exec.py @@ -194,10 +194,7 @@ def execute_agent(role: str, prompt: str, docs: list[str], debug: bool = False, command_text += f"\n\nTASK: {prompt}\n\n" # Use subprocess with input to pipe the prompt via stdin, avoiding WinError 206. # We use -p 'mma_task' to ensure non-interactive (headless) mode and valid parsing. - ps_command = ( - f"if (Test-Path 'C:\\projects\\misc\\setup_gemini.ps1') {{ . 'C:\\projects\\misc\\setup_gemini.ps1' }}; " - f"gemini -p '{role}' --output-format json --model {model}" - ) + ps_command = f"gemini -p '{role}' --output-format json --model {model}" cmd = ['powershell.exe', '-NoProfile', '-Command', ps_command] try: env = os.environ.copy() diff --git a/tests/test_arch_boundary_phase1.py b/tests/test_arch_boundary_phase1.py index a135472..8603101 100644 --- a/tests/test_arch_boundary_phase1.py +++ b/tests/test_arch_boundary_phase1.py @@ -67,5 +67,29 @@ class TestArchBoundaryPhase1(unittest.TestCase): captured_input = mock_run.call_args[1].get('input', '') self.assertIn('DEPENDENCY SKELETON: mcp_client.py', captured_input) + def test_mma_exec_no_hardcoded_path(self): + """TEST 4: mma_exec.execute_agent must not contain hardcoded machine paths.""" + import importlib as il + import sys as _sys + scripts_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'scripts')) + if scripts_path not in _sys.path: + _sys.path.insert(0, scripts_path) + import mma_exec as _mma + il.reload(_mma) + source = inspect.getsource(_mma.execute_agent) + self.assertNotIn('C:\\projects\\misc', source, "Hardcoded machine path must be removed from mma_exec.execute_agent") + + def test_claude_mma_exec_no_hardcoded_path(self): + """TEST 5: claude_mma_exec.execute_agent must not contain hardcoded machine paths.""" + import importlib as il + import sys as _sys + scripts_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'scripts')) + if scripts_path not in _sys.path: + _sys.path.insert(0, scripts_path) + import claude_mma_exec as _cmma + il.reload(_cmma) + source = inspect.getsource(_cmma.execute_agent) + self.assertNotIn('C:\\projects\\misc', source, "Hardcoded machine path must be removed from claude_mma_exec.execute_agent") + if __name__ == '__main__': unittest.main()