refactor: share trimmed string entry normalization

This commit is contained in:
Peter Steinberger
2026-03-07 23:11:04 +00:00
parent 6647d02846
commit d228a62143
12 changed files with 29 additions and 15 deletions

View File

@@ -6,6 +6,7 @@ import {
} from "../../agents/auth-profiles.js";
import { normalizeProviderId } from "../../agents/model-selection.js";
import type { RuntimeEnv } from "../../runtime.js";
import { normalizeStringEntries } from "../../shared/string-normalization.js";
import { shortenHomePath } from "../../utils.js";
import { loadModelsConfig } from "./load-config.js";
import { resolveKnownAgentId } from "./shared.js";
@@ -104,7 +105,7 @@ export async function modelsAuthOrderSetCommand(
allowKeychainPrompt: false,
});
const providerKey = provider;
const requested = (opts.order ?? []).map((entry) => String(entry).trim()).filter(Boolean);
const requested = normalizeStringEntries(opts.order ?? []);
if (requested.length === 0) {
throw new Error("Missing profile ids. Provide one or more profile ids.");
}