/** * v0.7 — stage progress journal for `solosquad uninstall`. * Per docs/plan/v0.7-uninstall-lifecycle.md §11.3 + P0 #4. * * Each cleanup stage logs a `begin` entry, then an `end` entry on success. * If a stage crashes between begin and end, the journal will show an * orphan `begin`, and the next invocation can detect this to resume from * the appropriate point (each cleanup step is itself idempotent). * * The journal lives at `/.solosquad/uninstall.journal.jsonl` * and is append-only. It is moved into the archive (as `last-journal.jsonl`) * after a successful uninstall and then deleted from the workspace. */ export type StageStatus = "begin" | "end" | "error"; export interface JournalEntry { ts: string; stage: string; status: StageStatus; runId: string; detail?: Record; } export declare class JournalWriter { readonly filePath: string; readonly runId: string; constructor(filePath: string, runId: string); begin(stage: string, detail?: Record): void; end(stage: string, detail?: Record): void; error(stage: string, detail?: Record): void; private append; } export declare function newRunId(): string; /** * Read the journal file. Returns an empty array if the file is missing. * Malformed lines are skipped (defensive — the file is append-only and * could be truncated by a crash). */ export declare function readJournal(filePath: string): JournalEntry[]; /** * Stages that have a `begin` but no `end` (potentially interrupted). * Filtered by runId when supplied — useful when checking the current run. */ export declare function findIncompleteStages(entries: JournalEntry[], runId?: string): string[]; /** * Has the named stage finished successfully in the most recent attempt? * If runId is supplied, scoped to that run only. */ export declare function isStageCompleted(entries: JournalEntry[], stage: string, runId?: string): boolean; export declare function journalPath(workspace: string): string; /** * v0.8.1 — `solosquad import` journal path. Reuses the same JSONL writer * + readers as the uninstall journal so resume semantics are identical. * Per docs/plan/v0.8.1-security-lifecycle-pair.md §4.4. * * Stages: `import.verify`, `import.unpack`, `import.merge-org`, * `import.verify-post`. Each is idempotent — re-running over an already * extracted file SHA-verifies and skips. */ export declare function importJournalPath(workspace: string): string;