import type { DoctorCheck, DoctorOptions, InstalledPlugin, InstallOptions, PluginSettingSchema } from "./types.js"; export declare class PluginManager { #private; constructor(cwd?: string); /** * Install a plugin with optional feature selection. * * Accepts: * - npm specs: `pkg`, `pkg@1.2.3`, `@scope/pkg`, `pkg[features]` * - namespaced git shorthand: `github:user/repo[#ref]`, `gitlab:`, `bitbucket:`, * `codeberg:`, `sourcehut:`/`srht:` * - pi-style git shorthand: `git:github.com/user/repo`, `git:git@github.com:user/repo` * - full git URLs: `https://github.com/user/repo`, `git@github.com:user/repo`, * `ssh://…`, `git+https://…` * * For git specs the package name is not knowable from the spec, so the * installer diffs `plugins/package.json` `dependencies` before and after * to find the newly added key. * * @param specString - Package specifier with optional features: "pkg", "pkg[feat]", "pkg[*]", "pkg[]" * @param options - Install options * @returns Installed plugin metadata */ install(specString: string, options?: InstallOptions): Promise; /** * Upgrade an installed npm or git plugin by re-installing it from the source * recorded in `plugins/package.json`: git plugins re-resolve their recorded * ref, npm plugins move to the latest published version. The enabled state * and feature selection survive the upgrade. * * @returns The previously installed version, the upgraded plugin, and whether * anything changed — a git plugin on a moving ref can pick up new commits * without bumping its `package.json` version, so this also compares the * `bun.lock` resolution. */ upgrade(name: string): Promise<{ from: string | undefined; plugin: InstalledPlugin; changed: boolean; }>; /** Throws the error `upgrade(name)` would throw before it changes anything (unknown, linked or local plugin). */ validateUpgrade(name: string): Promise; /** * Uninstall a plugin. */ uninstall(name: string): Promise; /** * Resolve one installed plugin, including a marketplace runtime package that * is intentionally omitted from {@link list}. * * Resolution order mirrors {@link getEnabledPlugins}: an explicit trusted * `options.path` (marketplace registry entry) wins; otherwise the active * enabled project plugin root shadows the user root — so inside a project * where the same package name exists in both scopes, config reads and writes * act on the package copy active at runtime. */ getPlugin(name: string, options?: { path?: string; }): Promise; /** * List all installed plugins. */ list(): Promise; /** * Link a local plugin for development. */ link(localPath: string): Promise; /** * Enable or disable a plugin globally. */ setEnabled(name: string, enabled: boolean): Promise; /** * Get enabled features for a plugin. */ getEnabledFeatures(name: string): Promise; /** * Set enabled features for a plugin. */ setEnabledFeatures(name: string, features: string[] | null): Promise; /** * Get all settings for a plugin. */ getPluginSettings(name: string): Promise>; /** * Set a plugin setting value. */ setPluginSetting(name: string, key: string, value: unknown): Promise; /** * Delete a plugin setting. */ deletePluginSetting(name: string, key: string): Promise; /** * Run health checks on the plugin system. */ doctor(options?: DoctorOptions): Promise; } export interface ValidationResult { valid: boolean; error?: string; } /** * Validate a setting value against its schema. */ export declare function validateSetting(value: unknown, schema: PluginSettingSchema): ValidationResult; /** * Parse a string value according to a setting schema's type. */ export declare function parseSettingValue(valueStr: string, schema: PluginSettingSchema): unknown;