MCPcopy Create free account
hub / github.com/Noumena-Network/code / getTopLevelPaths

Function getTopLevelPaths

src/hooks/fileSuggestions.ts:763–779  ·  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

761 * @returns Array of file/directory paths in the current directory
762 */
763async function getTopLevelPaths(): Promise<string[]> {
764 const fs = getFsImplementation()
765 const cwd = getCwd()
766
767 try {
768 const entries = await fs.readdir(cwd)
769 return entries.map(entry => {
770 const fullPath = path.join(cwd, entry.name)
771 const relativePath = path.relative(cwd, fullPath)
772 // Add trailing separator for directories
773 return entry.isDirectory() ? relativePath + path.sep : relativePath
774 })
775 } catch (error) {
776 logError(error as Error)
777 return []
778 }
779}
780
781/**
782 * 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