fix(web): tidy the XDG config root resolution
The web server read XDG_CONFIG_HOME through a redundant typeof guard on a value that is already string|undefined, which tripped the anti-slop lint on its own new line and diverged from the VS Code helper. Both now read the same way. The VS Code provider test also still hard-coded ~/.config/opencode, so it silently stopped asserting whenever XDG_CONFIG_HOME was set; it now uses the shared constant, like the web test already does.
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
upsertProviderConfig,
|
||||
validateCustomProviderConfig,
|
||||
} from './opencodeConfig';
|
||||
import { OPENCODE_CONFIG_DIR } from './opencodeConfigPaths';
|
||||
|
||||
let projectDir: string;
|
||||
|
||||
@@ -377,8 +378,8 @@ describe('custom provider config persistence (VS Code parity)', () => {
|
||||
assert.equal(sources.custom.exists, 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);
|
||||
@@ -416,8 +417,8 @@ describe('custom provider config persistence (VS Code parity)', () => {
|
||||
assert.equal(sources.project.exists, 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);
|
||||
|
||||
Reference in New Issue
Block a user