(pluginName: string, branch?: string)
| 279 | } |
| 280 | |
| 281 | async function resolveGitHubPluginPath(pluginName: string, branch?: string): Promise<ResolvedPluginPath> { |
| 282 | const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "compound-plugin-")) |
| 283 | const source = resolveGitHubSource() |
| 284 | try { |
| 285 | await cloneGitHubRepo(source, tempRoot, branch) |
| 286 | } catch (error) { |
| 287 | await fs.rm(tempRoot, { recursive: true, force: true }) |
| 288 | throw error |
| 289 | } |
| 290 | |
| 291 | const pluginPath = await resolvePluginRoot(tempRoot, pluginName) |
| 292 | if (!pluginPath) { |
| 293 | await fs.rm(tempRoot, { recursive: true, force: true }) |
| 294 | throw new Error(`Could not find plugin ${pluginName} in ${source}.`) |
| 295 | } |
| 296 | |
| 297 | return { |
| 298 | path: pluginPath, |
| 299 | cleanup: async () => { |
| 300 | await fs.rm(tempRoot, { recursive: true, force: true }) |
| 301 | }, |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | async function resolvePluginRoot(repoRoot: string, pluginName: string): Promise<string | null> { |
| 306 | const rootManifest = path.join(repoRoot, ".claude-plugin", "plugin.json") |
no test coverage detected