refactor(shared): deduplicate model resolution utility functions

Extract normalizeModel() (3 identical copies) and normalizeModelID()
(2 identical copies) into canonical src/shared/model-normalization.ts.
Delete dead-end duplicate model-name-matcher.ts. Update all consumers.
This commit is contained in:
IYODA Atsushi
2026-03-02 16:38:22 +09:00
parent a666612354
commit 4b366926d4
11 changed files with 140 additions and 120 deletions
+1 -5
View File
@@ -1,11 +1,7 @@
import { log } from "../../shared"
import { log, normalizeModelID } from "../../shared"
const OPUS_4_6_PATTERN = /claude-opus-4[-.]6/i
function normalizeModelID(modelID: string): string {
return modelID.replace(/\.(\d+)/g, "-$1")
}
function isClaudeProvider(providerID: string, modelID: string): boolean {
if (["anthropic", "google-vertex-anthropic", "opencode"].includes(providerID)) return true
if (providerID === "github-copilot" && modelID.toLowerCase().includes("claude")) return true