@@ -28,6 +28,7 @@ python3 /path/to/PyCompiler_ARK/pycompiler_ark.py
2828ARK_BIN=" python3 /path/to/PyCompiler_ARK/pycompiler_ark.py"
2929WORKSPACE_DIR=" /path/to/workspace"
3030ENGINE_ID=" <engine_id>"
31+ export ARK_AUTO_INSTALL_SYSTEM_TOOLS=1
3132
3233# Single-step workspace flow (init + auto-config + inspect)
3334$ARK_BIN workspace apply " $WORKSPACE_DIR " --with-venv --strict --json > " $WORKSPACE_DIR /.ark_workspace_apply.json"
4849ENTRYPOINT_FILE=" $WORKSPACE_DIR /$ENTRYPOINT_REL "
4950
5051$ARK_BIN engine info " $ENGINE_ID " --workspace " $WORKSPACE_DIR " --json > " $WORKSPACE_DIR /.ark_engine_info.json"
51- $ARK_BIN engine compile " $ENGINE_ID " " $ENTRYPOINT_FILE " --workspace " $WORKSPACE_DIR " --json > " $WORKSPACE_DIR /.ark_build_result.json"
52+ if ! $ARK_BIN engine compile " $ENGINE_ID " " $ENTRYPOINT_FILE " --workspace " $WORKSPACE_DIR " --json > " $WORKSPACE_DIR /.ark_build_result.json" ; then
53+ WORKSPACE_DIR=" $WORKSPACE_DIR " python3 - << 'PY '
54+ import json, os
55+ from pathlib import Path
56+ p = Path(os.environ["WORKSPACE_DIR"]) / ".ark_build_result.json"
57+ try:
58+ d = json.loads(p.read_text(encoding="utf-8"))
59+ print("Compilation failed:", d.get("error") or "unknown error")
60+ except Exception:
61+ print("Compilation failed (invalid .ark_build_result.json)")
62+ PY
63+ exit 1
64+ fi
5265```
5366
5467You can explicitly set or clear entrypoint in CI when needed:
@@ -72,11 +85,27 @@ $ARK_BIN workspace entrypoint-clear "$WORKSPACE_DIR" --json
7285
7386- ` engine compile `
7487 - compiles the resolved entrypoint with the selected engine
88+ - returns non-zero on build failure, even in ` --json ` mode (pipeline-friendly)
7589- ` engine config set/reset `
7690 - lets CI apply or reset workspace engine options without opening GUI
7791- ` venv status/use-system/use-venv/install-req `
7892 - lets CI enforce workspace Python mode and requirements installation policy
7993
94+ ## System Tool Auto-install Policy (CI Security)
95+
96+ When ` ARK_AUTO_INSTALL_SYSTEM_TOOLS=1 ` is set, ARK can attempt to install missing
97+ system tools required by engines. In CI/headless mode:
98+
99+ - installation is strictly non-interactive
100+ - ARK does not prompt for or persist sudo passwords
101+ - ARK uses root privileges when already running as root, otherwise ` sudo -n `
102+
103+ If auto-install fails in CI:
104+
105+ - run the pipeline as root, or
106+ - preinstall required system tools in the runner/base image, or
107+ - configure narrowly-scoped ` sudoers ` rules (NOPASSWD) for your CI user
108+
80109## Workspace Apply Options (CI-focused)
81110
82111` workspace apply ` (and alias ` workspace select ` ) supports options designed for pipelines:
@@ -200,6 +229,41 @@ If your team prefers a checked-in shell wrapper, create a script that chains:
200229
201230Then archive JSON outputs as CI artifacts for troubleshooting.
202231
232+ # # Final Summary Pattern
233+
234+ For readable CI logs, print a final status summary from generated JSON reports.
235+ This keeps one clear block with step-by-step ` OK` /` FAIL` states:
236+
237+ ` ` ` bash
238+ WORKSPACE_DIR=" /path/to/workspace"
239+ WORKSPACE_DIR=" $WORKSPACE_DIR " python3 - << 'PY '
240+ import json, os
241+ from pathlib import Path
242+
243+ ws = Path(os.environ["WORKSPACE_DIR"])
244+ reports = [
245+ ("workspace-apply", ws / ".ark_workspace_apply.json", lambda d: bool(d.get("ok"))),
246+ ("check", ws / ".ark_check.json", lambda d: bool(d.get("ok"))),
247+ ("engine-info", ws / ".ark_engine_info.json", lambda d: bool(d.get("found", True))),
248+ ("compile", ws / ".ark_build_result.json", lambda d: bool(d.get("success"))),
249+ ]
250+
251+ for name, path, ok_fn in reports:
252+ if not path.exists():
253+ print(f"[MISS] {name}: {path.name} not found")
254+ continue
255+ try:
256+ data = json.loads(path.read_text(encoding="utf-8"))
257+ except Exception as exc:
258+ print(f"[FAIL] {name}: invalid json ({exc})")
259+ continue
260+ ok = bool(ok_fn(data))
261+ detail = data.get("error") or data.get("message") or ""
262+ status = "OK" if ok else "FAIL"
263+ print(f"[{status}] {name}" + (f": {detail}" if detail else ""))
264+ PY
265+ ` ` `
266+
203267# # GitHub Actions Dogfooding Workflow
204268
205269This repository includes a workflow where ARK compiles itself using ARK CLI:
0 commit comments