MCPcopy
hub / github.com/codeaashu/claude-code / clearCwdEnvFiles

Function clearCwdEnvFiles

src/utils/sessionEnvironment.ts:33–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31}
32
33export async function clearCwdEnvFiles(): Promise<void> {
34 try {
35 const dir = await getSessionEnvDirPath()
36 const files = await readdir(dir)
37 await Promise.all(
38 files
39 .filter(
40 f =>
41 (f.startsWith('filechanged-hook-') ||
42 f.startsWith('cwdchanged-hook-')) &&
43 HOOK_ENV_REGEX.test(f),
44 )
45 .map(f => writeFile(join(dir, f), '')),
46 )
47 } catch (e: unknown) {
48 const code = getErrnoCode(e)
49 if (code !== 'ENOENT') {
50 logForDebugging(`Failed to clear cwd env files: ${errorMessage(e)}`)
51 }
52 }
53}
54
55export function invalidateSessionEnvCache(): void {
56 logForDebugging('Invalidating session environment cache')

Callers 1

onCwdChangedForHooksFunction · 0.85

Calls 5

getSessionEnvDirPathFunction · 0.85
readdirFunction · 0.85
getErrnoCodeFunction · 0.85
logForDebuggingFunction · 0.85
errorMessageFunction · 0.70

Tested by

no test coverage detected