MCPcopy Index your code
hub / github.com/codeaashu/claude-code / collectMarkdownFiles

Function collectMarkdownFiles

src/utils/plugins/loadPluginCommands.ts:102–130  ·  view source on GitHub ↗

* Recursively collects all markdown files from a directory

(
  dirPath: string,
  baseDir: string,
  loadedPaths: Set<string>,
)

Source from the content-addressed store, hash-verified

100 * Recursively collects all markdown files from a directory
101 */
102async 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

Callers 1

Calls 6

getFsImplementationFunction · 0.85
walkPluginMarkdownFunction · 0.85
isDuplicatePathFunction · 0.85
parseFrontmatterFunction · 0.85
readFileMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected