From 2690332d138a67d15548eee3bff23918d210e8ba Mon Sep 17 00:00:00 2001 From: mika kuns Date: Thu, 23 Apr 2026 13:07:23 +0200 Subject: [PATCH] feat(installer): record data directory in install manifest Write the resolved DbPath parent into the manifest so UninstallRunner can honour customised data locations instead of always assuming ~/.todo-app. Older manifests fall back to the default path. --- src/ClaudeDo.Installer/Core/InstallManifest.cs | 3 ++- src/ClaudeDo.Installer/Core/UninstallRunner.cs | 7 +++++-- src/ClaudeDo.Installer/Steps/WriteInstallManifestStep.cs | 6 +++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/ClaudeDo.Installer/Core/InstallManifest.cs b/src/ClaudeDo.Installer/Core/InstallManifest.cs index be2a774..6856907 100644 --- a/src/ClaudeDo.Installer/Core/InstallManifest.cs +++ b/src/ClaudeDo.Installer/Core/InstallManifest.cs @@ -8,7 +8,8 @@ public sealed record InstallManifest( string Version, string InstallDir, string WorkerDir, - DateTimeOffset InstalledAt); + DateTimeOffset InstalledAt, + string? DataDir = null); public static class InstallManifestStore { diff --git a/src/ClaudeDo.Installer/Core/UninstallRunner.cs b/src/ClaudeDo.Installer/Core/UninstallRunner.cs index e49f1f9..a5f6364 100644 --- a/src/ClaudeDo.Installer/Core/UninstallRunner.cs +++ b/src/ClaudeDo.Installer/Core/UninstallRunner.cs @@ -67,10 +67,13 @@ public sealed class UninstallRunner failures.Add($"install dir ({_context.InstallDirectory}): {err}"); } - // 6) Delete ~/.todo-app (config + DB + logs) — only if user opted in. + // 6) Delete data dir (config + DB + logs) — only if user opted in. + // Prefer the manifest-recorded DataDir so a customised DbPath is honoured; + // fall back to the default ~/.todo-app for older manifests. if (removeAppData) { - var appData = Paths.AppDataRoot(); + var manifest = InstallManifestStore.TryRead(_context.InstallDirectory); + var appData = manifest?.DataDir ?? Paths.AppDataRoot(); if (Directory.Exists(appData)) { progress.Report($"Deleting {appData}..."); diff --git a/src/ClaudeDo.Installer/Steps/WriteInstallManifestStep.cs b/src/ClaudeDo.Installer/Steps/WriteInstallManifestStep.cs index 83cfda8..3b73f3f 100644 --- a/src/ClaudeDo.Installer/Steps/WriteInstallManifestStep.cs +++ b/src/ClaudeDo.Installer/Steps/WriteInstallManifestStep.cs @@ -1,4 +1,5 @@ using System.IO; +using ClaudeDo.Data; using ClaudeDo.Installer.Core; namespace ClaudeDo.Installer.Steps; @@ -14,11 +15,14 @@ public sealed class WriteInstallManifestStep : IInstallStep try { + var dataDir = Path.GetDirectoryName(Paths.Expand(ctx.DbPath)); + var manifest = new InstallManifest( Version: ctx.InstalledVersion, InstallDir: ctx.InstallDirectory, WorkerDir: Path.Combine(ctx.InstallDirectory, "worker"), - InstalledAt: DateTimeOffset.UtcNow); + InstalledAt: DateTimeOffset.UtcNow, + DataDir: dataDir); InstallManifestStore.Write(ctx.InstallDirectory, manifest); progress.Report($"Wrote {InstallManifestStore.ManifestPath(ctx.InstallDirectory)}");