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:
Bohdan Triapitsyn
2026-09-05 14:45:20 +03:00
parent e43541d38b
commit f02dfbd4cb
2 changed files with 9 additions and 8 deletions
+4 -4
View File
@@ -6,10 +6,10 @@ import { parse as parseJsonc, printParseErrorCode } from 'jsonc-parser';
// ============== PATH CONSTANTS ==============
const XDG_CONFIG_HOME = typeof process.env.XDG_CONFIG_HOME === 'string' && process.env.XDG_CONFIG_HOME.trim()
? process.env.XDG_CONFIG_HOME.trim()
: path.join(os.homedir(), '.config');
const OPENCODE_CONFIG_DIR = path.join(XDG_CONFIG_HOME, 'opencode');
const OPENCODE_CONFIG_DIR = path.join(
process.env.XDG_CONFIG_HOME?.trim() || path.join(os.homedir(), '.config'),
'opencode',
);
const AGENT_DIR = path.join(OPENCODE_CONFIG_DIR, 'agents');
const COMMAND_DIR = path.join(OPENCODE_CONFIG_DIR, 'commands');
const SKILL_DIR = path.join(OPENCODE_CONFIG_DIR, 'skills');