/** * Shared utilities, constants, and types used across init write-* modules. */ export declare const MAX_EXEC_FILE_BYTES: number; /** * Probe whether an optionalDependency actually resolved in this install * (npm silently skips optionalDependencies it can't satisfy — see * docs/AUDIT-BACKLOG.md P1-1/P1-23). Used to caveat generated docs instead * of presenting these features as unconditionally working. */ export declare function _isOptionalPackageResolvable(pkg: string): boolean; /** * Atomic write helper — writes to a sibling .tmp file then renames into place. * SIGINT or crash during a partial write would otherwise corrupt user-critical * files (.claude/settings.json, .mcp.json, helper scripts that Claude Code * executes on every hook). Without atomicity a half-written settings.json or * a zero-byte hook-handler.cjs disables Claude Code's protections silently. */ export declare function atomicWriteFile(target: string, content: string | Buffer, encoding?: BufferEncoding): void; /** * Skills to copy based on configuration */ export declare const SKILLS_MAP: Record; /** * Commands to copy based on configuration */ export declare const COMMANDS_MAP: Record; /** * Agents to copy based on configuration */ export declare const AGENTS_MAP: Record; /** * Directory structure to create */ export declare const DIRECTORIES: { claude: string[]; runtime: string[]; }; /** * 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; 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[]; } export type InitManifestSection = 'skills' | 'commands' | 'agents'; /** * 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; /** * 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; /** * Find source helpers directory. * Validates that the directory contains hook-handler.cjs AND its required * subdirectory files (utils/telemetry.cjs etc.) to avoid accepting a partial * or corrupted source that would reproduce the missing-utils/ bug class. */ export declare function findSourceHelpersDir(sourceBaseDir?: string): string | null; /** * Find source .claude directory for statusline files */ export declare function findSourceClaudeDir(sourceBaseDir?: string): string | null; /** * Find source directory for skills/commands/agents */ export declare function findSourceDir(type: 'skills' | 'commands' | 'agents', sourceBaseDir?: string): string | null; /** * Copy directory recursively */ export declare function copyDirRecursive(src: string, dest: string): void; /** * Count files with extension in directory */ export declare function countFiles(dir: string, ext: string): number; /** Recursively collect .md files under dir, returned relative to dir. */ export declare function walkMdFiles(dir: string): string[]; /** Skip READMEs and other non-definition markdown. */ export declare function isLikelyUserFile(rel: string): boolean; /** Pull the `name:` scalar from a frontmatter block (best-effort). */ export declare function extractFmName(md: string): string | null; //# sourceMappingURL=shared.d.ts.map