| 107 | try { |
| 108 | const twoHoursAgo = Date.now() - 2 * 60 * 60 * 1000; |
| 109 | const scanDir = (dir) => { |
| 110 | const entries = fs.readdirSync(dir, { withFileTypes: true }); |
| 111 | for (const entry of entries) { |
| 112 | const full = path.join(dir, entry.name); |
| 113 | if (entry.isDirectory()) { scanDir(full); continue; } |
| 114 | if (!entry.name.endsWith('.md')) continue; |
| 115 | const stat = fs.statSync(full); |
| 116 | if (stat.mtimeMs > twoHoursAgo) { |
| 117 | state.pendingResearch.push(path.relative(PROJECT_ROOT, full).replace(/\\/g, '/')); |
| 118 | } |
| 119 | } |
| 120 | }; |
| 121 | scanDir(researchDir); |
| 122 | } catch { /* non-critical */ } |
| 123 | } |