feat(cli,host-service): single-host reads with explicit host targeting
What
Local-first follow-up (supersedes the planned "fan out automations + CLI project reads" work): instead of adding org-wide fan-out to the CLI, projects and workspaces are treated as strictly host-owned. Every CLI read targets exactly one host — --host <id> when given, else this machine — and every write requires an explicit host or derives it from the targeted resource. The desktop remains the cross-host view.
Changes
host-service
workspace.listjoins inprojectName, so consumers never stitch project names from a second query. Rows for orphanedprojectIds servenull.
CLI — reads
projects list/workspaces listare now plain single-host tRPC queries (HOST/HOSTS columns dropped;--projectfilter matches the row's id or host-served name).workspaces get/openlook up the id on the target host and error with a--hosthint instead of searching the org.
CLI — writes
projects setupnow requires--host/--local(previously a silent this-machine default), matchingprojects create/workspaces create.resolveHostTarget.requestedHostIdis now required — the hidden "undefined means local" fallback is gone; every caller states its host.workspaces update/delete,agents create,terminals createtake--host(default: this machine).
CLI — automations
automations create/updateresolvetargetHostId+v2ProjectIdthrough a singleresolveAutomationTarget: the--workspace/--projectmust exist on the target host or the command throws. The CLI always writes a concretetargetHostId, so cloud dispatch's "owner's most recent online host" fallback is legacy-rows-only now.- "Pin" terminology is removed from the CLI.
Behavior changes to be aware of
- Unscoped
workspaces list/projects listnow show this machine only (previously merged all reachable org hosts). - Workspace-id commands no longer locate the workspace across the org — pass
--hostfor remote hosts. workspaces list --project <unknown-name>returns an empty list instead of erroring.
Follow-ups (not in this PR)
@superset/sdk(resources/host-workspaces.ts) still has its own org-wide fan-out; per the SDK-mirrors-CLI rule it should adopt the same single-host semantics — breaking public API change, needs its own PR. Same for MCP-v2.- Cloud side: make
automations.targetHostIdrequired in the mutation schema and retire the dispatch-time host fallback; purge "pin" language fromdispatch.ts/desktop. automations update <id> --host Xalone still repoints without validating the automation's existing project/workspace exists on X.
Testing
bun run lintclean,tsc --noEmitclean forpackages/cliandpackages/host-servicebun testinpackages/cli: 35/35 (workspaces get suite updated for the new single-host contract)
https://claude.ai/code/session_01XvFLHZHLKBKCo1tKgZFUqd
Summary by cubic
Make projects and workspaces single-host across the CLI, @superset/sdk, and mcp-v2. All reads target one host (CLI defaults to this machine); all writes require an explicit host or derive it from the resource. Docs and samples updated; tool descriptions tightened.
-
New Features
host-service:workspace.listnow includesprojectName(ornullif orphaned).- CLI:
projects listandworkspaces listquery a single host with simplified columns;--projectaccepts id or host-served name.workspaces get/open/update/delete,agents create, andterminals createtake--host(default: this machine).projects setuprequires--host/--local.resolveHostTargetnow requires a concrete host id.automations create/updatepersist concretetargetHostId+v2ProjectIdviaresolveAutomationTarget; the target resource must exist on that host; “pin” terminology removed. Addedhosts start --org. @superset/sdk: host-explicit APIs.projects.list({ hostId })reads a host’sproject.list;workspaces.list({ hostId }),workspaces.update(id, …, { hostId }),workspaces.delete(id, { hostId }),agents.create({ hostId, … }), andterminals.create({ hostId, … })all target a specific host. Workspace rows includeprojectName. Samples now guard empty host lists.mcp-v2: tools call the named host directly.projects_list({ hostId })/workspaces_list({ hostId })read from that host;agents_create,terminals_create,workspaces_update, andworkspaces_deleterequirehostIdand mutate the host.workspaces_updatenow requiresname. Tool docs tightened (e.g.,tasks_deleteis soft delete).
-
Migration
- CLI reads show only the target host; pass
--host <id>for remote hosts. - Workspace-id commands no longer locate across the org; pass
--host. projects setuprequires--host/--local.workspaces list --project <unknown-name>returns an empty list instead of erroring.@superset/sdk: pass ahostIdtoprojects.list,workspaces.list/update/delete,agents.create, andterminals.create. Thehost-workspacesfan-out helpers are removed.mcp-v2: passhostIdtoprojects_list,workspaces_list,agents_create,terminals_create, andworkspaces_update/delete;workspaces_updaterequiresname.
- CLI reads show only the target host; pass
Summary by CodeRabbit
- New Features
- Added/expanded
--hostsupport across workspace, agent-session, terminal, automation, and project CLI commands; host-scoped defaults now target this machine. - SDK/MCP operations now require an explicit
hostIdinput for host-owned actions (workspace/agents/terminals/projects tools).
- Added/expanded
- Bug Fixes
- Improved host-specific “not found” errors and stricter automation target validation, including clearer guidance when no active organization exists.
- Documentation
- Updated CLI/SDK/MCP docs to reflect host-scoped listing/output changes (e.g.,
projects listandworkspaces listschemas/filters) and revised MCP tool descriptions.
- Updated CLI/SDK/MCP docs to reflect host-scoped listing/output changes (e.g.,