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
@@ -5,6 +5,7 @@ import { parseFrontmatter } from "../../shared/frontmatter"
import { isMarkdownFile } from "../../shared/file-utils"
import { log } from "../../shared/logger"
import type { AgentFrontmatter } from "../claude-code-agent-loader/types"
import { mapClaudeModelToOpenCode } from "../claude-code-agent-loader/claude-model-mapper"
import type { LoadedPlugin } from "./types"
function parseToolsConfig(toolsStr?: string): Record<string, boolean> | undefined {
@@ -46,10 +47,13 @@ export function loadPluginAgents(plugins: LoadedPlugin[]): Record<string, AgentC
const originalDescription = data.description || ""
const formattedDescription = `(plugin: ${plugin.name}) ${originalDescription}`
const mappedModel = mapClaudeModelToOpenCode(data.model)
const config: AgentConfig = {
description: formattedDescription,
mode: "subagent",
prompt: body.trim(),
...(mappedModel && { model: mappedModel }),
}
const toolsConfig = parseToolsConfig(data.tools)