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

Function projectHash

src/mcp/daemon-paths.ts:46–50  ·  view source on GitHub ↗

* Short stable identifier for a project root — used in tmpdir/pipe names. * * Hashed over canonicalProjectRoot, never a raw `path.resolve`: the key * is a rendezvous, so every spelling of one directory must land on one name or * a proxy probes a pipe the running daemon never bound (see t

(projectRoot: string)

Source from the content-addressed store, hash-verified

44 * a proxy probes a pipe the running daemon never bound (see that function).
45 */
46function projectHash(projectRoot: string): string {
47 // `crypto` is the slowest builtin to load, and every CLI command loads this file.
48 const { createHash } = require('crypto') as typeof import('crypto');
49 return createHash('sha256').update(canonicalProjectRoot(projectRoot)).digest('hex').slice(0, 16);
50}
51
52/**
53 * The deterministic tmpdir socket path for `projectRoot` — the fallback used

Callers 2

tmpdirSocketPathFunction · 0.85

Calls 2

canonicalProjectRootFunction · 0.90
updateMethod · 0.80

Tested by

no test coverage detected