diff --git a/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs b/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs index 55f8c5f..7277f72 100644 --- a/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs +++ b/src/ClaudeDo.Ui/ViewModels/Islands/DetailsIslandViewModel.cs @@ -58,6 +58,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase [ObservableProperty] private string? _model; [ObservableProperty] private string? _worktreePath; [ObservableProperty] private string? _worktreeBaseCommit; + [ObservableProperty] private string? _worktreeStateLabel; [ObservableProperty] private string? _branchLine; [ObservableProperty] private int _turns; [ObservableProperty] private int _tokens; @@ -231,6 +232,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase Notes = ""; Model = null; WorktreePath = null; + WorktreeStateLabel = null; BranchLine = null; AgentStatusLabel = "Idle"; LatestRunSessionId = null; @@ -260,6 +262,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase Notes = entity.Notes ?? ""; Model = entity.Model; WorktreePath = entity.Worktree?.Path; + WorktreeStateLabel = entity.Worktree?.State.ToString(); BranchLine = entity.Worktree is { } w ? $"{w.BranchName} \u2190 main" : null; AgentStatusLabel = entity.Status.ToString(); @@ -292,6 +295,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase WorktreePath = entity.Worktree?.Path; WorktreeBaseCommit = entity.Worktree?.BaseCommit; + WorktreeStateLabel = entity.Worktree?.State.ToString(); BranchLine = entity.Worktree is { } w ? $"{w.BranchName} ← main" : null; AgentStatusLabel = entity.Status.ToString(); if (Task is { } row && entity.Worktree?.DiffStat is { } stat) @@ -343,6 +347,11 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase ApproveMergeCommand.NotifyCanExecuteChanged(); } + partial void OnWorktreeStateLabelChanged(string? value) + { + ApproveMergeCommand.NotifyCanExecuteChanged(); + } + [RelayCommand] private async System.Threading.Tasks.Task SendPromptAsync() { @@ -398,7 +407,7 @@ public sealed partial class DetailsIslandViewModel : ViewModelBase } private bool CanMerge() => - Task != null && _worker.IsConnected && WorktreePath != null; + Task != null && _worker.IsConnected && WorktreePath != null && WorktreeStateLabel == "Active"; [RelayCommand] private async System.Threading.Tasks.Task StopAsync()