Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | 42x 14x 42x 8x 24x | /**
* Removal of everything managed mode put on disk: the server binary, the
* shared model cache, and one vault's index. Never touches the Obsidian vault.
*/
import { node } from "./binary-manager";
import { dirSizeBytes } from "./storage-stats";
import { sharedBinDir, sharedModelsDir } from "./vault-registry";
import { UNINSTALL_TARGET, type UninstallPlan, type UninstallTarget, type UninstallTargetKind } from "./types";
function target(kind: UninstallTargetKind, path: string): UninstallTarget {
return { kind, path, bytes: dirSizeBytes(path) };
}
/** Size every removable path so the confirmation can name what it deletes. */
export function planUninstall(sharedRoot: string, vaultDataDir: string): UninstallPlan {
const targets = [
target(UNINSTALL_TARGET.BINARY, sharedBinDir(sharedRoot)),
target(UNINSTALL_TARGET.MODELS, sharedModelsDir(sharedRoot)),
target(UNINSTALL_TARGET.INDEX, vaultDataDir),
];
return { targets, totalBytes: targets.reduce((sum, t) => sum + t.bytes, 0) };
}
/** Delete every planned path. Missing paths are not an error. */
export function executeUninstall(plan: UninstallPlan): void {
for (const t of plan.targets) {
node.rmSync(t.path, { recursive: true, force: true });
}
}
|