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

@@ -12,7 +12,9 @@ export function resolveMainSessionKey(cfg?: {
session?: { scope?: SessionScope; mainKey?: string };
agents?: { list?: Array<{ id?: string; default?: boolean }> };
}): string {
if (cfg?.session?.scope === "global") return "global";
if (cfg?.session?.scope === "global") {
return "global";
}
const agents = cfg?.agents?.list ?? [];
const defaultAgentId =
agents.find((agent) => agent?.default)?.id ?? agents[0]?.id ?? DEFAULT_AGENT_ID;
@@ -40,7 +42,9 @@ export function resolveExplicitAgentSessionKey(params: {
agentId?: string | null;
}): string | undefined {
const agentId = params.agentId?.trim();
if (!agentId) return undefined;
if (!agentId) {
return undefined;
}
return resolveAgentMainSessionKey({ cfg: params.cfg, agentId });
}
@@ -50,7 +54,9 @@ export function canonicalizeMainSessionAlias(params: {
sessionKey: string;
}): string {
const raw = params.sessionKey.trim();
if (!raw) return raw;
if (!raw) {
return raw;
}
const agentId = normalizeAgentId(params.agentId);
const mainKey = normalizeMainKey(params.cfg?.session?.mainKey);
@@ -63,7 +69,11 @@ export function canonicalizeMainSessionAlias(params: {
const isMainAlias =
raw === "main" || raw === mainKey || raw === agentMainSessionKey || raw === agentMainAliasKey;
if (params.cfg?.session?.scope === "global" && isMainAlias) return "global";
if (isMainAlias) return agentMainSessionKey;
if (params.cfg?.session?.scope === "global" && isMainAlias) {
return "global";
}
if (isMainAlias) {
return agentMainSessionKey;
}
return raw;
}