MCPcopy Create free account
hub / github.com/simstudioai/sim / chunkAllDocs

Method chunkAllDocs

apps/sim/lib/chunkers/docs-chunker.ts:39–62  ·  view source on GitHub ↗
(docsPath: string)

Source from the content-addressed store, hash-verified

37 }
38
39 async chunkAllDocs(docsPath: string): Promise<DocChunk[]> {
40 const allChunks: DocChunk[] = []
41
42 try {
43 const mdxFiles = await this.findMdxFiles(docsPath)
44 logger.info(`Found ${mdxFiles.length} .mdx files to process`)
45
46 for (const filePath of mdxFiles) {
47 try {
48 const chunks = await this.chunkMdxFile(filePath, docsPath)
49 allChunks.push(...chunks)
50 logger.info(`Processed ${filePath}: ${chunks.length} chunks`)
51 } catch (error) {
52 logger.error(`Error processing ${filePath}:`, error)
53 }
54 }
55
56 logger.info(`Total chunks generated: ${allChunks.length}`)
57 return allChunks
58 } catch (error) {
59 logger.error('Error processing docs:', error)
60 throw error
61 }
62 }
63
64 async chunkMdxFile(filePath: string, basePath: string): Promise<DocChunk[]> {
65 const content = await fs.readFile(filePath, 'utf-8')

Callers 1

processDocsFunction · 0.95

Calls 5

findMdxFilesMethod · 0.95
chunkMdxFileMethod · 0.95
infoMethod · 0.80
errorMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected