MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / removeDirectory

Function removeDirectory

src/directory.ts:1040–1063  ·  view source on GitHub ↗
(projectRoot: string)

Source from the content-addressed store, hash-verified

1038 * Remove the .codegraph directory
1039 */
1040export function removeDirectory(projectRoot: string): void {
1041 const codegraphDir = getCodeGraphDir(projectRoot);
1042
1043 if (!fs.existsSync(codegraphDir)) {
1044 return;
1045 }
1046
1047 // Verify .codegraph is a real directory, not a symlink pointing elsewhere
1048 const lstat = fs.lstatSync(codegraphDir);
1049 if (lstat.isSymbolicLink()) {
1050 // Only remove the symlink itself, never follow it for recursive delete
1051 fs.unlinkSync(codegraphDir);
1052 return;
1053 }
1054
1055 if (!lstat.isDirectory()) {
1056 // Not a directory - remove the single file
1057 fs.unlinkSync(codegraphDir);
1058 return;
1059 }
1060
1061 // Recursively remove directory
1062 fs.rmSync(codegraphDir, { recursive: true, force: true });
1063}
1064
1065/**
1066 * Get all files in the .codegraph directory

Callers 1

uninitializeMethod · 0.90

Calls 1

getCodeGraphDirFunction · 0.85

Tested by

no test coverage detected