-
Notifications
You must be signed in to change notification settings - Fork 30
🤖 feat: open existing branches as workspaces (with slash support) #1178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
ThomasK33
wants to merge
7
commits into
main
Choose a base branch
from
workspace-yd9c-hbdi
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,711
−341
Conversation
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
Two entry points for opening existing branches as workspaces: 1. **Creation Controls UI** - Toggle between 'New branch' and 'Existing branch' modes in the workspace creation flow. When in existing branch mode, shows a searchable dropdown of local + remote branches. 2. **Command Palette** - 'Open Branch as Workspace...' command (Cmd+Shift+P) with a searchable branch selector. Backend changes: - Add listRemoteBranches() to git.ts - Update BranchListResult schema to include remoteBranches - Fetch remotes before listing branches (best-effort, ensures newly pushed PR branches are visible) This enables the workflow: someone opens a PR on GitHub → you fetch → select their branch → experiment with it in an isolated workspace. Future: GitHub PR integration can layer on top - just needs to resolve PR → branch name, then feed into this existing flow. Signed-off-by: Thomas Kosiewski <[email protected]> --- _Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking: `high`_
Change-Id: Icd3157070795b352712304a8b56417ba74f28364 Signed-off-by: Thomas Kosiewski <[email protected]>
Enable creating and opening workspaces on existing git branches that contain forward slashes, a common naming convention like `feature/foo` or `bugfix/issue-123`. - Add `encodeWorkspaceNameForDir()` helper that uses `encodeURIComponent()` - `feature/foo` → directory `feature%2Ffoo` (not nested directories) - Simple names like `main` remain unchanged - Applied in WorktreeRuntime, SSHRuntime, and Config.addWorkspace() - Add `validateGitBranchName()` for worktree/SSH runtimes - Allows forward slashes (plus existing charset: a-z, 0-9, _, -) - Rejects: leading/trailing slashes, consecutive slashes, 64+ chars - Original `validateWorkspaceName()` still used for local runtime - workspaceService.create/rename/fork now choose validator based on runtime type - Git runtimes (worktree/SSH) use slash-permitting validation - Local runtime uses strict validation - Command palette now uses `metadata.name` for display (not path derivation) - Correctly displays `feature/foo` instead of `foo` or `feature%2Ffoo` - Existing workspaces continue to work (no migration needed) - Old workspace paths without encoding are handled correctly - Legacy fallback paths in config.ts unchanged Signed-off-by: Thomas Kosiewski <[email protected]> --- _Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking: `high`_ Change-Id: I650cebc612b2111cff8ae75a94a6a50fe7217165
Replace separate 'New branch' / 'Existing branch' toggle with a single combobox-style input that: - Shows matching existing branches as user types (autocomplete dropdown) - Selecting a branch from dropdown → uses existing branch, hides 'from main' - Typing a non-matching name and pressing Enter → creates new branch - Auto-generation via magic wand still works when input is empty Benefits: - Simpler, more intuitive UX - no mode switching required - Natural discovery of existing branches while typing - Consistent behavior whether creating or reusing branches Technical: - New BranchNameInput component with Popover-based autocomplete - CreationControls simplified (removed mode toggle, branch picker integration) - Trunk branch selector hidden when existing branch is selected Signed-off-by: Thomas Kosiewski <[email protected]> --- _Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking: `high`_ Change-Id: I1dd55befbd7c2902fc2ae7e095925776e6534504
- Show dropdown immediately when input is focused (not just when typing) - Add 'Create new branch' option at top when input doesn't match existing - Keep dropdown open while focused with existing branches visible - Remove 'Press Enter' hint since the create option makes it clear Change-Id: Id6c23e41008a9623762b0c6ec929038c775f140b Signed-off-by: Thomas Kosiewski <[email protected]>
- Default remoteBranches/remoteBranchGroups/recommendedTrunk in useCreationWorkspace - Update Storybook ORPC mock to include required branch fields Change-Id: Ia717febfc7f3f460c138ec96aaf73843a200a76b Signed-off-by: Thomas Kosiewski <[email protected]>
94691e8 to
ee4665d
Compare
- When the user types an exact branch name and leaves the field, auto-select the matching existing branch to keep workspace creation semantics correct - Prefer origin when the same remote branch name exists on multiple remotes - Add unit tests for selection inference Change-Id: I6b3652949bc54534096afae6616965cacc7788b3 Signed-off-by: Thomas Kosiewski <[email protected]>
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
This PR enables opening existing git branches as workspaces, including branches with forward slashes in their names (e.g.,
feature/foo,bugfix/issue-123).Features
Open Branch as Workspace - Two entry points:
Slash Support in Branch Names - Properly handles common branch naming conventions:
feature/foo→ stored asfeature%2Ffooon disk (not nested directories)feature/fooin the UITechnical Changes
encodeWorkspaceNameForDir()helper usingencodeURIComponent()for safe filesystem namesvalidateGitBranchName()validator allowing slashes (plusa-z,0-9,_,-)metadata.namefor display instead of deriving from encoded pathsBackward Compatibility
Generated with
mux• Model:anthropic:claude-opus-4-5• Thinking:high