mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-10 04:19:29 +00:00
fix(config): migrate all hardcoded paths to getCcsDir() and improve validation
- Replace os.homedir() + '.ccs' with getCcsDir() across 14 instances in 13 files: version-command, model-config, openrouter-catalog, config-checks, disk-cache, aggregator, auth-middleware, shell-completion, shared-manager, recovery-manager, auto-repair, delegation-validator, claude-dir-installer, cliproxy executor - Add isDirectory() validation for --config-dir argument in ccs.ts - Make detectCloudSyncPath() case-insensitive for cloud provider matching - Fix help-command.ts to use dynamic dirDisplay for all path references - Add 5 new tests: setGlobalConfigDir precedence, relative path resolution, reset behavior, getCcsDirSource with --config-dir, case-insensitive detection - Clean up unused os imports after migration
This commit is contained in:
@@ -111,6 +111,10 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim();
|
||||
);
|
||||
console.log('');
|
||||
|
||||
// Resolve display path for dynamic sections
|
||||
const [dirSource] = getCcsDirSource();
|
||||
const dirDisplay = dirSource === 'default' ? '~/.ccs' : getCcsDir();
|
||||
|
||||
// Usage section
|
||||
console.log(subheader('Usage:'));
|
||||
console.log(` ${color('ccs', 'command')} [profile] [claude-args...]`);
|
||||
@@ -122,7 +126,7 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim();
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
printMajorSection(
|
||||
'API Key Profiles',
|
||||
['Configure in ~/.ccs/*.settings.json'],
|
||||
[`Configure in ${dirDisplay}/*.settings.json`],
|
||||
[
|
||||
['ccs', 'Use default Claude account'],
|
||||
['ccs glm', 'GLM 4.6 (API key required)'],
|
||||
@@ -267,8 +271,6 @@ Run ${color('ccs config', 'command')} for web dashboard`.trim();
|
||||
]);
|
||||
|
||||
// Configuration
|
||||
const [dirSource] = getCcsDirSource();
|
||||
const dirDisplay = dirSource === 'default' ? '~/.ccs' : getCcsDir();
|
||||
printConfigSection('Configuration', [
|
||||
['Config File:', isUnifiedMode() ? `${dirDisplay}/config.yaml` : `${dirDisplay}/config.json`],
|
||||
['Profiles:', `${dirDisplay}/profiles.json`],
|
||||
|
||||
Reference in New Issue
Block a user