(
pluginPathOrName: string,
pluginName?: string
)
| 604 | |
| 605 | // 获取插件 README.md 内容 |
| 606 | public async getPluginReadme( |
| 607 | pluginPathOrName: string, |
| 608 | pluginName?: string |
| 609 | ): Promise<{ success: boolean; content?: string; error?: string }> { |
| 610 | try { |
| 611 | // 如果 pluginPathOrName 是一个路径(包含 / 或 \),则读取本地文件 |
| 612 | if (pluginPathOrName.includes('/') || pluginPathOrName.includes('\\')) { |
| 613 | return await this.getLocalPluginReadme(pluginPathOrName) |
| 614 | } |
| 615 | |
| 616 | // 否则当作插件名称,从远程加载 |
| 617 | const name = pluginName || pluginPathOrName |
| 618 | return await this.getRemotePluginReadme(name) |
| 619 | } catch (error: unknown) { |
| 620 | console.error('[Plugins] 读取插件 README 失败:', error) |
| 621 | return { success: false, error: error instanceof Error ? error.message : '读取失败' } |
| 622 | } |
| 623 | } |
| 624 | |
| 625 | // 读取本地插件 README |
| 626 | private async getLocalPluginReadme( |
no test coverage detected