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

@@ -23,7 +23,9 @@ export async function modelsFallbacksListCommand(
return;
}
if (opts.plain) {
for (const entry of fallbacks) runtime.log(entry);
for (const entry of fallbacks) {
runtime.log(entry);
}
return;
}
@@ -32,7 +34,9 @@ export async function modelsFallbacksListCommand(
runtime.log("- none");
return;
}
for (const entry of fallbacks) runtime.log(`- ${entry}`);
for (const entry of fallbacks) {
runtime.log(`- ${entry}`);
}
}
export async function modelsFallbacksAddCommand(modelRaw: string, runtime: RuntimeEnv) {
@@ -40,7 +44,9 @@ export async function modelsFallbacksAddCommand(modelRaw: string, runtime: Runti
const resolved = resolveModelTarget({ raw: modelRaw, cfg });
const targetKey = modelKey(resolved.provider, resolved.model);
const nextModels = { ...cfg.agents?.defaults?.models };
if (!nextModels[targetKey]) nextModels[targetKey] = {};
if (!nextModels[targetKey]) {
nextModels[targetKey] = {};
}
const aliasIndex = buildModelAliasIndex({
cfg,
defaultProvider: DEFAULT_PROVIDER,
@@ -57,7 +63,9 @@ export async function modelsFallbacksAddCommand(modelRaw: string, runtime: Runti
.filter((entry): entry is NonNullable<typeof entry> => Boolean(entry))
.map((entry) => modelKey(entry.ref.provider, entry.ref.model));
if (existingKeys.includes(targetKey)) return cfg;
if (existingKeys.includes(targetKey)) {
return cfg;
}
const existingModel = cfg.agents?.defaults?.model as
| { primary?: string; fallbacks?: string[] }
@@ -98,7 +106,9 @@ export async function modelsFallbacksRemoveCommand(modelRaw: string, runtime: Ru
defaultProvider: DEFAULT_PROVIDER,
aliasIndex,
});
if (!resolvedEntry) return true;
if (!resolvedEntry) {
return true;
}
return modelKey(resolvedEntry.ref.provider, resolvedEntry.ref.model) !== targetKey;
});