Skip to content

feat: grove convert CLI subcommand#28

Merged
rrbe merged 2 commits into
mainfrom
feat/grove-convert
May 21, 2026
Merged

feat: grove convert CLI subcommand#28
rrbe merged 2 commits into
mainfrom
feat/grove-convert

Conversation

@rrbe
Copy link
Copy Markdown
Owner

@rrbe rrbe commented May 21, 2026

Summary

  • Add grove convert [path] — extracts the main worktree's current branch into a separate worktree and switches the main worktree onto the configured base branch
  • Extend grove shell-init so the wrapper auto-cds into the new worktree after grove convert (matching how grove cd already works)
  • Output convention: worktree path goes to stdout, all logs go to stderr, so cd "$(grove convert)" works without flags

Behavior

  • Branch is always the main worktree's current HEAD (no positional branch arg)
  • Refuses when: main is in detached HEAD, main is already on the base branch, working tree is dirty, or the target path already exists (pre-flight check avoids the half-converted state)
  • Runs pre-create / post-create hooks by default; --no-hooks to skip
  • -b/--base overrides the base branch to switch the main worktree onto

Test plan

  • cargo test — 5 new unit tests for plan_convert cover detached HEAD / on-base / dirty / no-main / happy path
  • cargo clippy --all-targets -- -D warnings clean
  • Manual E2E: convert succeeds, main switches to base, worktree appears at the target path, shell wrapper auto-cds into it
  • Manual E2E: dirty / detached / on-base errors trigger correctly without touching state

🤖 Generated with Claude Code

rrbe and others added 2 commits May 21, 2026 11:42
Extract the main worktree's current branch into a separate worktree:
switches the main worktree onto the configured base branch, then adds a
new worktree for the previously-checked-out branch. Pre-create / post-create
hooks run by default (--no-hooks to skip).

The shell-init wrapper now auto-cds into the new worktree after a
successful `grove convert`, mirroring the existing `grove cd` behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replace scan_worktrees with targeted current_branch + git_status_details
to avoid the per-worktree status sweep and the gh pr list network call —
only the main worktree's branch and dirty flag are needed.

Route the phase-1 git switch through git::run_git_text instead of a raw
Command, matching the rest of the codebase. Drop the single-field
ConvertPlan wrapper, drop a redundant base_ref pass-through (the planner
already falls back to the configured default), and trim WHAT comments.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rrbe rrbe merged commit d111ad8 into main May 21, 2026
3 checks passed
@rrbe rrbe deleted the feat/grove-convert branch May 21, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant