import type { InitResult } from './types.js'; /** * Provenance manifest for generated .claude content. * * init used to "clean stale" entries by deleting every name under * .claude/{skills,commands,agents} that was absent from the current version's * SKILLS_MAP/COMMANDS_MAP/AGENTS_MAP. Every user-authored command and skill is * absent from those maps, so that pass deleted user content on the very first * run — unrecoverable data loss. * * The manifest records exactly which entries *this tool* wrote, so the stale * sweep can be restricted to those. Anything init did not write is never * removed. Projects initialised by an older version have no manifest, so their * first run under the fix deletes nothing and seeds the manifest instead; * stale generated content may survive one extra run, which is the correct * trade (preserving stale generated content is recoverable, deleting user * content is not). */ export declare const INIT_MANIFEST_REL: string; /** * One retired entry's provenance (o-38): a name the manifest recorded that * this version no longer ships, moved to `movedTo` instead of deleted. * Appended-only — a later run's `recordGenerated` never drops this array, so * the run after next can still tell a user what was retired and where it went. */ export interface RetiredEntry { /** The manifest section for a `.claude`/`.kimi-code` entry (an * `InitManifestSection` value), or a descriptive label for a mirror * retirement (e.g. `gemini-skills`) — mirrors have no manifest section * of their own, so this is an audit-trail label, not a lookup key. */ section: string; name: string; /** Path (relative to targetDir) the entry was moved to. */ movedTo: string; /** ISO timestamp of the retirement. */ at: string; } export interface InitManifest { version: number; /** Entry names directly under .claude/skills that init generated. */ skills: string[]; /** Entry names directly under .claude/commands that init generated. */ commands: string[]; /** Entry names (category dirs) directly under .claude/agents that init generated. */ agents: string[]; /** Directory names directly under .kimi-code/skills that init generated. */ kimiSkills: string[]; /** File names directly under .kimi-code/plugin/commands that init generated. */ kimiPluginCommands: string[]; /** Directory names directly under .opencode/skills that init generated. * Absent in manifests written before this field existed; normalised to * an empty list on read, which the sweep treats as "delete nothing". */ opencodeSkills: string[]; /** Opt-in packs installed on top of core (GH #411). Absent on a manifest * written before packs existed — see `installedPacks`. */ packs?: string[]; /** Every entry ever retired (o-38) — see `RetiredEntry`. Absent on a * manifest written before this field existed; treated as empty. */ retired?: RetiredEntry[]; /** sha256 of each shipped file as init last left it, keyed by its * project-relative path — how a later run tells a user edit from an * untouched install (see file-guard.ts). */ files?: Record; /** sha256 of each managed block's body as init last wrote it, keyed * `#` (see file-guard.ts). */ blocks?: Record; } export type InitManifestSection = 'skills' | 'commands' | 'agents' | 'kimiSkills' | 'kimiPluginCommands' | 'opencodeSkills'; /** * Read the provenance manifest. Returns null when absent or unreadable — * callers must treat that as "provenance unknown", i.e. delete nothing. */ export declare function readInitManifest(targetDir: string): InitManifest | null; /** Replace the manifest's `files` or `blocks` hash map, keeping every other * field (see file-guard.ts). */ export declare function recordManifestHashes(targetDir: string, field: 'files' | 'blocks', hashes: Record): void; /** * Names init previously generated in one section. Empty set when no manifest * exists — which makes the stale sweep a no-op rather than a delete-everything. */ export declare function previouslyGenerated(targetDir: string, section: InitManifestSection): Set; /** * Record the entries init just wrote for one section, merging into any * existing manifest so a partial run (e.g. --only-claude, or a section whose * source dir was missing) never drops provenance for the other sections. */ export declare function recordGenerated(targetDir: string, section: InitManifestSection, entries: string[]): void; /** Record the opt-in packs a project has installed (GH #411). */ export declare function recordPacks(targetDir: string, packs: readonly string[]): void; /** * Retire a generated entry instead of deleting it (o-38): a name the * manifest recorded that this version no longer ships anywhere is moved to * `.monomind/backups/-/retired/