map Claude Code model strings to OpenCode format when importing agents

This commit is contained in:
Jeon Suyeol
2026-03-06 11:56:03 +09:00
parent ee3d88af9d
commit 77a2ab7bdf
4 changed files with 101 additions and 0 deletions
@@ -0,0 +1,13 @@
import { normalizeModelID } from "../../shared/model-normalization"
const DATE_SUFFIX_PATTERN = /-\d{8}$/
export function mapClaudeModelToOpenCode(model: string | undefined): string | undefined {
if (!model) return undefined
const trimmed = model.trim()
if (trimmed.length === 0) return undefined
const withoutDate = trimmed.replace(DATE_SUFFIX_PATTERN, "")
return normalizeModelID(withoutDate)
}