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:
@@ -135,6 +135,27 @@ fn sanitize_projects(value: &Value) -> Option<Value> {
|
||||
}
|
||||
}
|
||||
|
||||
// Preserve worktreeDefaults
|
||||
if let Some(Value::Object(wt)) = obj.get("worktreeDefaults") {
|
||||
let mut defaults = serde_json::Map::new();
|
||||
if let Some(Value::String(s)) = wt.get("branchPrefix") {
|
||||
if !s.trim().is_empty() {
|
||||
defaults.insert("branchPrefix".to_string(), json!(s.trim()));
|
||||
}
|
||||
}
|
||||
if let Some(Value::String(s)) = wt.get("baseBranch") {
|
||||
if !s.trim().is_empty() {
|
||||
defaults.insert("baseBranch".to_string(), json!(s.trim()));
|
||||
}
|
||||
}
|
||||
if let Some(Value::Bool(b)) = wt.get("autoCreateWorktree") {
|
||||
defaults.insert("autoCreateWorktree".to_string(), json!(b));
|
||||
}
|
||||
if !defaults.is_empty() {
|
||||
project.insert("worktreeDefaults".to_string(), Value::Object(defaults));
|
||||
}
|
||||
}
|
||||
|
||||
result.push(Value::Object(project));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user