Skip to content

codebox vscode <instance> #1

@rickmak

Description

@rickmak

Objective

1-click/line VS Code Remote SSH into a sandbox

End game DX

codebox vscode demo-project

Running this on macOS opens VS Code connected directly to the demo-project sandbox over SSH — no manual SSH config editing, no copy-pasting host aliases. The developer is dropped into the remote workspace immediately.

Proposed solution

SSH config management

codebox maintains a dedicated SSH config tree at ~/.codebox/ssh_config, using SSH's Include directive to aggregate per-instance entries:

~/.codebox/ssh_config
  Include ~/.codebox/instances/*/ssh_config  ← per-instance entries (glob)

During installation (opt-in, like shell completion), users are instructed to add one line to their ~/.ssh/config:

Include ~/.codebox/ssh_config

This means VS Code Remote SSH (and all other SSH tooling) picks up codebox-managed hosts with no additional configuration.

On codebox create, codebox writes ~/.codebox/instances/<name>/ssh_config:

Host codebox-demo-project
  HostName localhost
  User user
  Port <host-port>
  StrictHostKeyChecking no
  IdentityFile <instance-key>    # if set
  ProxyJump <remote>             # if --remote is set

On codebox delete, the per-instance file is removed.

codebox vscode <instance>

The command:

  1. Looks up the instance's host port (same logic as shell)
  2. Writes/refreshes ~/.codebox/instances/<name>/ssh_config
  3. Constructs the URI: vscode://vscode-remote/ssh-remote+codebox-<name>/home/user
  4. Opens it via open "<uri>" on macOS (xdg-open on Linux, start on Windows)

Intermediate command

Before the full vscode subcommand lands, a lower-effort stepping stone:

codebox ssh-config demo-project

Writes (or refreshes) the per-instance SSH config entry and prints:

SSH config written to ~/.codebox/instances/demo-project/ssh_config

Open in VS Code:
  open "vscode://vscode-remote/ssh-remote+codebox-demo-project/home/user"

This lets users validate the SSH config approach before the open automation is wired in, and doubles as a repair command if the config drifts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions