( out: SkillRoot[], root: SkillRoot, isDir: (p: string) => Promise<boolean>, realpath: (p: string) => Promise<string>, )
| 340 | } |
| 341 | |
| 342 | async function pushProvidedRoot( |
| 343 | out: SkillRoot[], |
| 344 | root: SkillRoot, |
| 345 | isDir: (p: string) => Promise<boolean>, |
| 346 | realpath: (p: string) => Promise<string>, |
| 347 | ): Promise<boolean> { |
| 348 | if (!(await isDir(root.path))) return false; |
| 349 | const resolved = await realpath(root.path); |
| 350 | const existingIndex = out.findIndex((existing) => existing.path === resolved); |
| 351 | if (existingIndex < 0) { |
| 352 | out.push({ ...root, path: resolved }); |
| 353 | return true; |
| 354 | } |
| 355 | const existing = out[existingIndex]; |
| 356 | if (existing !== undefined && existing.plugin === undefined && root.plugin !== undefined) { |
| 357 | out[existingIndex] = { ...existing, plugin: root.plugin }; |
| 358 | } |
| 359 | return true; |
| 360 | } |
| 361 | |
| 362 | async function parseAndRegister(input: { |
| 363 | readonly parse: NonNullable<DiscoverSkillsOptions['parse']>; |
no test coverage detected