MCPcopy Create free account
hub / github.com/RioArisk/claudecode_api_RemoteControl / listDirectories

Function listDirectories

lib/transcript.js:495–510  ·  view source on GitHub ↗
(target)

Source from the content-addressed store, hash-verified

493}
494
495function listDirectories(target) {
496 const cwd = assertDirectoryPath(target);
497 const roots = getDirectoryRoots();
498 const parentDir = path.dirname(cwd);
499 const parent = normalizeFsPath(parentDir) === normalizeFsPath(cwd) ? null : parentDir;
500
501 const entries = fs.readdirSync(cwd, { withFileTypes: true })
502 .filter(entry => entry.isDirectory())
503 .map(entry => ({
504 name: entry.name,
505 path: path.join(cwd, entry.name),
506 }))
507 .sort((a, b) => a.name.localeCompare(b.name, undefined, { numeric: true, sensitivity: 'base' }));
508
509 return { cwd, parent, roots, entries };
510}
511
512module.exports = {
513 normalizeFsPath,

Callers 1

setupWebSocketServerFunction · 0.85

Calls 3

assertDirectoryPathFunction · 0.85
getDirectoryRootsFunction · 0.85
normalizeFsPathFunction · 0.85

Tested by

no test coverage detected