fix(plugin): persist ultrawork variant on same-model override and normalize Claude model IDs

🤖 Generated with [OhMyOpenCode](https://github.com/code-yeongyu/oh-my-openagent)
This commit is contained in:
YeonGyu-Kim
2026-03-16 13:53:28 +09:00
parent 32a296bf1e
commit 47d1ad7bb9
3 changed files with 20 additions and 3 deletions
@@ -75,6 +75,10 @@ describe("mapClaudeModelToOpenCode", () => {
expect(mapClaudeModelToOpenCode("anthropic/claude-sonnet-4-6")).toEqual({ providerID: "anthropic", modelID: "claude-sonnet-4-6" })
})
it("#when called with anthropic/claude-3.5-sonnet #then normalizes dots before splitting into object format", () => {
expect(mapClaudeModelToOpenCode("anthropic/claude-3.5-sonnet")).toEqual({ providerID: "anthropic", modelID: "claude-3-5-sonnet" })
})
it("#when called with openai/gpt-5.2 #then splits into object format", () => {
expect(mapClaudeModelToOpenCode("openai/gpt-5.2")).toEqual({ providerID: "openai", modelID: "gpt-5.2" })
})
@@ -20,7 +20,16 @@ function mapClaudeModelString(model: string | undefined): string | undefined {
const aliasResult = CLAUDE_CODE_ALIAS_MAP.get(trimmed.toLowerCase())
if (aliasResult) return aliasResult
if (trimmed.includes("/")) return trimmed
if (trimmed.includes("/")) {
const [providerID, ...modelParts] = trimmed.split("/")
const modelID = modelParts.join("/")
if (providerID.length === 0 || modelID.length === 0) return trimmed
return modelID.startsWith("claude-")
? `${providerID}/${normalizeModelID(modelID)}`
: trimmed
}
const normalized = normalizeModelID(trimmed)