service add / deploy: --endpoint http|tcp, and show a tcp service's tcp:// address

Merged
JW
7d ago
+229-15

The CLI half of InsForge/instacloud-platform#658, which adds compute endpoint tcp: a compute service reached as raw TCP on its own port, at its own IPv6 address.

insta service add compute game --image itzg/minecraft-server --port 25565 --endpoint tcp
# added compute service game … — tcp://<route_key>.ip.<region>.compute.instacloud.tech:25565
insta deploy --image app:2 --port 7000 --endpoint tcp     # switch an existing service; --endpoint http switches back

Changes

  • service add / deploy: new --endpoint <http|tcp>.
    • Parsed locally, so a typo, or a non-compute service add, fails before any network call.
    • Sent only when given, so every existing invocation sends the same body as before.
    • Which ports tcp accepts is the platform's answer and is not repeated here.
  • Archive (source-dir) lane:
    • carries endpoint in the one gated body;
    • accepts a live operation with an empty url when the platform names the tcp host (endpointHost, added in #658);
    • an empty url with no tcp host is still the "no URL" failure it always was, and that case has a control test.
  • Output:
    • service list and the service add line show tcp://<endpoint_host>:<port> for a tcp service instead of a domain, or tcp/<port> (address after the first deploy) before a deploy has confirmed the host;
    • deploy prints -> tcp://host:port;
    • --json passes endpoint / endpoint_host / endpointHost through.

Tests

  • test/endpoint-tcp.test.ts:
    • parse;
    • request bodies, both with and without the flag;
    • local refusals;
    • list and added lines, including the not-yet-deployed and http-unchanged cases;
    • deploy target;
    • archive accept and refuse.
  • Full suite: 2137 passed; typecheck clean.
  • Negative controls: each change was sabotaged in isolation and the matching test failed:
    • the list rendering;
    • the added line;
    • both bodies;
    • the deploy target;
    • archive accept and archive body;
    • the type check.

Order and companions

  • Merge order: after #658 deploys. An older platform ignores endpoint and creates an http service.
  • Command reference: InsForge/instacloud-skills cli-reference.md (AGENTS rule 4), in its own PR.
  • MCP: this is a new flag on existing leaves (service add, deploy), not a new leaf, so rule 6 does not bind. The matching endpoint argument on the MCP deploy/services tools will follow in InsForge/instacloud-mcp.

šŸ¤– Generated with Claude Code


Summary by cubic

Adds an --endpoint <http|tcp> option to service add and deploy, letting a compute service be reached as raw TCP on its own port at its own IPv6 address instead of an HTTPS domain. TCP services now show tcp://<host>:<port> (or tcp/<port> (address after the first deploy) before the host is confirmed) in service add, service list, and deploy output, and --json passes the endpoint fields through.

Details

  • The flag is parsed locally and only sent when given, so typos and non-compute services fail before any network call, and existing invocations send unchanged bodies.
  • deploy normalizes the flag before ApiClient.load() or requireProject(): either can touch the network, and requireProject() can persist an automatic link for an unlinked directory, so a typo like --endpoint tpc dies before any of that runs.
  • The archive deploy lane carries the endpoint and accepts an empty URL when the platform returns an endpointHost; the no-URL-without-host failure is unchanged.
  • Requires the platform change to be deployed first; older platforms ignore endpoint and create an HTTP service.