fix(ui): make Files-tab system prompts view-only, drop external-editor edit path

Editing a prompt file (even externally via "Open in editor") freezes it as a
user customization and blocks future default updates. The Files tab no longer
opens an external editor; it shows each prompt's content read-only in-app via
a new ViewPromptCommand, dropping the file-seeding side effect. Reset to
default and the customized-prompts deviation list are unchanged.
This commit is contained in:
mika kuns
2026-08-05 21:00:34 +02:00
parent bdee731376
commit 6887b1d08d
4 changed files with 30 additions and 29 deletions
@@ -1,5 +1,4 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using ClaudeDo.Data;
using ClaudeDo.Ui.Localization;
using ClaudeDo.Ui.Services;
@@ -15,6 +14,8 @@ public sealed partial class FilesSettingsTabViewModel : ViewModelBase
[ObservableProperty] private string _statusMessage = "";
[ObservableProperty] private bool _isBusy;
[ObservableProperty] private bool _hasCustomizedPrompts;
[ObservableProperty] private string? _viewedKindName;
[ObservableProperty] private string _viewedContent = "";
public string SystemPromptPath { get; } = PromptFiles.PathFor(PromptKind.System);
public string PlanningPromptPath { get; } = PromptFiles.PathFor(PromptKind.Planning);
@@ -49,20 +50,11 @@ public sealed partial class FilesSettingsTabViewModel : ViewModelBase
}
[RelayCommand]
private void OpenPrompt(string? kindName)
private void ViewPrompt(string? kindName)
{
if (!Enum.TryParse<PromptKind>(kindName, ignoreCase: true, out var kind)) return;
try
{
// No override file yet: seed it with today's bundled default (hash-tracked, so a later
// default change reconciles this file away automatically unless the user actually edits it)
// rather than leaving a plain file that would freeze the prompt forever.
if (!File.Exists(PromptFiles.PathFor(kind)))
PromptFiles.Save(kind, PromptFiles.DefaultFor(kind));
Process.Start(new ProcessStartInfo(PromptFiles.PathFor(kind)) { UseShellExecute = true });
}
catch (Exception ex) { StatusMessage = Loc.T("vm.filesTab.openFailed", ex.Message); }
finally { RefreshCustomizedPrompts(); }
ViewedKindName = kindName;
ViewedContent = PromptFiles.ReadOrDefault(kind);
}
private void RefreshCustomizedPrompts()