Skip to content

feat: Add CLI agent and tunnel commands - #176

Draft
mattdjenkinson wants to merge 3 commits into
mainfrom
feat/cli-agent-tunnels
Draft

feat: Add CLI agent and tunnel commands#176
mattdjenkinson wants to merge 3 commits into
mainfrom
feat/cli-agent-tunnels

Conversation

@mattdjenkinson

@mattdjenkinson mattdjenkinson commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Portless and similar CLIs need a public HTTPS URL they can create from a script and delete when the child process exits. The desktop app already does that work, but it is a GUI, so nothing on PATH can ask it for a tunnel.

The new CLI uses the same on-disk repo as the app: session, selected project, and connector key. A long-lived agent process holds the ListenNode. tunnel create calls that agent over loopback HTTP, or starts it in the background if it is not running.

JSON goes to stdout (id, url). Logs go to stderr. The default log filter is info, matching the GUI.

  • login, logout, status, and context show/list/set
  • agent start, stop, and status
  • tunnel create/list/get/delete, with --wait-hostname and --json
  • rustls crypto provider installed in the CLI so kube HTTPS does not panic
  • agent reloads selected_context.yml on tunnel calls, so a later context set is picked up without a restart

Test plan

  • cargo test -p lib
  • login, context set, and status --json
  • tunnel create --wait-hostname --json against a local HTTP server, then curl the url
  • --json prints only JSON on stdout; logs stay on stderr
  • second tunnel on the same agent; delete one; the other still serves
  • tunnel get after delete exits 1
  • agent stop; tunnel list fails; the next create auto-starts the agent
  • Vite 5.4 with the default Host check returns 403; with allowedHosts, the HMR websocket works
  • the desktop app and the CLI agent are not running against the same repo at once

Headless tools need a public URL they can create and tear down
without the desktop GUI. The agent holds the ListenNode; the CLI
talks to it over loopback HTTP and prints JSON on stdout.
Keep both the public_url tests from this branch and the quota
tests that landed on main.
Two ListenNodes with the same listen_key fight over the connector
and drop tunnels. The desktop app now starts or attaches to the
detached agent and talks to it over the control API, so quitting
the window no longer takes Portless URLs down.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant