feat: implement phase 1 solver baseline
This commit is contained in:
@@ -40,10 +40,25 @@ def load_npm_commands(root: Path) -> list[str]:
|
||||
return commands
|
||||
|
||||
|
||||
def load_cmake_commands(root: Path) -> list[str]:
|
||||
if not (root / "CMakeLists.txt").exists():
|
||||
return []
|
||||
|
||||
build_dir = root / "build"
|
||||
return [
|
||||
f'cmake -S "{root}" -B "{build_dir}"',
|
||||
f'cmake --build "{build_dir}" --config Debug',
|
||||
f'ctest --test-dir "{build_dir}" --output-on-failure -C Debug',
|
||||
]
|
||||
|
||||
|
||||
def discover_commands(root: Path) -> list[str]:
|
||||
env_commands = load_env_commands()
|
||||
if env_commands:
|
||||
return env_commands
|
||||
cmake_commands = load_cmake_commands(root)
|
||||
if cmake_commands:
|
||||
return cmake_commands
|
||||
return load_npm_commands(root)
|
||||
|
||||
|
||||
@@ -54,11 +69,13 @@ def run_command(command: str, root: Path) -> subprocess.CompletedProcess:
|
||||
shell=True,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
encoding="utf-8",
|
||||
errors="replace",
|
||||
)
|
||||
|
||||
|
||||
def emit_stream(prefix: str, content: str, *, stream) -> None:
|
||||
text = content.strip()
|
||||
text = (content or "").strip()
|
||||
if not text:
|
||||
return
|
||||
print(prefix, file=stream)
|
||||
|
||||
Reference in New Issue
Block a user