@wundr.io/cli 1.0.1 → 1.0.2-dev.20260530174250.ef0ec927

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 (69) hide show
  1. package/bin/wundr.js +13 -5
  2. package/package.json +30 -9
  3. package/src/ai/ai-service.ts +6 -4
  4. package/src/ai/claude-client.ts +6 -2
  5. package/src/ai/conversation-manager.ts +12 -5
  6. package/src/cli.ts +42 -13
  7. package/src/commands/ai.ts +340 -64
  8. package/src/commands/alignment.ts +1212 -0
  9. package/src/commands/analyze-optimized.ts +371 -33
  10. package/src/commands/analyze.ts +8 -6
  11. package/src/commands/batch.ts +166 -26
  12. package/src/commands/chat.ts +20 -10
  13. package/src/commands/claude-init.ts +31 -27
  14. package/src/commands/claude-setup.ts +761 -81
  15. package/src/commands/computer-setup.ts +524 -12
  16. package/src/commands/create-command.ts +3 -3
  17. package/src/commands/create.ts +9 -6
  18. package/src/commands/dashboard.ts +11 -6
  19. package/src/commands/govern.ts +11 -6
  20. package/src/commands/governance.ts +1005 -0
  21. package/src/commands/guardian.ts +887 -0
  22. package/src/commands/init.ts +104 -11
  23. package/src/commands/orchestrator.ts +789 -0
  24. package/src/commands/performance-optimizer.ts +15 -10
  25. package/src/commands/plugins.ts +8 -5
  26. package/src/commands/project-update.ts +1156 -0
  27. package/src/commands/rag.ts +1011 -0
  28. package/src/commands/session.ts +631 -0
  29. package/src/commands/setup.ts +42 -344
  30. package/src/commands/test-init.ts +3 -2
  31. package/src/commands/test.ts +3 -2
  32. package/src/commands/watch.ts +21 -11
  33. package/src/commands/worktree.ts +1057 -0
  34. package/src/context/context-manager.ts +5 -2
  35. package/src/context/session-manager.ts +18 -7
  36. package/src/framework/command-interface.ts +520 -0
  37. package/src/framework/command-registry.ts +942 -0
  38. package/src/framework/completion-exporter.ts +383 -0
  39. package/src/framework/debug-logger.ts +519 -0
  40. package/src/framework/error-handler.ts +867 -0
  41. package/src/framework/help-generator.ts +540 -0
  42. package/src/framework/index.ts +169 -0
  43. package/src/framework/interactive-repl.ts +703 -0
  44. package/src/framework/output-formatter.ts +834 -0
  45. package/src/framework/progress-manager.ts +539 -0
  46. package/src/index.ts +3 -2
  47. package/src/interactive/interactive-mode.ts +14 -7
  48. package/src/lib/conflict-resolution.ts +818 -0
  49. package/src/lib/merge-strategy.ts +550 -0
  50. package/src/lib/safety-mechanisms.ts +451 -0
  51. package/src/lib/state-detection.ts +1030 -0
  52. package/src/nlp/command-mapper.ts +8 -3
  53. package/src/nlp/command-parser.ts +5 -2
  54. package/src/nlp/intent-parser.ts +23 -9
  55. package/src/plugins/plugin-manager.ts +50 -24
  56. package/src/tests/computer-setup-integration.test.ts +46 -15
  57. package/src/types/index.ts +1 -1
  58. package/src/types/modules.d.ts +425 -1
  59. package/src/utils/backup-rollback-manager.ts +19 -14
  60. package/src/utils/claude-config-installer.ts +119 -28
  61. package/src/utils/config-manager.ts +9 -6
  62. package/src/utils/error-handler.ts +3 -1
  63. package/src/utils/logger.ts +35 -12
  64. package/templates/batch/ci-cd.yaml +7 -7
  65. package/test-suites/api/health.spec.ts +20 -23
  66. package/test-suites/helpers/test-config.ts +14 -13
  67. package/test-suites/ui/accessibility.spec.ts +27 -22
  68. package/test-suites/ui/smoke.spec.ts +26 -21
  69. package/src/commands/computer-setup-commands.ts +0 -869
@@ -1,869 +0,0 @@
1
- /**
2
- * Computer Setup Commands
3
- * Integrates real setup orchestrator for provisioning developer machines
4
- */
5
-
6
- import { Command } from 'commander';
7
- import chalk from 'chalk';
8
- import ora from 'ora';
9
- import inquirer from 'inquirer';
10
- import { ConfigManager } from '../utils/config-manager';
11
- import { PluginManager } from '../plugins/plugin-manager';
12
- import { logger } from '../utils/logger';
13
- import { BackupRollbackManager } from '../utils/backup-rollback-manager';
14
- import { ClaudeConfigInstaller } from '../utils/claude-config-installer';
15
- import { execSync } from 'child_process';
16
- import * as os from 'os';
17
- import * as fs from 'fs/promises';
18
- // Note: Using relative path import due to workspace resolution issues in this monorepo setup
19
- // The computer-setup package must be built first before building this CLI package
20
- import {
21
- SetupPlatform,
22
- SetupProgress,
23
- SetupResult,
24
- RealSetupOrchestrator,
25
- DeveloperProfile,
26
- } from '../../../computer-setup/dist';
27
-
28
- // Additional local types
29
- interface LocalSetupOptions {
30
- profile?: string;
31
- team?: string;
32
- mode?: string;
33
- os?: string;
34
- dryRun?: boolean;
35
- skipExisting?: boolean;
36
- parallel?: boolean;
37
- report?: boolean;
38
- }
39
-
40
- export class ComputerSetupCommands {
41
- private orchestrator: RealSetupOrchestrator;
42
- private platform: SetupPlatform;
43
- private backupManager: BackupRollbackManager;
44
- private claudeInstaller: ClaudeConfigInstaller;
45
-
46
- constructor(
47
- private program: Command,
48
- private configManager: ConfigManager,
49
- private pluginManager: PluginManager
50
- ) {
51
- this.platform = this.detectPlatform();
52
- this.orchestrator = new RealSetupOrchestrator(this.platform);
53
- this.backupManager = new BackupRollbackManager();
54
- this.claudeInstaller = new ClaudeConfigInstaller();
55
- this.registerCommands();
56
- }
57
-
58
- private registerCommands(): void {
59
- const computerSetup = this.program
60
- .command('computer-setup')
61
- .alias('setup-machine')
62
- .alias('provision')
63
- .description(
64
- 'Set up a new developer machine with all required tools and configurations'
65
- )
66
- .addHelpText(
67
- 'after',
68
- chalk.gray(`
69
- Examples:
70
- ${chalk.green('wundr computer-setup')} Interactive setup for new machine
71
- ${chalk.green('wundr computer-setup --profile frontend')} Use frontend developer profile
72
- ${chalk.green('wundr computer-setup --team platform')} Apply platform team configuration
73
- ${chalk.green('wundr computer-setup doctor')} Diagnose setup issues
74
- ${chalk.green('wundr computer-setup validate')} Validate current setup
75
- `)
76
- );
77
-
78
- // Main setup command
79
- computerSetup
80
- .command('run', { isDefault: true })
81
- .description('Run computer setup for new developer machine')
82
- .option(
83
- '-p, --profile <profile>',
84
- 'Use specific profile (frontend, backend, fullstack, devops)'
85
- )
86
- .option('-t, --team <team>', 'Apply team-specific configurations')
87
- .option('-m, --mode <mode>', 'Setup mode', 'interactive')
88
- .option('--os <os>', 'Target OS (auto-detected by default)')
89
- .option(
90
- '--dry-run',
91
- 'Show what would be installed without making changes'
92
- )
93
- .option('--skip-existing', 'Skip tools that are already installed')
94
- .option('--parallel', 'Install tools in parallel where possible')
95
- .option('--report', 'Generate detailed setup report')
96
- .action(async options => {
97
- await this.runSetup(options);
98
- });
99
-
100
- // Resume command
101
- computerSetup
102
- .command('resume')
103
- .description('Resume failed setup from saved state')
104
- .action(async () => {
105
- await this.resumeSetup();
106
- });
107
-
108
- // List profiles command
109
- computerSetup
110
- .command('list-profiles')
111
- .description('List available developer profiles')
112
- .action(async () => {
113
- await this.listAvailableProfiles();
114
- });
115
-
116
- // Profile management
117
- computerSetup
118
- .command('profile')
119
- .description('Manage developer profiles')
120
- .option('-l, --list', 'List available profiles')
121
- .option('-c, --create', 'Create new profile')
122
- .option('-e, --edit <name>', 'Edit existing profile')
123
- .option('-d, --delete <name>', 'Delete profile')
124
- .option('--export <path>', 'Export profiles')
125
- .option('--import <path>', 'Import profiles')
126
- .action(async options => {
127
- await this.manageProfiles(options);
128
- });
129
-
130
- // Team configuration
131
- computerSetup
132
- .command('team')
133
- .description('Manage team configurations')
134
- .argument('[team]', 'Team identifier')
135
- .option('--download', 'Download team configuration')
136
- .option('--apply', 'Apply team configuration')
137
- .option('--sync', 'Sync with team repository')
138
- .action(async (team, options) => {
139
- await this.manageTeamConfig(team, options);
140
- });
141
-
142
- // Validation
143
- computerSetup
144
- .command('validate')
145
- .description('Validate current machine setup')
146
- .option('--profile <profile>', 'Validate against specific profile')
147
- .option('--fix', 'Attempt to fix issues')
148
- .option('--report', 'Generate validation report')
149
- .action(async options => {
150
- await this.validateSetup(options);
151
- });
152
-
153
- // Doctor - diagnose issues
154
- computerSetup
155
- .command('doctor')
156
- .description('Diagnose and fix common setup issues')
157
- .option('--check <tool>', 'Check specific tool')
158
- .option('--fix', 'Attempt automatic fixes')
159
- .option('--verbose', 'Show detailed diagnostics')
160
- .action(async options => {
161
- await this.runDoctor(options);
162
- });
163
-
164
- // Tool-specific setup commands
165
- computerSetup
166
- .command('install')
167
- .description('Install specific tools')
168
- .argument('<tool>', 'Tool to install (node, python, docker, etc.)')
169
- .option('--version <version>', 'Specific version to install')
170
- .option('--global', 'Install globally')
171
- .action(async (tool, options) => {
172
- await this.installTool(tool, options);
173
- });
174
-
175
- // Claude Code configuration commands
176
- computerSetup
177
- .command('claude-config')
178
- .description('Install Claude Code configuration')
179
- .option('--dry-run', 'Show what would be installed')
180
- .option('--skip-backup', 'Skip backup creation')
181
- .option('--overwrite', 'Overwrite existing configurations')
182
- .option('--verbose', 'Show detailed output')
183
- .action(async options => {
184
- await this.installClaudeConfig(options);
185
- });
186
-
187
- // Backup management commands
188
- computerSetup
189
- .command('backup')
190
- .description('Manage configuration backups')
191
- .option('-l, --list', 'List all backups')
192
- .option('-c, --create', 'Create new backup')
193
- .option('-v, --verify <id>', 'Verify backup integrity')
194
- .option('--cleanup', 'Clean up old backups')
195
- .action(async options => {
196
- await this.manageBackups(options);
197
- });
198
-
199
- // Rollback command
200
- computerSetup
201
- .command('rollback')
202
- .description('Restore from backup')
203
- .option('--backup <id>', 'Specific backup to restore')
204
- .option('--dry-run', 'Show what would be restored')
205
- .option('--verbose', 'Show detailed output')
206
- .action(async options => {
207
- await this.rollbackConfiguration(options);
208
- });
209
- }
210
-
211
- private async runSetup(options: any): Promise<void> {
212
- console.log(chalk.cyan('\nšŸ–„ļø Wundr Computer Setup'));
213
- console.log(chalk.gray('Setting up your development machine...\n'));
214
-
215
- try {
216
- // Check for resumable setup
217
- const canResume = await this.orchestrator.canResume();
218
- if (canResume) {
219
- const { resume } = await inquirer.prompt([
220
- {
221
- type: 'confirm',
222
- name: 'resume',
223
- message: 'Found incomplete setup. Resume from where you left off?',
224
- default: true,
225
- },
226
- ]);
227
-
228
- if (resume) {
229
- return await this.resumeSetup();
230
- }
231
- }
232
-
233
- // Get profile
234
- let profileName = options.profile;
235
- if (!profileName) {
236
- if (options.mode === 'interactive') {
237
- profileName = await this.selectProfile();
238
- } else {
239
- profileName = 'fullstack'; // Default
240
- }
241
- }
242
-
243
- // Validate profile
244
- const availableProfiles = this.orchestrator.getAvailableProfiles();
245
- const profile = availableProfiles.find(p =>
246
- p.name.toLowerCase().includes(profileName.toLowerCase())
247
- );
248
-
249
- if (!profile) {
250
- console.error(chalk.red(`āŒ Unknown profile: ${profileName}`));
251
- console.log(chalk.cyan('\nAvailable profiles:'));
252
- availableProfiles.forEach(p =>
253
- console.log(` • ${p.name}: ${p.description}`)
254
- );
255
- return;
256
- }
257
-
258
- console.log(
259
- chalk.cyan(`\nšŸ“‹ Selected Profile: ${chalk.white(profile.name)}`)
260
- );
261
- console.log(chalk.gray(`${profile.description}`));
262
- console.log(
263
- chalk.gray(`Estimated time: ${profile.estimatedTimeMinutes} minutes\n`)
264
- );
265
-
266
- // Show what will be installed
267
- console.log(chalk.cyan('šŸ› ļø Tools to install:'));
268
- profile.requiredTools.forEach(tool => console.log(` • ${tool}`));
269
-
270
- if (profile.optionalTools.length > 0) {
271
- console.log(chalk.cyan('\nšŸ”§ Optional tools:'));
272
- profile.optionalTools.forEach(tool => console.log(` • ${tool}`));
273
- }
274
-
275
- if (options.dryRun) {
276
- console.log(chalk.yellow('\nāš ļø DRY RUN - No changes will be made'));
277
- return;
278
- }
279
-
280
- // Confirm before proceeding
281
- if (options.mode === 'interactive') {
282
- const { proceed } = await inquirer.prompt([
283
- {
284
- type: 'confirm',
285
- name: 'proceed',
286
- message: 'Proceed with setup?',
287
- default: true,
288
- },
289
- ]);
290
-
291
- if (!proceed) {
292
- console.log(chalk.yellow('Setup cancelled'));
293
- return;
294
- }
295
- }
296
-
297
- // Run the orchestrator with progress tracking
298
- const progressCallback = (progress: SetupProgress) => {
299
- // Update progress display
300
- process.stdout.clearLine(0);
301
- process.stdout.cursorTo(0);
302
- process.stdout.write(
303
- `${chalk.cyan('[')}${progress.percentage.toFixed(1)}%${chalk.cyan(']')} ${progress.currentStep}`
304
- );
305
- };
306
-
307
- console.log(chalk.cyan('\nšŸš€ Starting setup...\n'));
308
-
309
- const result: SetupResult = await this.orchestrator.orchestrate(
310
- profileName,
311
- {
312
- dryRun: options.dryRun,
313
- skipExisting: options.skipExisting,
314
- parallel: options.parallel,
315
- generateReport: options.report,
316
- },
317
- progressCallback
318
- );
319
-
320
- console.log('\n'); // New line after progress
321
-
322
- if (result.success) {
323
- console.log(chalk.green('āœ… Computer setup completed successfully!'));
324
- console.log(
325
- chalk.gray(
326
- `Setup took ${Math.round(result.duration / 1000)} seconds\n`
327
- )
328
- );
329
-
330
- if (result.completedSteps.length > 0) {
331
- console.log(
332
- chalk.cyan(`šŸŽÆ Completed steps (${result.completedSteps.length}):`)
333
- );
334
- result.completedSteps
335
- .slice(0, 5)
336
- .forEach(step => console.log(` āœ… ${step}`));
337
- if (result.completedSteps.length > 5) {
338
- console.log(` ... and ${result.completedSteps.length - 5} more`);
339
- }
340
- }
341
-
342
- if (result.skippedSteps.length > 0) {
343
- console.log(
344
- chalk.yellow(`ā­ļø Skipped steps (${result.skippedSteps.length}):`)
345
- );
346
- result.skippedSteps.forEach(step => console.log(` ā­ļø ${step}`));
347
- }
348
-
349
- this.displayNextSteps();
350
- } else {
351
- console.log(chalk.red('āŒ Setup failed!'));
352
-
353
- if (result.failedSteps.length > 0) {
354
- console.log(
355
- chalk.red(`Failed steps (${result.failedSteps.length}):`)
356
- );
357
- result.failedSteps.forEach(step => console.log(` āŒ ${step}`));
358
- }
359
-
360
- if (result.errors.length > 0) {
361
- console.log(chalk.red('\nErrors:'));
362
- result.errors.forEach(error => console.log(` • ${error.message}`));
363
- }
364
-
365
- console.log(
366
- chalk.cyan(
367
- '\nšŸ’” You can resume setup by running: wundr computer-setup resume'
368
- )
369
- );
370
- process.exit(1);
371
- }
372
- } catch (error) {
373
- console.error(chalk.red('\nāŒ Setup failed with error:'), error);
374
- console.log(
375
- chalk.cyan(
376
- '\nšŸ’” You can resume setup by running: wundr computer-setup resume'
377
- )
378
- );
379
- process.exit(1);
380
- }
381
- }
382
-
383
- private async manageProfiles(options: any): Promise<void> {
384
- if (options.list) {
385
- const profiles = await this.listProfiles();
386
- console.log(chalk.cyan('\nšŸ“‹ Available Profiles:\n'));
387
- profiles.forEach(p => {
388
- console.log(chalk.white(` • ${p.name} (${p.role})`));
389
- });
390
- } else if (options.create) {
391
- await this.createInteractiveProfile();
392
- } else if (options.edit) {
393
- await this.editProfile(options.edit);
394
- } else if (options.delete) {
395
- await this.deleteProfile(options.delete);
396
- } else if (options.export) {
397
- await this.exportProfiles(options.export);
398
- } else if (options.import) {
399
- await this.importProfiles(options.import);
400
- }
401
- }
402
-
403
- private async validateSetup(options: any): Promise<void> {
404
- const spinner = ora('Validating setup...').start();
405
-
406
- const checks = [
407
- { name: 'Node.js', cmd: 'node --version', required: true },
408
- { name: 'Git', cmd: 'git --version', required: true },
409
- { name: 'Docker', cmd: 'docker --version', required: false },
410
- { name: 'Claude Code', cmd: 'claude --version', required: false },
411
- ];
412
-
413
- const results: any[] = [];
414
-
415
- for (const check of checks) {
416
- try {
417
- // Would execute command and check
418
- results.push({ ...check, status: 'passed' });
419
- } catch (error) {
420
- results.push({ ...check, status: 'failed' });
421
- }
422
- }
423
-
424
- spinner.stop();
425
-
426
- console.log(chalk.cyan('\nšŸ” Validation Results:\n'));
427
- results.forEach(r => {
428
- const icon = r.status === 'passed' ? 'āœ…' : 'āŒ';
429
- const color = r.status === 'passed' ? chalk.green : chalk.red;
430
- console.log(color(` ${icon} ${r.name}`));
431
- });
432
-
433
- if (options.fix) {
434
- await this.attemptFixes(results.filter(r => r.status === 'failed'));
435
- }
436
- }
437
-
438
- private async runDoctor(options: any): Promise<void> {
439
- console.log(chalk.cyan('\nšŸ„ Computer Setup Doctor\n'));
440
-
441
- const diagnostics = [
442
- 'Checking system requirements...',
443
- 'Verifying network connectivity...',
444
- 'Checking disk space...',
445
- 'Validating permissions...',
446
- 'Checking installed tools...',
447
- 'Verifying configurations...',
448
- ];
449
-
450
- for (const diagnostic of diagnostics) {
451
- const spinner = ora(diagnostic).start();
452
- await new Promise(resolve => setTimeout(resolve, 500));
453
- spinner.succeed();
454
- }
455
-
456
- console.log(chalk.green('\nāœ… All checks passed!'));
457
- console.log(chalk.cyan('\nšŸ’Š Recommendations:'));
458
- console.log(' 1. Keep your tools updated');
459
- console.log(' 2. Regular security updates');
460
- console.log(' 3. Backup your configurations');
461
- }
462
-
463
- private async createInteractiveProfile(): Promise<any> {
464
- console.log(chalk.cyan('\nšŸ‘¤ Create Developer Profile\n'));
465
-
466
- const answers = await inquirer.prompt([
467
- {
468
- type: 'input',
469
- name: 'name',
470
- message: 'Your name:',
471
- validate: input => input.length > 0,
472
- },
473
- {
474
- type: 'input',
475
- name: 'email',
476
- message: 'Your email:',
477
- validate: input => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(input),
478
- },
479
- {
480
- type: 'list',
481
- name: 'role',
482
- message: 'Your role:',
483
- choices: [
484
- 'Frontend Developer',
485
- 'Backend Developer',
486
- 'Full Stack Developer',
487
- 'DevOps Engineer',
488
- 'Machine Learning Engineer',
489
- 'Mobile Developer',
490
- ],
491
- },
492
- {
493
- type: 'checkbox',
494
- name: 'tools',
495
- message: 'Select tools to install:',
496
- choices: [
497
- { name: 'Node.js', checked: true },
498
- { name: 'Python' },
499
- { name: 'Docker', checked: true },
500
- { name: 'Kubernetes' },
501
- { name: 'AWS CLI' },
502
- { name: 'Claude Code', checked: true },
503
- { name: 'GitHub CLI', checked: true },
504
- ],
505
- },
506
- ]);
507
-
508
- console.log(chalk.green('\nāœ… Profile created successfully!'));
509
-
510
- // Map answers to DeveloperProfile structure
511
- const profile: DeveloperProfile = {
512
- name: 'custom',
513
- role: answers.role,
514
- languages: {
515
- javascript: answers.tools.includes('Node.js'),
516
- typescript: answers.tools.includes('TypeScript'),
517
- python: answers.tools.includes('Python'),
518
- },
519
- frameworks: {},
520
- tools: {
521
- packageManagers: {
522
- npm: answers.tools.includes('Node.js'),
523
- yarn: answers.tools.includes('Yarn'),
524
- pnpm: answers.tools.includes('pnpm'),
525
- },
526
- containers: {
527
- docker: answers.tools.includes('Docker'),
528
- dockerCompose: answers.tools.includes('Docker'),
529
- kubernetes: answers.tools.includes('Kubernetes'),
530
- },
531
- editors: {
532
- vscode: answers.tools.includes('VS Code'),
533
- vim: answers.tools.includes('Vim'),
534
- claude: answers.tools.includes('Claude Code'),
535
- },
536
- databases: {
537
- postgresql: answers.tools.includes('PostgreSQL'),
538
- mysql: answers.tools.includes('MySQL'),
539
- mongodb: answers.tools.includes('MongoDB'),
540
- redis: answers.tools.includes('Redis'),
541
- },
542
- },
543
- };
544
-
545
- return profile;
546
- }
547
-
548
- private detectPlatform(os?: string): SetupPlatform {
549
- return {
550
- os: (os || process.platform) as 'darwin' | 'linux' | 'win32',
551
- arch: process.arch as 'x64' | 'arm64',
552
- version: process.version,
553
- node: process.version,
554
- shell: process.env.SHELL,
555
- };
556
- }
557
-
558
- private async selectProfile(): Promise<string> {
559
- const profiles = this.orchestrator.getAvailableProfiles();
560
-
561
- const { selectedProfile } = await inquirer.prompt([
562
- {
563
- type: 'list',
564
- name: 'selectedProfile',
565
- message: 'Select a developer profile:',
566
- choices: profiles.map(p => ({
567
- name: `${p.name} - ${p.description}`,
568
- value: p.name.toLowerCase().replace(' ', ''),
569
- short: p.name,
570
- })),
571
- },
572
- ]);
573
-
574
- return selectedProfile;
575
- }
576
-
577
- private async resumeSetup(): Promise<void> {
578
- console.log(chalk.cyan('\nšŸ”„ Resuming setup from saved state...\n'));
579
-
580
- const progressCallback = (progress: SetupProgress) => {
581
- process.stdout.clearLine(0);
582
- process.stdout.cursorTo(0);
583
- process.stdout.write(
584
- `${chalk.cyan('[')}${progress.percentage.toFixed(1)}%${chalk.cyan(']')} ${progress.currentStep}`
585
- );
586
- };
587
-
588
- try {
589
- const result = await this.orchestrator.resume(progressCallback);
590
- console.log('\n'); // New line after progress
591
-
592
- if (result.success) {
593
- console.log(
594
- chalk.green('āœ… Setup resumed and completed successfully!')
595
- );
596
- this.displayNextSteps();
597
- } else {
598
- console.log(chalk.red('āŒ Resume failed!'));
599
- if (result.errors.length > 0) {
600
- console.log(chalk.red('Errors:'));
601
- result.errors.forEach(error => console.log(` • ${error.message}`));
602
- }
603
- process.exit(1);
604
- }
605
- } catch (error) {
606
- console.error(chalk.red('āŒ Resume failed:'), error);
607
- process.exit(1);
608
- }
609
- }
610
-
611
- private async listAvailableProfiles(): Promise<void> {
612
- console.log(chalk.cyan('\nšŸ‘¤ Available Developer Profiles:\n'));
613
-
614
- const profiles = this.orchestrator.getAvailableProfiles();
615
- profiles.forEach(profile => {
616
- console.log(chalk.white(`šŸ“‹ ${profile.name}`));
617
- console.log(chalk.gray(` ${profile.description}`));
618
- console.log(
619
- chalk.gray(` Categories: ${profile.categories.join(', ')}`)
620
- );
621
- console.log(chalk.gray(` Tools: ${profile.requiredTools.join(', ')}`));
622
- console.log(
623
- chalk.gray(` Estimated time: ${profile.estimatedTimeMinutes} minutes`)
624
- );
625
- console.log();
626
- });
627
-
628
- console.log(
629
- chalk.cyan('Usage: wundr computer-setup --profile <profile-name>')
630
- );
631
- console.log(
632
- chalk.gray('Example: wundr computer-setup --profile frontend\n')
633
- );
634
- }
635
-
636
- private generateSetupSteps(profile: any, platform: any): any[] {
637
- const steps: Array<{ name: string; required: boolean }> = [];
638
-
639
- // Platform-specific setup
640
- if (platform.os === 'darwin') {
641
- steps.push({ name: 'Install Homebrew', required: true });
642
- steps.push({ name: 'Install Xcode Command Line Tools', required: true });
643
- }
644
-
645
- // Common tools
646
- steps.push({ name: 'Configure Git', required: true });
647
- steps.push({ name: 'Generate SSH keys', required: true });
648
-
649
- // Profile-specific tools
650
- if (profile.tools?.includes('Node.js')) {
651
- steps.push({ name: 'Install Node.js via nvm', required: true });
652
- steps.push({ name: 'Install pnpm', required: true });
653
- }
654
-
655
- if (profile.tools?.includes('Docker')) {
656
- steps.push({ name: 'Install Docker Desktop', required: false });
657
- }
658
-
659
- if (profile.tools?.includes('Claude Code')) {
660
- steps.push({ name: 'Install Claude Code', required: false });
661
- steps.push({ name: 'Configure Claude Flow', required: false });
662
- }
663
-
664
- // Final steps
665
- steps.push({ name: 'Configure shell environment', required: true });
666
- steps.push({ name: 'Install VS Code extensions', required: false });
667
-
668
- return steps;
669
- }
670
-
671
- private async executeSetupStep(step: any, options: any): Promise<void> {
672
- // Simulate execution
673
- await new Promise(resolve => setTimeout(resolve, 500));
674
-
675
- if (Math.random() > 0.95 && !step.required) {
676
- throw new Error('Simulated error');
677
- }
678
- }
679
-
680
- private displayNextSteps(): void {
681
- console.log(chalk.cyan('\nšŸ“ Next Steps:\n'));
682
- const steps = [
683
- 'Restart your terminal to apply changes',
684
- 'Run "wundr computer-setup validate" to verify',
685
- 'Sign in to your team tools (Slack, GitHub, etc.)',
686
- 'Clone your team repositories',
687
- 'Review team documentation',
688
- ];
689
-
690
- steps.forEach((step, i) => {
691
- console.log(chalk.white(` ${i + 1}. ${step}`));
692
- });
693
- }
694
-
695
- private async loadProfile(name: string): Promise<any> {
696
- // Load profile from config
697
- return {
698
- name: name,
699
- role: 'fullstack',
700
- tools: ['Node.js', 'Docker', 'Claude Code'],
701
- };
702
- }
703
-
704
- private async getDefaultProfile(): Promise<any> {
705
- return {
706
- name: 'default',
707
- role: 'fullstack',
708
- tools: ['Node.js', 'Git'],
709
- };
710
- }
711
-
712
- private async listProfiles(): Promise<any[]> {
713
- return [
714
- { name: 'frontend', role: 'Frontend Developer' },
715
- { name: 'backend', role: 'Backend Developer' },
716
- { name: 'fullstack', role: 'Full Stack Developer' },
717
- ];
718
- }
719
-
720
- private async editProfile(name: string): Promise<void> {
721
- console.log(chalk.cyan(`Editing profile: ${name}`));
722
- }
723
-
724
- private async deleteProfile(name: string): Promise<void> {
725
- console.log(chalk.yellow(`Deleting profile: ${name}`));
726
- }
727
-
728
- private async exportProfiles(path: string): Promise<void> {
729
- console.log(chalk.green(`Profiles exported to: ${path}`));
730
- }
731
-
732
- private async importProfiles(path: string): Promise<void> {
733
- console.log(chalk.green(`Profiles imported from: ${path}`));
734
- }
735
-
736
- private async manageTeamConfig(team: string, options: any): Promise<void> {
737
- console.log(chalk.cyan(`Managing team configuration: ${team}`));
738
- }
739
-
740
- private async installTool(tool: string, options: any): Promise<void> {
741
- console.log(chalk.cyan(`Installing ${tool}...`));
742
- }
743
-
744
- private async attemptFixes(failures: any[]): Promise<void> {
745
- console.log(chalk.yellow('\nAttempting fixes...'));
746
- for (const failure of failures) {
747
- console.log(chalk.gray(` Fixing ${failure.name}...`));
748
- }
749
- }
750
-
751
- /**
752
- * Install Claude Code configuration
753
- */
754
- private async installClaudeConfig(options: any): Promise<void> {
755
- console.log(chalk.cyan('\nšŸ”§ Claude Code Configuration Installer\n'));
756
-
757
- try {
758
- // Initialize managers
759
- await this.backupManager.initialize();
760
- await this.claudeInstaller.initialize();
761
-
762
- // Install configurations
763
- const result = await this.claudeInstaller.install({
764
- dryRun: options.dryRun,
765
- skipBackup: options.skipBackup,
766
- overwrite: options.overwrite,
767
- verbose: options.verbose,
768
- });
769
-
770
- if (!result.success) {
771
- process.exit(1);
772
- }
773
- } catch (error) {
774
- console.error(chalk.red('āŒ Installation failed:'), error);
775
- logger.error('Claude config installation failed', error);
776
- process.exit(1);
777
- }
778
- }
779
-
780
- /**
781
- * Manage backups
782
- */
783
- private async manageBackups(options: any): Promise<void> {
784
- await this.backupManager.initialize();
785
-
786
- if (options.list) {
787
- const backups = await this.backupManager.listBackups();
788
-
789
- if (backups.length === 0) {
790
- console.log(chalk.yellow('No backups found'));
791
- return;
792
- }
793
-
794
- console.log(chalk.cyan('\nšŸ“¦ Available Backups\n'));
795
- backups.forEach(backup => {
796
- const date = new Date(backup.timestamp).toLocaleString();
797
- const status = backup.success
798
- ? chalk.green('āœ… Success')
799
- : chalk.red('āŒ Failed');
800
-
801
- console.log(chalk.white(`ID: ${backup.backupId}`));
802
- console.log(chalk.gray(` Date: ${date}`));
803
- console.log(chalk.gray(` Reason: ${backup.reason}`));
804
- console.log(chalk.gray(` Status: ${status}`));
805
- console.log(chalk.gray(` Files: ${backup.files.length}`));
806
- console.log();
807
- });
808
- } else if (options.create) {
809
- const { files } = await inquirer.prompt([
810
- {
811
- type: 'input',
812
- name: 'files',
813
- message: 'Enter file paths (comma-separated):',
814
- validate: input => input.length > 0,
815
- },
816
- ]);
817
-
818
- const fileList = files.split(',').map((f: string) => f.trim());
819
- const backup = await this.backupManager.createBackup(
820
- fileList,
821
- 'Manual backup'
822
- );
823
-
824
- this.backupManager.displayBackupInfo(backup);
825
- } else if (options.verify) {
826
- const isValid = await this.backupManager.verifyBackup(options.verify);
827
-
828
- if (isValid) {
829
- console.log(chalk.green(`āœ… Backup ${options.verify} is valid`));
830
- } else {
831
- console.log(chalk.red(`āŒ Backup ${options.verify} is invalid`));
832
- process.exit(1);
833
- }
834
- } else if (options.cleanup) {
835
- await this.backupManager.cleanupOldBackups();
836
- console.log(chalk.green('āœ… Old backups cleaned up'));
837
- } else {
838
- console.log(chalk.yellow('Please specify an option. Use --help for details.'));
839
- }
840
- }
841
-
842
- /**
843
- * Rollback configuration
844
- */
845
- private async rollbackConfiguration(options: any): Promise<void> {
846
- console.log(chalk.cyan('\nšŸ”„ Configuration Rollback\n'));
847
-
848
- await this.backupManager.initialize();
849
-
850
- const success = await this.backupManager.rollback({
851
- backupId: options.backup,
852
- dryRun: options.dryRun,
853
- verbose: options.verbose,
854
- });
855
-
856
- if (!success) {
857
- console.log(chalk.red('\nāŒ Rollback failed'));
858
- process.exit(1);
859
- }
860
-
861
- if (!options.dryRun) {
862
- console.log(chalk.green('\nāœ… Rollback completed successfully'));
863
- console.log(chalk.cyan('\nNext steps:'));
864
- console.log(chalk.white(' 1. Verify restored configurations'));
865
- console.log(chalk.white(' 2. Restart terminal if needed'));
866
- console.log(chalk.white(' 3. Run validation script'));
867
- }
868
- }
869
- }