refactor: fold single-consumer helper types into their owners
Consolidate small single-purpose types into the files that own them: StreamResult into StreamAnalyzer, the Planning context records into PlanningSessionContext, PrimeClock/PrimeSchedulerOptions into PrimeScheduler, AgentMcpTools into LifecycleMcpTools, the locator subclasses into InstallArtifactLocator, LogLineViewModel into DetailsIslandViewModel, RepoImportItemViewModel into its modal, and StepViewModel into InstallPageViewModel. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,37 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
public enum LogKind { Sys, Tool, Claude, Stdout, Stderr, Done, Msg }
|
||||
|
||||
public sealed class LogLineViewModel
|
||||
{
|
||||
public required LogKind Kind { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public string TimestampFormatted { get; } = DateTime.Now.ToString("HH:mm:ss");
|
||||
public string KindMarker => Kind switch
|
||||
{
|
||||
LogKind.Sys => "sys",
|
||||
LogKind.Tool => "tool",
|
||||
LogKind.Claude => "claude",
|
||||
LogKind.Stdout => "out",
|
||||
LogKind.Stderr => "err",
|
||||
LogKind.Done => "done",
|
||||
LogKind.Msg => "claude",
|
||||
_ => "",
|
||||
};
|
||||
public string ClassName => Kind switch
|
||||
{
|
||||
LogKind.Sys => "log-sys",
|
||||
LogKind.Tool => "log-tool",
|
||||
LogKind.Claude => "log-claude",
|
||||
LogKind.Stdout => "log-stdout",
|
||||
LogKind.Stderr => "log-stderr",
|
||||
LogKind.Done => "log-done",
|
||||
LogKind.Msg => "log-msg",
|
||||
_ => "",
|
||||
};
|
||||
}
|
||||
|
||||
public sealed partial class DetailsIslandViewModel : ViewModelBase
|
||||
{
|
||||
private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory;
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
namespace ClaudeDo.Ui.ViewModels.Islands;
|
||||
|
||||
public enum LogKind { Sys, Tool, Claude, Stdout, Stderr, Done, Msg }
|
||||
|
||||
public sealed class LogLineViewModel
|
||||
{
|
||||
public required LogKind Kind { get; init; }
|
||||
public required string Text { get; init; }
|
||||
public string TimestampFormatted { get; } = DateTime.Now.ToString("HH:mm:ss");
|
||||
public string KindMarker => Kind switch
|
||||
{
|
||||
LogKind.Sys => "sys",
|
||||
LogKind.Tool => "tool",
|
||||
LogKind.Claude => "claude",
|
||||
LogKind.Stdout => "out",
|
||||
LogKind.Stderr => "err",
|
||||
LogKind.Done => "done",
|
||||
LogKind.Msg => "claude",
|
||||
_ => "",
|
||||
};
|
||||
public string ClassName => Kind switch
|
||||
{
|
||||
LogKind.Sys => "log-sys",
|
||||
LogKind.Tool => "log-tool",
|
||||
LogKind.Claude => "log-claude",
|
||||
LogKind.Stdout => "log-stdout",
|
||||
LogKind.Stderr => "log-stderr",
|
||||
LogKind.Done => "log-done",
|
||||
LogKind.Msg => "log-msg",
|
||||
_ => "",
|
||||
};
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels.Modals;
|
||||
|
||||
public sealed partial class RepoImportItemViewModel : ViewModelBase
|
||||
{
|
||||
public string Name { get; init; } = "";
|
||||
public string FullPath { get; init; } = "";
|
||||
|
||||
// True when a list already points at this path. Such rows are shown ticked + disabled.
|
||||
public bool AlreadyAdded { get; init; }
|
||||
public bool CanToggle => !AlreadyAdded;
|
||||
|
||||
[ObservableProperty] private bool _isChecked;
|
||||
|
||||
// Driven by the search filter; the row collapses when it doesn't match.
|
||||
[ObservableProperty] private bool _isVisible = true;
|
||||
}
|
||||
@@ -10,6 +10,21 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace ClaudeDo.Ui.ViewModels.Modals;
|
||||
|
||||
public sealed partial class RepoImportItemViewModel : ViewModelBase
|
||||
{
|
||||
public string Name { get; init; } = "";
|
||||
public string FullPath { get; init; } = "";
|
||||
|
||||
// True when a list already points at this path. Such rows are shown ticked + disabled.
|
||||
public bool AlreadyAdded { get; init; }
|
||||
public bool CanToggle => !AlreadyAdded;
|
||||
|
||||
[ObservableProperty] private bool _isChecked;
|
||||
|
||||
// Driven by the search filter; the row collapses when it doesn't match.
|
||||
[ObservableProperty] private bool _isVisible = true;
|
||||
}
|
||||
|
||||
public sealed partial class RepoImportModalViewModel : ViewModelBase
|
||||
{
|
||||
private readonly IDbContextFactory<ClaudeDoDbContext> _dbFactory;
|
||||
|
||||
Reference in New Issue
Block a user