( manifest: ResolvedManifest, customWorkflows: Record<string, string[]>, )
| 154 | } |
| 155 | |
| 156 | export function createCustomWorkflowsFromConfig( |
| 157 | manifest: ResolvedManifest, |
| 158 | customWorkflows: Record<string, string[]>, |
| 159 | ): { workflows: WorkflowManifestEntry[]; warnings: string[] } { |
| 160 | const workflows: WorkflowManifestEntry[] = []; |
| 161 | const warnings: string[] = []; |
| 162 | const toolIdByAlias = buildToolAliasMap(manifest); |
| 163 | |
| 164 | for (const [rawWorkflowName, rawToolNames] of Object.entries(customWorkflows)) { |
| 165 | const workflowName = normalizeName(rawWorkflowName); |
| 166 | if (!workflowName) { |
| 167 | continue; |
| 168 | } |
| 169 | |
| 170 | if (manifest.workflows.has(workflowName)) { |
| 171 | warnings.push( |
| 172 | `[config] Ignoring custom workflow '${workflowName}' because it conflicts with a built-in workflow.`, |
| 173 | ); |
| 174 | continue; |
| 175 | } |
| 176 | |
| 177 | const { toolIds, unknownToolNames } = resolveCustomWorkflowToolIds(toolIdByAlias, rawToolNames); |
| 178 | if (unknownToolNames.length > 0) { |
| 179 | warnings.push( |
| 180 | `[config] Custom workflow '${workflowName}' references unknown tools: ${unknownToolNames.join(', ')}`, |
| 181 | ); |
| 182 | } |
| 183 | if (toolIds.length === 0) { |
| 184 | warnings.push( |
| 185 | `[config] Ignoring custom workflow '${workflowName}' because it resolved to no known tools.`, |
| 186 | ); |
| 187 | continue; |
| 188 | } |
| 189 | |
| 190 | workflows.push(buildCustomWorkflowEntry(workflowName, toolIds)); |
| 191 | } |
| 192 | |
| 193 | return { workflows, warnings }; |
| 194 | } |
| 195 | |
| 196 | function emitConfigWarningMetric(kind: 'unknown_workflow' | 'invalid_custom_workflow'): void { |
| 197 | recordInternalErrorMetric({ |
no test coverage detected