import { PluginInfo } from "../types.mjs"; //#region src/services/plugin.d.ts interface ParsedPluginRef { name: string; type: 'git' | 'npm'; url?: string; version?: string; } /** * Parses a plugin reference string into its components. * Supports npm packages (scoped, unscoped, versioned) and git references. */ declare function parsePluginRef(ref: string): ParsedPluginRef; /** * 获取平台相关的缓存目录 * Linux: $XDG_CACHE_HOME 或 ~/.cache * macOS: ~/Library/Caches * Windows: %LOCALAPPDATA% */ declare function getPlatformCacheDir(): string; /** * Returns the default cache directory for opencode packages. * Respects XDG_CACHE_HOME if set. */ declare function getDefaultCacheDir(): string; /** * Resolves plugin information including current installed version * and latest available version. */ declare function resolvePluginInfo(ref: string, cacheDir?: string): Promise; /** * 插件升级结果 */ interface UpgradeResult { currentVersion: null | string; message?: string; name: string; previousVersion: null | string; status: 'failed' | 'skipped' | 'upgraded'; } /** * 升级单个插件到最新版本 * npm 插件:在缓存目录执行 npm install @latest * git 插件:在缓存目录执行 npm install @ * 固定版本的 npm 插件会被跳过 */ declare function upgradePlugin(ref: string, cacheDir?: string): Promise; /** * 删除插件的缓存目录 * @param ref 插件引用字符串 * @param cacheDir 可选的自定义缓存目录 * @returns 是否成功删除(目录不存在也算成功) */ declare function removePluginCache(ref: string, cacheDir?: string): { path: string; removed: boolean; }; //#endregion export { UpgradeResult, getDefaultCacheDir, getPlatformCacheDir, parsePluginRef, removePluginCache, resolvePluginInfo, upgradePlugin };