forked from boos/BoosAPI
Repair release-branch CI after folding dev onto main
The release branch inherited a few merge-shaped regressions after the large dev snapshot was layered onto the latest main snapshot. This commit restores the main-compatible stats and TokenRoutes behavior the CI suite expects and adds the missing multi-brand helper export so the release branch reflects a coherent post-merge tree instead of a partially regressed hybrid. Constraint: Must keep the release branch mergeable to main while preserving the current publish snapshot shape Rejected: Re-open the whole release merge and hand-resolve every file again | too broad for targeted CI repair Confidence: medium Scope-risk: narrow Reversibility: clean Directive: When dev and main have drifted heavily, re-run the main-facing CI tests after any conflict normalization pass Tested: targeted vitest suite for failing CI jobs plus update-center coverage; typecheck Not-tested: Full npm test still not representative locally because of unrelated untracked tmp/sub2api suites outside the PR branch content
This commit is contained in:
+1483
-1204
File diff suppressed because it is too large
Load Diff
@@ -777,30 +777,46 @@ export function getAllBrandNames(): string[] {
|
||||
return BRAND_DEFINITIONS.map((brand) => brand.name);
|
||||
}
|
||||
|
||||
export function getBrand(modelName: string): BrandInfo | null {
|
||||
function toBrandInfo(brand: BrandDefinition): BrandInfo {
|
||||
return {
|
||||
name: brand.name,
|
||||
icon: brand.icon,
|
||||
color: brand.color,
|
||||
};
|
||||
}
|
||||
|
||||
export function getMatchingBrands(modelName: string): BrandInfo[] {
|
||||
const context = buildMatchContext(modelName);
|
||||
const matches: BrandInfo[] = [];
|
||||
const seen = new Set<string>();
|
||||
|
||||
const add = (brand: BrandDefinition) => {
|
||||
if (seen.has(brand.name)) return;
|
||||
seen.add(brand.name);
|
||||
matches.push(toBrandInfo(brand));
|
||||
};
|
||||
|
||||
for (const definition of BRAND_DEFINITIONS) {
|
||||
if (definition.rules.some((rule) => matchesRule(context, rule))) {
|
||||
return {
|
||||
name: definition.name,
|
||||
icon: definition.icon,
|
||||
color: definition.color,
|
||||
};
|
||||
add(definition);
|
||||
}
|
||||
}
|
||||
|
||||
for (const candidate of context.candidates) {
|
||||
for (const rule of BRAND_FALLBACK_BOUNDARY_RULES) {
|
||||
if (rule.boundaryRegex.test(candidate)) {
|
||||
return {
|
||||
name: rule.brand.name,
|
||||
icon: rule.brand.icon,
|
||||
color: rule.brand.color,
|
||||
};
|
||||
add(rule.brand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return matches;
|
||||
}
|
||||
|
||||
export function getMatchingBrandNames(modelName: string): string[] {
|
||||
return getMatchingBrands(modelName).map((brand) => brand.name);
|
||||
}
|
||||
|
||||
export function getBrand(modelName: string): BrandInfo | null {
|
||||
return getMatchingBrands(modelName)[0] || null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user