/** * Ownership-checked plan for `monomind cleanup`. * * Incident 2026-09-22: `cleanup --force` deleted a fixed list of paths * (.agents/, .gemini/, AGENTS.md, data/, ...) wholesale. Run in a real * repository it removed ~1000 git-tracked files and the project's memory * store. The plan below removes a path only when monomind demonstrably owns * it, and the same plan drives both the preview and `--force`, so the preview * is exactly what `--force` will do. * * Rules, in order: * 1. A git-tracked file, or a directory holding one, is never deleted or * rewritten. Its untracked monomind-owned children may still be removed. * 2. User data (memory stores, org memory, knowledge index, monograph and * other databases, org configs, the catalog, backups) is kept unless `--purge-data`. * 3. Whole-path removal needs proof of ownership: a monomind-only namespace * (.monomind/, monomind.config.json, legacy .swarm/.hive-mind), an entry * listed in init's manifest, a file whose content still matches the hash * init recorded for it, a file named `monomind*` inside a provider dir, or * a file whose content is nothing but monomind marker blocks. * 4. A file that mixes monomind marker blocks (or a `monomind` JSON entry) * with other content only loses the monomind part. Settings files lose * only the hooks and statusLine that run a helper this plan removes * (cleanup-config-edits.ts), so no config is left pointing at one. A * tracked settings file keeps the helpers it runs instead (GH #448). * 5. Anything else is kept and reported with the reason. */ export type CleanupAction = 'remove' | 'strip' | 'skip'; export interface CleanupPlanEntry { /** Path relative to the project root, `/`-separated. */ path: string; kind: 'dir' | 'file'; action: CleanupAction; reason: string; size: number; /** True for user data that only `--purge-data` removes. */ data?: boolean; /** New file content for `strip`. */ content?: string; /** Manual step left to the user, shown in the preview and after --force. */ notice?: string; } export interface CleanupPlanOptions { keepConfig: boolean; purgeData: boolean; /** MONOMIND_MEMORY_PATH, if set. */ memoryPath?: string; } export type CleanupPlanResult = { ok: true; entries: CleanupPlanEntry[]; } | { ok: false; error: string; }; /** Remove every monomind marker block. Returns null when there was none. */ export declare function stripMonomindBlocks(text: string): string | null; /** Cheap, reliable signal that `cwd` is monomind's own source checkout. */ export declare function isMonomindSourceRepo(cwd: string): boolean; export declare function buildCleanupPlan(cwd: string, opts: CleanupPlanOptions): CleanupPlanResult; /** Apply one `remove`/`strip` entry; `skip` is a no-op. Throws on failure. */ export declare function applyCleanupEntry(cwd: string, e: CleanupPlanEntry): void; //# sourceMappingURL=cleanup-plan.d.ts.map