mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-11 08:42:11 +00:00
fix(tui): correct --skip-build hint and add TUI workspace install test
- Update the --skip-build pre-build hint in the dashboard startup path to use `npm install --workspace web && npm run build -w web` so users don't accidentally trigger a desktop rebuild by following the hint. - Add test_tui_launch_install_uses_workspace_scope to assert that the TUI launch npm install carries --workspace ui-tui, covering the call site added in the prior commit.
This commit is contained in:
parent
0416f852f2
commit
4bf52022e5
2 changed files with 34 additions and 1 deletions
|
|
@ -12412,7 +12412,7 @@ def cmd_dashboard(args):
|
|||
)
|
||||
if not (_dist_root / "index.html").exists():
|
||||
print(f"✗ --skip-build was passed but no web dist found at: {_dist_root}")
|
||||
print(" Pre-build first: cd web && npm install && npm run build")
|
||||
print(" Pre-build first: npm install --workspace web && npm run build -w web")
|
||||
print(" Or drop --skip-build to build automatically.")
|
||||
sys.exit(1)
|
||||
print(f"→ Skipping web UI build (--skip-build); using dist at {_dist_root}")
|
||||
|
|
|
|||
|
|
@ -390,3 +390,36 @@ def test_no_stray_lockfiles_in_workspace_subdirs(main_mod) -> None:
|
|||
"delete them and run `npm install` from the repo root instead: "
|
||||
+ ", ".join(str(d / "package-lock.json") for d in stray)
|
||||
)
|
||||
|
||||
|
||||
def test_tui_launch_install_uses_workspace_scope(
|
||||
tmp_path: Path, main_mod, monkeypatch
|
||||
) -> None:
|
||||
"""TUI launch npm install must pass --workspace ui-tui to avoid pulling apps/desktop."""
|
||||
tui_dir = tmp_path / "ui-tui"
|
||||
tui_dir.mkdir()
|
||||
(tui_dir / "package.json").write_text("{}")
|
||||
(tui_dir / "dist" / "entry.js").parent.mkdir(parents=True)
|
||||
(tui_dir / "dist" / "entry.js").write_text("console.log('tui')")
|
||||
# workspace root: parent has lockfile, tui_dir does not
|
||||
(tmp_path / "package-lock.json").write_text("{}")
|
||||
|
||||
monkeypatch.setattr(main_mod, "_tui_need_npm_install", lambda _root: True)
|
||||
monkeypatch.setattr(main_mod, "_tui_need_rebuild", lambda _root: False)
|
||||
monkeypatch.setattr(main_mod.shutil, "which", lambda name: f"/usr/bin/{name}")
|
||||
|
||||
npm_calls = []
|
||||
|
||||
def fake_run(cmd, **kwargs):
|
||||
if cmd[0].endswith("npm"):
|
||||
npm_calls.append(cmd)
|
||||
return types.SimpleNamespace(returncode=0, stdout="", stderr="")
|
||||
|
||||
monkeypatch.setattr(main_mod.subprocess, "run", fake_run)
|
||||
|
||||
main_mod._make_tui_argv(tui_dir, tui_dev=False)
|
||||
|
||||
assert npm_calls, "expected npm install to be called"
|
||||
install_cmd = npm_calls[0]
|
||||
assert "--workspace" in install_cmd
|
||||
assert "ui-tui" in install_cmd
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue