feat: add per-project worktree base directory configuration #1990
+292
−49
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.
Closes #1830 #1620
Summary
Allow users to configure a custom directory where git worktrees are created for each project, instead of using the system temp directory (e.g.,
/var/folders/.../vibe-kanban-dev/worktrees).This is useful for:
~/my-project-worktrees)Changes
Database
20260112000000_add_worktree_base_dir_to_projects.sql): Addsworktree_base_dir TEXT DEFAULT NULLcolumn to projects tableBackend
crates/db/src/models/project.rsworktree_base_dirfield toProjectandUpdateProjectstructs, updated all SQL queriescrates/server/src/routes/projects.rsvalidate_worktree_dir()crates/utils/src/path.rsvalidate_worktree_dir()(checks path exists, is directory, is writable) andexpand_tilde()utilitiescrates/services/src/services/worktree_manager.rsget_worktree_base_dir_with_config()as the single source of truth for worktree path resolutioncrates/services/src/services/workspace_manager.rsWorktreeManager::get_worktree_base_dir_with_config()crates/local-deployment/src/container.rscreate()andensure_container_exists()to fetch project and use itsworktree_base_dirFrontend
frontend/src/pages/settings/ProjectSettings.tsxfrontend/src/i18n/locales/*/settings.jsonshared/types.tsBug Fix
Fixed a state management issue in
ProjectSettings.tsxwhere theonSuccesscallback from a previous render's stale closure would overwrite fresh mutation data with stale form state. The fix ensures the form state is updated from the mutation response rather than being clobbered.Testing
get_worktree_base_dir_with_config()inworktree_manager.rs:Nonereturns default worktrees path~) is expanded to home directorycargo test --workspacepnpm run checkHow to Test
~/some-pathNotes