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:
@@ -175,7 +175,9 @@ function resolveOutputRoot(value: unknown): string {
|
||||
const expanded = expandHome(String(value).trim())
|
||||
return path.resolve(expanded)
|
||||
}
|
||||
return path.join(os.homedir(), ".opencode")
|
||||
// OpenCode global config lives at ~/.config/opencode per XDG spec
|
||||
// See: https://opencode.ai/docs/config/
|
||||
return path.join(os.homedir(), ".config", "opencode")
|
||||
}
|
||||
|
||||
async function resolveGitHubPluginPath(pluginName: string): Promise<ResolvedPluginPath> {
|
||||
|
||||
@@ -28,7 +28,10 @@ export async function writeOpenCodeBundle(outputRoot: string, bundle: OpenCodeBu
|
||||
}
|
||||
|
||||
function resolveOpenCodePaths(outputRoot: string) {
|
||||
if (path.basename(outputRoot) === ".opencode") {
|
||||
const base = path.basename(outputRoot)
|
||||
// Global install: ~/.config/opencode (basename is "opencode")
|
||||
// Project install: .opencode (basename is ".opencode")
|
||||
if (base === "opencode" || base === ".opencode") {
|
||||
return {
|
||||
root: outputRoot,
|
||||
configPath: path.join(outputRoot, "opencode.json"),
|
||||
@@ -38,6 +41,7 @@ function resolveOpenCodePaths(outputRoot: string) {
|
||||
}
|
||||
}
|
||||
|
||||
// Custom output directory - nest under .opencode subdirectory
|
||||
return {
|
||||
root: outputRoot,
|
||||
configPath: path.join(outputRoot, "opencode.json"),
|
||||
|
||||
Reference in New Issue
Block a user