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(clis): Install installs the CLI instead of opening a GitHub page
rubenluetke10-beep0d9d564e1231
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex eddd7fd850..d045e2fd69 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -381,6 +381,13 @@ jobs:# CLI dynamic layer + Command Registry gate it. Mirrors pre-push.run: python scripts/ci/check_danger_metadata.py+ - name: CLI install gate (Install installs, never opens a web page)+ # Static + stdlib-only: a seed CLI with no package manager makes the+ # Install button open the vendor's docs instead of installing, which+ # reads as a broken button. Also catches a `recommended` that names a+ # method the entry never declared.+ run: python scripts/ci/check_cli_install_methods.py+- name: Dead config switch gate (every switch is read by some code)# Static + stdlib-only: a config field nothing reads makes jarvis.toml# and the settings screen promise behaviour that does not exist (AP-31).diff --git a/docs/BUGS.md b/docs/BUGS.mdindex c282505adb..5b00cd5784 100644--- a/docs/BUGS.md+++ b/docs/BUGS.md@@ -14625,3 +14625,66 @@ and the `since` clock.**Related.** BUG-205 (the other half of this audit — two surfaces disagreeingabout one machine) and BUG-206 (the accelerator probe).++---++## BUG-208: pressing Install on a CLI opened a GitHub page instead of installing it (HIGH, FIXED 2026-08-28)++**Symptom.** In the CLI & Desktop apps section, "Google Workspace CLI (GAM)"+showed as not installed. Pressing **Install** opened the GAM GitHub wiki in a+browser tab and installed nothing. The Google Workspace CLI was in fact already+installed on the machine and working.++**Cause.** Three faults stacked into one broken button.++* The entry described **GAM**, an admin tool for a whole Workspace domain, and+ probed the binary `gam`. Everything else in the project — the+ `google-workspace` skill, `workflows_routes._integration_status` — drives+ `gws` (`@googleworkspace/cli`). The section was therefore probing a CLI the+ app never uses, so an installed Google Workspace CLI reported "not installed"+ forever.+* The entry declared **no install method at all**: `winget_id`,+ `scoop_package`, `npm_package`, `pip_package`, `cargo_package` and+ `script_url` were all `null`, leaving only `manual_url`.+* `cli_routes._install_methods_of` answers that case by inventing a+ pseudo-method named `manual` whose "command" is the documentation URL. The+ Install button renders from that list, so it appeared, and pressing it opened+ a web page. `jarvisctl` was in the same state.++**Fix.**++* The catalog entry is now `gws` — npm package `@googleworkspace/cli`, binary+ `gws`, `gws auth login` / `logout` / `status`, and risk patterns written for+ its `gws <service> <resource> <method>` grammar. `jarvisctl` installs from+ PyPI (`personal-jarvis`). Every rename target that had its own anti-drift+ guard moved with it: `CLI_VENDORS` in `CliLogo.tsx`, `LOGOS.md`,+ `PLUGIN_CLI_OVERLAP`, and the starter prompts in all three locales.+* New parse strategy `json_token_valid`: `gws auth status` prints a full+ credential block with `"token_valid": false` when the refresh call fails, so+ "a credential file exists" is not the same as "connected". Stored credentials+ plus a dead token now report `expired` (rendered as disconnected, with the+ Connect button), which is exactly the state this machine was in.+* `scripts/ci/check_cli_install_methods.py` fails the build on any seed entry+ with no runnable install method, and on a `recommended` naming a method the+ entry never declared. It would have caught both entries.+* Install no longer stops at "the binary exists". The spawned terminal runs the+ install, refreshes PATH in that same shell, then continues into the CLI's+ login command, stopping at the first failure. Without the PATH step,+ `gcloud auth login` right after `winget install` fails with "command not+ found" one second after a successful install.+* That terminal spawn was Windows-only (P-41): macOS now goes through+ `osascript` to Terminal.app, Linux through the first of seven emulators+ present. A machine with no screen falls back to the in-app streaming install+ job instead of dead-ending.+* Side fix in the same file: `DisconnectResponse` never declared the `error`+ field that three call sites pass, so Pydantic dropped every disconnect reason+ during validation and the UI could only ever show its generic failure toast.++**Guard.** `tests/unit/clis/test_install_path.py` (every seed CLI declares a+runnable method; `recommended` is one of them; the Google entry is `gws`; a+dead token reads `expired`; the chain stops at the first failure and carries no+`&&` on Windows), plus the CI gate above.++**Related.** AP-23 (assume an arbitrary downloader, never the maintainer) — the+manual fallback was invisible on a box where the CLI happened to be installed+already.diff --git a/docs/os-parity.md b/docs/os-parity.mdindex 98a2a89daa..9c015b3748 100644--- a/docs/os-parity.md+++ b/docs/os-parity.md@@ -291,6 +291,7 @@ shortcuts it never created. Covered by| P-38 | Medium | Native installer / desktop window | The Linux AppImage and `.deb` have **no native desktop window**. Windows (WebView2) and macOS (WKWebView) get one from the frozen bundle; Linux does not, because pywebview's GTK backend needs PyGObject and a frozen interpreter can never import the distribution's `python3-gi` (it is compiled against the system CPython), while bundling GTK 3 + WebKit2GTK portably means shipping its helper processes, GIO modules, pixbuf loaders, GSettings schemas and typelibs. The Qt route is also closed today: the `[desktop]` extra installs `pyside6-essentials`, which has no QtWebEngine, and `jarvis.spec` excludes PySide6 outright. Adding `pyside6-addons` and dropping that exclusion is the realistic fix, at roughly +400 MB | `packaging/linux/README.md` ("The window question"), `jarvis/ui/desktop_app.py::_degrade_to_browser_ui`, `jarvis.spec` `excludes`, `pyproject.toml` `[desktop]` | Linux: honest degradation, verified against a real build — the app catches pywebview's `WebViewException`, keeps the backend serving, and `AppRun` waits for `/api/health` and opens the interface with `xdg-open`. Everything except the window frame works, including the whole CLI. A source/pipx install on a Linux desktop with `python3-gi` + `gir1.2-webkit2-4.1` still gets the native window; only the frozen build does not. Sub-gap: the app's fallback message advises installing those system packages, which does not help a frozen build || P-39 | Medium | Dictation hold-key watchdog | A HOLD-started dictation is owed a release edge, and that edge can be lost between the OS hotkey listener and the pipeline (a checker restart mid-hold, a re-arm, a handler that raised). The recording then ran to its 30-minute cap with the bar's X dead and every key press refused (BUG-191). The repair asks the keyboard instead of trusting edges: `HotkeyBackend.chord_is_down(combo)` is a three-way capability — `True`/`False` when the backend can see the keyboard, `None` when it cannot — and the recording finishes itself once the chord has read "up" for one second. The three OS backends can see different amounts: Windows reads `GetAsyncKeyState` (ground truth, the poller's own source); macOS answers from the event tap's held-set, whose modifier half is re-synced from every event's flags word; Linux/X11 answers from pynput's held-set, which is edge-fed like the matcher itself | `jarvis/trigger/backends/__init__.py::HotkeyBackend.chord_is_down`, `backends/global_hotkeys.py::chord_is_down`, `backends/quartz.py::chord_is_down`, `backends/pynput.py::chord_is_down`, `backends/noop.py`, `jarvis/speech/pipeline.py::_watch_dictation_hold_key`, `tests/contract/test_hotkey_backend_protocol.py` | Windows: the watchdog sees the physical key and ends a lost-release recording within ~1 s. macOS / Linux-X11: the watchdog runs on the listener's own bookkeeping — it catches a release the pipeline missed, not one the listener itself missed. Wayland / no listener: the backend answers `None`, the watchdog stands down, and the other stop gestures carry alone — the key (a press during a running dictation is its stop), the bar's X, the Dictation view, `jarvis api dictation stop`. On no host does `None` ever read as "up": a phantom release is the one failure this must never produce || P-40 | Low | JarvisBar | The Prompt Mode switch (`[dictation].prompt_mode`, every dictation comes out as a written prompt) is a control on the native bar since 2026-08-28: a sparkle in the resting pill's left slot, drawn ONLY while the SETTING is on (visible without a hover — the pill opens as it does for mute). A click PAUSES the rewriting rather than changing the setting: the mark goes red with a slash through it, jarvis.toml is untouched, and the same click brings it back. The pause is runtime-only and clears on restart or on any write of the setting. With the setting off nothing is drawn there and the spot starts a session as before. The glyph mirrors the mic's inset rather than the close-X's, which is left untouched on a live bar. The switch has ONE writer (`jarvis/dictation/prompt_mode_switch.py`) and one broadcast (`DictationPromptModeChanged`) that the bar, the front-page pill and the settings card all redraw from | `jarvis/ui/jarvisbar/renderer.py::_draw_sparkle`, `interaction.py::resolve_click` (`prompt_mode_toggle`), `overlay.py` / `qt_overlay.py` / `subprocess_overlay.py` (`set_prompt_mode`, `set_on_prompt_mode_toggle`), `host.py` (op `set_prompt_mode`, event `prompt_mode_toggle`), `ui/orb/bus_bridge.py` | Windows/Linux (Tk bar, in-process) and macOS (Qt bar in the companion host, over the existing IPC protocol): the same sparkle, the same click, the same event. Headless / `orb_style = none`: the NullOverlay accepts both methods as no-ops; the pill on the front page and the settings card remain the switch. Guards: `tests/unit/ui/jarvisbar/test_prompt_mode_button.py`, `test_prompt_mode_bridge.py`, `test_surface_contract.py`, `test_host_protocol.py` |+| P-41 | Low | CLI install / connect terminal | Pressing **Install** or **Connect** in the CLI section opens a REAL terminal window and runs the command there, because an interactive OAuth login belongs in a shell the user can see and type into. That spawn was Windows-only until 2026-08-28 (`wt` -> `pwsh` -> `powershell`), so on macOS and Linux the two buttons reported "No external terminal available" and no CLI could be installed from the app at all. macOS now goes through `osascript` to Terminal.app, Linux through the first of seven emulators that exists (Debian's `x-terminal-emulator` alternative first, so the user's own default wins), and the window is held open afterwards the way `-NoExit` holds it on Windows. One install click now carries all the way to signed in: the terminal runs the install, refreshes PATH in that same shell, and continues into the CLI's login command, stopping at the first step that fails. The chain operator differs per OS on purpose — Windows PowerShell 5.1 is a possible fallback shell and `&&` is a parser error there, so the Windows spelling nests `if ($?)` instead | `jarvis/clis/external_terminal.py` (`_spawn_windows`, `_spawn_macos`, `_spawn_linux`, `chain_commands`, `path_refresh_command`), `jarvis/ui/web/cli_routes.py::spawn_external`, `tests/unit/clis/test_install_path.py` | Windows: verified live (wt path, composed install+login command). macOS/Linux: same code path, the branch itself unverified from this machine. A box with no screen has no window to open, so there the endpoint falls back to the in-app streaming install job and the UI says so instead of claiming a terminal appeared — a headless server can still install a CLI, it just cannot run an interactive login |## Maintenancediff --git a/jarvis/clis/capability_provider.py b/jarvis/clis/capability_provider.pyindex 790f173df4..2fad595426 100644--- a/jarvis/clis/capability_provider.py+++ b/jarvis/clis/capability_provider.py@@ -182,7 +182,7 @@ PLUGIN_CLI_OVERLAP: dict[str, str] = {"vercel": "vercel","supabase": "supabase","stripe": "stripe",- "gmail": "gam",+ "gmail": "gws",}diff --git a/jarvis/clis/catalog/seed_catalog.json b/jarvis/clis/catalog/seed_catalog.jsonindex af5d7ddbef..866340fe2b 100644--- a/jarvis/clis/catalog/seed_catalog.json+++ b/jarvis/clis/catalog/seed_catalog.json@@ -1937,66 +1937,78 @@]},{- "name": "gam",- "display_name": "Google Workspace CLI (GAM)",- "description": "Google Workspace CLI: Calendar events, Gmail messages, Drive, Users.",- "homepage": "https://github.com/GAM-team/GAM",- "binary_name": "gam",+ "name": "gws",+ "display_name": "Google Workspace CLI",+ "description": "Google Workspace: Gmail, Drive, Docs, Sheets, Calendar, Tasks, Chat, Slides.",+ "homepage": "https://github.com/googleworkspace/cli",+ "binary_name": "gws","check_command": [- "gam",- "version"+ "gws",+ "--version"],- "version_parse_regex": "GAM (\\S+)",+ "version_parse_regex": "gws (\\S+)","install": {"winget_id": null,"scoop_package": null,- "npm_package": null,+ "npm_package": "@googleworkspace/cli","pip_package": null,"cargo_package": null,"script_url": null,- "manual_url": "https://github.com/GAM-team/GAM/wiki",- "recommended": null+ "manual_url": "https://github.com/googleworkspace/cli#installation",+ "recommended": "npm"},"auth": {"type": "oauth_cli","login_command": [- "gam",- "oauth",- "create"+ "gws",+ "auth",+ "login"],"logout_command": [- "gam",- "oauth",- "delete"+ "gws",+ "auth",+ "logout"],"status_command": [- "gam",- "oauth",- "info"+ "gws",+ "auth",+ "status"],- "status_parse": "text_contains_email",+ "status_parse": "json_token_valid","secret_keys": [],"env_vars": []},"risk": {"default_tier": "monitor","blacklist_patterns": [- "gam * delete *",- "gam * remove *",- "gam update user * password *"+ "gws * delete*",+ "gws * * delete*",+ "gws * * * delete*",+ "gws * trash*",+ "gws * * trash*",+ "gws gmail * send*",+ "gws gmail * * send*",+ "gws chat * create*",+ "gws chat * * create*",+ "gws auth export*",+ "gws auth logout*"],"whitelist_patterns": [- "gam calendar * print *",- "gam calendar * show *",- "gam user * print *",- "gam user * show *",- "gam oauth info*",- "gam version*"+ "gws * list*",+ "gws * * list*",+ "gws * * * list*",+ "gws * get*",+ "gws * * get*",+ "gws * * * get*",+ "gws schema *",+ "gws auth status*",+ "gws --version*"]},"tool_schema_examples": [- "gam calendar <primary-email> printevents after today before tomorrow",- "gam user <primary-email> print messages query \"is:unread\" maxmessages 10"+ "gws gmail users messages list --params '{\"userId\": \"me\", \"q\": \"is:unread\", \"maxResults\": 10}'",+ "gws calendar events list --params '{\"calendarId\": \"primary\", \"maxResults\": 10}'",+ "gws drive files list --params '{\"pageSize\": 10}'"],"icon": "google","category": "workspace",@@ -2047,6 +2059,35 @@"postfach"],"description": "Google Workspace Gmail: list and read messages."+ },+ {+ "domains": [+ "storage"+ ],+ "verbs": [+ "zeig",+ "zeige",+ "such",+ "suche",+ "find",+ "list",+ "show",+ "search"+ ],+ "objects": [+ "datei",+ "dateien",+ "drive",+ "dokument",+ "dokumente",+ "file",+ "files",+ "document",+ "documents",+ "spreadsheet",+ "tabelle"+ ],+ "description": "Google Drive, Docs and Sheets: list, search and read files."}]},@@ -2065,11 +2106,11 @@"winget_id": null,"scoop_package": null,"npm_package": null,- "pip_package": null,+ "pip_package": "personal-jarvis","cargo_package": null,"script_url": null,"manual_url": "https://github.com/PersonalJarvis/PersonalJarvis",- "recommended": "manual"+ "recommended": "pip"},"auth": {"type": "none"diff --git a/jarvis/clis/external_terminal.py b/jarvis/clis/external_terminal.pyindex f58a9c8d9c..a953571207 100644--- a/jarvis/clis/external_terminal.py+++ b/jarvis/clis/external_terminal.py@@ -1,73 +1,131 @@-"""External terminal spawn: opens a real Windows Terminal (wt) or-PowerShell window detached from the app process.+"""External terminal spawn: opens a real terminal window, detached from the app.Background: The embedded xterm.js + ConPTY in the desktop app is finefor short commands but has UX limitations for interactive OAuth logins:- Browser login redirects often land in the background-- The terminal is tied to the app section (user switches section → it disappears)+- The terminal is tied to the app section (user switches section -> it disappears)- No familiar "real terminal" look for the user-Solution: For install + connect we spawn an **external** terminal window-using ``Windows Terminal`` (``wt.exe``) as the preferred option, with a-fallback to ``pwsh.exe`` and finally ``powershell.exe``. The CLI command is-passed directly via ``-Command``; the terminal stays open with ``-NoExit``-so the user can see output and enter follow-up commands.+Solution: For install + connect we spawn an **external** terminal window and+keep it open after the command finishes, so the user can read the output and+type follow-up commands.-cwd default = user home (``%USERPROFILE%``), NOT the project directory —-the user wants a "neutral" terminal, not a "Personal-Jarvis" terminal.+Each OS spells "open a terminal and run this" differently and no spelling+survives a move to another OS, so the platform picks the branch:++- Windows: Windows Terminal (``wt.exe``), else ``pwsh.exe``, else ``powershell.exe``+- macOS: ``Terminal.app`` via ``osascript``+- Linux: the first of ``x-terminal-emulator``, ``gnome-terminal``, ``konsole``,+ ``xfce4-terminal``, ``kitty``, ``alacritty``, ``xterm`` that exists++A headless box has no terminal to open at all. That is not a failure to hide:+the caller falls back to the in-app install job, which streams its output into+the UI instead. ``no_display`` says so explicitly, so the caller can tell+"nothing installed" apart from "installed somewhere you cannot see".++cwd default = user home, NOT the project directory - the user wants a+"neutral" terminal, not a "Personal-Jarvis" terminal."""from __future__ import annotationsimport loggingimport os+import shleximport shutilimport subprocess+import sysfrom pathlib import Pathlog = logging.getLogger(__name__)+# Terminal emulators that accept ``-e <argv...>``, in the order we try them.+# ``x-terminal-emulator`` is the Debian alternatives symlink and therefore the+# user's own default; it goes first for that reason, not because it is common.+_LINUX_TERMINALS: tuple[str, ...] = (+ "x-terminal-emulator",+ "gnome-terminal",+ "konsole",+ "xfce4-terminal",+ "kitty",+ "alacritty",+ "xterm",+)-def spawn_external_terminal(- command: str,- *,- cwd: Path | None = None,- title: str | None = None,-) -> tuple[bool, str]:- """Open an external terminal window and execute ``command`` inside it.- Args:- command: The full PowerShell command (e.g. ``"firebase login"``).- Passed to pwsh/powershell via ``-Command``.- cwd: Working directory for the new terminal. ``None`` → user home.- title: Optional tab title (only relevant for the ``wt`` path).+def _has_display() -> bool:+ """Whether this Linux box can show a window at all.- Returns:- ``(ok, used_method)`` — used_method is one of "wt", "pwsh", "powershell",- or "failed". ok=True on success.+ A container or an SSH session without X11 forwarding has neither variable+ set. Spawning a terminal there does not fail loudly - ``xterm`` exits with a+ "cannot open display" on stderr that nobody reads, and the app would report+ a successful install that never ran.+ """+ return bool(os.environ.get("DISPLAY") or os.environ.get("WAYLAND_DISPLAY"))- Behavior:- - The spawned terminal lives independently of the app process (detached).- - ``-NoExit`` ensures the window stays open after the command finishes.- - If no terminal is available: returns False with the reason logged.++def _posix_keep_open(command: str) -> list[str]:+ """``sh -c`` payload that runs ``command`` and then hands over an interactive shell.++ The trailing ``exec`` is what ``-NoExit`` does on Windows: the window stays+ up with the output still on screen. ``|| true`` keeps a failed install from+ closing the window before the error can be read - the exit status is+ printed instead."""- workdir = Path(cwd) if cwd else Path(os.environ.get("USERPROFILE", str(Path.home())))- workdir_str = str(workdir)+ return ["sh", "-c", f'{command}; echo; echo "[exit $?]"; exec ${{SHELL:-sh}} -i']++++def path_refresh_command() -> str:+ """Shell snippet that makes a just-installed binary findable in THIS shell.++ A package manager writes the new binary's directory into the persisted PATH,+ which every shell started afterwards inherits - but not the one that is+ running the install. Without this line, chaining ``gcloud auth login`` onto+ ``winget install gcloud`` fails with "command not found" one second after a+ successful install, which reads as a broken installer rather than a stale+ environment.+ """+ if sys.platform == "win32":+ return (+ "$env:Path = "+ "[Environment]::GetEnvironmentVariable('Path','Machine') + ';' + "+ "[Environment]::GetEnvironmentVariable('Path','User')"+ )+ # POSIX shells cache resolved command paths; the PATH itself is inherited+ # from the login shell and a global install lands in a directory already on+ # it, so only the cache has to go.+ return "hash -r"+- # 1) Windows Terminal (wt) — preferred, because of modern UX + tabs.+def chain_commands(parts: list[str]) -> str:+ """Join commands so each one runs only if the previous one succeeded.++ The spelling is not portable and there is no single one that works+ everywhere: ``&&`` is a parser error in Windows PowerShell 5.1, which is the+ last fallback when neither Windows Terminal nor pwsh is installed, so the+ Windows branch nests explicit ``$?`` tests instead.+ """+ parts = [p for p in parts if p]+ if not parts:+ return ""+ if len(parts) == 1:+ return parts[0]+ if sys.platform == "win32":+ head, *rest = parts+ return f"{head}; if ($?) {{ {chain_commands(rest)} }}"+ return " && ".join(parts)+++def _spawn_windows(command: str, workdir: str, title: str | None) -> tuple[bool, str]:+ # 1) Windows Terminal (wt) - preferred, because of modern UX + tabs.wt = shutil.which("wt")if wt:- argv: list[str] = [- wt,- "new-tab",- "--startingDirectory", workdir_str,- ]+ argv: list[str] = [wt, "new-tab", "--startingDirectory", workdir]if title:argv += ["--title", title]argv += ["pwsh.exe" if shutil.which("pwsh") else "powershell.exe",- "-NoExit",- "-NoLogo",- "-Command", command,+ "-NoExit", "-NoLogo", "-Command", command,]try:subprocess.Popen( # noqa: S603@@ -75,49 +133,130 @@ def spawn_external_terminal(creationflags=getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0),close_fds=True,)- log.info("external terminal via wt: %s (cwd=%s)", command, workdir_str)+ log.info("external terminal via wt: %s (cwd=%s)", command, workdir)return True, "wt"except Exception as exc: # noqa: BLE001log.warning("wt spawn failed, falling back to pwsh: %s", exc)- # 2) pwsh.exe as a standalone window.- pwsh = shutil.which("pwsh")- if pwsh:+ # 2) pwsh.exe / powershell.exe as a standalone window.+ for exe_name in ("pwsh", "powershell"):+ exe = shutil.which(exe_name)+ if not exe:+ continuetry:subprocess.Popen( # noqa: S603- [pwsh, "-NoExit", "-NoLogo", "-Command", command],- cwd=workdir_str,+ [exe, "-NoExit", "-NoLogo", "-Command", command],+ cwd=workdir,creationflags=(getattr(subprocess, "CREATE_NEW_CONSOLE", 0)| getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0)),close_fds=True,)- log.info("external terminal via pwsh: %s (cwd=%s)", command, workdir_str)- return True, "pwsh"+ log.info("external terminal via %s: %s (cwd=%s)", exe_name, command, workdir)+ return True, exe_nameexcept Exception as exc: # noqa: BLE001- log.warning("pwsh spawn failed, falling back to powershell: %s", exc)+ log.warning("%s spawn failed: %s", exe_name, exc)++ log.error("No external terminal available (wt/pwsh/powershell all not found)")+ return False, "failed"- # 3) powershell.exe (Windows default).- ps = shutil.which("powershell")- if ps:++def _spawn_macos(command: str, workdir: str, title: str | None) -> tuple[bool, str]:+ """Terminal.app via AppleScript.++ ``do script`` takes ONE AppleScript string literal, so the shell line is+ embedded in it and both the backslash and the double quote have to survive+ two levels of quoting - AppleScript's, then the shell's inside it. Getting+ that wrong does not raise; it silently runs a truncated command.+ """+ del title # Terminal.app names its window after the running command.+ shell_line = f"cd {shlex.quote(workdir)} && {command}"+ applescript_literal = shell_line.replace("\\", "\\\\").replace('"', '\\"')+ script = (+ f'tell application "Terminal"\n'+ f' activate\n'+ f' do script "{applescript_literal}"\n'+ f"end tell"+ )+ try:+ subprocess.Popen( # noqa: S603+ ["osascript", "-e", script],+ close_fds=True,+ start_new_session=True,+ )+ log.info("external terminal via Terminal.app: %s (cwd=%s)", command, workdir)+ return True, "terminal.app"+ except Exception as exc: # noqa: BLE001+ log.error("osascript spawn failed: %s", exc)+ return False, "failed"+++def _spawn_linux(command: str, workdir: str, title: str | None) -> tuple[bool, str]:+ if not _has_display():+ log.info("no DISPLAY/WAYLAND_DISPLAY - cannot open a terminal window")+ return False, "no_display"++ payload = _posix_keep_open(command)+ for name in _LINUX_TERMINALS:+ exe = shutil.which(name)+ if not exe:+ continue+ argv = [exe]+ if title and name in ("gnome-terminal", "konsole", "xfce4-terminal", "xterm"):+ argv += ["--title" if name != "xterm" else "-T", title]+ # gnome-terminal deprecated ``-e`` and parses ``--`` as "everything+ # after this is the argv"; the others still want ``-e``.+ argv += ["--"] if name == "gnome-terminal" else ["-e"]+ argv += payloadtry:subprocess.Popen( # noqa: S603- [ps, "-NoExit", "-NoLogo", "-Command", command],- cwd=workdir_str,- creationflags=(- getattr(subprocess, "CREATE_NEW_CONSOLE", 0)- | getattr(subprocess, "CREATE_NEW_PROCESS_GROUP", 0)- ),+ argv,+ cwd=workdir,close_fds=True,+ start_new_session=True,)- log.info("external terminal via powershell: %s (cwd=%s)", command, workdir_str)- return True, "powershell"+ log.info("external terminal via %s: %s (cwd=%s)", name, command, workdir)+ return True, nameexcept Exception as exc: # noqa: BLE001- log.warning("powershell spawn failed: %s", exc)+ log.warning("%s spawn failed, trying the next terminal: %s", name, exc)- log.error("No external terminal available (wt/pwsh/powershell all not found)")+ log.error("No external terminal available (tried: %s)", ", ".join(_LINUX_TERMINALS))return False, "failed"-__all__ = ["spawn_external_terminal"]+def spawn_external_terminal(+ command: str,+ *,+ cwd: Path | None = None,+ title: str | None = None,+) -> tuple[bool, str]:+ """Open an external terminal window and execute ``command`` inside it.++ Args:+ command: The full shell command (e.g. ``"firebase login"``).+ cwd: Working directory for the new terminal. ``None`` -> user home.+ title: Optional window/tab title, where the terminal supports one.++ Returns:+ ``(ok, used_method)``. ``used_method`` names the terminal that opened it+ ("wt", "pwsh", "powershell", "terminal.app", "gnome-terminal", ...), or+ ``"no_display"`` when the box has no screen, or ``"failed"`` when no+ terminal emulator is installed. ok=True on success.++ Behavior:+ - The spawned terminal lives independently of the app process (detached).+ - The window stays open after the command finishes, so its output can+ be read and follow-up commands typed.+ """+ workdir = Path(cwd) if cwd else Path(os.environ.get("USERPROFILE") or Path.home())+ workdir_str = str(workdir)++ if sys.platform == "win32":+ return _spawn_windows(command, workdir_str, title)+ if sys.platform == "darwin":+ return _spawn_macos(command, workdir_str, title)+ return _spawn_linux(command, workdir_str, title)+++__all__ = ["chain_commands", "path_refresh_command", "spawn_external_terminal"]diff --git a/jarvis/clis/prober.py b/jarvis/clis/prober.pyindex 0dcf4af1b5..1f349b6640 100644--- a/jarvis/clis/prober.py+++ b/jarvis/clis/prober.py@@ -285,6 +285,33 @@ def _apply_parse_strategy(return "connected"return "not_connected"+ if strategy == "json_token_valid":+ # For a CLI that reports its OAuth state as a JSON object with an+ # explicit validity flag (gws). Stored credentials and a *working*+ # token are two different things: `gws auth status` happily prints a+ # full credential block with ``"token_valid": false`` when the refresh+ # call fails. Treating "a credential file exists" as connected is how a+ # CLI ends up green in the UI and broken on first use — so a dead token+ # over stored credentials reports ``expired``, which the UI renders as+ # disconnected and offers Connect for.+ try:+ data = json.loads(stdout or "null")+ except json.JSONDecodeError:+ # Output we cannot read is not evidence either way, and "unknown"+ # is the return value that says exactly that — the caller renders+ # it, so nothing is being swallowed here.+ return "unknown"+ if not isinstance(data, dict):+ return "unknown"+ if data.get("token_valid") is True:+ return "connected"+ has_credentials = any(+ data.get(key)+ for key in ("has_refresh_token", "encrypted_credentials_exists",+ "plain_credentials_exists", "token_cache_exists")+ )+ return "expired" if has_credentials else "not_connected"+if strategy == "text_contains_email":pattern = r"[\w.+-]+@[\w-]+\.[\w.-]+"if re.search(pattern, stdout):diff --git a/jarvis/clis/spec.py b/jarvis/clis/spec.pyindex d3430de8e5..6715ba76c2 100644--- a/jarvis/clis/spec.py+++ b/jarvis/clis/spec.py@@ -26,6 +26,7 @@ StatusParseStrategy = Literal["json_array_nonempty","json_array_nonempty_or_error","json_has_field_username",+ "json_token_valid","text_contains_email","text_contains_username","text_contains_logged_in",@@ -54,15 +55,33 @@ class InstallMethods:def available_methods(self) -> tuple[str, ...]:out: list[str] = []- if self.winget_id: out.append("winget")- if self.scoop_package: out.append("scoop")- if self.npm_package: out.append("npm")- if self.pip_package: out.append("pip")- if self.cargo_package: out.append("cargo")- if self.script_url: out.append("script")- if self.manual_url and not out: out.append("manual")+ if self.winget_id:+ out.append("winget")+ if self.scoop_package:+ out.append("scoop")+ if self.npm_package:+ out.append("npm")+ if self.pip_package:+ out.append("pip")+ if self.cargo_package:+ out.append("cargo")+ if self.script_url:+ out.append("script")+ if self.manual_url and not out:+ out.append("manual")return tuple(out)+ def has_automatic_method(self) -> bool:+ """True when Install can actually run something instead of opening a page.++ ``manual`` is not an install method — it is the absence of one, dressed+ up as a link to somebody else's documentation. A catalog entry that only+ offers it turns the Install button into a browser redirect, which reads+ as a broken button. ``scripts/ci/check_cli_install_methods.py`` gates the+ seed catalog on this.+ """+ return any(m != "manual" for m in self.available_methods())+@dataclass(frozen=True, slots=True)class AuthConfig:diff --git a/jarvis/ui/web/cli_routes.py b/jarvis/ui/web/cli_routes.pyindex cde30125d8..78a96dc058 100644--- a/jarvis/ui/web/cli_routes.py+++ b/jarvis/ui/web/cli_routes.py@@ -170,14 +170,20 @@ class ConnectResponse(BaseModel):class DisconnectResponse(BaseModel):ok: bool+ # Three call sites below pass a reason for a failed disconnect and the UI+ # renders it. Without the field declared, Pydantic drops it during+ # validation without a word, and every failure reads as the same generic+ # "disconnect failed" toast.+ error: str | None = Noneclass SpawnExternalRequest(BaseModel):- """Request to /spawn-external — opens a **real** Windows terminal- (wt/pwsh) and runs either the install or the login command for the- given CLI in it. Unlike the embedded xterm in the frontend, the- terminal runs as a detached subprocess in the user session- (cwd = USERPROFILE), separate from the Jarvis app.+ """Request to /spawn-external — opens a **real** terminal window and runs+ either the install or the login command for the given CLI in it.++ Unlike the embedded xterm in the frontend, the terminal runs as a detached+ subprocess in the user session (cwd = home), separate from the Jarvis app.+ Which terminal that is depends on the OS; ``external_terminal`` decides."""kind: Literal["install", "login"]@@ -186,9 +192,12 @@ class SpawnExternalRequest(BaseModel):class SpawnExternalResponse(BaseModel):ok: bool- method: str = "failed" # "wt" | "pwsh" | "powershell" | "failed"+ # The terminal that opened it ("wt", "pwsh", "terminal.app",+ # "gnome-terminal", ...), "in-app" when the box has no screen and the+ # install streams into the UI instead, or "failed".+ method: str = "failed"command: str | None = None- error: str | None = None+ job_id: str | None = Noneerror: str | None = None@@ -529,16 +538,27 @@ async def spawn_external(request: Request,body: SpawnExternalRequest,) -> SpawnExternalResponse:- """Spawns an external Windows terminal (wt/pwsh) and runs either the- install or the login command in it.+ """Opens a real terminal window and runs the install or the login command.++ Install does not stop at "the binary exists". For a CLI that logs in+ interactively, the terminal continues straight into its login command, so+ one click carries the user from nothing installed to signed in — the part+ only they can do (approving the browser prompt) is the only part left. The+ PATH refresh between the two steps is not optional: the shell that ran the+ install still has the environment it started with, so the binary it just+ installed is not yet findable in it.Unlike POST /install (which runs its own asyncio subprocess pipeline- + streams output to the UI), this endpoint is pure spawn-and-forget- logic: we open a real terminal window (as the user expects when they- type ``wt`` themselves) and let the user interact there. Status- polling runs separately via /check.+ + streams output to the UI), this endpoint is spawn-and-forget: the user+ interacts in the terminal. Status polling runs separately via /check.+ A machine with no screen has no terminal to open, so there the install+ falls back to the streaming job and the response says so."""- from jarvis.clis.external_terminal import spawn_external_terminal+ from jarvis.clis.external_terminal import (+ chain_commands,+ path_refresh_command,+ spawn_external_terminal,+ )reg = _require_registry(request)spec = reg.catalog().get(name)@@ -558,7 +578,10 @@ async def spawn_external(ok=False,error=f"No install method '{body.method}' for {name}",)- command = " ".join(cmd_argv)+ steps = [" ".join(cmd_argv)]+ if spec.auth.type == "oauth_cli" and spec.auth.login_command:+ steps += [path_refresh_command(), " ".join(spec.auth.login_command)]+ command = chain_commands(steps)title = f"Install: {spec.display_name}"else: # kind == "login"if spec.auth.type != "oauth_cli" or not spec.auth.login_command:@@ -570,24 +593,34 @@ async def spawn_external(title = f"Login: {spec.display_name}"ok, method = spawn_external_terminal(command, cwd=None, title=title)- return SpawnExternalResponse(- ok=ok,- method=method,- command=command if ok else None,- error=None if ok else "No external terminal available (wt/pwsh/powershell)",+ if ok:+ return SpawnExternalResponse(ok=True, method=method, command=command)++ if body.kind == "install" and body.method:+ job = _start_install_job(reg, spec, name, body.method)+ if job is not None:+ return SpawnExternalResponse(+ ok=True,+ method="in-app",+ command=" ".join(job.command),+ job_id=job.job_id,+ )++ reason = (+ "This machine has no screen, so no terminal window can be opened."+ if method == "no_display"+ else "No terminal emulator found on this machine.")+ return SpawnExternalResponse(ok=False, method=method, error=reason)[email protected]("/{name}/install", response_model=InstallStartResponse)-async def install_cli(- name: str,- request: Request,- body: InstallRequest,-) -> InstallStartResponse:- reg = _require_registry(request)- spec = reg.catalog().get(name)- if spec is None:- raise HTTPException(status_code=404, detail=f"CLI '{name}' not in catalog")+def _start_install_job(reg: Any, spec: CliSpec, name: str, method: str) -> Any:+ """Run the install as a background job that streams its output over the bus.++ Used by POST /install directly, and by /spawn-external as its fallback when+ the machine has no terminal window to open — a headless server still has to+ be able to install a CLI, and the UI still has to be able to show it.+ """installer = reg.installer()bus = reg.bus()@@ -625,12 +658,26 @@ async def install_cli()asyncio.create_task(reg.refresh_status(name), name=f"cli-refresh-after-install-{name}")- job = installer.start(+ return installer.start(spec,- body.method, # type: ignore[arg-type]+ method, # type: ignore[arg-type]on_line=_on_line,on_done=_on_done,)++[email protected]("/{name}/install", response_model=InstallStartResponse)+async def install_cli(+ name: str,+ request: Request,+ body: InstallRequest,+) -> InstallStartResponse:+ reg = _require_registry(request)+ spec = reg.catalog().get(name)+ if spec is None:+ raise HTTPException(status_code=404, detail=f"CLI '{name}' not in catalog")++ job = _start_install_job(reg, spec, name, body.method)if job is None:return InstallStartResponse(ok=False,diff --git a/jarvis/ui/web/frontend/src/assets/clis/LOGOS.md b/jarvis/ui/web/frontend/src/assets/clis/LOGOS.mdindex 47f28bb941..d525aa76b0 100644--- a/jarvis/ui/web/frontend/src/assets/clis/LOGOS.md+++ b/jarvis/ui/web/frontend/src/assets/clis/LOGOS.md@@ -17,9 +17,9 @@ here and want it removed, open an issue and it will be taken out.## How a row picks a mark`CliLogo.tsx` maps a catalog CLI name to a **vendor** — the company the tool-talks to, not the binary — and the vendor to a file here. `gcloud` and `gam`+talks to, not the binary — and the vendor to a file here. `gcloud` and `gws`are both Google, but a different Google: `gcloud` draws the Cloud hexagon and-`gam` the Google G, because that is what each tool actually administers. A CLI+`gws` the Google G, because that is what each tool actually administers. A CLIwith no vendor row (`jarvisctl`, any custom CLI someone registers) draws thecategory glyph on the same tile, so adding a CLI never produces a broken image.@@ -60,7 +60,7 @@ provider cards use:| fly | `flyctl` | gilbarbara/logos `fly-icon.svg` | CC0 | colour | 2026-08-23 || github | `gh` | simple-icons `github.svg` | CC0-1.0 | mono | 2026-08-23 || gitlab | `glab` | gilbarbara/logos `gitlab-icon.svg` | CC0 | colour | 2026-08-23 |-| google | `gam` (Google Workspace) | gilbarbara/logos `google-icon.svg` | CC0 | colour | 2026-08-23 |+| google | `gws` (Google Workspace) | gilbarbara/logos `google-icon.svg` | CC0 | colour | 2026-08-23 || google-cloud | `gcloud` | gilbarbara/logos `google-cloud.svg` | CC0 | colour | 2026-08-23 || heroku | `heroku` | gilbarbara/logos `heroku-icon.svg` | CC0 | colour | 2026-08-23 || kubernetes | `kubectl` | gilbarbara/logos `kubernetes.svg` | CC0 | colour | 2026-08-23 |diff --git a/jarvis/ui/web/frontend/src/components/clis/CliLogo.tsx b/jarvis/ui/web/frontend/src/components/clis/CliLogo.tsxindex a4240497d3..16d03377f5 100644--- a/jarvis/ui/web/frontend/src/components/clis/CliLogo.tsx+++ b/jarvis/ui/web/frontend/src/components/clis/CliLogo.tsx@@ -62,7 +62,7 @@ const CLI_VENDOR_LOGOS: Record<string, VendorLogo> = {** Exact names, not substrings: `render` the vendor and `render` the binary* happen to match, but `gh` and `glab` share no letters with their companies,- * and a substring rule would make `gam` a Google Cloud tool. Custom CLIs a+ * and a substring rule would make `gws` a Google Cloud tool. Custom CLIs a* user registers land on the category glyph, which is the honest answer for a* binary this project has never heard of.*/@@ -72,10 +72,10 @@ const CLI_VENDORS: Record<string, string> = {docker: "docker",firebase: "firebase",flyctl: "fly",- gam: "google",gcloud: "google-cloud",gh: "github",glab: "gitlab",+ gws: "google",heroku: "heroku",kubectl: "kubernetes",neonctl: "neon",diff --git a/jarvis/ui/web/frontend/src/hooks/useClis.ts b/jarvis/ui/web/frontend/src/hooks/useClis.tsindex dec45daeb5..50764f06f7 100644--- a/jarvis/ui/web/frontend/src/hooks/useClis.ts+++ b/jarvis/ui/web/frontend/src/hooks/useClis.ts@@ -271,8 +271,12 @@ export function useInstallCli() {export interface SpawnExternalResponse {ok: boolean;- method: string; // "wt" | "pwsh" | "powershell" | "failed"+ // The terminal that opened it ("wt", "pwsh", "terminal.app",+ // "gnome-terminal", ...), "in-app" when the machine has no screen and the+ // install streams into the UI instead, or "failed"/"no_display".+ method: string;command: string | null;+ job_id: string | null;error: string | null;}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/de.json b/jarvis/ui/web/frontend/src/i18n/locales/de.jsonindex 4e5b6f6869..50ac16e1c0 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/de.json@@ -3469,12 +3469,13 @@"validating": "Validiere…","save_and_validate": "Speichern & Validieren","install_lowercase": "installieren",- "install_help": "Oeffnet ein externes Windows Terminal mit dem Install-Command. Der Status wird automatisch geprueft sobald das Terminal fertig ist.",+ "install_help": "Öffnet ein Terminal-Fenster, installiert und meldet dich danach gleich an. Der Status wird automatisch geprüft, sobald das Terminal fertig ist.","choose_method": "Methode wählen","recommended": "empfohlen","command_label": "Befehl","external_terminal_opened": "Externes Terminal geoeffnet","install_running": "Install laeuft. Status wird automatisch aktualisiert.",+ "install_running_in_app": "Dieser Rechner hat keinen Bildschirm — die Installation läuft in der App und wird hier angezeigt.","spawning": "Spawne…","open": "Öffnen","install_in_terminal": "Im Terminal installieren",@@ -3601,10 +3602,10 @@"docker": "Zeig die laufenden Container","firebase": "Liste meine Firebase-Projekte","flyctl": "Liste meine Fly.io-Apps",- "gam": "Zeig die Nutzer in meinem Google Workspace","gcloud": "Liste meine Google-Cloud-Projekte","gh": "Zeig meine offenen Pull Requests","glab": "Zeig meine offenen Merge Requests",+ "gws": "Zeig mir meine ungelesenen Mails","heroku": "Liste meine Heroku-Apps","kubectl": "Zeig die Pods im aktuellen Namespace","neonctl": "Liste meine Neon-Projekte",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/en.json b/jarvis/ui/web/frontend/src/i18n/locales/en.jsonindex b49cb8390d..80def893e4 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/en.json@@ -3469,12 +3469,13 @@"validating": "Validating…","save_and_validate": "Save & validate","install_lowercase": "— install",- "install_help": "Opens an external Windows terminal with the install command. The status is checked automatically once the terminal finishes.",+ "install_help": "Opens a terminal window, installs, and then signs you in right away. The status is checked automatically once the terminal finishes.","choose_method": "Choose method","recommended": "recommended","command_label": "Command","external_terminal_opened": "External terminal opened","install_running": "install is running. Status updates automatically.",+ "install_running_in_app": "This machine has no screen — the install runs inside the app and is shown here.","spawning": "Spawning…","open": "Open","install_in_terminal": "Install in terminal",@@ -3601,10 +3602,10 @@"docker": "List the running containers","firebase": "List my Firebase projects","flyctl": "List my Fly.io apps",- "gam": "Show my Google Workspace users","gcloud": "List my Google Cloud projects","gh": "Show my open pull requests","glab": "Show my open merge requests",+ "gws": "Show my unread mail","heroku": "List my Heroku apps","kubectl": "Show the pods in the current namespace","neonctl": "List my Neon projects",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/es.json b/jarvis/ui/web/frontend/src/i18n/locales/es.jsonindex cc38c82d0e..2cc2cbcf9f 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/es.json@@ -3469,12 +3469,13 @@"validating": "Validando…","save_and_validate": "Guardar y validar","install_lowercase": "— instalar",- "install_help": "Abre una terminal externa de Windows con el comando de instalación. El estado se comprueba automáticamente cuando la terminal termina.",+ "install_help": "Abre una ventana de terminal, instala y luego te conecta directamente. El estado se comprueba automáticamente cuando la terminal termina.","choose_method": "Elegir método","recommended": "recomendado","command_label": "Comando","external_terminal_opened": "Terminal externa abierta","install_running": "la instalación está en curso. El estado se actualiza automáticamente.",+ "install_running_in_app": "Este equipo no tiene pantalla: la instalación se ejecuta dentro de la app y se muestra aquí.","spawning": "Iniciando…","open": "Abrir","install_in_terminal": "Instalar en la terminal",@@ -3601,10 +3602,10 @@"docker": "Muestra los contenedores en ejecución","firebase": "Lista mis proyectos de Firebase","flyctl": "Lista mis apps de Fly.io",- "gam": "Muestra los usuarios de mi Google Workspace","gcloud": "Lista mis proyectos de Google Cloud","gh": "Muestra mis pull requests abiertas","glab": "Muestra mis merge requests abiertas",+ "gws": "Muestra mis correos sin leer","heroku": "Lista mis apps de Heroku","kubectl": "Muestra los pods del namespace actual","neonctl": "Lista mis proyectos de Neon",diff --git a/jarvis/ui/web/frontend/src/views/ClisView.tsx b/jarvis/ui/web/frontend/src/views/ClisView.tsxindex 76fc9876e4..6134483cd2 100644--- a/jarvis/ui/web/frontend/src/views/ClisView.tsx+++ b/jarvis/ui/web/frontend/src/views/ClisView.tsx@@ -1039,9 +1039,14 @@ function InstallDialog({{onSuccess: (res) => {if (res.ok) {+ // A machine with no screen has no terminal window to open;+ // the backend then installs in-app and streams the output,+ // so the toast must not claim a window appeared somewhere.pushToast("info",- `${t("clis_view.external_terminal_opened")} (${res.method}) — ${t("clis_view.install_running")}`,+ res.method === "in-app"+ ? t("clis_view.install_running_in_app")+ : `${t("clis_view.external_terminal_opened")} (${res.method}) — ${t("clis_view.install_running")}`,);onClose();} else {diff --git a/scripts/ci/check_cli_install_methods.py b/scripts/ci/check_cli_install_methods.pynew file mode 100644index 0000000000..0b938f2e90--- /dev/null+++ b/scripts/ci/check_cli_install_methods.py@@ -0,0 +1,84 @@+#!/usr/bin/env python3+"""Every CLI in the seed catalog must be installable by pressing Install.++The CLI section renders an Install button from ``install_methods``, and+``cli_routes._install_methods_of`` invents a pseudo-method called ``manual``+whenever an entry declares no package manager at all — its "command" being the+project's documentation URL. The button then opens a web page instead of+installing anything, which reads as a broken button rather than as a CLI that+has to be installed by hand. That is exactly how the ``gam`` entry behaved:+Install sent the user to a GitHub wiki.++This gate fails on any seed entry that would fall into that path, and on a+``recommended`` that names a method the entry does not actually declare (which+would preselect a dead radio button in the install dialog).++A custom CLI a user registers themselves may still be manual-only — there is+nobody to fix it for them. The shipped catalog may not.+"""++from __future__ import annotations++import json+import sys+from pathlib import Path++REPO = Path(__file__).resolve().parents[2]+CATALOG = REPO / "jarvis" / "clis" / "catalog" / "seed_catalog.json"++# Mirrors InstallMethods.available_methods() in jarvis/clis/spec.py. Kept as a+# plain list so the gate runs without importing the app.+METHOD_FIELDS: tuple[tuple[str, str], ...] = (+ ("winget", "winget_id"),+ ("scoop", "scoop_package"),+ ("npm", "npm_package"),+ ("pip", "pip_package"),+ ("cargo", "cargo_package"),+ ("script", "script_url"),+)+++def main() -> int:+ try:+ catalog = json.loads(CATALOG.read_text(encoding="utf-8"))+ except (OSError, json.JSONDecodeError) as exc:+ print(f"FAIL: cannot read {CATALOG.relative_to(REPO)}: {exc}")+ return 1++ failures: list[str] = []+ for entry in catalog.get("entries", []):+ name = entry.get("name", "<unnamed>")+ install = entry.get("install") or {}+ declared = [method for method, field in METHOD_FIELDS if install.get(field)]++ if not declared:+ failures.append(+ f" {name}: declares no install method — Install would open "+ f"{install.get('manual_url') or 'nothing'} instead of installing."+ )+ continue++ recommended = install.get("recommended")+ if recommended and recommended not in declared:+ failures.append(+ f" {name}: recommended={recommended!r} is not among the declared "+ f"methods {declared} — the install dialog would preselect a dead option."+ )++ if failures:+ print("FAIL: seed catalog entries that cannot be installed from the UI:")+ print("\n".join(failures))+ print(+ "\nGive the entry a real install method (winget_id / scoop_package / "+ "npm_package / pip_package / cargo_package / script_url). A "+ "documentation link is not an install method."+ )+ return 1++ total = len(catalog.get("entries", []))+ print(f"OK: all {total} seed CLIs declare a runnable install method.")+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/tests/unit/clis/test_capability_provider.py b/tests/unit/clis/test_capability_provider.pyindex c2360b2055..fb2a74be0b 100644--- a/tests/unit/clis/test_capability_provider.py+++ b/tests/unit/clis/test_capability_provider.py@@ -63,23 +63,23 @@ def test_connected_domain_tool_map():def test_refusal_hint_installed_not_connected():fake = FakeCliRegistry(- {"gam": make_spec("gam", domains=("calendar",))},+ {"gws": make_spec("gws", domains=("calendar",))},active=[],- status={"gam": CliStatus(installed=True, auth_status="not_connected")},+ status={"gws": CliStatus(installed=True, auth_status="not_connected")},)hint_de = refusal_hint("calendar", fake, "de")- assert "GAM" in hint_de and "installiert" in hint_de+ assert "GWS" in hint_de and "installiert" in hint_dehint_en = refusal_hint("calendar", fake, "en")- assert "GAM" in hint_en and "installed" in hint_en+ assert "GWS" in hint_en and "installed" in hint_endef test_refusal_hint_known_but_not_installed():fake = FakeCliRegistry(- {"gam": make_spec("gam", domains=("calendar",))},+ {"gws": make_spec("gws", domains=("calendar",))},active=[],- status={"gam": CliStatus(installed=False)},+ status={"gws": CliStatus(installed=False)},)- assert "GAM" in refusal_hint("calendar", fake, "en")+ assert "GWS" in refusal_hint("calendar", fake, "en")def test_refusal_hint_empty_for_unknown_domain():diff --git a/tests/unit/clis/test_install_path.py b/tests/unit/clis/test_install_path.pynew file mode 100644index 0000000000..507d77147b--- /dev/null+++ b/tests/unit/clis/test_install_path.py@@ -0,0 +1,142 @@+"""The Install button must install — on every OS, and all the way to connected.++Regression cover for the ``gam`` failure: a catalog entry that declared no+package manager turned Install into a link to a GitHub wiki, and the entry+probed a binary (``gam``) that was not the CLI the rest of the app drives+(``gws``), so an installed CLI still showed as missing.+"""++from __future__ import annotations++import json+from pathlib import Path++import pytest++from jarvis.clis.catalog import CliCatalog+from jarvis.clis.external_terminal import chain_commands, path_refresh_command+from jarvis.clis.prober import _apply_parse_strategy++SEED_PATH = Path(__file__).resolve().parents[3] / "jarvis/clis/catalog/seed_catalog.json"+++def _seed_entries() -> list[dict]:+ return json.loads(SEED_PATH.read_text(encoding="utf-8"))["entries"]+++# --------------------------------------------------------------------------+# Every shipped CLI installs+# --------------------------------------------------------------------------++[email protected]("entry", _seed_entries(), ids=lambda e: e["name"])+def test_every_seed_cli_has_a_runnable_install_method(entry: dict) -> None:+ """No shipped entry may fall back to "manual", which only opens a web page."""+ install = entry["install"]+ declared = [+ field+ for field in (+ "winget_id", "scoop_package", "npm_package",+ "pip_package", "cargo_package", "script_url",+ )+ if install.get(field)+ ]+ assert declared, (+ f"{entry['name']} declares no install method — the Install button would "+ f"open {install.get('manual_url')!r} instead of installing anything."+ )++[email protected]("entry", _seed_entries(), ids=lambda e: e["name"])+def test_recommended_method_is_actually_declared(entry: dict) -> None:+ install = entry["install"]+ recommended = install.get("recommended")+ if not recommended:+ return+ field = {+ "winget": "winget_id", "scoop": "scoop_package", "npm": "npm_package",+ "pip": "pip_package", "cargo": "cargo_package", "script": "script_url",+ }[recommended]+ assert install.get(field), (+ f"{entry['name']}: recommended={recommended!r} has no {field} — the "+ "install dialog would preselect a dead option."+ )+++def test_google_workspace_entry_is_the_cli_the_app_actually_drives(tmp_path: Path) -> None:+ """The catalog probes ``gws``, the CLI the skills and workflows call.++ It used to describe GAM, a different tool with a different binary: an+ installed Google Workspace CLI therefore reported "not installed" forever.+ """+ # Seed only — a custom catalog on the developer's box must not decide this.+ specs = CliCatalog(custom_path=tmp_path / "custom.json").all()+ assert "gam" not in specs, "the uninstallable GAM entry must not come back"+ gws = specs["gws"]+ assert gws.binary_name == "gws"+ assert gws.install.npm_package == "@googleworkspace/cli"+ assert gws.install.has_automatic_method()+ assert gws.auth.login_command == ("gws", "auth", "login")+ assert gws.auth.status_parse == "json_token_valid"+++# --------------------------------------------------------------------------+# Stored credentials are not the same thing as a working login+# --------------------------------------------------------------------------+++def test_dead_token_over_stored_credentials_reads_as_expired() -> None:+ """The exact `gws auth status` shape that used to look connected."""+ stdout = json.dumps({+ "has_refresh_token": True,+ "encrypted_credentials_exists": True,+ "token_error": "Bad Request",+ "token_valid": False,+ })+ assert _apply_parse_strategy("json_token_valid", stdout, "", 0) == "expired"+++def test_valid_token_reads_as_connected() -> None:+ stdout = json.dumps({"has_refresh_token": True, "token_valid": True})+ assert _apply_parse_strategy("json_token_valid", stdout, "", 0) == "connected"+++def test_no_credentials_at_all_reads_as_not_connected() -> None:+ stdout = json.dumps({"token_valid": False, "has_refresh_token": False})+ assert _apply_parse_strategy("json_token_valid", stdout, "", 0) == "not_connected"+++def test_unparseable_status_is_unknown_not_connected() -> None:+ assert _apply_parse_strategy("json_token_valid", "not json", "", 0) == "unknown"+++# --------------------------------------------------------------------------+# Install chains into login without stranding the shell on a stale PATH+# --------------------------------------------------------------------------+++def test_chain_stops_at_the_first_failure(monkeypatch: pytest.MonkeyPatch) -> None:+ """A failed install must not be followed by a login attempt."""+ monkeypatch.setattr("jarvis.clis.external_terminal.sys.platform", "linux")+ assert chain_commands(["a", "b", "c"]) == "a && b && c"++ # Windows PowerShell 5.1 is a possible fallback shell and has no `&&`,+ # so the Windows spelling must not contain one.+ monkeypatch.setattr("jarvis.clis.external_terminal.sys.platform", "win32")+ chained = chain_commands(["a", "b", "c"])+ assert "&&" not in chained+ assert chained == "a; if ($?) { b; if ($?) { c } }"+++def test_chain_of_one_is_left_alone(monkeypatch: pytest.MonkeyPatch) -> None:+ for platform in ("win32", "linux", "darwin"):+ monkeypatch.setattr("jarvis.clis.external_terminal.sys.platform", platform)+ assert chain_commands(["npm install -g x"]) == "npm install -g x"+ assert chain_commands([]) == ""+++def test_path_refresh_exists_for_every_platform(monkeypatch: pytest.MonkeyPatch) -> None:+ """Without it, `gcloud auth login` right after installing gcloud is not found."""+ for platform in ("win32", "linux", "darwin"):+ monkeypatch.setattr("jarvis.clis.external_terminal.sys.platform", platform)+ assert path_refresh_command().strip()diff --git a/tests/unit/clis/test_seed_catalog_capabilities.py b/tests/unit/clis/test_seed_catalog_capabilities.pyindex 5385025998..d5836646ff 100644--- a/tests/unit/clis/test_seed_catalog_capabilities.py+++ b/tests/unit/clis/test_seed_catalog_capabilities.py@@ -3,7 +3,7 @@ from jarvis.clis.capability_provider import DOMAIN_VOCABfrom jarvis.clis.catalog import CliCatalogCURATED = {- "gam", "gh", "glab", "gcloud", "az", "aws", "wrangler", "vercel",+ "gws", "gh", "glab", "gcloud", "az", "aws", "wrangler", "vercel","netlify", "heroku", "railway", "flyctl", "render", "supabase","firebase", "pscale", "neonctl", "stripe", "twilio", "docker", "kubectl",}diff --git a/tests/unit/clis/test_seed_catalog_display.py b/tests/unit/clis/test_seed_catalog_display.pyindex 25b0fa7175..6770286955 100644--- a/tests/unit/clis/test_seed_catalog_display.py+++ b/tests/unit/clis/test_seed_catalog_display.py@@ -26,8 +26,8 @@ def test_gcloud_display_name_is_google_cloud_cli() -> None:def test_google_workspace_cli_is_discoverable_by_name() -> None:- spec = load_catalog()["gam"]- assert spec.display_name == "Google Workspace CLI (GAM)"+ spec = load_catalog()["gws"]+ assert spec.display_name == "Google Workspace CLI"assert spec.category == "workspace"