fix(opencode): use correct global config path ~/.config/opencode (#117)
The OpenCode installer was writing to ~/.opencode but OpenCode expects global configuration at ~/.config/opencode per XDG Base Directory spec. Fixes: - src/commands/install.ts: Change default output from ~/.opencode to ~/.config/opencode - src/targets/opencode.ts: Recognize "opencode" basename (not just ".opencode") for direct writes without nesting Closes #114 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -59,4 +59,29 @@ describe("writeOpenCodeBundle", () => {
|
||||
expect(await exists(path.join(outputRoot, "skills", "skill-one", "SKILL.md"))).toBe(true)
|
||||
expect(await exists(path.join(outputRoot, ".opencode"))).toBe(false)
|
||||
})
|
||||
|
||||
test("writes directly into ~/.config/opencode style output root", async () => {
|
||||
// Simulates the global install path: ~/.config/opencode
|
||||
const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "config-opencode-"))
|
||||
const outputRoot = path.join(tempRoot, ".config", "opencode")
|
||||
const bundle: OpenCodeBundle = {
|
||||
config: { $schema: "https://opencode.ai/config.json" },
|
||||
agents: [{ name: "agent-one", content: "Agent content" }],
|
||||
plugins: [],
|
||||
skillDirs: [
|
||||
{
|
||||
name: "skill-one",
|
||||
sourceDir: path.join(import.meta.dir, "fixtures", "sample-plugin", "skills", "skill-one"),
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
await writeOpenCodeBundle(outputRoot, bundle)
|
||||
|
||||
// Should write directly, not nested under .opencode
|
||||
expect(await exists(path.join(outputRoot, "opencode.json"))).toBe(true)
|
||||
expect(await exists(path.join(outputRoot, "agents", "agent-one.md"))).toBe(true)
|
||||
expect(await exists(path.join(outputRoot, "skills", "skill-one", "SKILL.md"))).toBe(true)
|
||||
expect(await exists(path.join(outputRoot, ".opencode"))).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user