(opts: BuildCliToolCatalogOptions)
| 175 | * CLI visibility is determined by manifest availability and predicates. |
| 176 | */ |
| 177 | export async function buildCliToolCatalog(opts: BuildCliToolCatalogOptions): Promise<ToolCatalog> { |
| 178 | const manifestCatalog = await buildCliToolCatalogFromManifest(); |
| 179 | |
| 180 | if (!opts.cliExposedWorkflowIds.includes('xcode-ide')) { |
| 181 | return manifestCatalog; |
| 182 | } |
| 183 | |
| 184 | const dynamicTools = await loadDaemonBackedXcodeProxyTools(opts); |
| 185 | if (dynamicTools.length === 0) { |
| 186 | return manifestCatalog; |
| 187 | } |
| 188 | |
| 189 | const existingCliNames = new Set(manifestCatalog.tools.map((tool) => tool.cliName)); |
| 190 | const mergedTools = [ |
| 191 | ...manifestCatalog.tools, |
| 192 | ...dynamicTools.filter((tool) => !existingCliNames.has(tool.cliName)), |
| 193 | ]; |
| 194 | |
| 195 | return createToolCatalog(mergedTools); |
| 196 | } |
no test coverage detected