ccman 2.1.4 โ†’ 2.1.6

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 (55) hide show
  1. package/README.md +75 -225
  2. package/README_en.md +51 -201
  3. package/dist/cli.js +219 -0
  4. package/dist/cli.js.map +1 -1
  5. package/dist/config/static-env.d.ts +1 -1
  6. package/dist/config/static-env.js +1 -1
  7. package/dist/core/ClaudeConfigManager.d.ts +1 -1
  8. package/dist/core/ClaudeConfigManager.d.ts.map +1 -1
  9. package/dist/core/ClaudeConfigManager.js +2 -4
  10. package/dist/core/ClaudeConfigManager.js.map +1 -1
  11. package/dist/core/EnvironmentManager.d.ts +27 -0
  12. package/dist/core/EnvironmentManager.d.ts.map +1 -0
  13. package/dist/core/EnvironmentManager.js +46 -0
  14. package/dist/core/EnvironmentManager.js.map +1 -0
  15. package/dist/i18n/messages.d.ts +30 -0
  16. package/dist/i18n/messages.d.ts.map +1 -1
  17. package/dist/i18n/messages.js +62 -0
  18. package/dist/i18n/messages.js.map +1 -1
  19. package/dist/setup/checker.d.ts +33 -0
  20. package/dist/setup/checker.d.ts.map +1 -0
  21. package/dist/setup/checker.js +169 -0
  22. package/dist/setup/checker.js.map +1 -0
  23. package/dist/setup/installer.d.ts +17 -0
  24. package/dist/setup/installer.d.ts.map +1 -0
  25. package/dist/setup/installer.js +108 -0
  26. package/dist/setup/installer.js.map +1 -0
  27. package/dist/setup/planner.d.ts +22 -0
  28. package/dist/setup/planner.d.ts.map +1 -0
  29. package/dist/setup/planner.js +213 -0
  30. package/dist/setup/planner.js.map +1 -0
  31. package/dist/setup/strategies/base.d.ts +26 -0
  32. package/dist/setup/strategies/base.d.ts.map +1 -0
  33. package/dist/setup/strategies/base.js +32 -0
  34. package/dist/setup/strategies/base.js.map +1 -0
  35. package/dist/setup/strategies/node.d.ts +9 -0
  36. package/dist/setup/strategies/node.d.ts.map +1 -0
  37. package/dist/setup/strategies/node.js +141 -0
  38. package/dist/setup/strategies/node.js.map +1 -0
  39. package/dist/setup/strategies/nvm.d.ts +9 -0
  40. package/dist/setup/strategies/nvm.d.ts.map +1 -0
  41. package/dist/setup/strategies/nvm.js +106 -0
  42. package/dist/setup/strategies/nvm.js.map +1 -0
  43. package/dist/setup/strategies/volta.d.ts +9 -0
  44. package/dist/setup/strategies/volta.d.ts.map +1 -0
  45. package/dist/setup/strategies/volta.js +111 -0
  46. package/dist/setup/strategies/volta.js.map +1 -0
  47. package/dist/setup/types.d.ts +95 -0
  48. package/dist/setup/types.d.ts.map +1 -0
  49. package/dist/setup/types.js +6 -0
  50. package/dist/setup/types.js.map +1 -0
  51. package/dist/utils/command.d.ts +33 -0
  52. package/dist/utils/command.d.ts.map +1 -0
  53. package/dist/utils/command.js +73 -0
  54. package/dist/utils/command.js.map +1 -0
  55. package/package.json +5 -2
package/README_en.md CHANGED
@@ -28,12 +28,54 @@
28
28
 
29
29
  ## ๐Ÿš€ Quick Start
30
30
 
31
- ### Installation
31
+ ### Installation Methods
32
+
33
+ #### Method 1: npm Installation (Recommended)
32
34
 
33
35
  ```bash
36
+ # Global installation
34
37
  npm install -g ccman
38
+
39
+ # Or use pnpm
40
+ pnpm add -g ccman
41
+
42
+ # Or use yarn
43
+ yarn global add ccman
44
+ ```
45
+
46
+ #### Method 2: npx Direct Run (No Installation Required)
47
+
48
+ ```bash
49
+ # Run directly without global installation
50
+ npx ccman
51
+
52
+ # Run specific commands
53
+ npx ccman ls
54
+ npx ccman add anthropic "Anthropic Official" https://api.anthropic.com
55
+ ```
56
+
57
+ #### Method 3: Install from Source
58
+
59
+ ```bash
60
+ # Clone repository
61
+ git clone https://github.com/2ue/ccman.git
62
+ cd ccman
63
+
64
+ # Install dependencies
65
+ pnpm install
66
+
67
+ # Link globally (development mode)
68
+ npm link
69
+
70
+ # Or build and run
71
+ pnpm build
72
+ node dist/cli.js
35
73
  ```
36
74
 
75
+ #### Method 4: Download Pre-built Version
76
+
77
+ Visit [GitHub Releases](https://github.com/2ue/ccman/releases) to download pre-built versions for your platform (if available)
78
+
37
79
  ### First Run
38
80
 
39
81
  ```bash
@@ -109,7 +151,7 @@ $ ccman
109
151
 
110
152
  CCM directly manages the `~/.claude/settings.json` file with these safety measures:
111
153
 
112
- ### 1. Selective Updates
154
+ ### Selective Updates
113
155
 
114
156
  Only modifies CCM-managed configuration items:
115
157
  - `env.ANTHROPIC_AUTH_TOKEN`
@@ -118,13 +160,9 @@ Only modifies CCM-managed configuration items:
118
160
  - `env.CLAUDE_CODE_MAX_OUTPUT_TOKENS`
119
161
  - `permissions.allow` / `permissions.deny`
120
162
 
121
- ### 2. Configuration Protection
122
-
123
- Preserves all other user configuration items:
124
- - โœ… Preserves: `mcpServers`, `model`, `customUserConfig`, etc.
125
- - ๐Ÿ”„ Updates: Only the CCM-managed configuration items listed above
163
+ **Preserves all other user configuration items** (such as `mcpServers`, `model`, `customUserConfig`, etc.)
126
164
 
127
- ### 3. Automatic Backups
165
+ ### Automatic Backups
128
166
 
129
167
  Automatically backs up current configuration to `~/.ccman/backups/` before each switch
130
168
 
@@ -140,57 +178,6 @@ Automatically backs up current configuration to `~/.ccman/backups/` before each
140
178
  โ””โ”€โ”€ backups/ # Configuration backup directory (auto-created)
141
179
  ```
142
180
 
143
- ### Provider Configuration File Structure
144
-
145
- ```json
146
- {
147
- "name": "Anthropic Official",
148
- "description": "Official Anthropic API Configuration",
149
- "config": {
150
- "env": {
151
- "ANTHROPIC_AUTH_TOKEN": "your-token",
152
- "ANTHROPIC_BASE_URL": "https://api.anthropic.com",
153
- "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": 1,
154
- "CLAUDE_CODE_MAX_OUTPUT_TOKENS": 32000
155
- },
156
- "permissions": {
157
- "allow": [],
158
- "deny": []
159
- }
160
- },
161
- "metadata": {
162
- "createdAt": "2025-01-15T10:30:00.000Z",
163
- "updatedAt": "2025-01-15T10:30:00.000Z",
164
- "usageCount": 5
165
- }
166
- }
167
- ```
168
-
169
- ### Main CCM Configuration File Structure
170
-
171
- ```json
172
- {
173
- "currentProvider": "anthropic",
174
- "claudeConfigPath": "/Users/user/.claude/settings.json",
175
- "providers": {
176
- "anthropic": {
177
- "name": "Anthropic Official",
178
- "configFile": "anthropic.json",
179
- "lastUsed": "2025-01-15T10:30:00.000Z"
180
- }
181
- },
182
- "settings": {
183
- "language": "zh",
184
- "firstRun": false
185
- },
186
- "metadata": {
187
- "version": "2.1.3",
188
- "createdAt": "2025-01-15T10:00:00.000Z",
189
- "updatedAt": "2025-01-15T10:30:00.000Z"
190
- }
191
- }
192
- ```
193
-
194
181
  ## ๐ŸŒ Language Support
195
182
 
196
183
  ### Supported Languages
@@ -205,88 +192,6 @@ Automatically backs up current configuration to `~/.ccman/backups/` before each
205
192
  - Other environments (including `zh-*`, unset, etc.) โ†’ Automatically uses Chinese interface
206
193
  - Users can manually override language settings at any time
207
194
 
208
- ### First-Run Experience
209
-
210
- ```bash
211
- $ ccman
212
-
213
- ๐ŸŒ Welcome to CCM! / ๆฌข่ฟŽไฝฟ็”จ CCM!
214
-
215
- This is your first time running CCM.
216
- ่ฟ™ๆ˜ฏๆ‚จ้ฆ–ๆฌก่ฟ่กŒ CCMใ€‚
217
-
218
- ? Please choose your preferred language:
219
- ? ่ฏท้€‰ๆ‹ฉๆ‚จๅๅฅฝ็š„่ฏญ่จ€๏ผš
220
- โฏ ๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡ (Chinese)
221
- ๐Ÿ‡บ๐Ÿ‡ธ English
222
- ๐ŸŒ Auto-detect based on system
223
-
224
- โœ“ Language set to English
225
- โœ“ You can change this later with: ccman lang set <zh|en|auto>
226
- ```
227
-
228
- ## ๐Ÿ› ๏ธ Development
229
-
230
- ### Environment Setup
231
-
232
- ```bash
233
- # Clone repository
234
- git clone https://github.com/2ue/ccman.git
235
- cd ccman
236
-
237
- # Install dependencies
238
- pnpm install
239
- ```
240
-
241
- ### Development Commands
242
-
243
- ```bash
244
- pnpm run dev # Development mode (using tsx)
245
- pnpm run build # TypeScript compilation
246
- pnpm run start # Run compiled CLI
247
- pnpm run clean # Clean dist/ directory
248
- pnpm run lint # ESLint code check
249
- pnpm test # Run tests
250
- ```
251
-
252
- ### Development Environment Isolation
253
-
254
- CCM supports development environment configuration isolation to avoid affecting production configurations:
255
-
256
- ```bash
257
- # Set development environment configuration paths
258
- export CCM_CONFIG_DIR=".ccman-dev"
259
- export CLAUDE_CONFIG_PATH="$HOME/.claude/settings-dev.json"
260
-
261
- # Run in isolated environment
262
- pnpm run dev
263
- ```
264
-
265
- ### Project Structure
266
-
267
- ```
268
- src/
269
- โ”œโ”€โ”€ types/ # TypeScript type definitions
270
- โ”‚ โ””โ”€โ”€ index.ts # Core type interfaces
271
- โ”œโ”€โ”€ core/ # Core modules
272
- โ”‚ โ”œโ”€โ”€ CCMConfigManager.ts # CCM configuration manager
273
- โ”‚ โ””โ”€โ”€ ClaudeConfigManager.ts # Claude configuration manager
274
- โ”œโ”€โ”€ providers/ # Provider management
275
- โ”‚ โ””โ”€โ”€ ProviderManager.ts # Provider business logic
276
- โ”œโ”€โ”€ commands/ # Command handling
277
- โ”‚ โ””โ”€โ”€ lang.ts # Language command processing
278
- โ”œโ”€โ”€ i18n/ # Internationalization
279
- โ”‚ โ”œโ”€โ”€ LanguageManager.ts # Language manager
280
- โ”‚ โ””โ”€โ”€ messages.ts # Multi-language messages
281
- โ”œโ”€โ”€ utils/ # Utility functions
282
- โ”‚ โ”œโ”€โ”€ env-config.ts # Environment configuration
283
- โ”‚ โ””โ”€โ”€ version.ts # Version information
284
- โ”œโ”€โ”€ config/ # Configuration files
285
- โ”‚ โ””โ”€โ”€ static-env.ts # Static environment configuration
286
- โ”œโ”€โ”€ cli.ts # CLI entry point
287
- โ””โ”€โ”€ index.ts # Module exports
288
- ```
289
-
290
195
  ## ๐Ÿ“‹ System Requirements
291
196
 
292
197
  - **Node.js** >= 16.0.0
@@ -307,9 +212,6 @@ ccman use <provider-id>
307
212
 
308
213
  # 3. Check Claude configuration file
309
214
  cat ~/.claude/settings.json | grep ANTHROPIC
310
-
311
- # 4. View complete configuration
312
- cat ~/.claude/settings.json | jq .
313
215
  ```
314
216
 
315
217
  ### Language Switching Issues
@@ -321,9 +223,6 @@ ccman lang
321
223
  # Force set to Chinese
322
224
  ccman lang set zh
323
225
 
324
- # Force set to English
325
- ccman lang set en
326
-
327
226
  # Reset to first-run state (re-select language)
328
227
  ccman lang reset
329
228
  ccman
@@ -339,61 +238,12 @@ ccman clear
339
238
  ccman
340
239
  ```
341
240
 
342
- ### Development Environment Issues
343
-
344
- ```bash
345
- # Use isolated development environment
346
- export CCM_CONFIG_DIR=".ccman-dev"
347
- pnpm run dev
348
-
349
- # Clean and rebuild
350
- pnpm run clean
351
- pnpm run build
352
- ```
353
-
354
- ## ๐Ÿ“ Changelog
355
-
356
- ### v2.1.3 (2025-09-24)
357
- - โœจ Added `CLAUDE_CODE_MAX_OUTPUT_TOKENS` configuration support
358
- - ๐Ÿ› Fixed TypeScript compilation errors, completely removed apiKeyHelper configuration
359
- - ๐ŸŽจ Optimized interactive menu experience
360
- - ๐Ÿ“ฆ Updated dependency package versions
361
-
362
- ### v2.1.2
363
- - ๐ŸŽจ Simplified provider configuration, removed manual ID setting
364
- - โœจ Optimized first-run experience
365
-
366
- ### v2.0.0
367
- - ๐ŸŽ‰ New architecture: Direct configuration integration without shell integration
368
- - ๐ŸŒ Intelligent multilingual support (Chinese/English/Auto-detect)
369
- - ๐ŸŽฏ Interactive menu system
370
- - ๐Ÿ“ Multi-provider management
371
- - ๐Ÿ”’ Automatic backups and configuration protection
372
-
373
- ### v1.x
374
- - Legacy architecture: Based on shell environment variable integration (deprecated)
375
-
376
- ## ๐Ÿš€ Migration from v1.x
377
-
378
- CCM v2.0 uses a completely different architecture and is incompatible with v1.x:
379
-
380
- ### v1.x (Deprecated)
381
- - โŒ Modified shell configuration files (.bashrc, .zshrc, etc.)
382
- - โŒ Used environment variables
383
- - โŒ Complex shell integration and reloading
384
-
385
- ### v2.x (Current Version)
386
- - โœ… Directly modifies `~/.claude/settings.json`
387
- - โœ… Provider-based configuration management
388
- - โœ… Intelligent language support
389
- - โœ… Simplified, secure implementation
390
-
391
- **Migration Steps**:
241
+ ## ๐Ÿ“š Development Documentation
392
242
 
393
- 1. Uninstall v1.x version
394
- 2. Clean up related content from shell configuration files
395
- 3. Install v2.x version: `npm install -g ccman`
396
- 4. Run `ccman` to reconfigure
243
+ - [ๅผ€ๅ‘ๆŒ‡ๅ— (ไธญๆ–‡)](./docs/DEVELOPMENT.md)
244
+ - [Development Guide (English)](./docs/DEVELOPMENT_en.md)
245
+ - [Release Guide](./docs/release-guide.md)
246
+ - [Scripts Guide](./docs/scripts-guide.md)
397
247
 
398
248
  ## ๐Ÿค Contributing
399
249
 
package/dist/cli.js CHANGED
@@ -1,5 +1,38 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
3
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
4
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
38
  };
@@ -12,6 +45,7 @@ const LanguageManager_1 = require("./i18n/LanguageManager");
12
45
  const lang_1 = require("./commands/lang");
13
46
  const version_1 = require("./utils/version");
14
47
  const default_providers_1 = require("./config/default-providers");
48
+ const EnvironmentManager_1 = require("./core/EnvironmentManager");
15
49
  const program = new commander_1.Command();
16
50
  const providerManager = new ProviderManager_1.ProviderManager();
17
51
  const languageManager = new LanguageManager_1.LanguageManager();
@@ -162,6 +196,10 @@ async function showInteractiveMenu() {
162
196
  { name: messages.mainMenuOptions.updateProvider, value: 'update' },
163
197
  { name: messages.mainMenuOptions.removeProvider, value: 'remove' },
164
198
  { name: messages.mainMenuOptions.showStatus, value: 'status' },
199
+ new inquirer_1.default.Separator(),
200
+ { name: messages.mainMenuOptions.doctor, value: 'doctor' },
201
+ { name: messages.mainMenuOptions.setup, value: 'setup' },
202
+ new inquirer_1.default.Separator(),
165
203
  { name: messages.mainMenuOptions.exit, value: 'exit' }
166
204
  ]
167
205
  }
@@ -367,6 +405,187 @@ async function showInteractiveMenu() {
367
405
  shouldContinue = await askToContinue();
368
406
  break;
369
407
  }
408
+ case 'doctor': {
409
+ const envManager = new EnvironmentManager_1.EnvironmentManager();
410
+ const checkResult = await envManager.checkEnvironment();
411
+ console.log();
412
+ console.log(chalk_1.default.blue(`๐Ÿ” ${messages.environment.checkTitle}`));
413
+ console.log();
414
+ // Claude Code ็Šถๆ€
415
+ if (checkResult.claudeCode.installed) {
416
+ console.log(chalk_1.default.green(`${messages.environment.claudeCode}: โœ“ ${messages.environment.installed}`));
417
+ if (checkResult.claudeCode.version) {
418
+ console.log(` ${messages.environment.version}: ${checkResult.claudeCode.version}`);
419
+ }
420
+ if (checkResult.claudeCode.path) {
421
+ console.log(` ${messages.environment.path}: ${checkResult.claudeCode.path}`);
422
+ }
423
+ }
424
+ else {
425
+ console.log(chalk_1.default.red(`${messages.environment.claudeCode}: โœ— ${messages.environment.notInstalled}`));
426
+ }
427
+ console.log();
428
+ // Node.js ็Šถๆ€
429
+ if (checkResult.node.installed) {
430
+ const versionStatus = checkResult.node.versionValid ? chalk_1.default.green('โœ“') : chalk_1.default.yellow('โš ๏ธ');
431
+ console.log(`${chalk_1.default.green(messages.environment.nodeJs + ':')} ${versionStatus} ${messages.environment.installed}`);
432
+ console.log(` ${messages.environment.version}: ${checkResult.node.version}`);
433
+ console.log(` ${messages.environment.required}: ${checkResult.requirements.nodeVersion}`);
434
+ if (checkResult.node.path) {
435
+ console.log(` ${messages.environment.path}: ${checkResult.node.path}`);
436
+ }
437
+ }
438
+ else {
439
+ console.log(chalk_1.default.red(`${messages.environment.nodeJs}: โœ— ${messages.environment.notInstalled}`));
440
+ }
441
+ console.log();
442
+ // npm ็Šถๆ€
443
+ if (checkResult.npm.installed) {
444
+ console.log(chalk_1.default.green(`${messages.environment.npm}: โœ“ ${messages.environment.installed}`));
445
+ if (checkResult.npm.version) {
446
+ console.log(` ${messages.environment.version}: ${checkResult.npm.version}`);
447
+ }
448
+ if (checkResult.npm.path) {
449
+ console.log(` ${messages.environment.path}: ${checkResult.npm.path}`);
450
+ }
451
+ }
452
+ else {
453
+ console.log(chalk_1.default.yellow(`${messages.environment.npm}: โœ— ${messages.environment.notInstalled}`));
454
+ }
455
+ console.log();
456
+ // ็‰ˆๆœฌ็ฎก็†ๅ™จ
457
+ const managers = [];
458
+ if (checkResult.versionManagers.volta)
459
+ managers.push('volta');
460
+ if (checkResult.versionManagers.nvm)
461
+ managers.push('nvm');
462
+ if (managers.length > 0) {
463
+ console.log(chalk_1.default.blue(`${messages.environment.versionManagers}:`));
464
+ managers.forEach(m => console.log(` โœ“ ${m}`));
465
+ console.log();
466
+ }
467
+ // ้—ฎ้ข˜ๅˆ—่กจ
468
+ if (checkResult.issues.length > 0) {
469
+ console.log(chalk_1.default.yellow(`โš ๏ธ ${messages.environment.issues}:`));
470
+ checkResult.issues.forEach(issue => console.log(` - ${issue}`));
471
+ console.log();
472
+ }
473
+ // ๅปบ่ฎฎ
474
+ if (checkResult.suggestions.length > 0) {
475
+ console.log(chalk_1.default.cyan(`๐Ÿ’ก ${messages.environment.suggestions}:`));
476
+ checkResult.suggestions.forEach(suggestion => console.log(` - ${suggestion}`));
477
+ console.log();
478
+ }
479
+ // ๆ€ปไฝ“็Šถๆ€
480
+ if (checkResult.status === 'ready') {
481
+ console.log(chalk_1.default.green(`โœ… ${messages.environment.ready}`));
482
+ }
483
+ else if (checkResult.status === 'warning') {
484
+ console.log(chalk_1.default.yellow(`โš ๏ธ ${messages.environment.hasWarnings}`));
485
+ }
486
+ else {
487
+ console.log(chalk_1.default.red(`โŒ ${messages.environment.notReady}`));
488
+ }
489
+ console.log();
490
+ console.log();
491
+ shouldContinue = await askToContinue();
492
+ break;
493
+ }
494
+ case 'setup': {
495
+ const envManager = new EnvironmentManager_1.EnvironmentManager();
496
+ console.log(chalk_1.default.blue(`๐Ÿ” ${messages.environment.checkingEnvironment}`));
497
+ const checkResult = await envManager.checkEnvironment();
498
+ console.log();
499
+ console.log(`${messages.environment.environmentStatus}:`);
500
+ console.log(` ${messages.environment.claudeCode}: ${checkResult.claudeCode.installed ? 'โœ“' : 'โœ—'}`);
501
+ console.log(` ${messages.environment.nodeJs}: ${checkResult.node.installed && checkResult.node.versionValid ? 'โœ“' : 'โœ—'}`);
502
+ console.log();
503
+ if (checkResult.status === 'ready') {
504
+ console.log(chalk_1.default.green(`โœ… ${messages.environment.ready}!`));
505
+ console.log(messages.environment.noSetupNeeded);
506
+ }
507
+ else {
508
+ const plan = await envManager.generateInstallPlan(checkResult);
509
+ if (plan.needsNode) {
510
+ console.log(chalk_1.default.yellow(`โš ๏ธ ${messages.environment.nodeJs} ${messages.environment.needsInstallOrUpgrade}`));
511
+ console.log();
512
+ console.log(`${messages.environment.availableOptions}:`);
513
+ console.log();
514
+ const optionChoices = plan.nodeOptions.map((opt, idx) => ({
515
+ name: `${idx + 1}. ${opt.name}${opt.reason ? ` (${opt.reason})` : ''}`,
516
+ value: idx,
517
+ short: opt.name
518
+ }));
519
+ const optionAnswer = await inquirer_1.default.prompt([
520
+ {
521
+ type: 'list',
522
+ name: 'option',
523
+ message: messages.environment.selectMethod + ':',
524
+ choices: optionChoices
525
+ }
526
+ ]);
527
+ const selectedOption = plan.nodeOptions[optionAnswer.option];
528
+ console.log();
529
+ console.log(chalk_1.default.cyan(`${messages.environment.selected}: ${selectedOption.name}`));
530
+ if (selectedOption.description) {
531
+ console.log(chalk_1.default.gray(` ${selectedOption.description}`));
532
+ }
533
+ console.log();
534
+ console.log(chalk_1.default.blue(`${messages.environment.installSteps}:`));
535
+ selectedOption.steps.forEach((step, idx) => {
536
+ console.log(` ${idx + 1}. ${step.description}`);
537
+ console.log(chalk_1.default.gray(` $ ${step.command}`));
538
+ });
539
+ console.log();
540
+ const confirmAnswer = await inquirer_1.default.prompt([
541
+ {
542
+ type: 'confirm',
543
+ name: 'confirm',
544
+ message: messages.environment.proceedInstall,
545
+ default: true
546
+ }
547
+ ]);
548
+ if (confirmAnswer.confirm) {
549
+ const { Installer } = await Promise.resolve().then(() => __importStar(require('./setup/installer')));
550
+ const installer = new Installer({ dryRun: true });
551
+ await installer.executeSteps(selectedOption.steps);
552
+ }
553
+ else {
554
+ console.log(chalk_1.default.yellow(messages.environment.installCancelled));
555
+ }
556
+ }
557
+ if (plan.needsClaudeCode) {
558
+ console.log();
559
+ console.log(chalk_1.default.yellow(`โš ๏ธ ${messages.environment.claudeCode} ${messages.environment.needsInstallOrUpgrade}`));
560
+ console.log();
561
+ console.log(chalk_1.default.blue(`${messages.environment.installSteps}:`));
562
+ plan.claudeCodeSteps.forEach((step, idx) => {
563
+ console.log(` ${idx + 1}. ${step.description}`);
564
+ console.log(chalk_1.default.gray(` $ ${step.command}`));
565
+ });
566
+ console.log();
567
+ const confirmAnswer = await inquirer_1.default.prompt([
568
+ {
569
+ type: 'confirm',
570
+ name: 'confirm',
571
+ message: messages.environment.proceedInstall,
572
+ default: true
573
+ }
574
+ ]);
575
+ if (confirmAnswer.confirm) {
576
+ const { Installer } = await Promise.resolve().then(() => __importStar(require('./setup/installer')));
577
+ const installer = new Installer({ dryRun: true });
578
+ await installer.executeSteps(plan.claudeCodeSteps);
579
+ }
580
+ else {
581
+ console.log(chalk_1.default.yellow(messages.environment.installCancelled));
582
+ }
583
+ }
584
+ }
585
+ console.log();
586
+ shouldContinue = await askToContinue();
587
+ break;
588
+ }
370
589
  }
371
590
  } // while ๅพช็Žฏ็ป“ๆŸ
372
591
  }