fix(agents): address cubic review findings on agent loader

- Case-insensitive .md extension stripping for agent name extraction
- Resolve project agent_definitions paths relative to config dir (.opencode/)
- Use getOpenCodeConfigDir() to respect OPENCODE_CONFIG_DIR/XDG_CONFIG_HOME
- First-write-wins semantics for both inline and definition-file agents
  so project-level agents always take precedence over global-level
This commit is contained in:
Brandon Webb
2026-04-14 20:27:50 -04:00
committed by YeonGyu-Kim
parent 3d0fb22cda
commit 42445f5130
5 changed files with 29 additions and 23 deletions
@@ -82,6 +82,22 @@ Prompt.`
expect(result?.config.prompt).toBe("Prompt.")
})
test("strips .MD extension case-insensitively for agent name", () => {
const filePath = join(tempDir, "UpperCase.MD")
const content = `---
description: Mixed case extension
---
Prompt content.`
writeFileSync(filePath, content, "utf-8")
const result = parseMarkdownAgentFile(filePath, "definition-file")
expect(result).not.toBeNull()
expect(result?.name).toBe("UpperCase")
})
test("defaults mode to subagent when not specified", () => {
const filePath = join(tempDir, "no-mode.md")
const content = `---