phase 02: convert command to md files
This commit is contained in:
@@ -8,7 +8,7 @@ import type { ClaudePlugin } from "../src/types/claude"
|
||||
const fixtureRoot = path.join(import.meta.dir, "fixtures", "sample-plugin")
|
||||
|
||||
describe("convertClaudeToOpenCode", () => {
|
||||
test("maps commands, permissions, and agents", async () => {
|
||||
test("from-command mode: map allowedTools to global permission block", async () => {
|
||||
const plugin = await loadClaudePlugin(fixtureRoot)
|
||||
const bundle = convertClaudeToOpenCode(plugin, {
|
||||
agentMode: "subagent",
|
||||
@@ -16,6 +16,7 @@ describe("convertClaudeToOpenCode", () => {
|
||||
permissions: "from-commands",
|
||||
})
|
||||
|
||||
expect(bundle.config.command).toBeUndefined()
|
||||
expect(bundle.commandFiles.find((f) => f.name === "workflows:review")).toBeDefined()
|
||||
expect(bundle.commandFiles.find((f) => f.name === "plan_review")).toBeDefined()
|
||||
|
||||
@@ -201,7 +202,7 @@ describe("convertClaudeToOpenCode", () => {
|
||||
expect(parsed.data.mode).toBe("primary")
|
||||
})
|
||||
|
||||
test("excludes commands with disable-model-invocation from command map", async () => {
|
||||
test("excludes commands with disable-model-invocation from commandFiles", async () => {
|
||||
const plugin = await loadClaudePlugin(fixtureRoot)
|
||||
const bundle = convertClaudeToOpenCode(plugin, {
|
||||
agentMode: "subagent",
|
||||
@@ -276,4 +277,33 @@ Run \`/compound-engineering-setup\` to create a settings file.`,
|
||||
// Tool-agnostic path in project root — no rewriting needed
|
||||
expect(agentFile!.content).toContain("compound-engineering.local.md")
|
||||
})
|
||||
|
||||
test("command .md files include description in frontmatter", () => {
|
||||
const plugin: ClaudePlugin = {
|
||||
root: "/tmp/plugin",
|
||||
manifest: { name: "fixture", version: "1.0.0" },
|
||||
agents: [],
|
||||
commands: [
|
||||
{
|
||||
name: "test-cmd",
|
||||
description: "Test description",
|
||||
body: "Do the thing",
|
||||
sourcePath: "/tmp/plugin/commands/test-cmd.md",
|
||||
},
|
||||
],
|
||||
skills: [],
|
||||
}
|
||||
|
||||
const bundle = convertClaudeToOpenCode(plugin, {
|
||||
agentMode: "subagent",
|
||||
inferTemperature: false,
|
||||
permissions: "none",
|
||||
})
|
||||
|
||||
const commandFile = bundle.commandFiles.find((f) => f.name === "test-cmd")
|
||||
expect(commandFile).toBeDefined()
|
||||
const parsed = parseFrontmatter(commandFile!.content)
|
||||
expect(parsed.data.description).toBe("Test description")
|
||||
expect(parsed.body).toContain("Do the thing")
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user