* 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>
This commit is contained in:
@@ -30,20 +30,21 @@ const { createTempDir, cleanup } = require('./helpers.cjs');
|
||||
|
||||
const {
|
||||
getDirName,
|
||||
getGlobalDir,
|
||||
getConfigDirFromHome,
|
||||
convertClaudeToCliineMarkdown,
|
||||
install,
|
||||
finishInstall,
|
||||
} = require('../bin/install.js');
|
||||
|
||||
const { getGlobalConfigDir } = require('../gsd-core/bin/lib/runtime-homes.cjs');
|
||||
|
||||
describe('Cline runtime directory mapping', () => {
|
||||
test('getDirName returns .cline for local installs', () => {
|
||||
assert.strictEqual(getDirName('cline'), '.cline');
|
||||
});
|
||||
|
||||
test('getGlobalDir returns ~/.cline for global installs', () => {
|
||||
assert.strictEqual(getGlobalDir('cline'), path.join(os.homedir(), '.cline'));
|
||||
test('getGlobalConfigDir returns ~/.cline for global installs', () => {
|
||||
assert.strictEqual(getGlobalConfigDir('cline'), path.join(os.homedir(), '.cline'));
|
||||
});
|
||||
|
||||
test('getConfigDirFromHome returns .cline fragment', () => {
|
||||
@@ -52,7 +53,7 @@ describe('Cline runtime directory mapping', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getGlobalDir (Cline)', () => {
|
||||
describe('getGlobalConfigDir (Cline)', () => {
|
||||
let originalClineConfigDir;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -69,30 +70,30 @@ describe('getGlobalDir (Cline)', () => {
|
||||
|
||||
test('returns ~/.cline with no env var or explicit dir', () => {
|
||||
delete process.env.CLINE_CONFIG_DIR;
|
||||
const result = getGlobalDir('cline');
|
||||
const result = getGlobalConfigDir('cline');
|
||||
assert.strictEqual(result, path.join(os.homedir(), '.cline'));
|
||||
});
|
||||
|
||||
test('returns explicit dir when provided', () => {
|
||||
const result = getGlobalDir('cline', '/custom/cline-path');
|
||||
const result = getGlobalConfigDir('cline', '/custom/cline-path');
|
||||
assert.strictEqual(result, '/custom/cline-path');
|
||||
});
|
||||
|
||||
test('respects CLINE_CONFIG_DIR env var', () => {
|
||||
process.env.CLINE_CONFIG_DIR = '~/custom-cline';
|
||||
const result = getGlobalDir('cline');
|
||||
const result = getGlobalConfigDir('cline');
|
||||
assert.strictEqual(result, path.join(os.homedir(), 'custom-cline'));
|
||||
});
|
||||
|
||||
test('explicit dir takes priority over CLINE_CONFIG_DIR', () => {
|
||||
process.env.CLINE_CONFIG_DIR = '~/from-env';
|
||||
const result = getGlobalDir('cline', '/explicit/path');
|
||||
const result = getGlobalConfigDir('cline', '/explicit/path');
|
||||
assert.strictEqual(result, '/explicit/path');
|
||||
});
|
||||
|
||||
test('does not break other runtimes', () => {
|
||||
assert.strictEqual(getGlobalDir('claude'), path.join(os.homedir(), '.claude'));
|
||||
assert.strictEqual(getGlobalDir('codex'), path.join(os.homedir(), '.codex'));
|
||||
assert.strictEqual(getGlobalConfigDir('claude'), path.join(os.homedir(), '.claude'));
|
||||
assert.strictEqual(getGlobalConfigDir('codex'), path.join(os.homedir(), '.codex'));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user