feat(reach): add --extra-port for ad-hoc port publishing on create#6
Merged
Conversation
Add `reach create --extra-port HOST:CONTAINER` (repeatable) and `SandboxPorts.extra: Vec<(u16, u16)>` to publish additional ports beyond the built-in vnc/novnc/health trio. Driven by a real workflow: a host process needs to drive Chrome's remote debugging port (CDP) inside the sandbox. Without extra-port mapping the only options are recreating the container manually with `docker run -p` (loses reach lifecycle management) or routing through the docker bridge IP (blocked under WSL2 + DockerDesktop). - Single-port shorthand `--extra-port 9222` expands to `9222:9222`. - Each pair propagates through HostConfig.port_bindings and ExposedPorts so docker actually publishes the mapping. - Result `SandboxPortMapping.extra` round-trips through the JSON serializer (skipped when empty so existing JSON consumers see no change), and `extract_ports` recovers it from `docker ps` output. - `reach create` summary prints any extras under an "Extra:" line. Tests: - existing docker_types JSON test still passes (extra defaults to empty Vec via the new field with serde skip_serializing_if). - value_parser unit-tested implicitly via clap on cargo build. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add `reach create --extra-port HOST:CONTAINER` (repeatable) so callers can publish additional ports from the sandbox to the host beyond the built-in vnc/novnc/health trio.
```
reach create --name todie-poster --extra-port 9222
reach create --name foo --extra-port 8080:80 --extra-port 9229:9229
```
Single-port shorthand (`--extra-port 9222`) expands to `9222:9222`.
Why
Driven by a real workflow: a host process needs to drive Chrome's remote debugging port (CDP) inside the sandbox so the host daemon can connect to a browser running under the reach desktop.
Without extra-port mapping the only options are:
Implementation
Test plan
🤖 Generated with Claude Code