fix(web): honor XDG_CONFIG_HOME for OpenCode paths (#3305)

Closes #3304. Thanks for consolidating the global OpenCode paths. VS Code path parity and effective-path display follow-ups are maintainer-owned.
This commit is contained in:
tdoherty
2026-09-05 02:14:26 +03:00
committed by GitHub
parent 64f9f3aba7
commit 0543b954c3
11 changed files with 130 additions and 17 deletions
@@ -9,6 +9,7 @@ import {
getProviderSources,
removeProviderConfig,
} from './providers.js';
import { OPENCODE_CONFIG_DIR } from './shared.js';
let projectDir;
@@ -334,8 +335,8 @@ describe('custom provider config persistence', () => {
expect(sources.sources.custom.exists).toBe(false);
for (const userPath of [
path.join(os.homedir(), '.config', 'opencode', 'opencode.json'),
path.join(os.homedir(), '.config', 'opencode', 'config.json'),
path.join(OPENCODE_CONFIG_DIR, 'opencode.json'),
path.join(OPENCODE_CONFIG_DIR, 'config.json'),
]) {
if (!fs.existsSync(userPath)) continue;
const userConfig = readJson(userPath);
@@ -373,8 +374,8 @@ describe('custom provider config persistence', () => {
expect(sources.sources.project.exists).toBe(false);
for (const userPath of [
path.join(os.homedir(), '.config', 'opencode', 'opencode.json'),
path.join(os.homedir(), '.config', 'opencode', 'config.json'),
path.join(OPENCODE_CONFIG_DIR, 'opencode.json'),
path.join(OPENCODE_CONFIG_DIR, 'config.json'),
]) {
if (!fs.existsSync(userPath)) continue;
const userConfig = readJson(userPath);