chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions

View File

@@ -37,18 +37,28 @@ export function resolveSubagentRegistryPath(): string {
export function loadSubagentRegistryFromDisk(): Map<string, SubagentRunRecord> {
const pathname = resolveSubagentRegistryPath();
const raw = loadJsonFile(pathname);
if (!raw || typeof raw !== "object") return new Map();
if (!raw || typeof raw !== "object") {
return new Map();
}
const record = raw as Partial<PersistedSubagentRegistry>;
if (record.version !== 1 && record.version !== 2) return new Map();
if (record.version !== 1 && record.version !== 2) {
return new Map();
}
const runsRaw = record.runs;
if (!runsRaw || typeof runsRaw !== "object") return new Map();
if (!runsRaw || typeof runsRaw !== "object") {
return new Map();
}
const out = new Map<string, SubagentRunRecord>();
const isLegacy = record.version === 1;
let migrated = false;
for (const [runId, entry] of Object.entries(runsRaw)) {
if (!entry || typeof entry !== "object") continue;
if (!entry || typeof entry !== "object") {
continue;
}
const typed = entry as LegacySubagentRunRecord;
if (!typed.runId || typeof typed.runId !== "string") continue;
if (!typed.runId || typeof typed.runId !== "string") {
continue;
}
const legacyCompletedAt =
isLegacy && typeof typed.announceCompletedAt === "number"
? typed.announceCompletedAt
@@ -81,7 +91,9 @@ export function loadSubagentRegistryFromDisk(): Map<string, SubagentRunRecord> {
cleanupCompletedAt,
cleanupHandled,
});
if (isLegacy) migrated = true;
if (isLegacy) {
migrated = true;
}
}
if (migrated) {
try {