Skip to content

feat(worktrees): fleet stats, best-of-N compare, overlap warnings, create-from-anything (W4-W8)#41

Merged
danielss-dev merged 3 commits into
mainfrom
feat/worktree-fleet
Jul 7, 2026
Merged

feat(worktrees): fleet stats, best-of-N compare, overlap warnings, create-from-anything (W4-W8)#41
danielss-dev merged 3 commits into
mainfrom
feat/worktree-fleet

Conversation

@danielss-dev

Copy link
Copy Markdown
Owner

Summary

The rest of the worktrees menu from docs/improvements.md (W1-W3 shipped in #40):

  • W4 setup copy-list - .worktreeinclude honored: on create, gitignored setup files (.env, local settings) matching its patterns copy from the source worktree into the fresh one (own gitignore-subset matcher; offered as a checked toggle only when the file names something). Agent-tool badges on overview rows.
  • W5 fleet stats - one workdir walk per row (background) for disk size + "touched 3m ago" activity, diff HEAD --shortstat for +/- lines; rows sort most-recently-touched first within rank.
  • W6 best-of-N compare (v1) - selection checkboxes (Space), "Compare (N)" opens one column per attempt diffed vs its own fork point, shared files highlighted, per-column Review / "Pick winner..." handing off to Merge & clean up.
  • W7 overlap warnings - pairwise dirty-file intersection badges rows ("overlaps agent-b: 1") and warns inside the merge dialog.
  • W8 create-from-anything - add_worktree grows start-point/track; the dialog gains a Start-at picker (branches / remote branches / tags / commit) with auto-track + fetch-first; "New worktree from here..." in branch + commit context menus; worktree lock/unlock engine + IPC + sidebar menu.
  • Follow-ups - archive snapshots auto-prune (newest 10 per slug, 60-day cap); sidebar worktree menu gains Review vs base + Merge & clean up; palette gains Clean up / Prune entries; Cmd+4->Cmd+5 copy drift fixed.

Test plan

  • cargo test -p strand-core - 109 passed (+7 new worktree tests: include matcher, shortstat parse, start point, include copy, stats, lock/unlock, archive auto-prune)
  • cargo clippy -p strand-core -p strand-tauri -- -D warnings - clean
  • pnpm --filter ./ui exec tsc --noEmit - clean
  • vitest run - 200 passed
  • Live CDP pass against the running app with a fixture family (3 agent worktrees, overlapping dirty edits): stats/badges render, compare + pick-winner handoff, on-disk verification of start-point + .env copy, lock/unlock round-trip via git worktree list, palette cleanup removes + archives + closes dead tabs.

🤖 Generated with Claude Code

…rktreeinclude copy, archive auto-prune

Engine half of the W4-W8 worktrees pass (docs/improvements.md):
- add_worktree grows start_point + track (worktree add [--track] -b <branch>
  <dest> [<start>]) so a task branch can cut from any branch/tag/commit
- lock_worktree(reason) / unlock_worktree shell-outs
- worktree_stats: one workdir walk (skip .git, no symlink-follow) for disk
  bytes + newest mtime, plus 'diff HEAD --shortstat' for +/- lines
- .worktreeinclude honored: worktree_include_patterns +
  copy_worktree_include copy gitignored setup files (.env, local settings)
  into a fresh worktree via a small gitignore-subset matcher (anchoring,
  **, */?, trailing-/ and basename patterns)
- archive_worktree_state now auto-prunes snapshots (newest 10 per slug,
  60-day age cap)
- five new IPC commands + start_point/track on repo_worktree_add

+7 engine tests (matcher, shortstat parse, start point, include copy,
stats, lock/unlock, auto-prune).
…create-from-anything

UI half of the W4-W8 worktrees pass:
- Overview rows show +/- lines, 'touched Nm ago' activity, and disk size
  (background per-row fetch so huge trees never delay badges); rows sort
  most-recently-touched first within their rank; agent-tool badges
  (.claude/worktrees/ paths, vk/ branches)
- Best-of-N compare (v1): selection checkboxes (Space toggles the focused
  row), 'Compare (N)' opens WorktreeCompareDialog - one column per attempt
  diffed vs its own fork point, files touched by >=2 attempts highlighted,
  per-column Review / 'Pick winner...' handing off to Merge & clean up
- Overlap warnings: pairwise dirty-file intersection badges rows and warns
  inside WorktreeMergeDialog
- Create dialog: 'Start at' picker (branches / remote branches / tags /
  handed-in commit) with auto-track + fetch-first for remote bases and
  task-branch prefill; offers the .worktreeinclude setup-file copy when the
  file names something
- 'New worktree from here...' in the sidebar local+remote branch menus and
  the commit graph context menu
- Sidebar worktree menu: Review vs base (new store-shared reviewWorktree
  action), Merge & clean up..., Lock/Unlock
- Palette: 'Clean up merged worktrees...' (switches to the overview and
  opens the confirm dialog via a strand:worktrees-cleanup event) and
  'Prune stale worktrees'

Verified end-to-end against the running app over WebView2 CDP (fixture
family with overlapping dirty worktrees): stats/badges render, compare +
pick-winner handoff, on-disk start-point + .env copy, lock/unlock
round-trip, palette cleanup removes+archives and closes dead tabs.
@danielss-dev danielss-dev merged commit 5f2cf60 into main Jul 7, 2026
2 checks passed
@danielss-dev danielss-dev deleted the feat/worktree-fleet branch July 7, 2026 22:49
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