Skip to content
Python

CLI: join and up at the top level; one spelling per command

Rohit C Prasade0c7b6eeb0de
diff --git a/coworker/cli.py b/coworker/cli.py
index a3d6cd9b..87cb69e5 100644
--- a/coworker/cli.py
+++ b/coworker/cli.py
@@ -1,10 +1,9 @@
"""CLI entry point.
-Public surface: `openworker machine <command>` (run headless, joined to a controller),
-`openworker version`, and help. Everything else is unlisted until it has been tested as a
-product surface: the terminal UI (`openworker tui`, or a skill name as before) and the
-older top-level spellings of the machine commands (`openworker join …`), which enrolled
-boxes and their service units still use.
+Public surface: `openworker join <link>` and `openworker up` (the two everyday commands),
+`openworker machine <command>` (status, keys, logs, service, leave), `openworker version`,
+and help. The terminal UI (`openworker tui`, or a skill name as before) is unlisted until
+it has been tested as a product surface.
"""
from __future__ import annotations
@@ -22,33 +21,49 @@ from .permissions import Mode
from .secrets import state_dir
-REMOTE_COMMANDS = ("join", "auth", "up", "status", "leave", "secrets", "keys", "service")
-
HELP = """\
usage: openworker <command>
OpenWorker — an open-source AI coworker you govern.
commands:
- machine run this computer as a headless OpenWorker machine
- join <link> enroll with the join link from the app, then serve
- auth join <url> enroll by approving a code in the app, then serve
- up serve again with the stored identity
- status show enrollment and the sealing-key fingerprint (--json)
- keys manage provider keys stored on this machine
- service run `up` as a background service (systemd, launchd)
- logs show the service's log (-f to follow)
- leave forget this machine's enrollment and identity
- version print the version
-
-Run `openworker machine <command> --help` for details.
+ join <link> enroll this computer as a machine, then serve
+ (the link comes from the app: Settings > Machines > Add a machine;
+ give the controller's address instead to approve a code there)
+ up serve again with the stored identity
+ machine manage this machine
+ status show enrollment and the sealing-key fingerprint (--json)
+ keys manage provider keys stored on this machine
+ logs show the service's log (-f to follow)
+ service run `up` as a background service (systemd, launchd)
+ leave forget this machine's enrollment and identity
+ version print the version
+
+Run `openworker <command> --help` for details.
Desktop app and docs: https://openworker.com
"""
+# Typed at the wrong level: say where the command lives, rather than letting it fall
+# through to the terminal UI as an unknown skill.
+_AT_TOP = {"join": "join", "up": "up"}
+_UNDER_MACHINE = {
+ "status": "status", "keys": "keys", "secrets": "keys", "logs": "logs",
+ "service": "service", "leave": "leave",
+}
+
+
+def _moved(typed: str, now: str) -> None:
+ import sys
+
+ print(f"error: `openworker {typed}` is `openworker {now}`.", file=sys.stderr)
+ raise SystemExit(2)
+
def main(argv: Optional[list[str]] = None) -> None:
import sys
+ from .remote.joiner import MACHINE_COMMANDS, TOP_COMMANDS
+
args = list(sys.argv[1:] if argv is None else argv)
if not args or args[0] in ("-h", "--help", "help"):
print(HELP, end="")
@@ -58,16 +73,21 @@ def main(argv: Optional[list[str]] = None) -> None:
print(f"openworker {app_version()}")
return
- if args[0] == "machine":
+ if args[0] in TOP_COMMANDS:
from .remote.joiner import cli as remote_cli
- raise SystemExit(remote_cli(args[1:] or ["--help"]))
- # The older top-level spellings (`openworker join <url>`, `openworker up`): unlisted, kept
- # working — they must win over the terminal UI's positional `skill` argument.
- if args[0] in REMOTE_COMMANDS:
+ raise SystemExit(remote_cli(args, prog="openworker", only=TOP_COMMANDS))
+ if args[0] == "machine":
from .remote.joiner import cli as remote_cli
- raise SystemExit(remote_cli(args))
+ rest = args[1:] or ["--help"]
+ if rest[0] in _AT_TOP:
+ _moved(f"machine {rest[0]}", _AT_TOP[rest[0]])
+ raise SystemExit(remote_cli(rest, prog="openworker machine", only=MACHINE_COMMANDS))
+ if args[0] in _UNDER_MACHINE:
+ _moved(args[0], f"machine {_UNDER_MACHINE[args[0]]}")
+ if args[0] == "auth":
+ _moved("auth join <address>", "join <address>")
if args[0] == "tui":
args = args[1:]
diff --git a/coworker/remote/acceptor.py b/coworker/remote/acceptor.py
index 90acaa95..fe45d81f 100644
--- a/coworker/remote/acceptor.py
+++ b/coworker/remote/acceptor.py
@@ -41,7 +41,7 @@ from .stores import Ephemera, InMemoryEphemera, Registry
TOKEN_TTL_SECONDS = 600.0
_CHALLENGE_BYTES = 32
-# Device-authorization flow (`openworker machine auth join`): the box asks, the user
+# Device-authorization flow (`openworker join`): the box asks, the user
# approves in the controller UI, approval mints the one join token.
DEVICE_TTL_SECONDS = 900.0
DEVICE_POLL_SECONDS = 5
@@ -289,7 +289,7 @@ def mount_acceptor(
# whether a token is valid to an unauthenticated caller.
return PlainTextResponse(
"This is an OpenWorker join URL. On the machine you want to add, run:\n"
- " openworker machine join <this URL> [--name=my-box]\n"
+ " openworker join <this URL> [--name=my-box]\n"
)
@app.post("/v1/remote/arm")
@@ -314,7 +314,7 @@ def mount_acceptor(
acceptor.disarm()
return {"armed": False}
- # -- device-authorization flow (`openworker machine auth join`) --------------------
+ # -- device-authorization flow (`openworker join`) --------------------
# start/poll are machine-facing and tokenless (like /j/ and /ws/machine);
# listing and approve/deny ride the GUI's sidecar-token middleware. The
# approval MINTS the one join token, bound to the requesting identity —
diff --git a/coworker/remote/joiner.py b/coworker/remote/joiner.py
index 56e751ba..bc8a7004 100644
--- a/coworker/remote/joiner.py
+++ b/coworker/remote/joiner.py
@@ -1,4 +1,4 @@
-"""The box side of remote homes: `openworker join / up / status / leave`.
+"""The box side of remote homes: `openworker join`, `openworker up`, `openworker machine …`.
Joined mode runs the ENTIRE existing server — state dir, engines, the full
ASGI app — with no listener at all. `joiner` dials the controller, proves its
@@ -547,21 +547,49 @@ def _lifespan(app):
# -- CLI ----------------------------------------------------------------------
-def cli(argv: Optional[list[str]] = None, prog: str = "openworker machine") -> int:
+TOP_COMMANDS = ("join", "up")
+MACHINE_COMMANDS = ("status", "keys", "logs", "service", "leave")
+
+
+class _Only:
+ """Registers a subcommand only when the caller's view includes it; the rest get a
+ throwaway parser, so one definition serves `openworker`, `openworker machine` and tests."""
+
+ def __init__(self, sub, only):
+ self._sub, self._only = sub, only
+
+ def add_parser(self, name, **kw):
+ if self._only is None or name in self._only:
+ return self._sub.add_parser(name, **kw)
+ return argparse.ArgumentParser(add_help=False)
+
+
+def cli(
+ argv: Optional[list[str]] = None,
+ prog: str = "openworker",
+ only: Optional[tuple[str, ...]] = None,
+) -> int:
+ """`only` limits the subcommands offered: TOP_COMMANDS for `openworker join|up`,
+ MACHINE_COMMANDS for `openworker machine …`; None offers all of them."""
from ..secrets import state_dir
argv = list(sys.argv[1:] if argv is None else argv)
- # `keys` is the public name; `secrets` is the older spelling and keeps working.
- if argv and argv[0] == "secrets":
- argv[0] = "keys"
parser = argparse.ArgumentParser(
prog=prog,
- description="Run this OpenWorker headless, joined to a controller (the desktop app or OpenWorker Cloud).",
+ description=(
+ "Manage this machine."
+ if only == MACHINE_COMMANDS
+ else "Run this OpenWorker headless, joined to a controller (the desktop app or OpenWorker Cloud)."
+ ),
)
- sub = parser.add_subparsers(dest="command", required=True)
+ sub = _Only(parser.add_subparsers(dest="command", required=True), only)
p_join = sub.add_parser("join", help="enroll with a controller and start serving")
- p_join.add_argument("url", help="join URL from the controller (…/j/<token>)")
+ p_join.add_argument(
+ "url",
+ help="the join link from the app (…/j/<token>), or the controller's address to "
+ "enroll by approving a code there",
+ )
p_join.add_argument("--name", default=None, help="machine name (default: hostname)")
# `auth join`: no token in hand — ask the controller for approval (device
@@ -629,7 +657,15 @@ def cli(argv: Optional[list[str]] = None, prog: str = "openworker machine") -> i
return 2
+def _is_controller_address(url: str) -> bool:
+ """A bare address (no path): enroll by approving a code there, not with a link."""
+ parts = urlsplit(url if "://" in url else f"//{url}")
+ return bool(parts.netloc) and parts.path in ("", "/") and not parts.query
+
+
def _cmd_join(state: Path, url: str, name: Optional[str]) -> int:
+ if _is_controller_address(url):
+ return _cmd_auth_join(state, url, name)
try:
controller, token = parse_join_url(url)
except ValueError as exc:
@@ -713,7 +749,7 @@ def _cmd_up(state: Path) -> int:
cfg = load_remote_config(state)
if cfg is None:
print(
- "error: this machine has not joined a controller (run `openworker machine join <link>`)",
+ "error: this machine has not joined a controller (run `openworker join <link>`)",
file=sys.stderr,
)
return 2
@@ -843,7 +879,7 @@ def _cmd_service(state: Path, args, platform: Optional[str] = None, home: Option
if platform != "linux":
print(
"error: `service` supports Linux (systemd) and macOS (launchd). Here, run "
- "`openworker machine up` in a terminal that stays open.",
+ "`openworker up` in a terminal that stays open.",
file=sys.stderr,
)
return 2
@@ -870,7 +906,7 @@ def _cmd_service(state: Path, args, platform: Optional[str] = None, home: Option
if cfg is None:
print(
"error: this machine has not joined a controller yet — run "
- "`openworker machine join <link>` first, then install the service.",
+ "`openworker join <link>` first, then install the service.",
file=sys.stderr,
)
return 2
@@ -1012,7 +1048,7 @@ def _cmd_service_macos(state: Path, args, home: Path) -> int:
if cfg is None:
print(
"error: this machine has not joined a controller yet — run "
- "`openworker machine join <link>` first, then install the service.",
+ "`openworker join <link>` first, then install the service.",
file=sys.stderr,
)
return 2
@@ -1090,7 +1126,7 @@ def _cmd_logs(state: Path, args, platform: Optional[str] = None) -> int:
if platform == "darwin" and not service_log_path(state).exists():
print(
"no service log yet. Logs are kept when this machine runs as a service "
- "(`openworker machine service install`); in a terminal, `up` prints them there.",
+ "(`openworker machine service install`); in a terminal, `openworker up` prints them there.",
file=sys.stderr,
)
return 1
diff --git a/coworker/remote/stores.py b/coworker/remote/stores.py
index 01d3ed59..fcc770fe 100644
--- a/coworker/remote/stores.py
+++ b/coworker/remote/stores.py
@@ -100,7 +100,7 @@ class Ephemera(Protocol):
leases have no TTL — a process death releases them with the process."""
...
- # Device-authorization grants (`openworker auth join`): a box's pending
+ # Device-authorization grants (`openworker join <address>`): a box's pending
# request to be approved. Keyed by device_code (secret, box-held); looked
# up by user_code (short, human-typed) on the approval side.
def put_grant(self, grant: dict[str, Any]) -> None: ...
diff --git a/coworker/server/run.py b/coworker/server/run.py
index 5eba5f6a..40cd9ac9 100644
--- a/coworker/server/run.py
+++ b/coworker/server/run.py
@@ -142,7 +142,7 @@ _ENGINE_LOCK = None
def _warn_if_state_shared() -> None:
"""The desktop sidecar runs on a random port precisely so it can coexist with
a hand-run `openworker-server` on the same state dir, so this entrypoint only
- WARNS about a second engine (statelock.py). `openworker machine up` refuses outright;
+ WARNS about a second engine (statelock.py). `openworker up` refuses outright;
set COWORKER_STATE_LOCK=strict to make this server refuse too."""
global _ENGINE_LOCK
from ..statelock import EngineBusy, acquire
diff --git a/docs/remote-machines.md b/docs/remote-machines.md
index a1718b26..fda8bfbe 100644
--- a/docs/remote-machines.md
+++ b/docs/remote-machines.md
@@ -81,7 +81,7 @@ supervisor to keep it up unattended.
3. Copy the one-line command from the card and run it on the machine:
```bash
-openworker machine join http://127.0.0.1:8765/j/<token> --name=my-box
+openworker join http://127.0.0.1:8765/j/<token> --name=my-box
```
The card flips to **“✓ my-box joined”** and shows the machine's key
@@ -139,7 +139,7 @@ To keep the machine serving across logouts and reboots, on the machine:
openworker machine service install
```
-This writes and enables a systemd user unit running `openworker machine up`
+This writes and enables a systemd user unit running `openworker up`
(auto-restart, 5s backoff). To also run without anyone logged in:
```bash
diff --git a/packaging/install.sh b/packaging/install.sh
index 933899b8..d874c2a7 100755
--- a/packaging/install.sh
+++ b/packaging/install.sh
@@ -82,7 +82,7 @@ main() {
say ""
say "Next:"
say " 1. In the OpenWorker app: Settings > Machines > Add a machine, and copy the join link."
- say " 2. Here: openworker machine join <link>"
+ say " 2. Here: openworker join <link>"
say " 3. To keep it running in the background: openworker machine service install"
}
diff --git a/surfaces/gui/e2e/machines.spec.ts b/surfaces/gui/e2e/machines.spec.ts
index 91c2b8d2..3011ca50 100644
--- a/surfaces/gui/e2e/machines.spec.ts
+++ b/surfaces/gui/e2e/machines.spec.ts
@@ -68,7 +68,7 @@ test("enrollment: arming shows the one-liner, a joining box flips the card", asy
await page.getByText("Add a machine…").click();
await expect(page.getByTestId("join-command")).toContainText(
- "openworker machine join http://127.0.0.1:9787/j/e2e-token",
+ "openworker join http://127.0.0.1:9787/j/e2e-token",
);
await expect(page.getByText(/Waiting for the machine/)).toBeVisible();
await expect(page.getByTestId("token-countdown")).toContainText("token expires in");
diff --git a/surfaces/gui/src/api.ts b/surfaces/gui/src/api.ts
index 9f2ac3b3..78226728 100644
--- a/surfaces/gui/src/api.ts
+++ b/surfaces/gui/src/api.ts
@@ -3208,7 +3208,7 @@ export async function getMe(): Promise<MeInfo> {
return r.json();
}
-// -- device-flow approval (`openworker machine auth join` — typed-code, GitHub-style) --
+// -- device-flow approval (`openworker join` — typed-code, GitHub-style) --
export interface DeviceRequestDetail {
user_code: string;
diff --git a/surfaces/gui/src/components/MachinesSection.test.tsx b/surfaces/gui/src/components/MachinesSection.test.tsx
index 32de836f..08b02f5b 100644
--- a/surfaces/gui/src/components/MachinesSection.test.tsx
+++ b/surfaces/gui/src/components/MachinesSection.test.tsx
@@ -76,7 +76,7 @@ describe("MachinesSection", () => {
fireEvent.click(screen.getByText("Add a machine…"));
await waitFor(() =>
expect(screen.getByTestId("join-command").textContent).toContain(
- "openworker machine join http://127.0.0.1:9787/j/tok123",
+ "openworker join http://127.0.0.1:9787/j/tok123",
),
);
expect(armCalls).toBe(1);
diff --git a/surfaces/gui/src/components/MachinesSection.tsx b/surfaces/gui/src/components/MachinesSection.tsx
index 0267a5bd..2929d9e4 100644
--- a/surfaces/gui/src/components/MachinesSection.tsx
+++ b/surfaces/gui/src/components/MachinesSection.tsx
@@ -453,7 +453,7 @@ export function MachinesSection() {
// The signed-in identity + org switcher moved to Settings ▸ Account
// (UX-046 tail, 2026-08-30) — this page is the fleet list only.
-// Typed-code approval for `openworker machine auth join` (GitHub device-flow style).
+// Typed-code approval for `openworker join` (GitHub device-flow style).
// The machine printed a code; the user types it here, checks the fingerprint
// against what the machine printed, and decides. Approval mints the one join
// token, bound to that machine's identity — a mistyped code shows a stranger's
@@ -561,7 +561,7 @@ function ApproveMachineCard({
components={{
cmd: (
<span className="font-mono text-ink">
- {`openworker machine auth join <${t("machines.approve.this_url")}>`}
+ {`openworker join <${t("machines.approve.this_url")}>`}
</span>
),
}}
@@ -690,7 +690,7 @@ function AddMachineCard({
return "9787";
}
})();
- const command = joinUrl ? `openworker machine join ${joinUrl} --name=my-box` : "…";
+ const command = joinUrl ? `openworker join ${joinUrl} --name=my-box` : "…";
const copy = async () => {
if (!joinUrl) return;
diff --git a/surfaces/gui/src/routes.ts b/surfaces/gui/src/routes.ts
index 4db09bfe..a52e35b0 100644
--- a/surfaces/gui/src/routes.ts
+++ b/surfaces/gui/src/routes.ts
@@ -4,7 +4,7 @@
// before the first rewrite.
//
// #/approve/XXXX-XXXX → open Settings ▸ Machines with the code prefilled
-// (what `openworker machine auth join` prints on hosted)
+// (what `openworker join` prints on hosted)
// #/s/{sessionId} → land on that session (bookmark/refresh)
// #/settings/{page}?m={id} → open that Settings page; ?m= is the machine
// scope for machine-scoped pages (UX-046)
diff --git a/tests/test_cli_surface.py b/tests/test_cli_surface.py
index 97c5c47b..c37e006d 100644
--- a/tests/test_cli_surface.py
+++ b/tests/test_cli_surface.py
@@ -1,5 +1,6 @@
-"""The public CLI surface: `openworker machine …`, `version`, and help that lists them.
-Older top-level spellings stay working (enrolled boxes and their service units use them)."""
+"""The public CLI surface: `openworker join` and `openworker up` (the everyday pair),
+`openworker machine …` (status, keys, logs, service, leave), `version`, and help that lists
+them. There is one spelling for each command; typing one at the wrong level says where it is."""
import pytest
@@ -7,11 +8,11 @@ from coworker import cli as ow_cli
from coworker.remote import joiner
-def test_no_arguments_prints_help_that_lists_the_machine_commands(capsys):
+def test_no_arguments_prints_help_that_lists_every_public_command(capsys):
ow_cli.main([])
out = capsys.readouterr().out
assert "usage: openworker <command>" in out
- for verb in ("machine", "join", "up", "status", "keys", "service", "leave", "version"):
+ for verb in ("join <link>", "up", "machine", "status", "keys", "logs", "service", "leave", "version"):
assert verb in out
# Unlisted until tested as a product surface.
for hidden in ("tui", "sessions", "inbox", "doctor"):
@@ -31,7 +32,7 @@ def test_version(flag, capsys):
assert out.startswith("openworker ") and out.split()[1][0].isdigit()
-def test_machine_group_runs_the_headless_commands(tmp_path, monkeypatch, capsys):
+def test_machine_group_runs_the_management_commands(tmp_path, monkeypatch, capsys):
monkeypatch.setenv("COWORKER_STATE_DIR", str(tmp_path))
with pytest.raises(SystemExit) as exc:
ow_cli.main(["machine", "status"])
@@ -39,25 +40,63 @@ def test_machine_group_runs_the_headless_commands(tmp_path, monkeypatch, capsys)
assert "not joined" in capsys.readouterr().out
-def test_machine_with_no_command_shows_its_help(capsys):
+def test_machine_with_no_command_shows_its_help_without_join_or_up(capsys):
with pytest.raises(SystemExit) as exc:
ow_cli.main(["machine"])
assert exc.value.code == 0
- assert "usage: openworker machine" in capsys.readouterr().out
+ out = capsys.readouterr().out
+ assert "usage: openworker machine" in out and "{status,logs,keys,leave,service}" in out
-def test_older_top_level_spelling_still_works(tmp_path, monkeypatch, capsys):
+def test_up_is_a_top_level_command(tmp_path, monkeypatch, capsys):
monkeypatch.setenv("COWORKER_STATE_DIR", str(tmp_path))
with pytest.raises(SystemExit) as exc:
- ow_cli.main(["status"])
- assert exc.value.code == 0
- assert "not joined" in capsys.readouterr().out
+ ow_cli.main(["up"])
+ assert exc.value.code == 2 # never joined
+ assert "openworker join <link>" in capsys.readouterr().err
+
+
+def test_join_is_a_top_level_command_and_checks_its_link(tmp_path, monkeypatch, capsys):
+ monkeypatch.setenv("COWORKER_STATE_DIR", str(tmp_path))
+ with pytest.raises(SystemExit) as exc:
+ ow_cli.main(["join", "http://host:1/wrong/tok"])
+ assert exc.value.code == 2
+
+
+def test_join_with_a_bare_address_means_approve_a_code_there(tmp_path, monkeypatch):
+ """One verb for both ways in: a link enrolls directly; a controller's address starts the
+ approve-a-code flow (what used to be spelled `auth join`)."""
+ seen = {}
+ monkeypatch.setattr(joiner, "_cmd_auth_join", lambda state, url, name: seen.update(url=url, name=name) or 0)
+ assert joiner.cli(["join", "https://machines.example.com", "--name", "box"]) == 0
+ assert seen == {"url": "https://machines.example.com", "name": "box"}
+ assert joiner._is_controller_address("http://127.0.0.1:8765/")
+ assert not joiner._is_controller_address("http://127.0.0.1:8765/j/abc")
+ assert not joiner._is_controller_address("http://host:1/wrong/tok")
+
+
+ "typed, now",
+ [
+ (["status"], "machine status"),
+ (["secrets", "list"], "machine keys"),
+ (["service", "install"], "machine service"),
+ (["machine", "up"], "up"),
+ (["machine", "join", "http://h/j/t"], "join"),
+ (["auth", "join", "http://h"], "join <address>"),
+ ],
+)
+def test_a_command_typed_at_the_wrong_level_says_where_it_lives(typed, now, capsys):
+ with pytest.raises(SystemExit) as exc:
+ ow_cli.main(typed)
+ assert exc.value.code == 2
+ assert f"is `openworker {now}`" in capsys.readouterr().err
-def test_keys_is_the_public_name_and_secrets_still_works(tmp_path, monkeypatch, capsys):
+def test_keys_stores_a_key_and_never_prints_it(tmp_path, monkeypatch, capsys):
monkeypatch.setenv("COWORKER_STATE_DIR", str(tmp_path))
assert joiner.cli(["keys", "set", "openai", "api_key=sk-local"]) == 0
- assert joiner.cli(["secrets", "list"]) == 0
+ assert joiner.cli(["keys", "list"]) == 0
out = capsys.readouterr().out
assert "openai" in out and "sk-local" not in out
@@ -160,7 +199,7 @@ def test_macos_service_install_refuses_a_twin_on_the_same_state_dir(tmp_path, mo
def test_service_needs_a_joined_machine_and_a_supported_platform(tmp_path, capsys):
args = argparse.Namespace(service_command="install", force=False)
assert joiner._cmd_service(tmp_path, args, platform="darwin", home=tmp_path) == 2
- assert "machine join" in capsys.readouterr().err
+ assert "openworker join <link>" in capsys.readouterr().err
assert joiner._cmd_service(tmp_path, args, platform="win32", home=tmp_path) == 2
assert "systemd" in capsys.readouterr().err
@@ -184,7 +223,7 @@ def test_install_script_is_valid_posix_shell_and_runs_nothing_if_truncated():
assert subprocess.run([exe, "-n", str(INSTALL_SH)]).returncode == 0
# No sudo, and it points people at the public command spelling.
assert "sudo" not in text.replace("(no sudo)", "")
- assert "openworker machine join <link>" in text
+ assert "openworker join <link>" in text
def test_install_script_refuses_an_unsupported_os(tmp_path):
diff --git a/tests/test_remote_home.py b/tests/test_remote_home.py
index 340b8bfd..29c87ce6 100644
--- a/tests/test_remote_home.py
+++ b/tests/test_remote_home.py
@@ -467,7 +467,7 @@ async def _device_approve_cycle(client, base: str, fingerprint: str, name: str =
async def test_device_flow_mints_identity_bound_token(tmp_path):
- # `openworker auth join`: the box asks, the user approves a NAMED identity,
+ # `openworker join <address>`: the box asks, the user approves a NAMED identity,
# approval mints the one join token — bound so only that identity can use it.
import websockets
@@ -1074,15 +1074,15 @@ def test_secrets_cli_set_and_list(tmp_path, capsys, monkeypatch):
from coworker.remote import joiner
monkeypatch.setenv("COWORKER_STATE_DIR", str(tmp_path / "s-state"))
- assert joiner.cli(["secrets", "set", "openai", "api_key=sk-local"]) == 0
+ assert joiner.cli(["keys", "set", "openai", "api_key=sk-local"]) == 0
assert "stored profile 'openai'" in capsys.readouterr().out
- assert joiner.cli(["secrets", "list"]) == 0
+ assert joiner.cli(["keys", "list"]) == 0
assert "openai" in capsys.readouterr().out
from coworker.secrets import SecretStore
store = SecretStore(tmp_path / "s-state" / "secrets.json")
assert store.get("openai") == {"api_key": "sk-local"}
- assert joiner.cli(["secrets", "set", "bad", "no-equals"]) == 2
+ assert joiner.cli(["keys", "set", "bad", "no-equals"]) == 2
# -- bridged session WebSocket (P1c) -------------------------------------------
@@ -1311,7 +1311,7 @@ def test_openworker_cli_routes_remote_verbs(monkeypatch, tmp_path, capsys):
monkeypatch.setenv("COWORKER_STATE_DIR", str(tmp_path / "route-state"))
with pytest.raises(SystemExit) as exit_info:
- ow_cli.main(["status"])
+ ow_cli.main(["machine", "status"])
assert exit_info.value.code == 0
assert "not joined" in capsys.readouterr().out