Review this generated code before using it in automation.
Run an AI coding CLI on the supplied checkout, stop it after five minutes, retain process evidence, and report success only from its documented machine result.
Python
from pathlib import Path
import os
import subprocess
def run_cli(workspace: Path, prompt: str) -> dict[str, object]:
result = subprocess.run(
["ai-cli", "--non-interactive", "--prompt", prompt],
cwd=workspace,
env=os.environ.copy(),
capture_output=True,
text=True,
timeout=300,
)
passed = result.returncode == 0 and '"status":"passed"' in result.stdout
return {
"passed": passed,
"argv": result.args,
"exit_code": result.returncode,
"stdout": result.stdout,
"stderr": result.stderr,
}
generated code is illustrative, not from any one model