Skip to content

feat(sandbox): offer to link directory after interactive picker#951

Merged
codyde merged 1 commit into
masterfrom
feat/sandbox-offer-link
Jun 5, 2026
Merged

feat(sandbox): offer to link directory after interactive picker#951
codyde merged 1 commit into
masterfrom
feat/sandbox-offer-link

Conversation

@codyde
Copy link
Copy Markdown
Collaborator

@codyde codyde commented Jun 5, 2026

What

When railway sandbox commands fall through to the interactive workspace → project → environment picker (i.e. no --project/--environment flags and no existing link), the picker now ends by offering to save the selection as the directory link:

? Link this directory to my-project (production)? (Y/n)
  • Yes (default): persists via the same link_project path railway link uses, prints Linked to my-project (production). Run railway unlink to undo. Future commands — sandbox and otherwise — skip the prompts.
  • No / Esc: proceeds without linking; the sandbox operation continues unaffected.

Why

The sandbox commands already honor an existing link (precedence: flags → linked project/environment → picker), but in an unlinked directory the full three-level picker re-runs on every create/list/template invocation. The user just deliberately picked a project and environment — offering to remember it costs one Enter keypress.

Design notes

  • Explicit consent, not silent linking. Only railway link and railway init write the link today; this keeps that precedent. The link is durable state that steers railway up/variables, so it shouldn't be mutated as a side effect.
  • Picker path only. The prompt never appears when the project came from a flag or an existing link — passing explicit flags signals the user doesn't want directory state touched.
  • resolve_project_and_env/resolve_target/prompt_workspace_project_env take &mut Configs now; all callers already held one.

Testing

  • cargo check + cargo test (288 passed)
  • Not yet manually exercised — suggested verification: unlinked dir → sandbox create → picker → accept link → second sandbox create should go straight through; railway unlink restores the picker

🤖 Generated with Claude Code

The sandbox commands already honor an existing `railway link` (flags →
link → picker), but when a directory is unlinked the full workspace →
project → environment picker re-runs on every create/list. After the
picker now asks "Link this directory to <project> (<env>)?" (default
yes; Esc/no proceeds without linking) and persists via the same
link_project path `railway link` uses, so follow-up commands skip the
prompts. Linking stays explicit-consent only, matching `link`/`init`
precedent — no silent writes from flag or already-linked paths.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codyde codyde added the release/patch Author patch release label Jun 5, 2026
@codyde codyde merged commit 2734bff into master Jun 5, 2026
6 of 7 checks passed
@codyde codyde deleted the feat/sandbox-offer-link branch June 5, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/patch Author patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant