settings: add configurable worktree location#92
Merged
Merged
Conversation
New local worktrees are created under a user-configurable base directory (Settings → General), defaulting to ~/.mori. Stored in ToolSettings and resolved per creation so changes apply immediately. Existing worktrees are left in place; remote SSH worktrees still use the repo's parent directory.
Mori was purely DB-driven and never discovered worktrees on disk, so a repo's pre-existing worktrees stayed invisible. Add importExistingWorktrees(projectId:) which scans `git worktree list`, skips already-tracked and bare entries, and imports the rest (best-effort tmux session each). Runs automatically on addProject so a freshly added repo shows all its branches, and is exposed as an "Import Existing Worktrees" project context-menu action for on-demand rescans.
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.
What
Adds a user-configurable base directory for new local worktrees in Settings → General. Defaults to
~/.mori(unchanged behavior when left empty).Why
New worktrees were hardcoded to
~/.mori. Users want them elsewhere (e.g. a dedicated~/code/worktrees).How
ToolSettingsgains aworktreeBasePathfield +resolvedWorktreeBaseDir()helper (expands~, falls back to~/.mori). Stored in the existing UserDefaults settings bucket.WorkspaceManager.createWorktree()reads the resolved base dir per creation, so changes apply immediately.onToolSettingsChangedsave callback.Scope / tradeoffs
<remote repo parent>/.mori, unrelated to the local home dir.Test
mise run buildpasses (debug).mise run dev: empty field resolves to~/.mori; custom path updates the preview and persists on Apply.