| 35 | if (!arg.startsWith('--')) options.projectRoot = path.resolve(arg); |
| 36 | } |
| 37 | return options; |
| 38 | } |
| 39 | |
| 40 | function readMarkdownFiles(dir, skip = []) { |
| 41 | if (!fs.existsSync(dir)) return []; |
| 42 | const results = []; |
| 43 | for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { |
| 44 | if (!entry.isFile() || !entry.name.endsWith('.md')) continue; |
| 45 | if (skip.some(s => entry.name.includes(s))) continue; |
| 46 | const content = fs.readFileSync(path.join(dir, entry.name), 'utf8').trim(); |
| 47 | if (content) results.push({ name: entry.name, content }); |
| 48 | } |
| 49 | return results; |
| 50 | } |