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

Function getTopLevelPaths

src/hooks/fileSuggestions.ts:692–708  ·  view source on GitHub ↗

* Gets the top-level files and directories in the current working directory * @returns Array of file/directory paths in the current directory

()

Source from the content-addressed store, hash-verified

690 * @returns Array of file/directory paths in the current directory
691 */
692async function getTopLevelPaths(): Promise<string[]> {
693 const fs = getFsImplementation()
694 const cwd = getCwd()
695
696 try {
697 const entries = await fs.readdir(cwd)
698 return entries.map(entry => {
699 const fullPath = path.join(cwd, entry.name)
700 const relativePath = path.relative(cwd, fullPath)
701 // Add trailing separator for directories
702 return entry.isDirectory() ? relativePath + path.sep : relativePath
703 })
704 } catch (error) {
705 logError(error as Error)
706 return []
707 }
708}
709
710/**
711 * Generate file suggestions for the current input and cursor position

Callers 1

generateFileSuggestionsFunction · 0.85

Calls 3

getFsImplementationFunction · 0.85
getCwdFunction · 0.85
logErrorFunction · 0.50

Tested by

no test coverage detected