MCPcopy Create free account
hub / github.com/SethGammon/Citadel / isNativeMemoryPath

Function isNativeMemoryPath

hooks_src/protect-files.js:283–294  ·  view source on GitHub ↗

* True when an absolute, normalized path points into the Claude Code native * auto-memory directory: /.claude/projects/ /memory/ where * is a single path segment. The memory directory itself also matches. * Comparison is case-insensitive on win32. * CITADEL_HOME_OVERRIDE replac

(normalizedPath)

Source from the content-addressed store, hash-verified

281 * Comparison is case-insensitive on win32.
282 * CITADEL_HOME_OVERRIDE replaces the home directory only when CITADEL_TEST=1
283 * so tests can exercise this path without touching the real home.
284 *
285 * @param {string} normalizedPath - Result of path.normalize(path.resolve(...))
286 * @returns {boolean}
287 */
288function isNativeMemoryPath(normalizedPath) {
289 const home = (process.env.CITADEL_TEST === '1' && process.env.CITADEL_HOME_OVERRIDE)
290 ? process.env.CITADEL_HOME_OVERRIDE
291 : os.homedir();
292 const projectsRoot = path.normalize(health.canonicalizePath(
293 path.resolve(home, '.claude', 'projects')
294 ));
295 const fold = (p) => (process.platform === 'win32' ? p.toLowerCase() : p);
296 const target = fold(normalizedPath);
297 const root = fold(projectsRoot);

Callers 1

runFunction · 0.85

Calls 1

foldFunction · 0.85

Tested by

no test coverage detected