ccconfig 1.4.2 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/ccconfig.js +144 -105
  2. package/package.json +1 -1
package/ccconfig.js CHANGED
@@ -4,7 +4,7 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
6
  const readline = require('readline');
7
- const { spawn, execSync } = require('child_process');
7
+ const {spawn, execSync} = require('child_process');
8
8
 
9
9
  // Configuration file paths
10
10
  const CONFIG_DIR = path.join(os.homedir(), '.config', 'ccconfig');
@@ -52,7 +52,11 @@ function ensureProfilesAvailable({onEmpty} = {}) {
52
52
  }
53
53
 
54
54
  function ensureProfileAvailable(
55
- name, {allowEmptyEnv = false, onEmptyProfiles, onMissingProfile, onEmptyEnv} = {}) {
55
+ name,
56
+ {allowEmptyEnv = false,
57
+ onEmptyProfiles,
58
+ onMissingProfile,
59
+ onEmptyEnv} = {}) {
56
60
  const profiles = ensureProfilesAvailable({onEmpty: onEmptyProfiles});
57
61
  const profilesMap = getProfilesMap(profiles);
58
62
  const profile = profilesMap[name];
@@ -68,7 +72,8 @@ function ensureProfileAvailable(
68
72
  process.exit(1);
69
73
  }
70
74
 
71
- if (!allowEmptyEnv && (!profile.env || Object.keys(profile.env).length === 0)) {
75
+ if (!allowEmptyEnv &&
76
+ (!profile.env || Object.keys(profile.env).length === 0)) {
72
77
  if (typeof onEmptyEnv === 'function') {
73
78
  onEmptyEnv();
74
79
  } else {
@@ -83,7 +88,10 @@ function ensureProfileAvailable(
83
88
  }
84
89
 
85
90
  // All supported commands
86
- const COMMANDS = ['list', 'ls', 'add', 'update', 'use', 'start', 'safe-start', 'remove', 'rm', 'current', 'mode', 'env', 'edit', 'completion'];
91
+ const COMMANDS = [
92
+ 'list', 'ls', 'add', 'update', 'use', 'start', 'safe-start', 'remove', 'rm',
93
+ 'current', 'mode', 'env', 'edit', 'completion'
94
+ ];
87
95
 
88
96
  // ccconfig markers for shell config files
89
97
  const SHELL_MARKERS = {
@@ -140,11 +148,16 @@ function printEnvVar(key, value, mask = true) {
140
148
  * Utility: Display environment variables with consistent formatting
141
149
  */
142
150
  function displayEnvVars(envVars, mask = true, indent = ' ') {
143
- const keys = [ENV_KEYS.BASE_URL, ENV_KEYS.AUTH_TOKEN, ENV_KEYS.API_KEY, ENV_KEYS.MODEL, ENV_KEYS.SMALL_FAST_MODEL];
151
+ const keys = [
152
+ ENV_KEYS.BASE_URL, ENV_KEYS.AUTH_TOKEN, ENV_KEYS.API_KEY, ENV_KEYS.MODEL,
153
+ ENV_KEYS.SMALL_FAST_MODEL
154
+ ];
144
155
  for (const key of keys) {
145
156
  if (!(key in envVars)) continue;
146
157
  const value = envVars[key];
147
- if (!value && key !== ENV_KEYS.BASE_URL && key !== ENV_KEYS.AUTH_TOKEN && key !== ENV_KEYS.API_KEY) continue;
158
+ if (!value && key !== ENV_KEYS.BASE_URL && key !== ENV_KEYS.AUTH_TOKEN &&
159
+ key !== ENV_KEYS.API_KEY)
160
+ continue;
148
161
  const displayValue = maskValue(key, value, mask);
149
162
  console.log(`${indent}${key}: ${displayValue || '(not set)'}`);
150
163
  }
@@ -160,16 +173,14 @@ class ReadlineHelper {
160
173
 
161
174
  ensureInterface() {
162
175
  if (!this.rl) {
163
- this.rl = readline.createInterface({
164
- input: process.stdin,
165
- output: process.stdout
166
- });
176
+ this.rl = readline.createInterface(
177
+ {input: process.stdin, output: process.stdout});
167
178
  }
168
179
  }
169
180
 
170
181
  async ask(question, defaultValue = '', options = {}) {
171
182
  this.ensureInterface();
172
- const { brackets = 'parentheses' } = options;
183
+ const {brackets = 'parentheses'} = options;
173
184
  const left = brackets === 'square' ? '[' : '(';
174
185
  const right = brackets === 'square' ? ']' : ')';
175
186
  const suffix = defaultValue ? ` ${left}${defaultValue}${right}` : '';
@@ -184,34 +195,32 @@ class ReadlineHelper {
184
195
 
185
196
  async askEnvVars(existingEnv = {}) {
186
197
  const baseUrl = await this.ask(
187
- 'ANTHROPIC_BASE_URL (press Enter to keep current/default)',
188
- existingEnv.ANTHROPIC_BASE_URL || 'https://api.anthropic.com',
189
- { brackets: existingEnv.ANTHROPIC_BASE_URL ? 'square' : 'parentheses' }
190
- );
198
+ 'ANTHROPIC_BASE_URL (press Enter to keep current/default)',
199
+ existingEnv.ANTHROPIC_BASE_URL || 'https://api.anthropic.com',
200
+ {brackets: existingEnv.ANTHROPIC_BASE_URL ? 'square' : 'parentheses'});
191
201
 
192
202
  const authToken = await this.ask(
193
- 'ANTHROPIC_AUTH_TOKEN (press Enter to keep current/set empty)',
194
- existingEnv.ANTHROPIC_AUTH_TOKEN || '',
195
- { brackets: existingEnv.ANTHROPIC_AUTH_TOKEN ? 'square' : 'parentheses' }
196
- );
203
+ 'ANTHROPIC_AUTH_TOKEN (press Enter to keep current/set empty)',
204
+ existingEnv.ANTHROPIC_AUTH_TOKEN || '', {
205
+ brackets: existingEnv.ANTHROPIC_AUTH_TOKEN ? 'square' : 'parentheses'
206
+ });
197
207
 
198
208
  const apiKey = await this.ask(
199
- 'ANTHROPIC_API_KEY (press Enter to keep current/set empty)',
200
- existingEnv.ANTHROPIC_API_KEY || '',
201
- { brackets: existingEnv.ANTHROPIC_API_KEY ? 'square' : 'parentheses' }
202
- );
209
+ 'ANTHROPIC_API_KEY (press Enter to keep current/set empty)',
210
+ existingEnv.ANTHROPIC_API_KEY || '',
211
+ {brackets: existingEnv.ANTHROPIC_API_KEY ? 'square' : 'parentheses'});
203
212
 
204
213
  const model = await this.ask(
205
- 'ANTHROPIC_MODEL (press Enter to skip/keep current)',
206
- existingEnv.ANTHROPIC_MODEL || '',
207
- { brackets: existingEnv.ANTHROPIC_MODEL ? 'square' : 'parentheses' }
208
- );
214
+ 'ANTHROPIC_MODEL (press Enter to skip/keep current)',
215
+ existingEnv.ANTHROPIC_MODEL || '',
216
+ {brackets: existingEnv.ANTHROPIC_MODEL ? 'square' : 'parentheses'});
209
217
 
210
218
  const smallFastModel = await this.ask(
211
- 'ANTHROPIC_SMALL_FAST_MODEL (press Enter to skip/keep current)',
212
- existingEnv.ANTHROPIC_SMALL_FAST_MODEL || '',
213
- { brackets: existingEnv.ANTHROPIC_SMALL_FAST_MODEL ? 'square' : 'parentheses' }
214
- );
219
+ 'ANTHROPIC_SMALL_FAST_MODEL (press Enter to skip/keep current)',
220
+ existingEnv.ANTHROPIC_SMALL_FAST_MODEL || '', {
221
+ brackets: existingEnv.ANTHROPIC_SMALL_FAST_MODEL ? 'square' :
222
+ 'parentheses'
223
+ });
215
224
 
216
225
  const envVars = {
217
226
  [ENV_KEYS.BASE_URL]: baseUrl || '',
@@ -249,14 +258,17 @@ function requireInteractive(commandName) {
249
258
  * Utility: Display environment variables section for current command
250
259
  */
251
260
  function displayEnvSection(envVars, showSecret) {
252
- if (!envVars || (!envVars[ENV_KEYS.BASE_URL] && !envVars[ENV_KEYS.AUTH_TOKEN] && !envVars[ENV_KEYS.API_KEY])) {
261
+ if (!envVars ||
262
+ (!envVars[ENV_KEYS.BASE_URL] && !envVars[ENV_KEYS.AUTH_TOKEN] &&
263
+ !envVars[ENV_KEYS.API_KEY])) {
253
264
  console.log(' (not configured)');
254
265
  return;
255
266
  }
256
267
 
257
268
  const normalizedEnv = {
258
269
  [ENV_KEYS.BASE_URL]: envVars[ENV_KEYS.BASE_URL] || '(not set)',
259
- [ENV_KEYS.AUTH_TOKEN]: envVars[ENV_KEYS.AUTH_TOKEN] || envVars[ENV_KEYS.API_KEY] || '(not set)',
270
+ [ENV_KEYS.AUTH_TOKEN]: envVars[ENV_KEYS.AUTH_TOKEN] ||
271
+ envVars[ENV_KEYS.API_KEY] || '(not set)',
260
272
  [ENV_KEYS.MODEL]: envVars[ENV_KEYS.MODEL],
261
273
  [ENV_KEYS.SMALL_FAST_MODEL]: envVars[ENV_KEYS.SMALL_FAST_MODEL]
262
274
  };
@@ -269,12 +281,14 @@ function displayEnvSection(envVars, showSecret) {
269
281
 
270
282
  // Display with aligned columns
271
283
  console.log(` ${ENV_KEYS.BASE_URL}: ${normalizedEnv[ENV_KEYS.BASE_URL]}`);
272
- console.log(` ${ENV_KEYS.AUTH_TOKEN}: ${normalizedEnv[ENV_KEYS.AUTH_TOKEN]}`);
284
+ console.log(
285
+ ` ${ENV_KEYS.AUTH_TOKEN}: ${normalizedEnv[ENV_KEYS.AUTH_TOKEN]}`);
273
286
  if (normalizedEnv[ENV_KEYS.MODEL]) {
274
287
  console.log(` ${ENV_KEYS.MODEL}: ${normalizedEnv[ENV_KEYS.MODEL]}`);
275
288
  }
276
289
  if (normalizedEnv[ENV_KEYS.SMALL_FAST_MODEL]) {
277
- console.log(` ${ENV_KEYS.SMALL_FAST_MODEL}: ${normalizedEnv[ENV_KEYS.SMALL_FAST_MODEL]}`);
290
+ console.log(` ${ENV_KEYS.SMALL_FAST_MODEL}: ${
291
+ normalizedEnv[ENV_KEYS.SMALL_FAST_MODEL]}`);
278
292
  }
279
293
  }
280
294
 
@@ -315,7 +329,8 @@ function validateConfigName(name, allowEmpty = false) {
315
329
  // Limit length to prevent issues
316
330
  const MAX_NAME_LENGTH = 50;
317
331
  if (name.length > MAX_NAME_LENGTH) {
318
- console.error(`Error: Configuration name too long (max ${MAX_NAME_LENGTH} characters)`);
332
+ console.error(`Error: Configuration name too long (max ${
333
+ MAX_NAME_LENGTH} characters)`);
319
334
  console.error(`Current length: ${name.length}`);
320
335
  process.exit(1);
321
336
  }
@@ -451,10 +466,10 @@ function writeEnvFile(envVars) {
451
466
  const lines = Object.entries(envVars).map(([key, value]) => {
452
467
  // Escape special characters to prevent injection
453
468
  const escapedValue = String(value ?? '')
454
- .replace(/\\/g, '\\\\')
455
- .replace(/\n/g, '\\n')
456
- .replace(/\r/g, '\\r')
457
- .replace(/\t/g, '\\t');
469
+ .replace(/\\/g, '\\\\')
470
+ .replace(/\n/g, '\\n')
471
+ .replace(/\r/g, '\\r')
472
+ .replace(/\t/g, '\\t');
458
473
  return `${key}=${escapedValue}`;
459
474
  });
460
475
  const content = lines.join('\n') + '\n';
@@ -481,17 +496,17 @@ function readEnvFile() {
481
496
  const content = fs.readFileSync(ENV_FILE, 'utf-8');
482
497
  const env = {};
483
498
  content.split('\n').forEach(line => {
484
- // Only accept valid environment variable names: starts with letter or underscore,
485
- // followed by letters, numbers, or underscores
499
+ // Only accept valid environment variable names: starts with letter or
500
+ // underscore, followed by letters, numbers, or underscores
486
501
  const match = line.match(/^([A-Z_][A-Z0-9_]*)=(.*)$/);
487
502
  if (match) {
488
503
  // Unescape special characters
489
504
  // IMPORTANT: Must unescape \\\\ first to avoid double-unescaping
490
505
  const unescapedValue = match[2]
491
- .replace(/\\\\/g, '\\')
492
- .replace(/\\n/g, '\n')
493
- .replace(/\\r/g, '\r')
494
- .replace(/\\t/g, '\t');
506
+ .replace(/\\\\/g, '\\')
507
+ .replace(/\\n/g, '\n')
508
+ .replace(/\\r/g, '\r')
509
+ .replace(/\\t/g, '\t');
495
510
  env[match[1]] = unescapedValue;
496
511
  }
497
512
  });
@@ -631,7 +646,8 @@ function list() {
631
646
  console.log(` Model: ${profile.env.ANTHROPIC_MODEL}`);
632
647
  }
633
648
  if (profile.env && profile.env.ANTHROPIC_SMALL_FAST_MODEL) {
634
- console.log(` Small Fast Model: ${profile.env.ANTHROPIC_SMALL_FAST_MODEL}`);
649
+ console.log(
650
+ ` Small Fast Model: ${profile.env.ANTHROPIC_SMALL_FAST_MODEL}`);
635
651
  }
636
652
  console.log('');
637
653
  }
@@ -696,7 +712,8 @@ async function add(name) {
696
712
  console.log('');
697
713
  console.log('This information has been saved to:');
698
714
  console.log(` ${PROFILES_FILE}`);
699
- console.log('You can edit this file directly to further customize the profile:');
715
+ console.log(
716
+ 'You can edit this file directly to further customize the profile:');
700
717
  console.log(` vim ${PROFILES_FILE}`);
701
718
  console.log('Or run ccconfig edit to open it with your preferred editor');
702
719
  } finally {
@@ -730,7 +747,8 @@ async function update(name) {
730
747
  console.error(`Error: Configuration '${name}' does not exist`);
731
748
  console.error('');
732
749
  console.error('Run ccconfig list to see available configurations');
733
- console.error(`Or use 'ccconfig add ${name}' to create a new configuration`);
750
+ console.error(
751
+ `Or use 'ccconfig add ${name}' to create a new configuration`);
734
752
  process.exit(1);
735
753
  }
736
754
  });
@@ -738,7 +756,8 @@ async function update(name) {
738
756
  const existingEnv = profile.env || {};
739
757
 
740
758
  console.log(`Updating configuration '${name}'`);
741
- console.log('Press Enter to keep current value/default, or enter new value to update');
759
+ console.log(
760
+ 'Press Enter to keep current value/default, or enter new value to update');
742
761
  console.log('');
743
762
 
744
763
  const envVars = await helper.askEnvVars(existingEnv);
@@ -812,7 +831,9 @@ const ShellUtils = {
812
831
  },
813
832
  fish: (value) => {
814
833
  const str = value == null ? '' : String(value);
815
- return str.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\$/g, '\\$');
834
+ return str.replace(/\\/g, '\\\\')
835
+ .replace(/"/g, '\\"')
836
+ .replace(/\$/g, '\\$');
816
837
  },
817
838
  pwsh: (value) => {
818
839
  const str = value == null ? '' : String(value);
@@ -827,10 +848,12 @@ const ShellUtils = {
827
848
  if (process.env.FISH_VERSION || shellPath.includes('fish')) {
828
849
  return 'fish';
829
850
  }
830
- if (process.env.ZSH_NAME || process.env.ZSH_VERSION || shellPath.includes('zsh')) {
851
+ if (process.env.ZSH_NAME || process.env.ZSH_VERSION ||
852
+ shellPath.includes('zsh')) {
831
853
  return 'zsh';
832
854
  }
833
- if (process.env.POWERSHELL_DISTRIBUTION_CHANNEL || shellPath.includes('pwsh') || shellPath.includes('powershell')) {
855
+ if (process.env.POWERSHELL_DISTRIBUTION_CHANNEL ||
856
+ shellPath.includes('pwsh') || shellPath.includes('powershell')) {
834
857
  return 'powershell';
835
858
  }
836
859
  if (shellPath.includes('bash')) {
@@ -851,14 +874,17 @@ const ShellUtils = {
851
874
  const configs = {
852
875
  fish: path.join(homeDir, '.config', 'fish', 'config.fish'),
853
876
  zsh: path.join(homeDir, '.zshrc'),
854
- bash: process.platform === 'darwin'
855
- ? (fs.existsSync(path.join(homeDir, '.bash_profile')) || !fs.existsSync(path.join(homeDir, '.bashrc'))
856
- ? path.join(homeDir, '.bash_profile')
857
- : path.join(homeDir, '.bashrc'))
858
- : path.join(homeDir, '.bashrc'),
859
- powershell: process.platform === 'win32'
860
- ? path.join(process.env.USERPROFILE || homeDir, 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1')
861
- : path.join(homeDir, '.config', 'powershell', 'profile.ps1')
877
+ bash: process.platform === 'darwin' ?
878
+ (fs.existsSync(path.join(homeDir, '.bash_profile')) ||
879
+ !fs.existsSync(path.join(homeDir, '.bashrc')) ?
880
+ path.join(homeDir, '.bash_profile') :
881
+ path.join(homeDir, '.bashrc')) :
882
+ path.join(homeDir, '.bashrc'),
883
+ powershell: process.platform === 'win32' ?
884
+ path.join(
885
+ process.env.USERPROFILE || homeDir, 'Documents', 'PowerShell',
886
+ 'Microsoft.PowerShell_profile.ps1') :
887
+ path.join(homeDir, '.config', 'powershell', 'profile.ps1')
862
888
  };
863
889
  return configs[shellType];
864
890
  },
@@ -893,11 +919,10 @@ const ShellUtils = {
893
919
  break;
894
920
  case 'dotenv':
895
921
  const renderedValue = value == null ? '' : String(value);
896
- const escapedValue = renderedValue
897
- .replace(/\\/g, '\\\\')
898
- .replace(/\n/g, '\\n')
899
- .replace(/\r/g, '\\r')
900
- .replace(/\t/g, '\\t');
922
+ const escapedValue = renderedValue.replace(/\\/g, '\\\\')
923
+ .replace(/\n/g, '\\n')
924
+ .replace(/\r/g, '\\r')
925
+ .replace(/\t/g, '\\t');
901
926
  lines.push(`${key}=${escapedValue}`);
902
927
  break;
903
928
  }
@@ -907,9 +932,15 @@ const ShellUtils = {
907
932
  };
908
933
 
909
934
  // Legacy function wrappers for backward compatibility
910
- function escapePosix(value) { return ShellUtils.escape.posix(value); }
911
- function escapeFish(value) { return ShellUtils.escape.fish(value); }
912
- function escapePwsh(value) { return ShellUtils.escape.pwsh(value); }
935
+ function escapePosix(value) {
936
+ return ShellUtils.escape.posix(value);
937
+ }
938
+ function escapeFish(value) {
939
+ return ShellUtils.escape.fish(value);
940
+ }
941
+ function escapePwsh(value) {
942
+ return ShellUtils.escape.pwsh(value);
943
+ }
913
944
 
914
945
  /**
915
946
  * Detect shell type and config file path
@@ -950,7 +981,8 @@ async function writePermanentEnv(envVars) {
950
981
  const maskedEnvLines = ShellUtils.formatEnvVars(maskedEnvVars, shell);
951
982
 
952
983
  const envBlock = `${marker}\n${envLines.join('\n')}\n${markerEnd}\n`;
953
- const maskedEnvBlock = `${marker}\n${maskedEnvLines.join('\n')}\n${markerEnd}\n`;
984
+ const maskedEnvBlock =
985
+ `${marker}\n${maskedEnvLines.join('\n')}\n${markerEnd}\n`;
954
986
 
955
987
  // Display warning and confirmation
956
988
  console.log('');
@@ -1319,12 +1351,15 @@ function env(format = 'bash') {
1319
1351
  const envVars = getActiveEnvVars();
1320
1352
 
1321
1353
  if (!envVars || Object.keys(envVars).length === 0) {
1322
- console.error('Error: No available environment variable configuration found');
1323
- console.error('Please run ccconfig use <name> to select a configuration first');
1354
+ console.error(
1355
+ 'Error: No available environment variable configuration found');
1356
+ console.error(
1357
+ 'Please run ccconfig use <name> to select a configuration first');
1324
1358
  process.exit(1);
1325
1359
  }
1326
1360
 
1327
- const supportedFormats = ['fish', 'bash', 'zsh', 'sh', 'powershell', 'pwsh', 'dotenv'];
1361
+ const supportedFormats =
1362
+ ['fish', 'bash', 'zsh', 'sh', 'powershell', 'pwsh', 'dotenv'];
1328
1363
  if (!supportedFormats.includes(format)) {
1329
1364
  console.error(`Error: Unsupported format: ${format}`);
1330
1365
  console.error(`Supported formats: ${supportedFormats.join(', ')}`);
@@ -1343,7 +1378,7 @@ function env(format = 'bash') {
1343
1378
  * @param {boolean} options.safe - Whether to run in safe mode (default: false)
1344
1379
  */
1345
1380
  function startClaude(name, extraArgs = [], options = {}) {
1346
- const { safe = false } = options;
1381
+ const {safe = false} = options;
1347
1382
  const commandName = safe ? 'safe-start' : 'start';
1348
1383
 
1349
1384
  if (!name) {
@@ -1373,8 +1408,9 @@ function startClaude(name, extraArgs = [], options = {}) {
1373
1408
 
1374
1409
  // Check if claude binary exists before proceeding
1375
1410
  try {
1376
- const command = process.platform === 'win32' ? 'where claude' : 'which claude';
1377
- execSync(command, { stdio: 'pipe' });
1411
+ const command =
1412
+ process.platform === 'win32' ? 'where claude' : 'which claude';
1413
+ execSync(command, {stdio: 'pipe'});
1378
1414
  } catch (err) {
1379
1415
  console.error('Error: Claude Code CLI not found');
1380
1416
  console.error('');
@@ -1395,17 +1431,22 @@ function startClaude(name, extraArgs = [], options = {}) {
1395
1431
  }
1396
1432
 
1397
1433
  // Build Claude arguments based on mode
1398
- const claudeArgs = safe ? extraArgs : ['--dangerously-skip-permissions', ...extraArgs];
1434
+ const claudeArgs =
1435
+ safe ? extraArgs : ['--dangerously-skip-permissions', ...extraArgs];
1399
1436
 
1400
1437
  // Display mode-specific notes
1401
1438
  console.log('');
1402
1439
  if (safe) {
1403
- console.log('Note: Running in safe mode (permission confirmation required)');
1404
- console.log(' Claude Code will ask for confirmation before executing commands');
1440
+ console.log(
1441
+ 'Note: Running in safe mode (permission confirmation required)');
1442
+ console.log(
1443
+ ' Claude Code will ask for confirmation before executing commands');
1405
1444
  console.log(' For automatic execution, use "ccconfig start" instead');
1406
1445
  } else {
1407
- console.log('Note: Starting with --dangerously-skip-permissions flag enabled');
1408
- console.log(' This allows Claude Code to execute commands without confirmation prompts');
1446
+ console.log(
1447
+ 'Note: Starting with --dangerously-skip-permissions flag enabled');
1448
+ console.log(
1449
+ ' This allows Claude Code to execute commands without confirmation prompts');
1409
1450
  console.log(' Only use this with profiles you trust');
1410
1451
  }
1411
1452
  console.log('');
@@ -1444,7 +1485,8 @@ function startClaude(name, extraArgs = [], options = {}) {
1444
1485
  }
1445
1486
  }
1446
1487
 
1447
- const canResetTerminal = process.platform !== 'win32' && process.stdin.isTTY && process.stdout.isTTY;
1488
+ const canResetTerminal = process.platform !== 'win32' &&
1489
+ process.stdin.isTTY && process.stdout.isTTY;
1448
1490
 
1449
1491
  // Use stty to restore terminal settings on Unix-like systems
1450
1492
  // This is more comprehensive than just setRawMode
@@ -1452,15 +1494,15 @@ function startClaude(name, extraArgs = [], options = {}) {
1452
1494
  try {
1453
1495
  // 'stty sane' restores terminal to sensible settings
1454
1496
  // Use stdio: 'inherit' to ensure it operates on the same terminal
1455
- execSync('stty sane', { stdio: 'inherit' });
1497
+ execSync('stty sane', {stdio: 'inherit'});
1456
1498
  } catch (e) {
1457
1499
  // If stty fails, try basic echo and icanon reset
1458
1500
  try {
1459
- execSync('stty echo icanon', { stdio: 'inherit' });
1501
+ execSync('stty echo icanon', {stdio: 'inherit'});
1460
1502
  } catch (e2) {
1461
1503
  try {
1462
- execSync('stty echo', { stdio: 'inherit' });
1463
- execSync('stty icanon', { stdio: 'inherit' });
1504
+ execSync('stty echo', {stdio: 'inherit'});
1505
+ execSync('stty icanon', {stdio: 'inherit'});
1464
1506
  } catch (e3) {
1465
1507
  // Ignore - best effort
1466
1508
  }
@@ -1492,7 +1534,7 @@ function startClaude(name, extraArgs = [], options = {}) {
1492
1534
  // Show project promotion message on exit
1493
1535
  console.log('');
1494
1536
  console.log('──────────────────────────────────────────');
1495
- console.log('Thanks for using ccconfig!');
1537
+ console.log('Thanks for using \x1b[1mccconfig\x1b[0m!');
1496
1538
  console.log('');
1497
1539
  console.log('If you find this tool helpful, please consider:');
1498
1540
  console.log(' ⭐ Star us on GitHub: https://github.com/Danielmelody/ccconfig');
@@ -1525,14 +1567,15 @@ function startClaude(name, extraArgs = [], options = {}) {
1525
1567
  * Start Claude Code with specified profile (auto-approve mode)
1526
1568
  */
1527
1569
  function start(name, extraArgs = []) {
1528
- return startClaude(name, extraArgs, { safe: false });
1570
+ return startClaude(name, extraArgs, {safe: false});
1529
1571
  }
1530
1572
 
1531
1573
  /**
1532
- * Start Claude Code with specified profile (safe mode - requires permission confirmation)
1574
+ * Start Claude Code with specified profile (safe mode - requires permission
1575
+ * confirmation)
1533
1576
  */
1534
1577
  function safeStart(name, extraArgs = []) {
1535
- return startClaude(name, extraArgs, { safe: true });
1578
+ return startClaude(name, extraArgs, {safe: true});
1536
1579
  }
1537
1580
 
1538
1581
  /**
@@ -1546,7 +1589,8 @@ function completion(shell) {
1546
1589
  console.error('To install:');
1547
1590
  console.error(' Bash: ccconfig completion bash >> ~/.bashrc');
1548
1591
  console.error(' Zsh: ccconfig completion zsh >> ~/.zshrc');
1549
- console.error(' Fish: ccconfig completion fish > ~/.config/fish/completions/ccconfig.fish');
1592
+ console.error(
1593
+ ' Fish: ccconfig completion fish > ~/.config/fish/completions/ccconfig.fish');
1550
1594
  console.error(' PowerShell: ccconfig completion pwsh >> $PROFILE');
1551
1595
  process.exit(1);
1552
1596
  }
@@ -1859,8 +1903,7 @@ function help() {
1859
1903
  ' -s, --show-secret Show full token in current command');
1860
1904
  console.log('');
1861
1905
  console.log('Notes:');
1862
- console.log(
1863
- ' • Two ways to start Claude Code:');
1906
+ console.log(' • Two ways to start Claude Code:');
1864
1907
  console.log(
1865
1908
  ' - start: Auto-approve mode (adds --dangerously-skip-permissions)');
1866
1909
  console.log(
@@ -1916,8 +1959,10 @@ async function main() {
1916
1959
  // - Extract flags that appear BEFORE the command
1917
1960
  // - Keep command and all arguments after it unchanged (for Claude)
1918
1961
  const preCommandArgs = commandIndex >= 0 ? args.slice(0, commandIndex) : [];
1919
- showSecret = preCommandArgs.includes('--show-secret') || preCommandArgs.includes('-s');
1920
- permanent = preCommandArgs.includes('--permanent') || preCommandArgs.includes('-p');
1962
+ showSecret = preCommandArgs.includes('--show-secret') ||
1963
+ preCommandArgs.includes('-s');
1964
+ permanent =
1965
+ preCommandArgs.includes('--permanent') || preCommandArgs.includes('-p');
1921
1966
 
1922
1967
  // Keep command and all arguments after it (these go to Claude)
1923
1968
  filteredArgs = commandIndex >= 0 ? args.slice(commandIndex) : [];
@@ -1929,16 +1974,10 @@ async function main() {
1929
1974
  permanent = args.includes('--permanent') || args.includes('-p');
1930
1975
 
1931
1976
  // Filter out all recognized flags
1932
- filteredArgs = args.filter(arg =>
1933
- arg !== '--show-secret' &&
1934
- arg !== '-s' &&
1935
- arg !== '--permanent' &&
1936
- arg !== '-p' &&
1937
- arg !== '--version' &&
1938
- arg !== '-V' &&
1939
- arg !== '--help' &&
1940
- arg !== '-h'
1941
- );
1977
+ filteredArgs = args.filter(
1978
+ arg => arg !== '--show-secret' && arg !== '-s' &&
1979
+ arg !== '--permanent' && arg !== '-p' && arg !== '--version' &&
1980
+ arg !== '-V' && arg !== '--help' && arg !== '-h');
1942
1981
  }
1943
1982
 
1944
1983
  switch (command) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccconfig",
3
- "version": "1.4.2",
3
+ "version": "1.4.3",
4
4
  "description": "Cross-platform Claude Code configuration switching tool",
5
5
  "main": "ccconfig.js",
6
6
  "bin": {