/** * pi-mind postinstall / host-project wiring logic. * * Extracted from bin/init.js so the postinstall script stays a thin * wrapper while the actual file/symlink logic is unit-testable. The * postinstall wrapper handles: * 1. process.exit(0) on PI_MIND_SKIP_INIT=1 * 2. host-root detection (INIT_CWD + pnpm-aware walk) * 3. printing the "ready" banner * * Everything in this file is pure: takes explicit paths, returns a * structured result, no process.env reads, no side effects beyond * filesystem mutations. Testable in tmp dirs. */ export interface RunInitOptions { /** Where to install .pi/extensions, .pi/skills, and .pi-mind/. */ hostRoot: string; /** Where the package's `dist/extensions/` and `skills/` live. */ pkgRoot: string; /** Override the .pi-mind directory (default: /.pi-mind). */ piMindDir?: string; /** Verbose logger (default: silent). */ log?: (line: string) => void; /** Warning logger (default: silent). */ warn?: (line: string) => void; } export interface RunInitResult { /** Relative paths of symlinks created (or refreshed) under .pi/. */ linked: string[]; /** Relative paths of directories created under .pi-mind/. */ dirsCreated: string[]; /** Relative paths of dangling symlinks removed. */ removedDangling: string[]; /** Relative paths of pre-existing non-symlink entries we left alone. */ skipped: string[]; } /** * Create the standard .pi/ and .pi-mind/ tree under hostRoot, and link the * package's compiled extensions + source skills into it. * * Idempotent: re-running on an already-initialized host is a no-op except * for cleaning up dangling symlinks (extension/skill removed between * package versions). * * Returns a structured result so callers (tests, the postinstall wrapper) * can surface what changed. */ export declare function runInit(opts: RunInitOptions): RunInitResult; /** * Walks up from pkgRoot looking for a host root: the parent of a * node_modules that is NOT inside a pnpm virtual store. Returns null if * no host root is found (caller is in dev mode / pkg root itself). * * Exposed for the bin/init.js postinstall wrapper. Tests don't need this * because they call runInit directly with explicit hostRoot. */ export declare function findHostRoot(pkgRoot: string, initCwd?: string): string | null; //# sourceMappingURL=init.d.ts.map