feat(sandbox): offer to link directory after interactive picker#951
Merged
Conversation
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>
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.
What
When
railway sandboxcommands fall through to the interactive workspace → project → environment picker (i.e. no--project/--environmentflags and no existing link), the picker now ends by offering to save the selection as the directory link:link_projectpathrailway linkuses, printsLinked to my-project (production). Runrailway unlinkto undo.Future commands — sandbox and otherwise — skip the prompts.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/templateinvocation. The user just deliberately picked a project and environment — offering to remember it costs one Enter keypress.Design notes
railway linkandrailway initwrite the link today; this keeps that precedent. The link is durable state that steersrailway up/variables, so it shouldn't be mutated as a side effect.resolve_project_and_env/resolve_target/prompt_workspace_project_envtake&mut Configsnow; all callers already held one.Testing
cargo check+cargo test(288 passed)sandbox create→ picker → accept link → secondsandbox createshould go straight through;railway unlinkrestores the picker🤖 Generated with Claude Code