-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathsetup.js
More file actions
executable file
·804 lines (706 loc) · 25.3 KB
/
setup.js
File metadata and controls
executable file
·804 lines (706 loc) · 25.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
#!/usr/bin/env node
const inquirer = require('inquirer');
const chalk = require('chalk');
const fs = require('fs-extra');
const path = require('path');
const ClaudeAuthHandler = require('./src/setup/claude-auth');
const ConfigGenerator = require('./src/setup/config-generator');
const DockerHelper = require('./src/setup/docker-helper');
class SetupWizard {
constructor() {
this.claudeAuth = new ClaudeAuthHandler();
this.configGenerator = new ConfigGenerator();
this.dockerHelper = new DockerHelper();
this.config = {};
}
/**
* Display welcome banner
*/
showWelcome() {
console.log(
chalk.cyan(`
╔══════════════════════════════════════════════════════════════╗
║ ║
║ 🚀 PR Automation Setup Wizard 🚀 ║
║ ║
║ This wizard will guide you through setting up the ║
║ Bitbucket PR automation service with Claude CLI ║
║ ║
╚══════════════════════════════════════════════════════════════╝
`),
);
}
/**
* Check prerequisites
*/
async checkPrerequisites() {
console.log(chalk.blue('\n🔍 Checking prerequisites...'));
// Check Node.js version
const nodeVersion = process.version;
console.log(chalk.green(`✓ Node.js version: ${nodeVersion}`));
// Check if we're in the right directory
const packageJsonPath = path.join(process.cwd(), 'package.json');
if (!(await fs.pathExists(packageJsonPath))) {
console.error(chalk.red('✗ package.json not found. Please run this from the project root.'));
process.exit(1);
}
console.log(chalk.green('✓ Project directory validated'));
// Check Claude CLI installation
const claudeInstalled = await this.claudeAuth.checkClaudeInstallation();
if (!claudeInstalled) {
console.log(chalk.yellow('⚠ Claude CLI not found. You can install it with:'));
console.log(chalk.gray(' npm install -g @anthropic-ai/claude-code'));
const { continueWithoutClaude } = await inquirer.prompt([
{
type: 'confirm',
name: 'continueWithoutClaude',
message: 'Continue without Claude CLI installed?',
default: false,
},
]);
if (!continueWithoutClaude) {
console.log(chalk.blue('Please install Claude CLI and run the setup again.'));
process.exit(0);
}
} else {
console.log(chalk.green('✓ Claude CLI is installed'));
}
// Check Docker installation
const dockerOk = await this.dockerHelper.checkDockerInstallation();
if (!dockerOk) {
console.log(chalk.yellow('⚠ Docker is not properly installed or running.'));
console.log(chalk.gray(' Please install Docker and ensure the daemon is running.'));
const { continueWithoutDocker } = await inquirer.prompt([
{
type: 'confirm',
name: 'continueWithoutDocker',
message: 'Continue setup without Docker? (You can run it manually later)',
default: false,
},
]);
if (!continueWithoutDocker) {
console.log(chalk.blue('Please install Docker and run the setup again.'));
process.exit(0);
}
}
console.log(chalk.green('✓ Prerequisites check completed\n'));
}
/**
* Setup Claude authentication
*/
async setupClaudeAuth() {
console.log(chalk.blue('🤖 Setting up Claude authentication...'));
const existingConfig = await this.claudeAuth.checkExistingClaudeConfig();
if (existingConfig.hasConfig || existingConfig.hasDir) {
console.log(chalk.yellow(`\n📁 Found existing Claude configuration:`));
if (existingConfig.hasConfig) {
console.log(chalk.gray(` • Config: ${existingConfig.configPath}`));
}
if (existingConfig.hasDir) {
console.log(chalk.gray(` • Session data: ${existingConfig.dirPath}`));
}
const { useExisting } = await inquirer.prompt([
{
type: 'list',
name: 'useExisting',
message: 'How would you like to proceed?',
choices: [
{
name: '🔄 Use existing Claude configuration (recommended)',
value: 'use_existing',
},
{
name: '🔑 Set up new API key authentication',
value: 'new_api',
},
{
name: '🤖 Set up GLM model (via Z.ai)',
value: 'new_glm',
},
{
name: '🆕 Start fresh (remove existing config)',
value: 'fresh_start',
},
],
default: 'use_existing',
},
]);
if (useExisting === 'use_existing') {
this.config.authMethod = 'session';
this.config.claudeProvider = 'claude';
const success = await this.claudeAuth.copyExistingClaudeConfig();
if (!success) {
throw new Error('Failed to copy existing Claude configuration');
}
// Ask for model selection even when using existing config
const availableModels = this.claudeAuth.getAvailableModels().claude;
const { model } = await inquirer.prompt([
{
type: 'list',
name: 'model',
message: 'Choose Claude model:',
choices: availableModels,
default: 'sonnet',
},
]);
this.config.claudeModel = model;
return;
} else if (useExisting === 'new_api') {
// Set up for API key authentication
this.config.authMethod = 'api';
this.config.claudeProvider = 'claude';
await this.setupAPIKeyAuth();
return;
} else if (useExisting === 'new_glm') {
// Set up for GLM authentication
this.config.authMethod = 'glm';
this.config.claudeProvider = 'glm';
await this.setupGLMAuth();
return;
} else if (useExisting === 'fresh_start') {
// Remove existing config and start fresh
console.log(chalk.yellow('🗑️ Removing existing Claude configuration...'));
const fs = require('fs-extra');
const claudeConfigDir = path.join(process.cwd(), 'claude-config');
if (await fs.pathExists(claudeConfigDir)) {
await fs.remove(claudeConfigDir);
console.log(chalk.green('✓ Removed existing Claude configuration'));
}
// Continue to normal authentication method selection
}
}
const { method } = await inquirer.prompt([
{
type: 'list',
name: 'method',
message: 'Choose Claude authentication method:',
choices: [
{
name: '🔄 Session-based (use existing Claude login)',
value: 'session',
},
{
name: '🔑 API Key (use Anthropic API)',
value: 'api',
},
{
name: '🤖 GLM Model (via Z.ai)',
value: 'glm',
},
],
},
]);
this.config.authMethod = method;
this.config.claudeProvider = method === 'glm' ? 'glm' : 'claude';
// Show instructions
this.claudeAuth.showAuthInstructions(method);
if (method === 'session') {
const success = await this.claudeAuth.copyExistingClaudeConfig();
if (!success) {
throw new Error('Failed to copy Claude configuration');
}
// Ask for model selection even with session-based auth
const availableModels = this.claudeAuth.getAvailableModels().claude;
const { model } = await inquirer.prompt([
{
type: 'list',
name: 'model',
message: 'Choose Claude model:',
choices: availableModels,
default: 'sonnet',
},
]);
this.config.claudeModel = model;
} else if (method === 'api') {
const { apiKey } = await inquirer.prompt([
{
type: 'password',
name: 'apiKey',
message: 'Enter your Anthropic API key:',
validate: input => input.trim().length > 0 || 'API key is required',
},
]);
const availableModels = this.claudeAuth.getAvailableModels().claude;
const { model } = await inquirer.prompt([
{
type: 'list',
name: 'model',
message: 'Choose Claude model:',
choices: availableModels,
default: 'sonnet',
},
]);
const success = await this.claudeAuth.generateClaudeConfigFromAPI(apiKey, model);
if (!success) {
throw new Error('Failed to generate Claude configuration');
}
this.config.claudeModel = model;
} else if (method === 'glm') {
const { apiKey } = await inquirer.prompt([
{
type: 'password',
name: 'apiKey',
message: 'Enter your GLM API key:',
validate: input => input.trim().length > 0 || 'API key is required',
},
]);
const availableModels = this.claudeAuth.getAvailableModels().glm;
const { model } = await inquirer.prompt([
{
type: 'list',
name: 'model',
message: 'Choose GLM model:',
choices: availableModels,
default: 'glm-4.6',
},
]);
const success = await this.claudeAuth.generateGLMConfig(apiKey, model);
if (!success) {
throw new Error('Failed to generate GLM configuration');
}
this.config.claudeModel = model;
}
}
/**
* Setup API Key authentication
*/
async setupAPIKeyAuth() {
this.claudeAuth.showAuthInstructions('api');
const { apiKey } = await inquirer.prompt([
{
type: 'password',
name: 'apiKey',
message: 'Enter your Anthropic API key:',
validate: input => input.trim().length > 0 || 'API key is required',
},
]);
const availableModels = this.claudeAuth.getAvailableModels().claude;
const { model } = await inquirer.prompt([
{
type: 'list',
name: 'model',
message: 'Choose Claude model:',
choices: availableModels,
default: 'sonnet',
},
]);
const success = await this.claudeAuth.generateClaudeConfigFromAPI(apiKey, model);
if (!success) {
throw new Error('Failed to generate Claude configuration');
}
this.config.claudeModel = model;
}
/**
* Setup GLM authentication
*/
async setupGLMAuth() {
this.claudeAuth.showAuthInstructions('glm');
const { apiKey } = await inquirer.prompt([
{
type: 'password',
name: 'apiKey',
message: 'Enter your GLM API key:',
validate: input => input.trim().length > 0 || 'API key is required',
},
]);
const availableModels = this.claudeAuth.getAvailableModels().glm;
const { model } = await inquirer.prompt([
{
type: 'list',
name: 'model',
message: 'Choose GLM model:',
choices: availableModels,
default: 'glm-4.6',
},
]);
const success = await this.claudeAuth.generateGLMConfig(apiKey, model);
if (!success) {
throw new Error('Failed to generate GLM configuration');
}
this.config.claudeModel = model;
}
/**
* Setup Bitbucket configuration
*/
async setupBitbucketConfig() {
console.log(chalk.blue('\n🔧 Setting up Bitbucket configuration...'));
console.log(
chalk.cyan(`
To create a Bitbucket App Password:
1. Go to Bitbucket → Personal Settings → App passwords
2. Click "Create app password"
3. Name: "PR Automation"
4. Permissions: Select "Repositories: Read" and "Pull requests: Read"
5. Copy the generated password
`),
);
const { user, email, token } = await inquirer.prompt([
{
type: 'input',
name: 'user',
message: 'Enter your Bitbucket username:',
validate: input => input.trim().length > 0 || 'Username is required',
},
{
type: 'input',
name: 'email',
message: 'Enter your Bitbucket user email:',
validate: input => {
const trimmed = input.trim();
if (trimmed.length === 0) return 'Email is required';
// Basic email validation
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(trimmed)) return 'Please enter a valid email address';
return true;
},
},
{
type: 'password',
name: 'token',
message: 'Enter your Bitbucket App Password:',
validate: input => input.trim().length > 0 || 'App Password is required',
},
]);
this.config.bitbucketUser = user.trim();
this.config.bitbucketUserEmail = email.trim();
this.config.bitbucketToken = token;
const { workspace } = await inquirer.prompt([
{
type: 'input',
name: 'workspace',
message: 'Enter your Bitbucket workspace name:',
default: 'yourworkspace',
validate: input => input.trim().length > 0 || 'Workspace is required',
},
]);
this.config.workspace = workspace.trim();
}
/**
* Setup server and webhook configuration
*/
async setupServerConfig() {
console.log(chalk.blue('\n⚙️ Setting up server configuration...'));
const { port } = await inquirer.prompt([
{
type: 'number',
name: 'port',
message: 'Enter server port:',
default: 3000,
validate: input => (input >= 1 && input <= 65535) || 'Port must be between 1 and 65535',
},
]);
this.config.port = port;
const { processOnlyCreated } = await inquirer.prompt([
{
type: 'confirm',
name: 'processOnlyCreated',
message: 'Only process PR creation events (ignore updates)?',
default: false,
},
]);
this.config.processOnlyCreated = processOnlyCreated;
const { nonAllowedUsers } = await inquirer.prompt([
{
type: 'input',
name: 'nonAllowedUsers',
message:
'Skip reviews for specific users? (Comma-separated display names, leave empty to review all)',
default: '',
},
]);
this.config.nonAllowedUsers = nonAllowedUsers.trim();
const { useWebhookSecret } = await inquirer.prompt([
{
type: 'confirm',
name: 'useWebhookSecret',
message: 'Use webhook signature validation (recommended for security)?',
default: true,
},
]);
if (useWebhookSecret) {
const { generateSecret } = await inquirer.prompt([
{
type: 'confirm',
name: 'generateSecret',
message: 'Generate a random webhook secret?',
default: true,
},
]);
if (generateSecret) {
this.config.webhookSecret = this.claudeAuth.generateWebhookSecret();
console.log(chalk.green(`✓ Generated webhook secret: ${this.config.webhookSecret}`));
} else {
const { secret } = await inquirer.prompt([
{
type: 'password',
name: 'secret',
message: 'Enter webhook secret:',
validate: input => input.trim().length > 0 || 'Webhook secret is required',
},
]);
this.config.webhookSecret = secret;
}
} else {
this.config.webhookSecret = '';
}
// Prompt logs: persist prompts sent to Claude (for debugging/audit)
const { promptLogsEnabled } = await inquirer.prompt([
{
type: 'confirm',
name: 'promptLogsEnabled',
message: 'Enable prompt logs (persist prompts sent to Claude for debugging)?',
default: false,
},
]);
this.config.promptLogsEnabled = promptLogsEnabled;
}
/**
* Review and confirm configuration
*/
async reviewConfiguration() {
console.log(chalk.blue('\n📋 Configuration Review'));
this.configGenerator.showConfigurationPreview(this.config);
const validation = this.configGenerator.validateConfiguration(this.config);
if (!validation.isValid) {
console.error(chalk.red('\n❌ Configuration validation failed:'));
validation.errors.forEach(error => console.error(chalk.red(` • ${error}`)));
throw new Error('Configuration validation failed');
}
const { confirm } = await inquirer.prompt([
{
type: 'confirm',
name: 'confirm',
message: 'Does this configuration look correct?',
default: true,
},
]);
if (!confirm) {
throw new Error('Configuration cancelled by user');
}
}
/**
* Generate configuration files
*/
async generateConfigFiles() {
console.log(chalk.blue('\n📝 Generating configuration files...'));
// Backup existing .env if it exists
await this.configGenerator.backupExistingEnv();
// Create necessary directories
await this.configGenerator.createDirectories();
// Generate .env file
const envSuccess = await this.configGenerator.generateEnvFile(this.config);
if (!envSuccess) {
throw new Error('Failed to generate .env file');
}
// Generate MCP server configuration in .claude.json
const mcpSuccess = await this.configGenerator.generateMcpConfig(this.config);
if (!mcpSuccess) {
console.log(chalk.yellow('⚠ Warning: Failed to update .claude.json with MCP servers'));
}
const configOverrides = {
promptLogs: { enabled: this.config.promptLogsEnabled },
};
if (this.config.claudeModel) {
configOverrides.claude = { model: this.config.claudeModel };
}
await this.configGenerator.createOrMigrateConfigJson(configOverrides);
console.log(chalk.green('✓ Configuration files generated'));
}
/**
* Setup and start Docker services
*/
async setupDocker() {
console.log(chalk.blue('\n🐳 Setting up Docker services...'));
// Create docker-compose.yml if needed
await this.dockerHelper.createDockerComposeFile();
const { buildAndStart } = await inquirer.prompt([
{
type: 'confirm',
name: 'buildAndStart',
message: 'Build and start Docker services now?',
default: true,
},
]);
if (buildAndStart) {
// Build Docker image
const buildSuccess = await this.dockerHelper.buildDockerImage();
if (!buildSuccess) {
// Handle build failure with alternatives
const failureResult = await this.dockerHelper.handleBuildFailure();
if (!failureResult.success) {
console.log(
chalk.yellow('⚠ Docker setup skipped. You can configure it manually later.'),
);
this.dockerHelper.showDockerCommands();
return;
}
if (failureResult.action === 'rebuild') {
// Rebuild was successful, continue with starting services
const startSuccess = await this.dockerHelper.startServices();
if (!startSuccess) {
console.log(
chalk.yellow(
'⚠ Failed to start Docker services. You can start them manually later.',
),
);
this.dockerHelper.showDockerCommands();
return;
}
// Check service health
await this.dockerHelper.checkServiceHealth();
await this.dockerHelper.showServiceStatus();
} else if (failureResult.action === 'local') {
// Local development setup, skip Docker
console.log(chalk.green('✓ Local development setup configured'));
return;
}
// If action was 'skip', just continue without Docker
} else {
// Build was successful, continue with starting services
const startSuccess = await this.dockerHelper.startServices();
if (!startSuccess) {
console.log(
chalk.yellow('⚠ Failed to start Docker services. You can start them manually later.'),
);
this.dockerHelper.showDockerCommands();
return;
}
// Check service health
await this.dockerHelper.checkServiceHealth();
await this.dockerHelper.showServiceStatus();
}
}
this.dockerHelper.showDockerCommands();
}
/**
* Show completion message
*/
showCompletion() {
console.log(
chalk.green(`
╔══════════════════════════════════════════════════════════════╗
║ ║
║ 🎉 Setup Completed Successfully! 🎉 ║
║ ║
╚══════════════════════════════════════════════════════════════╝
`),
);
console.log(chalk.cyan('Next Steps:'));
console.log(chalk.gray('1. Configure your Bitbucket webhook:'));
console.log(chalk.gray(` URL: http://your-server:${this.config.port}/webhook/bitbucket/pr`));
if (this.config.webhookSecret) {
console.log(chalk.gray(` Secret: ${this.config.webhookSecret}`));
}
console.log(chalk.gray('2. Test the service:'));
console.log(chalk.gray(` curl http://localhost:${this.config.port}/health`));
console.log(chalk.gray('3. Check logs:'));
console.log(chalk.gray(' docker-compose logs -f'));
console.log(chalk.cyan('\n📚 Documentation:'));
console.log(chalk.gray('• README.md - Complete usage guide'));
console.log(chalk.gray('• WEBHOOK_SECURITY.md - Security configuration'));
console.log(chalk.gray('• PROMETHEUS.md - Monitoring setup'));
console.log(chalk.green('\n✨ Your PR automation service is ready to use!'));
}
/**
* Validate we can recreate configuration; if not, warn and exit (do not enter setup).
*/
async validateRecreateConfiguration() {
const result = await this.configGenerator.validateCanRecreateConfiguration();
if (!result.canProceed) {
console.error(chalk.red('\n❌ Cannot proceed with setup configuration:\n'));
result.errors.forEach(err => console.error(chalk.red(` • ${err}`)));
if (result.warnings.length) {
result.warnings.forEach(w => console.log(chalk.yellow(` ⚠ ${w}`)));
}
console.log(
chalk.yellow(
'\n⚠ Fix the issues above and run the setup again. Do not continue into the setup wizard until these are resolved.\n',
),
);
process.exit(1);
}
}
/**
* If config.json or docker-compose exist, ask user to backup and clear before continuing.
*/
async confirmClearExistingConfigIfAny() {
const existing = await this.configGenerator.checkExistingConfigAndDocker();
if (!existing.hasConfigJson && !existing.hasDockerCompose) {
return;
}
const files = [];
if (existing.hasConfigJson) files.push('src/config/config.json');
if (existing.hasDockerCompose) files.push('docker-compose.yml');
console.log(chalk.yellow(`\n📁 Existing configuration file(s) found: ${files.join(', ')}`));
console.log(
chalk.gray(
'Re-running setup will overwrite these. You can backup and clear them now, or exit and keep them.\n',
),
);
const { clearExisting } = await inquirer.prompt([
{
type: 'confirm',
name: 'clearExisting',
message:
'Do you want to backup and clear these files so setup can recreate them? (Backups will be created in the same directory.)',
default: false,
},
]);
if (!clearExisting) {
console.log(
chalk.yellow(
'\n⚠ Setup cancelled. Resolve or backup existing config/docker-compose manually, then run setup again.\n',
),
);
process.exit(0);
}
if (existing.hasConfigJson) {
const ok = await this.configGenerator.backupAndRemoveConfigJson();
if (!ok) {
console.error(chalk.red('Cannot continue: failed to backup/remove config.json.'));
process.exit(1);
}
}
if (existing.hasDockerCompose) {
const ok = await this.configGenerator.backupAndRemoveDockerCompose();
if (!ok) {
console.error(chalk.red('Cannot continue: failed to backup/remove docker-compose.yml.'));
process.exit(1);
}
}
}
/**
* Main setup flow
*/
async run() {
try {
this.showWelcome();
await this.validateRecreateConfiguration();
await this.checkPrerequisites();
await this.confirmClearExistingConfigIfAny();
await this.setupClaudeAuth();
await this.setupBitbucketConfig();
await this.setupServerConfig();
await this.reviewConfiguration();
await this.generateConfigFiles();
await this.setupDocker();
this.showCompletion();
} catch (error) {
console.error(chalk.red('\n❌ Setup failed:'), error.message);
if (error.message.includes('Docker')) {
this.dockerHelper.handleDockerIssues(error);
}
console.log(chalk.yellow('\n💡 You can re-run the setup at any time with: npm run setup'));
process.exit(1);
}
}
}
// Run the setup wizard
if (require.main === module) {
const wizard = new SetupWizard();
wizard.run().catch(error => {
console.error(chalk.red('Unexpected error:'), error);
process.exit(1);
});
}
module.exports = SetupWizard;