* Recursively collects all markdown files from a directory
( dirPath: string, baseDir: string, loadedPaths: Set<string>, )
| 100 | * Recursively collects all markdown files from a directory |
| 101 | */ |
| 102 | async function collectMarkdownFiles( |
| 103 | dirPath: string, |
| 104 | baseDir: string, |
| 105 | loadedPaths: Set<string>, |
| 106 | ): Promise<PluginMarkdownFile[]> { |
| 107 | const files: PluginMarkdownFile[] = [] |
| 108 | const fs = getFsImplementation() |
| 109 | |
| 110 | await walkPluginMarkdown( |
| 111 | dirPath, |
| 112 | async fullPath => { |
| 113 | if (isDuplicatePath(fs, fullPath, loadedPaths)) return |
| 114 | const content = await fs.readFile(fullPath, { encoding: 'utf-8' }) |
| 115 | const { frontmatter, content: markdownContent } = parseFrontmatter( |
| 116 | content, |
| 117 | fullPath, |
| 118 | ) |
| 119 | files.push({ |
| 120 | filePath: fullPath, |
| 121 | baseDir, |
| 122 | frontmatter, |
| 123 | content: markdownContent, |
| 124 | }) |
| 125 | }, |
| 126 | { stopAtSkillDir: true, logLabel: 'commands' }, |
| 127 | ) |
| 128 | |
| 129 | return files |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * Transforms plugin markdown files to handle skill directories |
no test coverage detected