refactor: remove legacy config and state aliases (PR5)

This commit is contained in:
ejclaw
2026-04-10 22:09:04 +09:00
parent 312d19c0d1
commit e5bd721ac4
18 changed files with 155 additions and 980 deletions

27
src/data-state-files.ts Normal file
View File

@@ -0,0 +1,27 @@
import fs from 'fs';
import path from 'path';
const ALLOWED_DATA_JSON_PATTERNS = [
/^token-rotation-state\.json$/,
/^codex-rotation-state\.json$/,
/^claude-usage-cache\.json$/,
/^restart-context\..+\.json$/,
];
function isAllowedDataStateJson(filename: string): boolean {
return ALLOWED_DATA_JSON_PATTERNS.some((pattern) => pattern.test(filename));
}
export function listUnexpectedDataStateFiles(dataDir: string): string[] {
if (!fs.existsSync(dataDir)) {
return [];
}
return fs
.readdirSync(dataDir, { withFileTypes: true })
.filter((entry) => entry.isFile())
.map((entry) => entry.name)
.filter((filename) => path.extname(filename) === '.json')
.filter((filename) => !isAllowedDataStateJson(filename))
.sort();
}