| 391 | } |
| 392 | |
| 393 | function generateIntakeItem(marker, hash) { |
| 394 | if (!fs.existsSync(INTAKE_DIR)) { |
| 395 | fs.mkdirSync(INTAKE_DIR, { recursive: true }); |
| 396 | } |
| 397 | |
| 398 | const timestamp = Date.now(); |
| 399 | const slug = slugify(marker.file); |
| 400 | const filename = `watch-${marker.action}-${slug}-${timestamp}.md`; |
| 401 | const filePath = path.join(INTAKE_DIR, filename); |
| 402 | |
| 403 | const descriptionBlock = marker.description ? `\n${marker.description}\n` : ''; |
| 404 | |
| 405 | const content = `--- |
| 406 | title: "${marker.action} ${marker.file}:${marker.line}" |
| 407 | status: pending |
| 408 | priority: normal |
| 409 | target: ${marker.file} |
| 410 | source: watch |
| 411 | marker_hash: ${hash} |
| 412 | --- |
| 413 | |
| 414 | Marker comment found at ${marker.file}:${marker.line}: |
| 415 | \`${marker.raw}\` |
| 416 | ${descriptionBlock}`; |
| 417 | |
| 418 | fs.writeFileSync(filePath, content, 'utf8'); |
| 419 | return filename; |
| 420 | } |
| 421 | |
| 422 | // -- Output formatting -------------------------------------------------------- |
| 423 | |