Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(installer): surface npm build failures instead of reporting npm missing
ANO3457481f7337bf89
diff --git a/install/installer.py b/install/installer.pyindex e4656d0402..19464b869d 100644--- a/install/installer.py+++ b/install/installer.py@@ -757,20 +757,56 @@ def _build_ui_bundle(index: Path) -> bool:branch. It needs npm; without it the caller says so and stops."""npm = shutil.which("npm")+ if npm is None:+ note("no prebuilt UI found and Node.js/npm is not installed to build one")+ note(+ "release installs always ship the UI; a checkout of main needs "+ "`npm run build` in dodaios/ui/web/frontend"+ )+ return Falsefrontend = index.parent.parent / "frontend"- if npm is None or not (frontend / "package-lock.json").is_file():+ if not (frontend / "package-lock.json").is_file():+ note(+ "no prebuilt UI found and dodaios/ui/web/frontend/package-lock.json "+ "is missing"+ )return Falsefor args, label in ((["ci"], "installing the UI build tools (npm ci)"),(["run", "build"], "building the UI (npm run build)"),):+ cmd_name = f"npm {' '.join(args)}"try:result = run_captured([npm, *args], cwd=frontend, label=label, timeout=1800)- except (OSError, subprocess.TimeoutExpired):+ except (OSError, subprocess.TimeoutExpired) as exc:+ note(f"UI build command '{cmd_name}' failed: {rich_escape(str(exc))}")return Falseif result.returncode != 0:+ note(+ f"UI build command '{cmd_name}' failed with exit code "+ f"{result.returncode}"+ )+ combined = "\n".join(+ part.strip()+ for part in (+ getattr(result, "stdout", "") or "",+ getattr(result, "stderr", "") or "",+ )+ if part and part.strip()+ )+ output_tail = combined.splitlines()[-15:]+ if output_tail:+ note("npm output tail:")+ for line in output_tail:+ note(rich_escape(line))return False- return index.is_file()+ if not index.is_file():+ note(+ "UI build finished (npm run build exited 0) but build output is "+ "incomplete: dodaios/ui/web/dist/index.html was not produced"+ )+ return False+ return Truedef step_ui_bundle_check() -> bool:@@ -783,9 +819,6 @@ def step_ui_bundle_check() -> bool:dist = repo_root() / "dodaios" / "ui" / "web" / "dist"index = dist / "index.html"if not index.is_file() and not _build_ui_bundle(index):- note("no prebuilt UI found and Node.js/npm is not installed to build one")- note("release installs always ship the UI; a checkout of main needs "- "`npm run build` in dodaios/ui/web/frontend")return Falseimport rediff --git a/tests/unit/install/test_installer_update_contract.py b/tests/unit/install/test_installer_update_contract.pyindex ae906b141c..e429088f12 100644--- a/tests/unit/install/test_installer_update_contract.py+++ b/tests/unit/install/test_installer_update_contract.py@@ -172,12 +172,66 @@ def test_ui_bundle_check_builds_a_missing_bundle_with_npm(def test_ui_bundle_check_without_npm_reports_a_missing_bundle(- monkeypatch: pytest.MonkeyPatch, tmp_path: Path+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, capsys) -> None:monkeypatch.setattr(installer, "repo_root", lambda: tmp_path)monkeypatch.setattr(installer.shutil, "which", lambda name: None)assert installer.step_ui_bundle_check() is False+ out = capsys.readouterr().out+ assert "Node.js/npm is not installed" in out+++def test_ui_bundle_check_reports_npm_nonzero_exit_and_stderr_tail(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, capsys+) -> None:+ frontend = tmp_path / "dodaios" / "ui" / "web" / "frontend"+ frontend.mkdir(parents=True)+ (frontend / "package-lock.json").write_text("{}\n", encoding="utf-8")+ stderr_lines = "\n".join(f"npm-err-{idx}" for idx in range(20))++ def fake_build(cmd, *, label, cwd=None, timeout=None):+ if cmd[1:] == ["run", "build"]:+ return subprocess.CompletedProcess(+ cmd, 2, "vite build started\n", stderr_lines+ )+ return subprocess.CompletedProcess(cmd, 0, "", "")++ monkeypatch.setattr(installer, "repo_root", lambda: tmp_path)+ monkeypatch.setattr(installer.shutil, "which", lambda name: "npm")+ monkeypatch.setattr(installer, "run_captured", fake_build)++ assert installer.step_ui_bundle_check() is False+ out = capsys.readouterr().out+ assert "Node.js/npm is not installed" not in out+ assert "npm run build" in out+ assert "exit code 2" in out+ assert "npm-err-19" in out+ assert "npm-err-0" not in out+++def test_ui_bundle_check_reports_incomplete_build_output_when_index_missing(+ monkeypatch: pytest.MonkeyPatch, tmp_path: Path, capsys+) -> None:+ frontend = tmp_path / "dodaios" / "ui" / "web" / "frontend"+ frontend.mkdir(parents=True)+ (frontend / "package-lock.json").write_text("{}\n", encoding="utf-8")++ monkeypatch.setattr(installer, "repo_root", lambda: tmp_path)+ monkeypatch.setattr(installer.shutil, "which", lambda name: "npm")+ monkeypatch.setattr(+ installer,+ "run_captured",+ lambda cmd, *, label, cwd=None, timeout=None: subprocess.CompletedProcess(+ cmd, 0, "", ""+ ),+ )++ assert installer.step_ui_bundle_check() is False+ out = capsys.readouterr().out+ assert "Node.js/npm is not installed" not in out+ assert "build output is incomplete" in out+ assert "index.html" in outdef test_desktop_registration_failure_is_install_failure(