MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / loadKnowledgeFilesFromPaths

Function loadKnowledgeFilesFromPaths

sdk/src/run-state.ts:455–479  ·  view source on GitHub ↗
(params: {
  cwd: string
  filePaths: string[]
  fs: CodebuffFileSystem
  logger: Logger
})

Source from the content-addressed store, hash-verified

453}
454
455async function loadKnowledgeFilesFromPaths(params: {
456 cwd: string
457 filePaths: string[]
458 fs: CodebuffFileSystem
459 logger: Logger
460}): Promise<Record<string, string>> {
461 const { cwd, filePaths, fs, logger } = params
462 const selectedFilePaths = selectKnowledgeFilePaths(filePaths)
463
464 const knowledgeFiles: Record<string, string> = {}
465 for (const filePath of selectedFilePaths) {
466 try {
467 knowledgeFiles[filePath] = await fs.readFile(
468 path.join(cwd, filePath),
469 'utf8',
470 )
471 } catch (error) {
472 logger.debug?.(
473 { filePath, error: getErrorObject(error) },
474 'Failed to read project knowledge file',
475 )
476 }
477 }
478 return knowledgeFiles
479}
480
481export async function initialSessionState(
482 params: InitialSessionStateOptions,

Callers 1

initialSessionStateFunction · 0.85

Calls 3

getErrorObjectFunction · 0.90
selectKnowledgeFilePathsFunction · 0.85
readFileMethod · 0.80

Tested by

no test coverage detected