feat: Introduce default delete branch option for worktrees

This commit adds a new feature allowing users to set a default value for the "delete branch" checkbox when deleting a worktree. Key changes include:

1. **State Management**: Introduced `defaultDeleteBranchByProject` to manage the default delete branch setting per project.
2. **UI Components**: Updated the WorktreesSection to include a toggle for the default delete branch option, enhancing user control during worktree deletion.
3. **Dialog Updates**: Modified the DeleteWorktreeDialog to respect the default delete branch setting, improving the user experience by streamlining the deletion process.

These enhancements provide users with more flexibility and control over worktree management, improving overall project workflows.
This commit is contained in:
Kacper
2026-01-10 23:18:39 +01:00
parent aeb5bd829f
commit e902e8ea4c
7 changed files with 204 additions and 63 deletions

View File

@@ -50,7 +50,7 @@ export function useInitScriptEvents(projectPath: string | null) {
switch (event.type) {
case 'worktree:init-started': {
const startPayload = payload as InitScriptStartedPayload;
setInitScriptState(projectPath, {
setInitScriptState(projectPath, startPayload.branch, {
status: 'running',
branch: startPayload.branch,
output: [],
@@ -60,12 +60,12 @@ export function useInitScriptEvents(projectPath: string | null) {
}
case 'worktree:init-output': {
const outputPayload = payload as InitScriptOutputPayload;
appendInitScriptOutput(projectPath, outputPayload.content);
appendInitScriptOutput(projectPath, outputPayload.branch, outputPayload.content);
break;
}
case 'worktree:init-completed': {
const completePayload = payload as InitScriptCompletedPayload;
setInitScriptState(projectPath, {
setInitScriptState(projectPath, completePayload.branch, {
status: completePayload.success ? 'success' : 'failed',
error: completePayload.error,
});