type UpdatePolicy = "auto" | "nudge" | "off"; declare const VALID_POLICIES: readonly UpdatePolicy[]; interface PluginRuntimeConfig { /** npm package name, e.g. "@theglitchking/semantic-pages" */ packageName: string; /** Claude Code plugin name (matches plugin.json `name`), e.g. "semantic-pages" */ pluginName: string; /** * Filename (not full path) of the plugin's policy config inside * /.claude/, e.g. "semantic-pages.json". */ configFile: string; /** Env-var prefix for opt-outs, e.g. "SEMANTIC_PAGES". Used for * _UPDATE_POLICY * _SKIP_LINK * _SKIP_HOOK_REGISTER * Default: pluginName uppercased with "-" replaced by "_". */ envPrefix?: string; } interface PostinstallOptions extends PluginRuntimeConfig { /** Package root (where this plugin was installed). Pass * `dirname(fileURLToPath(import.meta.url))`-based resolution. */ packageRoot: string; /** Directory under packageRoot containing skill dirs to symlink, or null. */ skillsDir?: string | null; /** * Command string to register in the consumer's .claude/settings.json. * Must contain the pluginName as substring (used for dedup). */ hookCommand: string; } interface SessionStartOptions extends PluginRuntimeConfig { /** * Plugin-specific reconcile step run before the update check. Receives the * project root. Any thrown error is caught and logged; the update check * still runs. */ reconcile?: (projectRoot: string) => void | Promise; /** Override network timeout for the update check (default 3000ms). */ updateTimeoutMs?: number; /** Override cache TTL (default 6h). */ cacheTtlMs?: number; /** Override auto-update timeout (default 60s). */ autoUpdateTimeoutMs?: number; } declare function readJson(path: string, fallback?: T | null): T | null; declare function writeJson(path: string, value: unknown): void; declare function isCi(): boolean; declare function compareVersions(a: string, b: string): number; declare function loadPolicy(projectRoot: string, cfg: PluginRuntimeConfig): UpdatePolicy; declare function setPolicy(projectRoot: string, cfg: PluginRuntimeConfig, policy: UpdatePolicy): string; declare function installedVersion(projectRoot: string, cfg: PluginRuntimeConfig): string | null; declare function fetchLatestVersion(packageName: string, cacheFile: string, opts?: { timeoutMs?: number; ttlMs?: number; }): Promise; declare function settingsHasMatchingHook(settings: any, marker: string): boolean; interface PostinstallResult { linkedCount: number; policy: UpdatePolicy; hook: "registered" | "already" | "skipped-env" | "skipped-plugin" | "skipped-no-settings" | "skipped-unparseable" | "skipped-write-failed"; summary: string; } declare function runPostinstall(opts: PostinstallOptions): PostinstallResult | null; interface SessionStartResult { /** Message to include as additionalContext (may be empty). */ message: string; } /** * Main SessionStart entry. Runs reconcile (if provided), then update check. * Always emits a valid SessionStart hook response and resolves normally. */ declare function runSessionStart(opts: SessionStartOptions): Promise; interface RegisterCommandsOptions extends PluginRuntimeConfig { /** * Optional hook runner to invoke after a successful update — typically the * plugin's own postinstall linker. Receives the consumer cwd. */ onAfterUpdate?: (cwd: string) => void; } /** * Add `update`, `policy`, `status`, `relink` subcommands to a commander * Program. Commander is a peer dependency — pass in the already-imported * program. */ declare function registerUpdateCommands(program: any, opts: RegisterCommandsOptions): void; export { type PluginRuntimeConfig, type PostinstallOptions, type PostinstallResult, type RegisterCommandsOptions, type SessionStartOptions, type SessionStartResult, type UpdatePolicy, VALID_POLICIES, compareVersions, fetchLatestVersion, installedVersion, isCi, loadPolicy, readJson, registerUpdateCommands, runPostinstall, runSessionStart, setPolicy, settingsHasMatchingHook, writeJson };