Conversation
When creating a new worktree, copy whitelisted build directories (node_modules, .next, target, dist, etc.) from the most recently run worktree for the same repo context. On macOS (APFS), `cp -Rc` uses clonefile() for instant, zero-cost copies that share physical disk blocks until one side diverges. On Linux, `cp -R --reflink=auto` provides the same on Btrfs/XFS. Only directories that are both in the hardcoded whitelist AND gitignored are copied, preventing accidental duplication of tracked source directories. The copy is best-effort: failures are logged but never block worktree creation. Implementation: - Migration 0012: adds `last_run_worktree_path` to `action_contexts` - `build_dir_copy` module: whitelist, gitignore check, platform copy - `branches.rs`: invokes copy after worktree creation - `actions/commands.rs`: updates `last_run_worktree_path` on action run Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the flat whitelist check at the subpath root with a bounded recursive walk (depth <= 5) of the entire worktree. This finds build directories at all levels — root node_modules, intermediate node_modules in monorepo packages, Rust target dirs, etc. — not just those directly under the subpath. The walk skips .git, prunes on match (no recursion into copied dirs), and preserves all existing safety checks (whitelist AND gitignored). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove dist, target, .venv, and .cache from the build directory whitelist — these carry medium or higher risk of stale output, broken paths, or unexpected disk usage. Keep only low/very-low risk entries (node_modules, .next, .turbo, .svelte-kit, __pycache__) plus build which was explicitly requested. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add Xcode's DerivedData directory to the build directory whitelist. This gives new worktrees a warm Xcode build cache when projects use a project-relative DerivedData path, avoiding expensive clean builds. Low risk: APFS CoW is guaranteed on macOS, Xcode handles staleness via its incremental build system, and the name is Xcode-specific with no collision concerns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add a per-repo opt-in toggle for the build directory copy feature. The setting defaults to off and is gated behind an "Experimental" badge in repo settings. Both worktree setup paths now check copy_build_dirs_enabled before copying. - Migration 0013: adds copy_build_dirs_enabled column (default 0) - Store: new set_copy_build_dirs_enabled method - Tauri: new set_copy_build_dirs_enabled command - UI: checkbox + Experimental badge in repo settings panel Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Main branch added 0012-soft-delete-comments while this branch had 0012-add-last-run-worktree, causing a "Multiple migrations detected for migration id: 12" panic at startup. Renumber our migrations to 0013 and 0014. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a9d5178821
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| await commands.setCopyBuildDirsEnabled(selectedContext.id, enabled); | ||
| contexts = contexts.map((c) => | ||
| c.id === selectedContext!.id ? { ...c, copyBuildDirsEnabled: enabled } : c |
There was a problem hiding this comment.
Capture context ID before awaiting checkbox update
The onchange handler reads selectedContext again after await commands.setCopyBuildDirsEnabled(...), so if the user switches to another repo context before the promise resolves, the post-await contexts.map(...) can update the wrong context (or throw if selection becomes null). This makes the UI reflect an incorrect toggle state for a different repo context; capture the original contextId in a local variable before await and use that for both the command and state update.
Useful? React with 👍 / 👎.
Adds experimental build directory copying between worktrees with APFS cloning, recursive whitelist discovery, settings UI, and persisted opt-in state.