(content, tasks)
| 130 | return rows.join('\n'); |
| 131 | } |
| 132 | |
| 133 | function updateWorkQueue(content, tasks) { |
| 134 | const lines = String(content || '').split(/\r?\n/); |
| 135 | const start = lines.findIndex((line) => /^##\s+Work Queue\s*$/i.test(line.trim())); |
| 136 | const replacement = ['## Work Queue', serializeWorkQueue(tasks)]; |
| 137 | if (start === -1) { |
| 138 | return `${String(content || '').replace(/\s*$/, '')}\n\n${replacement.join('\n')}\n`; |
| 139 | } |
| 140 | |
| 141 | let end = start + 1; |
| 142 | while (end < lines.length && !/^##\s+/.test(lines[end].trim())) end++; |
| 143 | return [ |
| 144 | ...lines.slice(0, start), |
| 145 | ...replacement, |
| 146 | ...lines.slice(end), |
| 147 | ].join('\n'); |
| 148 | } |
| 149 | |
| 150 | function buildTaskMap(tasks) { |
no test coverage detected