refactor: extract interfaces to Interfaces folders and consolidate filters

Move interface declarations into per-area Interfaces/ subfolders, merge the
small task-list filter classes into StatusFilter/SmartFlagFilter, and simplify
related services, converters and hub DTO handling.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-05-30 15:41:10 +02:00
parent 77100b6b3b
commit 41da124a31
42 changed files with 306 additions and 532 deletions

View File

@@ -5,6 +5,23 @@ using ClaudeDo.Data;
namespace ClaudeDo.Installer.Core;
internal static class JsonConfigFile
{
public static T LoadOrDefault<T>(string fileName, JsonSerializerOptions readOpts) where T : new()
{
var path = Path.Combine(Paths.AppDataRoot(), fileName);
if (!File.Exists(path)) return new();
return JsonSerializer.Deserialize<T>(File.ReadAllText(path), readOpts) ?? new();
}
public static void Save<T>(string fileName, T value, JsonSerializerOptions writeOpts)
{
var dir = Paths.AppDataRoot();
Directory.CreateDirectory(dir);
File.WriteAllText(Path.Combine(dir, fileName), JsonSerializer.Serialize(value, writeOpts));
}
}
/// <summary>
/// Mirrors ClaudeDo.Worker.Config.WorkerConfig JSON shape.
/// Keep in sync with src/ClaudeDo.Worker/Config/WorkerConfig.cs.
@@ -47,21 +64,9 @@ public sealed class InstallerWorkerConfig
};
public static InstallerWorkerConfig Load()
{
var path = Path.Combine(Paths.AppDataRoot(), "worker.config.json");
if (!File.Exists(path)) return new();
var json = File.ReadAllText(path);
return JsonSerializer.Deserialize<InstallerWorkerConfig>(json, ReadOpts) ?? new();
}
=> JsonConfigFile.LoadOrDefault<InstallerWorkerConfig>("worker.config.json", ReadOpts);
public void Save()
{
var dir = Paths.AppDataRoot();
Directory.CreateDirectory(dir);
var path = Path.Combine(dir, "worker.config.json");
var json = JsonSerializer.Serialize(this, WriteOpts);
File.WriteAllText(path, json);
}
public void Save() => JsonConfigFile.Save("worker.config.json", this, WriteOpts);
}
/// <summary>
@@ -85,25 +90,9 @@ public sealed class InstallerAppSettings
public static InstallerAppSettings Load()
{
var path = Path.Combine(Paths.AppDataRoot(), "ui.config.json");
if (!File.Exists(path)) return new();
try
{
var json = File.ReadAllText(path);
return JsonSerializer.Deserialize<InstallerAppSettings>(json, ReadOpts) ?? new();
}
catch
{
return new();
}
try { return JsonConfigFile.LoadOrDefault<InstallerAppSettings>("ui.config.json", ReadOpts); }
catch { return new(); }
}
public void Save()
{
var dir = Paths.AppDataRoot();
Directory.CreateDirectory(dir);
var path = Path.Combine(dir, "ui.config.json");
var json = JsonSerializer.Serialize(this, WriteOpts);
File.WriteAllText(path, json);
}
public void Save() => JsonConfigFile.Save("ui.config.json", this, WriteOpts);
}