MCPcopy
hub / github.com/ZToolsCenter/ZTools / getPluginReadme

Method getPluginReadme

src/main/api/renderer/plugins.ts:606–623  ·  view source on GitHub ↗
(
    pluginPathOrName: string,
    pluginName?: string
  )

Source from the content-addressed store, hash-verified

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(

Callers 3

setupIPCMethod · 0.95
setupIPCMethod · 0.80
loadReadmeFunction · 0.80

Calls 2

getLocalPluginReadmeMethod · 0.95
getRemotePluginReadmeMethod · 0.95

Tested by

no test coverage detected