MCPcopy Index your code
hub / github.com/liuup/claude-code-analysis / sanitizePath

Function sanitizePath

src/utils/cachePaths.ts:13–19  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

11// data (error logs, MCP logs) is not orphaned.
12const MAX_SANITIZED_LENGTH = 200
13function sanitizePath(name: string): string {
14 const sanitized = name.replace(/[^a-zA-Z0-9]/g, '-')
15 if (sanitized.length <= MAX_SANITIZED_LENGTH) {
16 return sanitized
17 }
18 return `${sanitized.slice(0, MAX_SANITIZED_LENGTH)}-${Math.abs(djb2Hash(name)).toString(36)}`
19}
20
21function getProjectDir(cwd: string): string {
22 return sanitizePath(cwd)

Callers 13

sessionStorage.tsFile · 0.70
gatherProjectCandidatesFunction · 0.70
getProjectDirFunction · 0.70
cachePaths.tsFile · 0.70
getRecordFilePathFunction · 0.70
getSessionRecordingPathsFunction · 0.70
getLocalAgentMemoryDirFunction · 0.50
getProjectTempDirFunction · 0.50
getBridgePointerPathFunction · 0.50

Calls 2

djb2HashFunction · 0.85
toStringMethod · 0.65

Tested by

no test coverage detected