feat(workspace): accept repo@branch handle in worktree remove#746
Merged
Conversation
`workspace worktree remove` only accepted the two-arg `<repo> <branch>` form and rejected the `<repo>@<branch-slug>` handle that the rest of the workspace surface (list/show/path/finalize/cleanup output) prints and accepts. Copying a handle from `list`/cleanup output and pasting it into `remove` failed every time. Accept a single `<repo>@<branch-slug>` handle as the first positional in addition to the existing two-arg form. When both positionals are present the two-arg form wins as the disambiguator; a lone first arg containing `@` is split on the first `@`. The underlying ability already slugifies the branch, so passing the slug half is safe and idempotent. Closes #745
Contributor
Homeboy Results —
|
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.
Summary
workspace worktree removewas the odd one out on theworkspaceCLI surface: it only accepted the two-arg<repo> <branch>form and rejected the<repo>@<branch-slug>handle thatlist,show,path,finalize,mark-cleanup-eligible, and the cleanup dry-run output all print/accept. Copying a handle out oflist/cleanup output and pasting it intoremovefailed every time:This PR closes the gap (scoped to it — no command redesign).
Changes
removecase of theworktree()dispatcher ininc/Cli/Commands/WorkspaceCommand.phpnow accepts a single<repo>@<branch-slug>handle as the first positional, in addition to the existing two-arg<repo> <branch>form (kept for backward compat).@is split on the first@into repo + branch-slug.--forcebehavior is unchanged.@subcommanddocblock examples so--helpshows both forms.The underlying ability (
datamachine-code/workspace-worktree-remove→WorkspaceWorktreeLifecycle::worktree_remove($repo, $branch, $force)) already callsslugify_branch()internally, so passing the already-slugified branch half of a handle is safe and idempotent.Verification
php -l inc/Cli/Commands/WorkspaceCommand.php→ no syntax errors.@slug (data-machine@fix@weird→ branchfix@weird), two-arg-wins-over-@, and the missing-arg / empty error paths. No real worktrees were removed during testing — only the arg-parsing path was exercised.Closes #745