MCPcopy Index your code
hub / github.com/callstack/agent-device / pruneStaleDevStateDirs

Function pruneStaleDevStateDirs

scripts/clean-daemon.ts:66–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64// owns and that have been idle past the retention threshold. Never touches the
65// global ~/.agent-device root contents.
66function pruneStaleDevStateDirs(): void {
67 const devRoot = path.join(os.homedir(), '.agent-device', 'dev');
68 const cutoffMs = Date.now() - PRUNE_DEV_MAX_AGE_MS;
69 for (const dirPath of listDevStateDirs(devRoot)) {
70 if (hasLiveDaemon(dirPath) || newestMtimeMs(dirPath) > cutoffMs) continue;
71 fs.rmSync(dirPath, { recursive: true, force: true });
72 process.stdout.write(`Removed stale daemon state dir: ${dirPath}\n`);
73 }
74}
75
76function listDevStateDirs(devRoot: string): string[] {
77 let entries: fs.Dirent[];

Callers 1

clean-daemon.tsFile · 0.85

Calls 4

listDevStateDirsFunction · 0.85
hasLiveDaemonFunction · 0.85
newestMtimeMsFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected