@stackmemoryai/stackmemory
Version:
Lossless, project-scoped memory for AI coding tools. Durable context across sessions with 56 MCP tools, FTS5 search, conductor orchestrator, loop/watch monitoring, snapshot capture, pre-flight overlap checks, Claude/Codex/OpenCode wrappers, Linear sync, a
19 lines (18 loc) • 546 B
JavaScript
import { fileURLToPath as __fileURLToPath } from 'url';
import { dirname as __pathDirname } from 'path';
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
import { readdirSync, unlinkSync } from "fs";
import { join } from "path";
function pruneOldFiles(dir, ext, maxKeep) {
try {
const files = readdirSync(dir).filter((f) => f.endsWith(ext)).sort().reverse();
for (const old of files.slice(maxKeep)) {
unlinkSync(join(dir, old));
}
} catch {
}
}
export {
pruneOldFiles
};