mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-03 04:17:54 +00:00
fix(profile): close km legacy kimi compatibility gaps
This commit is contained in:
@@ -10,6 +10,23 @@ const PROFILE_COMPAT_ALIASES: Readonly<Record<string, readonly string[]>> = Obje
|
||||
km: ['kimi'],
|
||||
});
|
||||
|
||||
/**
|
||||
* Resolve a legacy alias to its canonical profile name.
|
||||
* Returns trimmed input when no alias mapping exists.
|
||||
*/
|
||||
export function resolveAliasToCanonical(profileName: string): string {
|
||||
const raw = profileName.trim();
|
||||
const normalized = raw.toLowerCase();
|
||||
|
||||
for (const [canonical, aliases] of Object.entries(PROFILE_COMPAT_ALIASES)) {
|
||||
if (aliases.includes(normalized)) {
|
||||
return canonical;
|
||||
}
|
||||
}
|
||||
|
||||
return raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build lookup candidates for a profile.
|
||||
* Order: exact input -> lowercase form (if different) -> legacy aliases.
|
||||
|
||||
Reference in New Issue
Block a user