cmux-tui: start-chat plan answers the folder's repo; start-chat ensure gets the workspace machine

Merged
TE
4d ago
+448-9

Summary

Client half of zero-setup hot start (cmuxterm-hq#5846, item 2): the first Cloud send of a chat gets a workspace machine that boots from the repository's set-up snapshot once it is ready.

  • cmux link start-chat plan reads the chat folder's GitHub origin remote (a new optional local field in the request) and answers repo (owner/name, or null). It also echoes environment, the cloud environment cloud.startChat chose (an optional env_... that the environment sheet sets, #30359).
  • New cmux link start-chat ensure --workspace W --key K --repo OWNER/NAME [--ref R] [--environment env_...] [--platform URL], with the cmux credential on stdin. It sends POST /v1/workspaces/{W}/machine to the cmux platform, with the plan's create_key as clientKey (a retry gets the same machine), plus repo, ref and environment. It prints one JSON line: {"ok":true,"machine","team","created","snapshot","environment":{"id","status"}}, or the platform's error code (for example cloud_environment.not_found).
  • cli/machine_join.rs shares its platform client (Platform, platform_origin, CallError) with the link module, gains a post call, and lists the workspace-machine error codes as known codes.

The App still makes machines via cloud.createMachine. A follow-up wires CloudStartChat+Machine.swift to call ensure when the plan has a repo. That needs CloudMoveCLI to pass the token on stdin, as AddDeviceServices does.

Testing

  • New tests in link/start_chat_cli/tests.rs: parsing GitHub remote URLs, plan against a real git folder (no origin → null, then an scp-style origin), the ensure flags and body, and how platform answers and errors map to its line.
  • cmux-ci test -- cargo test -p cmux-tui start_chat (result in a comment below).

Observed / Not run

  • Not run yet: the end-to-end send from a DEV build (it waits on the Swift wiring).

Changelog

none

šŸ¤– Generated with Claude Code
Agent session: agent session