Skip to content

feat(sandbox): railway sandbox commands (create/list/ssh/exec/destroy)#925

Merged
codyde merged 4 commits into
masterfrom
cody/sandbox
May 30, 2026
Merged

feat(sandbox): railway sandbox commands (create/list/ssh/exec/destroy)#925
codyde merged 4 commits into
masterfrom
cody/sandbox

Conversation

@codyde
Copy link
Copy Markdown
Collaborator

@codyde codyde commented May 30, 2026

What

Adds a railway sandbox command group for Project Sandboxes (gated by the PROJECT_SANDBOXES backend flag). The backend is already shipped — this is CLI-only.

Commands

  • railway sandbox create — provisions a sandbox and remembers it as the active one. Interactive workspace → project → environment picker when no project is linked (Esc steps back a level); --project/--environment for non-interactive use.
  • railway sandbox list (ls) — sandboxes in the environment, with a CREATED column; the active sandbox is marked *.
  • railway sandbox ssh (connect) — connects over the native SSH relay (sbx:<env>:<id>@ssh.railway.com). Defaults to the active sandbox, or --id <id> (environment recovered from the local store). Reuses the existing railway ssh key-registration flow and auto-selects the registered key; sends periodic sandboxHeartbeats to keep the session alive.
  • railway sandbox exec -- <cmd> — one-shot command via sandboxExec.
  • railway sandbox destroy (rm/delete) — tears down a sandbox.

Notes

  • Local store: ~/.railway/config.json gains sandboxes (id→environment cache) + active_sandbox, so ssh/exec/destroy work without re-specifying --environment.
  • No credentials injected into sandbox SSH sessions — the backend deliberately returns an empty shell env for sandbox targets; only RAILWAY_PROJECT_ID/ENVIRONMENT_ID/SANDBOX_ID context vars are present.
  • Auth: a standard railway login (user OAuth) is sufficient; RAILWAY_API_TOKEN is not required.
  • schema.json: additively adds only the Sandbox* types + the sandbox query/mutation fields (no reformat/reorder of the existing schema).
  • A single-line rotating-cube spinner covers the create/destroy waits.

Testing

Verified end-to-end against production: create → list → ssh → exec → destroy, the active-sandbox default, --id resolution, the interactive picker's data path, and the no-injection behavior.

🤖 Generated with Claude Code

codyde and others added 3 commits May 30, 2026 01:20
…estroy)

Adds a `railway sandbox` command group for Project Sandboxes (gated by the
PROJECT_SANDBOXES backend flag; backend already shipped — this is CLI-only):

- create: provision a sandbox; interactive workspace -> project -> environment
  picker when nothing is linked (Esc steps back), or --project/--environment
  for non-interactive use. Stored locally as the active sandbox.
- list: sandboxes in the environment (CREATED column, active marked *).
- ssh (alias connect): connect over the native SSH relay using the
  sbx:<env>:<id> target; defaults to the active sandbox or --id (environment
  recovered from the local store). Reuses the railway ssh key flow and
  auto-selects the registered key; sends periodic sandboxHeartbeats.
- exec: one-shot command via sandboxExec.
- destroy (alias rm/delete): tear down a sandbox.

Local store in ~/.railway/config.json (sandboxes id->env cache + active_sandbox)
lets ssh/exec/destroy run without re-specifying the environment. A rotating-cube
spinner covers the create/destroy waits.

schema.json: additively adds the Sandbox* types + sandbox query/mutation fields.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- create/destroy now use an animated single-line "shimmer" spinner: a
  rotating half-shaded cube, a light gradient sweeping across the label, and
  trailing dots that build up one at a time (precomputed as indicatif tick
  frames; degrades to plain text off-TTY).
- selection menus (workspace → project → environment) are indented ~2 columns
  via a dedicated render config so they read as running "under" the command.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…link`)

Drop the bespoke indented render config; the workspace → project →
environment picker now uses the same `prompt_options`/`prompt_options_skippable`
helpers (and default render config) as the rest of the CLI, so its look is
consistent with `railway link` et al. The shimmer spinner is unchanged. The
picker still stops at environment (sandboxes are environment-scoped — no
service selection).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codyde codyde added the release/minor Author minor release label May 30, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codyde codyde merged commit e474e43 into master May 30, 2026
6 checks passed
@codyde codyde deleted the cody/sandbox branch May 30, 2026 08:52
codyde added a commit that referenced this pull request Jun 4, 2026
…-browser-login

* origin/master: (28 commits)
  chore: Release railwayapp version 5.0.0
  feat(sandbox): fork, templates, and `--variable`/`--env-file` on create (#933)
  chore: Release railwayapp version 4.68.0
  feat(volume): include modified time in files JSON (#931)
  chore: Release railwayapp version 4.67.0
  Add service source connection support (#934)
  chore: Release railwayapp version 4.66.2
  Make GraphQL HTTP timeout configurable via RAILWAY_HTTP_TIMEOUT (#932)
  chore: Release railwayapp version 4.66.1
  feat(volume): show status and scheduled deletion date in volume list (#928)
  SSH Command: Handle Identity Files (#926)
  chore: Release railwayapp version 4.66.0
  feat(sandbox): `railway sandbox` commands (create/list/ssh/exec/destroy) (#925)
  chore: Release railwayapp version 4.65.0
  SSH Agent Support, `russh` edition. (#915)
  chore: Release railwayapp version 4.64.0
  chore: Release railwayapp version 4.63.0
  Rephrase agent advisory and gate by CLI version (#919)
  Forward --remote to setup agent in cli.new installer (#918)
  chore: Release railwayapp version 4.62.0
  ...

# Conflicts:
#	src/consts.rs
#	src/util/mod.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/minor Author minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant