| 286 | // -- Marker scanning ---------------------------------------------------------- |
| 287 | |
| 288 | function scanFileForMarkers(filePath, relPath) { |
| 289 | const markers = []; |
| 290 | let content; |
| 291 | try { |
| 292 | content = fs.readFileSync(filePath, 'utf8'); |
| 293 | } catch { |
| 294 | return markers; |
| 295 | } |
| 296 | |
| 297 | const lines = content.split(/\r?\n/); |
| 298 | for (let i = 0; i < lines.length; i++) { |
| 299 | const line = lines[i]; |
| 300 | for (const pattern of MARKER_PATTERNS) { |
| 301 | const match = line.match(pattern); |
| 302 | if (match) { |
| 303 | const action = match[1].toLowerCase(); |
| 304 | const description = (match[2] || '').trim(); |
| 305 | if (VALID_ACTIONS.has(action)) { |
| 306 | markers.push({ |
| 307 | file: relPath, |
| 308 | line: i + 1, |
| 309 | action, |
| 310 | description, |
| 311 | raw: line.trim(), |
| 312 | timestamp: new Date().toISOString(), |
| 313 | }); |
| 314 | } |
| 315 | break; // one marker per line |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | return markers; |
| 321 | } |
| 322 | |
| 323 | // -- File categorization ------------------------------------------------------ |
| 324 | |