feat: implement worktree session creation and management
- Added `createWorktreeSession` utility to handle the creation of new sessions with auto-generated worktrees. - Introduced branch name generation utilities for creating unique and friendly branch names. - Updated `CommandPalette` to trigger worktree session creation via a command. - Refactored keyboard shortcuts to support new worktree session creation with Shift + Cmd/Ctrl + N. - Enhanced project settings to include worktree defaults (branch prefix, base branch, auto-create option). - Updated persistence logic to preserve worktree defaults when saving project settings. - Modified menu actions to initiate new worktree sessions. - Ensured proper handling of existing branches to avoid conflicts during worktree creation.
This commit is contained in:
@@ -130,6 +130,23 @@ const sanitizeProjects = (value: unknown): DesktopSettings['projects'] | undefin
|
||||
) {
|
||||
project.lastOpenedAt = candidate.lastOpenedAt;
|
||||
}
|
||||
// Preserve worktreeDefaults
|
||||
if (candidate.worktreeDefaults && typeof candidate.worktreeDefaults === 'object') {
|
||||
const wt = candidate.worktreeDefaults as Record<string, unknown>;
|
||||
const defaults: Record<string, unknown> = {};
|
||||
if (typeof wt.branchPrefix === 'string' && wt.branchPrefix.trim()) {
|
||||
defaults.branchPrefix = wt.branchPrefix.trim();
|
||||
}
|
||||
if (typeof wt.baseBranch === 'string' && wt.baseBranch.trim()) {
|
||||
defaults.baseBranch = wt.baseBranch.trim();
|
||||
}
|
||||
if (typeof wt.autoCreateWorktree === 'boolean') {
|
||||
defaults.autoCreateWorktree = wt.autoCreateWorktree;
|
||||
}
|
||||
if (Object.keys(defaults).length > 0) {
|
||||
(project as unknown as Record<string, unknown>).worktreeDefaults = defaults;
|
||||
}
|
||||
}
|
||||
|
||||
result.push(project);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user