feat(slashcommand): support parent opencode config dirs for command discovery

This commit is contained in:
YeonGyu-Kim
2026-03-12 18:17:34 +09:00
parent 8c2385fe31
commit b4e01e9987
2 changed files with 29 additions and 4 deletions
@@ -157,4 +157,28 @@ describe("slashcommand command discovery plugin integration", () => {
expect(names).not.toContain("daplug:run-prompt")
expect(names).not.toContain("daplug:plugin-plan")
})
it("discovers parent opencode commands when profile config dir is active", () => {
const opencodeRootDir = join(tempDir, "opencode-root")
const profileConfigDir = join(opencodeRootDir, "profiles", "codex")
const globalCommandDir = join(opencodeRootDir, "command")
mkdirSync(profileConfigDir, { recursive: true })
mkdirSync(globalCommandDir, { recursive: true })
writeFileSync(
join(globalCommandDir, "commit.md"),
`---
description: Commit through parent opencode config
---
Use parent opencode commit command.
`
)
process.env.OPENCODE_CONFIG_DIR = profileConfigDir
const commands = discoverCommandsSync(projectDir)
const commitCommand = commands.find(command => command.name === "commit")
expect(commitCommand?.scope).toBe("opencode")
expect(commitCommand?.content).toContain("Use parent opencode commit command.")
})
})