* refactor(#56): retire legacy runtime directory helpers into runtime-homes projection Consolidate per-runtime global config-dir resolution onto the single canonical projection runtime-homes:getGlobalConfigDir. Extend it with the explicitDir override (CLI --config-dir) and the opencode/kilo OPENCODE_CONFIG/KILO_CONFIG file-path precedence the installer helpers had, making it byte-for-behavior equivalent to the old getGlobalDir across all 15 install runtimes. Delete bin/install.js's getGlobalDir/getOpencodeGlobalDir/getKiloGlobalDir (and the orphaned local expandTilde), repoint all 9 call-sites, and remove getGlobalDir from module.exports (net -242 lines in the installer). Migrate the 5 test importers to the canonical projection; harden default/XDG assertions against ambient *_CONFIG env vars. getAgentsDir now respects OPENCODE_CONFIG/KILO_CONFIG consistently with the installer (intentional convergence). Update CONTEXT.md Installer Module entry. Completes the installer-refactor chain #58 -> #60 -> #56. Closes #56 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * chore(#56): add changeset for runtime directory helper retirement Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
53 lines
1.8 KiB
JavaScript
53 lines
1.8 KiB
JavaScript
process.env.GSD_TEST_MODE = '1';
|
|
|
|
const { describe, test, beforeEach, afterEach } = require('node:test');
|
|
const assert = require('node:assert/strict');
|
|
const os = require('os');
|
|
const path = require('path');
|
|
|
|
const { getGlobalConfigDir } = require('../gsd-core/bin/lib/runtime-homes.cjs');
|
|
|
|
describe('getGlobalConfigDir (Windsurf)', () => {
|
|
let originalWindsurfConfigDir;
|
|
|
|
beforeEach(() => {
|
|
originalWindsurfConfigDir = process.env.WINDSURF_CONFIG_DIR;
|
|
delete process.env.WINDSURF_CONFIG_DIR;
|
|
});
|
|
|
|
afterEach(() => {
|
|
if (originalWindsurfConfigDir !== undefined) {
|
|
process.env.WINDSURF_CONFIG_DIR = originalWindsurfConfigDir;
|
|
} else {
|
|
delete process.env.WINDSURF_CONFIG_DIR;
|
|
}
|
|
});
|
|
|
|
test('returns ~/.codeium/windsurf with no env var or explicit dir', () => {
|
|
const result = getGlobalConfigDir('windsurf');
|
|
assert.strictEqual(result, path.join(os.homedir(), '.codeium', 'windsurf'));
|
|
});
|
|
|
|
test('returns explicit dir when provided', () => {
|
|
const result = getGlobalConfigDir('windsurf', '/custom/windsurf-path');
|
|
assert.strictEqual(result, '/custom/windsurf-path');
|
|
});
|
|
|
|
test('respects WINDSURF_CONFIG_DIR env var', () => {
|
|
process.env.WINDSURF_CONFIG_DIR = '~/custom-windsurf';
|
|
const result = getGlobalConfigDir('windsurf');
|
|
assert.strictEqual(result, path.join(os.homedir(), 'custom-windsurf'));
|
|
});
|
|
|
|
test('explicit dir takes priority over WINDSURF_CONFIG_DIR', () => {
|
|
process.env.WINDSURF_CONFIG_DIR = '~/from-env';
|
|
const result = getGlobalConfigDir('windsurf', '/explicit/path');
|
|
assert.strictEqual(result, '/explicit/path');
|
|
});
|
|
|
|
test('does not break other runtimes', () => {
|
|
assert.strictEqual(getGlobalConfigDir('claude'), path.join(os.homedir(), '.claude'));
|
|
assert.strictEqual(getGlobalConfigDir('codex'), path.join(os.homedir(), '.codex'));
|
|
});
|
|
});
|