/** * Plugin registry — read/write Claude's plugin registry files and install plugins. * * Manages: * - known_marketplaces.json: Registry of known marketplace sources * - installed_plugins.json: Registry of installed plugins * * Follows Postel's Law: reads with fallbacks (liberal), writes with structured data. */ import type { ClaudeUserPaths } from '../paths/claude-paths.js'; export interface MarketplaceSource { source: 'npm' | 'github' | 'url' | 'hostPattern'; [key: string]: unknown; } export interface KnownMarketplaceEntry { source: MarketplaceSource; installLocation: string; lastUpdated: string; } export type KnownMarketplaces = Record; export interface InstalledPluginEntry { scope: 'user' | 'project'; installPath: string; version: string; installedAt: string; lastUpdated: string; } export interface InstalledPlugins { version: 2; plugins: Record; } export type InstallPluginSource = { source: 'npm'; package: string; version?: string; } | { source: 'github'; repo: string; } | { source: 'url'; url: string; }; export interface InstallPluginOptions { marketplaceName: string; pluginName: string; /** Absolute path to dist/plugins// */ pluginDir: string; version: string; source: InstallPluginSource; paths: ClaudeUserPaths; } /** * Read known_marketplaces.json from the Claude plugins directory. * Returns an empty object if the file does not exist. */ export declare function readKnownMarketplaces(paths: ClaudeUserPaths): KnownMarketplaces; /** * Write known_marketplaces.json to the Claude plugins directory. * Creates parent directories if needed. */ export declare function writeKnownMarketplaces(paths: ClaudeUserPaths, data: KnownMarketplaces): void; /** * Read installed_plugins.json from the Claude plugins directory. * Returns empty registry if the file does not exist. */ export declare function readInstalledPlugins(paths: ClaudeUserPaths): InstalledPlugins; /** * Write installed_plugins.json to the Claude plugins directory. * Creates parent directories if needed. */ export declare function writeInstalledPlugins(paths: ClaudeUserPaths, data: InstalledPlugins): void; /** * Install a plugin into the Claude user plugin registry. * * Performs 5 steps atomically (best-effort — failures warn but never throw): * 1. Copy plugin files to marketplacesDir * 2. Update known_marketplaces.json * 3. Copy plugin files to pluginsCacheDir * 4. Update installed_plugins.json * 5. Enable plugin in user settings.json */ export declare function installPlugin(opts: InstallPluginOptions): Promise; /** * Read user settings.json as a plain object. * Returns an empty object if the file does not exist or is invalid. */ export declare function readUserSettings(paths: ClaudeUserPaths): Record; //# sourceMappingURL=plugin-registry.d.ts.map