Skip to content

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.

feat(cli): say plainly what a marketplace install did

Haraldb51e50e00bd2
diff --git a/docs/jarvis-cli-reference.md b/docs/jarvis-cli-reference.md
index 6f49356048..5d896cdc9b 100644
--- a/docs/jarvis-cli-reference.md
+++ b/docs/jarvis-cli-reference.md
@@ -107,10 +107,12 @@ _Generated from the curated command tree by `scripts/ci/gen_cli_reference.py`
## marketplace
+- `jarvis marketplace browse` — Show everything the community marketplace offers, and what you already have.
- `jarvis marketplace connect-pat <plugin_id> --token --yes --dry-run` — Connect a plugin with a personal access token.
- `jarvis marketplace connect-poll <plugin_id> <flow_id>` — Poll an in-progress OAuth connect flow.
- `jarvis marketplace connect-start <plugin_id> --yes --dry-run` — Begin an OAuth connect flow (prints the redirect URI + flow id).
- `jarvis marketplace disconnect <plugin_id> --yes --dry-run` — Disconnect a plugin.
+- `jarvis marketplace install <item_id> --yes --dry-run` — Install a marketplace entry by name — skill or plugin — and report the result.
- `jarvis marketplace list` — List marketplace plugins + their connection status.
## mcps
@@ -135,6 +137,15 @@ _Generated from the curated command tree by `scripts/ci/gen_cli_reference.py`
- `jarvis missions show <mission_id>` — Show one mission with its events + verdicts.
- `jarvis missions tool-approvals <mission_id>` — List supervisor tool calls waiting for approval in a mission.
+## modes
+
+- `jarvis modes create <name> --character --slug --emoji --description --voice --verbosity --proactivity` — Create or replace a mode. Does NOT switch to it — use `modes use` for that.
+- `jarvis modes delete <slug>` — Delete a mode you created. Built-ins are refused; a copy of one is not.
+- `jarvis modes list` — List every mode and show which one is active.
+- `jarvis modes restore <slug>` — Throw away your edits to a built-in mode and bring the shipped one back.
+- `jarvis modes show <slug>` — Show one mode in full, including its character text.
+- `jarvis modes use <slug>` — Switch the active mode. Applies on the next turn — no restart.
+
## outputs
- `jarvis outputs files <slug>` — List the artifacts a mission produced.
@@ -172,6 +183,7 @@ _Generated from the curated command tree by `scripts/ci/gen_cli_reference.py`
- `jarvis skills disable <name> --yes --dry-run` — Deactivate a skill.
- `jarvis skills draft <intent> --name-hint --category --yes --dry-run` — Generate a skill draft from an intent (AI author; lands as state=draft).
- `jarvis skills enable <name> --yes --dry-run` — Activate a skill.
+- `jarvis skills import <source> --yes --dry-run` — Install a skill from a local folder or a SKILL.md link.
- `jarvis skills list` — List all discovered skills.
- `jarvis skills reload --yes --dry-run` — Re-scan the skills directory.
- `jarvis skills show <name>` — Show one skill's detail.
diff --git a/docs/jarvis-cli.md b/docs/jarvis-cli.md
index da73ab0dee..aea6c404d3 100644
--- a/docs/jarvis-cli.md
+++ b/docs/jarvis-cli.md
@@ -86,6 +86,24 @@ jarvis --json missions list # JSON, for scripts/agents
jarvis missions list # rich table, for humans
```
+## Installing from the marketplace
+
+A marketplace page prints one line to copy. It works for both kinds of entry —
+skills and plugins — and you never have to know which one you are looking at:
+
+```bash
+jarvis marketplace install three-bullet-brief
+jarvis marketplace browse # everything on offer + what you have
+```
+
+At a terminal the command first shows what the entry is and where it comes from,
+asks once, and then says plainly what happened — a skill that validated is usable
+immediately, while a plugin lands on your list but stays powerless until you
+connect your account. **Exit code 1 means "not usable"**: an unknown name, a
+declined prompt, or a skill whose file failed validation. Piped or with `--json`
+it skips the prose and the prompt and prints the API payload
+(`POST /api/marketplace/community/install/<name>`).
+
## Safety model
The CLI is agent-first, so it stays out of your way for safe work and only gates
diff --git a/jarvis/cli_ctl/commands/marketplace.py b/jarvis/cli_ctl/commands/marketplace.py
index 5e586dd7ea..395572f7ff 100644
--- a/jarvis/cli_ctl/commands/marketplace.py
+++ b/jarvis/cli_ctl/commands/marketplace.py
@@ -1,12 +1,300 @@
-"""marketplace: connect/disconnect marketplace plugins (/api/marketplace)."""
+"""marketplace: browse, install, connect, disconnect marketplace entries.
+
+``install`` is the command a downloader copies straight off a marketplace page,
+so it is also the one place where "did anything actually happen?" must never be
+a guess. It therefore narrates in plain words for a person at a terminal — what
+the entry is, where it landed, whether it can be used right now, and what is
+still missing — while any pipe, script, or agent (``--json`` or a non-TTY
+stdout) keeps getting the untouched API payload.
+"""
from __future__ import annotations
+from typing import Any
+
import typer
-from jarvis.cli_ctl import invoke, options
+from jarvis.cli_ctl import invoke, options, render
+from jarvis.cli_ctl.client import ApiError
+
+app = typer.Typer(
+ no_args_is_help=True,
+ help="Marketplace: browse, install, connect, disconnect.",
+)
+
+
+# ----------------------------------------------------------------------
+# Shared plumbing
+# ----------------------------------------------------------------------
+
+
+def _fail(exc: ApiError) -> typer.Exit:
+ """Turn an API failure into one plain sentence + a non-zero exit."""
+ if exc.status_code is None:
+ # Transport failure: the cause-specific diagnosis beats "connection
+ # refused" for someone who just wants to know why nothing happened.
+ from jarvis.cli_ctl import doctor
+
+ render.error(doctor.unreachable_message(exc.base_url))
+ else:
+ detail = exc.payload if isinstance(exc.payload, str) else exc.message
+ render.error(detail)
+ return typer.Exit(code=1)
+
+
+def _find_entry(index: dict[str, Any], item_id: str) -> tuple[str, dict[str, Any]] | None:
+ """Locate ``item_id`` in a community index payload as ("skill"|"plugin", entry)."""
+ for skill in index.get("skills") or []:
+ if skill.get("name") == item_id:
+ return "skill", skill
+ for plugin in index.get("plugins") or []:
+ if plugin.get("name") == item_id:
+ return "plugin", plugin
+ return None
+
+
+def _suggest(index: dict[str, Any], item_id: str) -> str:
+ """Closest existing name, phrased as a hint — or an empty string."""
+ import difflib
+
+ names = [s.get("name", "") for s in index.get("skills") or []]
+ names += [p.get("name", "") for p in index.get("plugins") or []]
+ close = difflib.get_close_matches(item_id, [n for n in names if n], n=1, cutoff=0.6)
+ return f" Did you mean {close[0]!r}?" if close else ""
+
+
+_field = render.field
+
+
+# ----------------------------------------------------------------------
+# install
+# ----------------------------------------------------------------------
+
+
+_SKILL_BLURB = (
+ "A written instruction sheet for the assistant. It adds no server and no "
+ "login of its own."
+)
+_PLUGIN_BLURB = (
+ "A connector to an outside service. Installing it only puts it on your "
+ "list — it stays powerless until you connect your account."
+)
+
+
+def _preview(kind: str, entry: dict[str, Any], item_id: str) -> None:
+ """Show WHAT is about to be installed, before a single byte is fetched."""
+ title = entry.get("title") or entry.get("display_name") or item_id
+ parts = [kind]
+ if entry.get("version"):
+ parts.append(f"v{entry['version']}")
+ if entry.get("publisher"):
+ parts.append(f"by {entry['publisher']}")
+ render.line()
+ render.line(f"[bold]{title}[/bold] · {' · '.join(parts)}")
+ render.line()
+ _field("What", _SKILL_BLURB if kind == "skill" else _PLUGIN_BLURB)
+ if entry.get("description"):
+ _field("Does", str(entry["description"]))
+ if entry.get("source_url"):
+ _field("From", str(entry["source_url"]))
+ _field("Goes to", "your skills" if kind == "skill" else "your plugin list")
+ render.line()
+
+
+def _report_installed(payload: dict[str, Any]) -> int:
+ """Print the after-the-fact status. Returns the process exit code."""
+ kind = str(payload.get("kind") or "")
+ item_id = str(payload.get("id") or "")
+ title = str(payload.get("title") or item_id)
+ render.line()
+ if payload.get("ready"):
+ render.line(f"[green]Installed:[/green] [bold]{title}[/bold]")
+ elif payload.get("next_action") == "connect":
+ render.line(f"[green]Installed:[/green] [bold]{title}[/bold]")
+ else:
+ render.line(f"[yellow]Installed, but not usable:[/yellow] [bold]{title}[/bold]")
+ render.line()
+ _field("Kind", kind or "unknown")
+ if payload.get("location"):
+ _field("File", str(payload["location"]))
+
+ if payload.get("ready"):
+ _field(
+ "Status",
+ "ready to use — Jarvis picked it up already, no restart needed",
+ )
+ _field("Check", f"jarvis skills show {item_id}")
+ _field("Turn off", f"jarvis skills disable {item_id}")
+ render.line()
+ return 0
+
+ if payload.get("next_action") == "connect":
+ _field(
+ "Status",
+ "on your list, but NOT connected — it cannot do anything yet",
+ )
+ _field("Next", f"jarvis marketplace connect-start {item_id}")
+ _field("Or", "open the app → Plugins → Community and press Connect")
+ render.line()
+ return 0
+
+ _field("Status", f"{payload.get('state') or 'unknown'} — Jarvis will not use it")
+ if payload.get("problem"):
+ _field("Problem", str(payload["problem"]))
+ _field("Look", f"jarvis skills show {item_id}")
+ render.line()
+ return 1
+
+
+def _report_already_there(kind: str, item_id: str, client: Any) -> int:
+ """Nothing to install — say what is already there and how it stands."""
+ render.line()
+ render.line(f"[green]Already installed:[/green] [bold]{item_id}[/bold]")
+ render.line()
+ _field("Kind", kind)
+ if kind == "skill":
+ try:
+ detail = client.request("GET", f"/api/skills/{item_id}")
+ except ApiError:
+ detail = {}
+ state = str(detail.get("state") or "unknown")
+ ready = state in ("active", "validated")
+ _field(
+ "Status",
+ "ready to use" if ready else f"{state} — Jarvis will not use it",
+ )
+ if detail.get("error"):
+ _field("Problem", str(detail["error"]))
+ _field("Look", f"jarvis skills show {item_id}")
+ render.line()
+ return 0 if ready else 1
+ status = "unknown"
+ try:
+ listing = client.request("GET", "/api/marketplace/plugins")
+ for plugin in listing.get("plugins", []) if isinstance(listing, dict) else []:
+ if plugin.get("id") == item_id:
+ status = str(plugin.get("status") or "unknown")
+ break
+ except ApiError:
+ pass
+ if status == "connected":
+ _field("Status", "connected and usable")
+ else:
+ _field("Status", f"{status} — connect it before it can do anything")
+ _field("Next", f"jarvis marketplace connect-start {item_id}")
+ render.line()
+ return 0
+
+
+def install(
+ item_id: str = typer.Argument(..., help="Marketplace name, e.g. three-bullet-brief."),
+ yes: bool = options.yes_opt(),
+ dry_run: bool = options.dry_opt(),
+) -> None:
+ """Install a marketplace entry by name — skill or plugin — and report the result.
+
+ At a terminal this shows what the entry is and asks once before installing,
+ then states plainly whether the thing is usable now or still needs a step.
+ Piped or with ``--json`` it sends the install straight through and prints
+ the API payload. Exit code 1 means "not usable": a skill that failed
+ validation, an unknown name, or a refused install.
+ """
+ from jarvis.cli_ctl import safety
+ from jarvis.cli_ctl.__main__ import as_json, make_client
+
+ json_out = as_json()
+ human = render.is_human() and not json_out
+ path = f"/api/marketplace/community/install/{item_id}"
+
+ if dry_run:
+ safety.gate_request("POST", path, assume_yes=yes, dry_run=True, as_json=json_out)
+ return # dry run: preview already printed, nothing sent
+
+ client = make_client()
+ try:
+ if human:
+ # Resolve the name FIRST so an unknown entry (or one that is
+ # already there) is answered without touching the install path.
+ try:
+ index = client.request("GET", "/api/marketplace/community")
+ except ApiError as exc:
+ raise _fail(exc) from exc
+ found = _find_entry(index if isinstance(index, dict) else {}, item_id)
+ if found is None:
+ render.error(
+ f"{item_id!r} is not in the marketplace."
+ f"{_suggest(index if isinstance(index, dict) else {}, item_id)} "
+ "Run `jarvis marketplace browse` to see everything on offer."
+ )
+ raise typer.Exit(code=1)
+ kind, entry = found
+ if entry.get("installed"):
+ raise typer.Exit(code=_report_already_there(kind, item_id, client))
+ _preview(kind, entry, item_id)
+ if not yes and not typer.confirm("Install it?", default=False):
+ render.line("Cancelled — nothing was installed.")
+ raise typer.Exit(code=1)
+ render.line("Installing …")
+
+ # Non-destructive today, so the gate waves it through — but routing it
+ # through the same gate every other mutation uses means a later risk
+ # reclassification of this path applies here without a code change.
+ if not safety.gate_request(
+ "POST", path, assume_yes=yes or human, as_json=json_out
+ ):
+ return
+ try:
+ result = client.request("POST", path)
+ except ApiError as exc:
+ raise _fail(exc) from exc
+
+ if not human:
+ render.emit(result, as_json=json_out)
+ return
+ raise typer.Exit(code=_report_installed(result if isinstance(result, dict) else {}))
+ finally:
+ client.close()
+
+
+def browse() -> None:
+ """Show everything the community marketplace offers, and what you already have."""
+ from jarvis.cli_ctl.__main__ import as_json, make_client
+
+ json_out = as_json()
+ human = render.is_human() and not json_out
+ client = make_client()
+ try:
+ try:
+ index = client.request("GET", "/api/marketplace/community")
+ except ApiError as exc:
+ raise _fail(exc) from exc
+ if not human:
+ render.emit(index, as_json=json_out)
+ return
+ payload = index if isinstance(index, dict) else {}
+ for kind, key in (("Skills", "skills"), ("Plugins", "plugins")):
+ entries = payload.get(key) or []
+ render.line()
+ render.line(f"[bold]{kind}[/bold] ({len(entries)})")
+ if not entries:
+ render.line(" nothing published yet")
+ continue
+ for entry in entries:
+ name = entry.get("name", "?")
+ mark = "[green]installed[/green]" if entry.get("installed") else "available"
+ render.line(f" {name:<28} {mark}")
+ render.line()
+ render.line("Install one with: jarvis marketplace install <name>")
+ render.line()
+ finally:
+ client.close()
+
-app = typer.Typer(no_args_is_help=True, help="Marketplace plugins: list, connect, disconnect.")
+# ----------------------------------------------------------------------
+# Connect / disconnect
+# ----------------------------------------------------------------------
@app.command("list")
diff --git a/jarvis/cli_ctl/render.py b/jarvis/cli_ctl/render.py
index 2c2b1b3e09..427998112b 100644
--- a/jarvis/cli_ctl/render.py
+++ b/jarvis/cli_ctl/render.py
@@ -56,5 +56,48 @@ def emit(payload: Any, *, as_json: bool) -> None:
_out.print(str(payload))
+def is_human() -> bool:
+ """True when the caller is a person at a terminal, not a pipe or an agent.
+
+ A command that wants to narrate ("Downloading… done", "installed but not
+ connected yet") asks this first: prose belongs to the interactive terminal
+ only, while every non-TTY consumer keeps receiving the machine JSON
+ ``emit`` produces. Callers must still honor the global ``--json`` flag.
+ """
+ return _stdout_isatty()
+
+
+def line(text: str = "") -> None:
+ """Print one prose line to stdout (Rich markup allowed, no highlighting)."""
+ _out.print(text)
+
+
+def field(label: str, value: str, *, label_width: int = 9) -> None:
+ """Print one ``label value`` row of a status block, wrapped in-column.
+
+ The value is wrapped here rather than by Rich because Rich restarts a
+ continuation line at column 0, which destroys the two-column read exactly
+ when it matters most — a narrow terminal. Long unbroken tokens (a Windows
+ path, a URL) are left intact and allowed to overhang; a path chopped
+ mid-word is worse than one that runs on. The value is escaped, so a
+ file path or an error message containing ``[`` cannot be eaten as markup.
+ """
+ import textwrap
+
+ from rich.markup import escape
+
+ indent = " " * (2 + label_width + 1)
+ width = max(40, min(_out.width, 100))
+ parts = textwrap.wrap(
+ value,
+ width=max(20, width - len(indent)),
+ break_long_words=False,
+ break_on_hyphens=False,
+ ) or [""]
+ _out.print(f" [bold]{label:<{label_width}}[/bold] {escape(parts[0])}", soft_wrap=True)
+ for extra in parts[1:]:
+ _out.print(f"{indent}{escape(extra)}", soft_wrap=True)
+
+
def error(message: str) -> None:
_err.print(f"[red]error:[/red] {message}")
diff --git a/tests/unit/cli_ctl/test_commands_marketplace.py b/tests/unit/cli_ctl/test_commands_marketplace.py
new file mode 100644
index 0000000000..f0d11a9fed
--- /dev/null
+++ b/tests/unit/cli_ctl/test_commands_marketplace.py
@@ -0,0 +1,260 @@
+"""`jarvis marketplace install` — the command a downloader copies off a page.
+
+Its whole job is that nobody has to guess whether anything happened, so these
+tests pin the REPORTING as tightly as the request: what the terminal is told
+after a skill, a plugin, an unknown name, and a broken install, plus the exit
+code that a script keys on.
+"""
+from __future__ import annotations
+
+from typing import Any
+
+import pytest
+from typer.testing import CliRunner
+
+from jarvis.cli_ctl.__main__ import app
+
+runner = CliRunner()
+
+_INDEX = {
+ "status": "fresh",
+ "plugins": [
+ {
+ "name": "todo-fox",
+ "display_name": "TodoFox",
+ "publisher": "octocat",
+ "version": "1.2.0",
+ "description": "Tasks and reminders",
+ "source_url": "https://github.com/PersonalJarvis/marketplace",
+ "installed": False,
+ }
+ ],
+ "skills": [
+ {
+ "name": "three-point-check",
+ "title": "Three Point Check",
+ "publisher": "octocat",
+ "version": "1.0.0",
+ "description": "Three bullets plus a takeaway",
+ "source_url": "https://github.com/PersonalJarvis/marketplace",
+ "installed": False,
+ }
+ ],
+}
+
+_SKILL_RESULT = {
+ "ok": True,
+ "kind": "skill",
+ "id": "three-point-check",
+ "title": "Three Point Check",
+ "publisher": "octocat",
+ "version": "1.0.0",
+ "location": r"C:\Users\x\AppData\Local\Jarvis\skills\three-point-check\SKILL.md",
+ "state": "validated",
+ "ready": True,
+ "problem": None,
+ "next_action": "none",
+}
+
+
+def terminal(monkeypatch: pytest.MonkeyPatch) -> None:
+ """Pretend stdout is an interactive terminal, so the prose path runs."""
+ monkeypatch.setattr("jarvis.cli_ctl.render._stdout_isatty", lambda: True)
+
+
+def _out(res: Any) -> str:
+ return (res.stdout + res.stderr).lower()
+
+
+# ----------------------------------------------------------------------
+# Non-interactive (pipe / agent / --json): payload straight through
+# ----------------------------------------------------------------------
+
+
+def test_piped_install_sends_one_post_and_prints_the_payload(capture_api) -> None:
+ capture_api["routes"][
+ ("POST", "/api/marketplace/community/install/three-point-check")
+ ] = (200, _SKILL_RESULT)
+ res = runner.invoke(app, ["marketplace", "install", "three-point-check"])
+ assert res.exit_code == 0
+ # No index lookup, no prompt — exactly one request, the install itself.
+ assert [c["path"] for c in capture_api["calls"]] == [
+ "/api/marketplace/community/install/three-point-check"
+ ]
+ assert '"kind": "skill"' in res.stdout
+
+
+def test_dry_run_previews_without_sending(capture_api) -> None:
+ res = runner.invoke(app, ["marketplace", "install", "todo-fox", "--dry-run"])
+ assert res.exit_code == 0
+ assert capture_api["calls"] == []
+ assert "dry_run" in res.stdout
+ assert "/api/marketplace/community/install/todo-fox" in res.stdout
+
+
+# ----------------------------------------------------------------------
+# Terminal: say what happened
+# ----------------------------------------------------------------------
+
+
+def test_skill_install_reports_it_as_ready(capture_api, terminal) -> None:
+ capture_api["routes"][("GET", "/api/marketplace/community")] = (200, _INDEX)
+ capture_api["routes"][
+ ("POST", "/api/marketplace/community/install/three-point-check")
+ ] = (200, _SKILL_RESULT)
+ res = runner.invoke(
+ app, ["marketplace", "install", "three-point-check", "--yes"]
+ )
+ assert res.exit_code == 0
+ out = _out(res)
+ assert "three point check" in out
+ assert "installed" in out
+ assert "ready to use" in out
+ assert "no restart" in out
+
+
+def test_plugin_install_says_it_is_not_connected_yet(capture_api, terminal) -> None:
+ capture_api["routes"][("GET", "/api/marketplace/community")] = (200, _INDEX)
+ capture_api["routes"][
+ ("POST", "/api/marketplace/community/install/todo-fox")
+ ] = (
+ 200,
+ {
+ "ok": True,
+ "kind": "plugin",
+ "id": "todo-fox",
+ "title": "TodoFox",
+ "state": "not_connected",
+ "ready": False,
+ "problem": None,
+ "next_action": "connect",
+ "location": "",
+ },
+ )
+ res = runner.invoke(app, ["marketplace", "install", "todo-fox", "--yes"])
+ # Needing a connect step is the normal outcome, not a failure.
+ assert res.exit_code == 0
+ out = _out(res)
+ assert "not connected" in out
+ assert "connect-start" in out
+
+
+def test_broken_skill_install_exits_nonzero_and_names_the_problem(
+ capture_api, terminal
+) -> None:
+ capture_api["routes"][("GET", "/api/marketplace/community")] = (200, _INDEX)
+ capture_api["routes"][
+ ("POST", "/api/marketplace/community/install/three-point-check")
+ ] = (
+ 200,
+ {
+ **_SKILL_RESULT,
+ "state": "draft",
+ "ready": False,
+ "problem": "voice trigger needs 'pattern'",
+ "next_action": "repair",
+ },
+ )
+ res = runner.invoke(
+ app, ["marketplace", "install", "three-point-check", "--yes"]
+ )
+ assert res.exit_code == 1
+ out = _out(res)
+ assert "not usable" in out
+ assert "pattern" in out
+
+
+def test_unknown_name_suggests_the_closest_and_installs_nothing(
+ capture_api, terminal
+) -> None:
+ capture_api["routes"][("GET", "/api/marketplace/community")] = (200, _INDEX)
+ res = runner.invoke(app, ["marketplace", "install", "three-point-chek", "--yes"])
+ assert res.exit_code == 1
+ assert [c["method"] for c in capture_api["calls"]] == ["GET"]
+ out = _out(res)
+ assert "three-point-check" in out
+ assert "browse" in out
+
+
+def test_already_installed_skill_reports_its_current_state(
+ capture_api, terminal
+) -> None:
+ index = {
+ **_INDEX,
+ "skills": [{**_INDEX["skills"][0], "installed": True}],
+ }
+ capture_api["routes"][("GET", "/api/marketplace/community")] = (200, index)
+ capture_api["routes"][("GET", "/api/skills/three-point-check")] = (
+ 200,
+ {"name": "three-point-check", "state": "active", "error": None},
+ )
+ res = runner.invoke(
+ app, ["marketplace", "install", "three-point-check", "--yes"]
+ )
+ assert res.exit_code == 0
+ assert all(c["method"] == "GET" for c in capture_api["calls"])
+ out = _out(res)
+ assert "already installed" in out
+ assert "ready to use" in out
+
+
+def test_declining_the_prompt_installs_nothing(capture_api, terminal) -> None:
+ capture_api["routes"][("GET", "/api/marketplace/community")] = (200, _INDEX)
+ res = runner.invoke(
+ app, ["marketplace", "install", "three-point-check"], input="n\n"
+ )
+ assert res.exit_code == 1
+ assert all(c["method"] == "GET" for c in capture_api["calls"])
+ assert "cancelled" in _out(res)
+
+
+def test_unreachable_server_explains_instead_of_stack_tracing(
+ monkeypatch: pytest.MonkeyPatch, terminal
+) -> None:
+ import httpx
+
+ import jarvis.cli_ctl.client as client_mod
+
+ def boom(request: httpx.Request) -> httpx.Response:
+ raise httpx.ConnectError("no listener", request=request)
+
+ real_init = client_mod.JarvisClient.__init__
+
+ def patched_init(self, base_url, control_key, **kw):
+ kw["transport"] = httpx.MockTransport(boom)
+ real_init(self, base_url, control_key, **kw)
+
+ monkeypatch.setattr(client_mod.JarvisClient, "__init__", patched_init)
+ res = runner.invoke(app, ["marketplace", "install", "todo-fox", "--yes"])
+ assert res.exit_code == 1
+ out = _out(res)
+ assert "unreachable" not in out or "jarvis" in out
+ assert "run.bat" in out or "still starting" in out or "target" in out
+
+
+# ----------------------------------------------------------------------
+# browse
+# ----------------------------------------------------------------------
+
+
+def test_browse_lists_both_kinds_with_install_state(capture_api, terminal) -> None:
+ index = {
+ **_INDEX,
+ "skills": [{**_INDEX["skills"][0], "installed": True}],
+ }
+ capture_api["routes"][("GET", "/api/marketplace/community")] = (200, index)
+ res = runner.invoke(app, ["marketplace", "browse"])
+ assert res.exit_code == 0
+ out = _out(res)
+ assert "three-point-check" in out
+ assert "installed" in out
+ assert "todo-fox" in out
+ assert "available" in out
+
+
+def test_browse_piped_emits_the_raw_index(capture_api) -> None:
+ capture_api["routes"][("GET", "/api/marketplace/community")] = (200, _INDEX)
+ res = runner.invoke(app, ["marketplace", "browse"])
+ assert res.exit_code == 0
+ assert '"status": "fresh"' in res.stdout
diff --git a/tests/unit/cli_ctl/test_render.py b/tests/unit/cli_ctl/test_render.py
index dfa0911a7a..0306cd6318 100644
--- a/tests/unit/cli_ctl/test_render.py
+++ b/tests/unit/cli_ctl/test_render.py
@@ -49,3 +49,24 @@ def test_error_sets_message_on_stderr(capsys):
render.error("boom")
err = capsys.readouterr().err
assert "boom" in err
+
+
+def test_field_wraps_the_value_under_its_own_column(capsys):
+ render.field("Status", " ".join(["word"] * 60))
+ lines = [ln for ln in capsys.readouterr().out.splitlines() if ln.strip()]
+ assert len(lines) > 1, "a long value must wrap, not run off"
+ # Continuation lines start under the value, not at column 0 — otherwise a
+ # narrow terminal turns the status block into prose soup.
+ indent = lines[0].index("word")
+ assert all(ln.startswith(" " * indent) for ln in lines[1:])
+
+
+def test_field_keeps_a_long_path_in_one_piece(capsys):
+ path = r"C:\Users\someone\AppData\Local\Jarvis\skills\three-bullet-brief\SKILL.md"
+ render.field("File", path)
+ assert path in capsys.readouterr().out.replace("\n", "")
+
+
+def test_field_does_not_eat_brackets_as_markup(capsys):
+ render.field("Problem", "invalid [type=missing] in frontmatter")
+ assert "[type=missing]" in capsys.readouterr().out