Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion one_conv/live/bridge_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def join_command(invitation, hub_port, accept_teleport, yes):
raise click.UsageError(str(error)) from None
hub = _check_hub(hub)
saved = bridge.settings()
missing = [step for step in installer.plan(launcher) if not step.done()]
missing = [step for step in installer.plan(launcher) if step.available() and not step.done()]
if not yes:
click.echo("DRY-RUN (nothing changed). Re-run with --yes to join.")
click.echo(f" redeem the one-time invite for node {node} at {hub}")
Expand Down
4 changes: 3 additions & 1 deletion one_conv/live/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ def install_command(harness, yes):
from . import bridge
steps = [step for step in installer.plan(launcher) if harness in (None, step.harness)]
for step in steps:
if step.done():
if not step.available():
click.echo(f" skipped [{step.harness}] {step.cli} is not installed")
elif step.done():
click.echo(f" ok [{step.harness}] {step.summary}")
elif yes:
step.apply()
Expand Down
10 changes: 8 additions & 2 deletions one_conv/live/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import re
import shlex
import shutil
import shutil
import subprocess
import sys
from collections.abc import Callable
Expand All @@ -27,6 +28,11 @@ class Step:
summary: str
done: Callable[[], bool]
apply: Callable[[], None]
# The harness command the step runs; without it on PATH the step is skipped, not failed.
cli: str = ""

def available(self, which=None) -> bool:
return not self.cli or (which or shutil.which)(self.cli) is not None


def _json_file(path: Path) -> dict:
Expand Down Expand Up @@ -177,14 +183,14 @@ def agy_hooks_apply():
Step("claude", "register the one-conv MCP server (user scope)",
lambda: _registered(["claude", "mcp", "get", "one-conv"], mcp),
lambda: _replace(["claude", "mcp", "remove", "--scope", "user", "one-conv"],
["claude", "mcp", "add", "--scope", "user", "one-conv", "--", *mcp])),
["claude", "mcp", "add", "--scope", "user", "one-conv", "--", *mcp]), cli="claude"),
Step("claude", f'set "crossSessionInbound": "accept" in {settings}; any local process running as '
"you can then inject user turns into every Claude Code session, including bypass ones",
inbound_done, inbound_apply),
Step("codex", "register the one-conv MCP server",
lambda: _registered(["codex", "mcp", "get", "one-conv"], mcp),
lambda: _replace(["codex", "mcp", "remove", "one-conv"],
["codex", "mcp", "add", "one-conv", "--", *mcp])),
["codex", "mcp", "add", "one-conv", "--", *mcp]), cli="codex"),
Step("omp", f"write the relay extension {omp.extension_path()}", extension_done, extension_apply),
Step("cursor", f"add the one-conv MCP server to {cursor_mcp}", cursor_mcp_done, cursor_mcp_apply),
Step("cursor", f"add the relay stop hook to {cursor_hooks}", cursor_hook_done, cursor_hook_apply),
Expand Down
22 changes: 22 additions & 0 deletions tests/test_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,28 @@ def _step(summary_part):
return next(step for step in install.plan(["one-conv"]) if summary_part in step.summary)


def _codex_step():
return next(step for step in install.plan(["one-conv"]) if step.harness == "codex")


def test_install_step_without_its_cli_is_unavailable():
assert not _codex_step().available(which=lambda name: None)


def test_install_step_with_its_cli_is_available():
assert _codex_step().available(which=lambda name: f"/usr/bin/{name}")


def test_install_file_step_needs_no_cli():
assert _step("stop hook").available(which=lambda name: None)


def test_install_lists_a_missing_harness_cli_as_skipped(homes, monkeypatch):
monkeypatch.setattr(install.shutil, "which", lambda name, **kw: None if name == "codex" else f"/usr/bin/{name}")
result = CliRunner().invoke(build_live_group(["one-conv"]), ["install", "--harness", "codex"])
assert "skipped [codex] codex is not installed" in result.output


def test_install_inbound_setting_keeps_other_settings(homes):
(homes / "claude" / "settings.json").write_text(json.dumps({"theme": "dark"}))
_step("crossSessionInbound").apply()
Expand Down
Loading