(content: string)
| 1286 | } |
| 1287 | |
| 1288 | function extractOutputsFromContent(content: string): Record<string, any> { |
| 1289 | const outputsStart = content.search(/outputs\s*:\s*{/) |
| 1290 | if (outputsStart === -1) return {} |
| 1291 | |
| 1292 | const openBracePos = content.indexOf('{', outputsStart) |
| 1293 | if (openBracePos === -1) return {} |
| 1294 | |
| 1295 | const pos = findMatchingClose(content, openBracePos) |
| 1296 | if (pos === -1) return {} |
| 1297 | |
| 1298 | const outputsContent = content.substring(openBracePos + 1, pos - 1).trim() |
| 1299 | const outputs: Record<string, any> = {} |
| 1300 | |
| 1301 | const fieldRegex = /(\w+)\s*:\s*{/g |
| 1302 | let match |
| 1303 | const fieldPositions: Array<{ name: string; start: number }> = [] |
| 1304 | |
| 1305 | while ((match = fieldRegex.exec(outputsContent)) !== null) { |
| 1306 | fieldPositions.push({ |
| 1307 | name: match[1], |
| 1308 | start: match.index + match[0].length - 1, |
| 1309 | }) |
| 1310 | } |
| 1311 | |
| 1312 | fieldPositions.forEach((field) => { |
| 1313 | const endPos = findMatchingClose(outputsContent, field.start) |
| 1314 | |
| 1315 | if (endPos !== -1) { |
| 1316 | const fieldContent = outputsContent.substring(field.start + 1, endPos - 1).trim() |
| 1317 | |
| 1318 | const typeMatch = fieldContent.match(/type\s*:\s*['"](.*?)['"]/) |
| 1319 | const description = extractDescription(fieldContent) |
| 1320 | |
| 1321 | if (typeMatch) { |
| 1322 | outputs[field.name] = { |
| 1323 | type: typeMatch[1], |
| 1324 | description: description || `${field.name} output from the block`, |
| 1325 | } |
| 1326 | } |
| 1327 | } |
| 1328 | }) |
| 1329 | |
| 1330 | return outputs |
| 1331 | } |
| 1332 | |
| 1333 | function extractToolsAccessFromContent(content: string): string[] { |
| 1334 | const accessMatch = content.match(/access\s*:\s*\[\s*([^\]]+)\s*\]/) |
no test coverage detected