baseguard 1.0.3 ā 1.0.5
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.
- package/.baseguardrc.example.json +63 -63
- package/.eslintrc.json +24 -24
- package/.prettierrc +7 -7
- package/CHANGELOG.md +195 -195
- package/DEPLOYMENT.md +624 -624
- package/DEPLOYMENT_CHECKLIST.md +239 -239
- package/DEPLOYMENT_SUMMARY_v1.0.2.md +202 -202
- package/QUICK_START.md +134 -134
- package/README.md +488 -488
- package/RELEASE_NOTES_v1.0.2.md +434 -434
- package/bin/base.js +627 -627
- package/dist/ai/fix-manager.d.ts.map +1 -1
- package/dist/ai/fix-manager.js +1 -1
- package/dist/ai/fix-manager.js.map +1 -1
- package/dist/ai/gemini-analyzer.d.ts.map +1 -1
- package/dist/ai/gemini-analyzer.js +29 -35
- package/dist/ai/gemini-analyzer.js.map +1 -1
- package/dist/ai/gemini-code-fixer.d.ts.map +1 -1
- package/dist/ai/gemini-code-fixer.js +58 -58
- package/dist/ai/gemini-code-fixer.js.map +1 -1
- package/dist/ai/jules-implementer.d.ts +3 -0
- package/dist/ai/jules-implementer.d.ts.map +1 -1
- package/dist/ai/jules-implementer.js +63 -32
- package/dist/ai/jules-implementer.js.map +1 -1
- package/dist/ai/unified-code-fixer.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +1 -1
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/config.js +2 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/fix.d.ts.map +1 -1
- package/dist/commands/fix.js +48 -15
- package/dist/commands/fix.js.map +1 -1
- package/dist/core/api-key-manager.js +2 -2
- package/dist/core/api-key-manager.js.map +1 -1
- package/dist/core/baseguard.d.ts +1 -0
- package/dist/core/baseguard.d.ts.map +1 -1
- package/dist/core/baseguard.js +13 -10
- package/dist/core/baseguard.js.map +1 -1
- package/dist/core/baseline-checker.d.ts.map +1 -1
- package/dist/core/baseline-checker.js +8 -5
- package/dist/core/baseline-checker.js.map +1 -1
- package/dist/core/configuration-recovery.d.ts.map +1 -1
- package/dist/core/configuration-recovery.js +1 -1
- package/dist/core/configuration-recovery.js.map +1 -1
- package/dist/core/debug-logger.d.ts.map +1 -1
- package/dist/core/debug-logger.js +1 -1
- package/dist/core/debug-logger.js.map +1 -1
- package/dist/core/error-handler.d.ts.map +1 -1
- package/dist/core/error-handler.js +2 -1
- package/dist/core/error-handler.js.map +1 -1
- package/dist/core/gitignore-manager.js +5 -5
- package/dist/core/graceful-degradation-manager.d.ts.map +1 -1
- package/dist/core/graceful-degradation-manager.js +16 -16
- package/dist/core/graceful-degradation-manager.js.map +1 -1
- package/dist/core/lazy-loader.d.ts.map +1 -1
- package/dist/core/lazy-loader.js +9 -2
- package/dist/core/lazy-loader.js.map +1 -1
- package/dist/core/memory-manager.d.ts +0 -3
- package/dist/core/memory-manager.d.ts.map +1 -1
- package/dist/core/memory-manager.js.map +1 -1
- package/dist/core/parser-worker.d.ts +2 -0
- package/dist/core/parser-worker.d.ts.map +1 -0
- package/dist/core/parser-worker.js +19 -0
- package/dist/core/parser-worker.js.map +1 -0
- package/dist/core/startup-optimizer.d.ts.map +1 -1
- package/dist/core/startup-optimizer.js +4 -8
- package/dist/core/startup-optimizer.js.map +1 -1
- package/dist/core/system-error-handler.d.ts.map +1 -1
- package/dist/core/system-error-handler.js.map +1 -1
- package/dist/git/automation-engine.d.ts.map +1 -1
- package/dist/git/automation-engine.js +5 -4
- package/dist/git/automation-engine.js.map +1 -1
- package/dist/git/github-manager.d.ts.map +1 -1
- package/dist/git/github-manager.js.map +1 -1
- package/dist/git/hook-manager.js +5 -5
- package/dist/git/hook-manager.js.map +1 -1
- package/dist/parsers/parser-manager.d.ts.map +1 -1
- package/dist/parsers/parser-manager.js +1 -1
- package/dist/parsers/parser-manager.js.map +1 -1
- package/dist/parsers/svelte-parser.js +1 -1
- package/dist/parsers/svelte-parser.js.map +1 -1
- package/dist/parsers/vanilla-parser.d.ts.map +1 -1
- package/dist/parsers/vanilla-parser.js.map +1 -1
- package/dist/parsers/vue-parser.d.ts.map +1 -1
- package/dist/parsers/vue-parser.js.map +1 -1
- package/dist/ui/components.d.ts +1 -1
- package/dist/ui/components.d.ts.map +1 -1
- package/dist/ui/components.js +11 -11
- package/dist/ui/components.js.map +1 -1
- package/dist/ui/terminal-header.js +14 -14
- package/package.json +105 -105
- package/src/ai/__tests__/gemini-analyzer.test.ts +180 -180
- package/src/ai/agentkit-orchestrator.ts +533 -533
- package/src/ai/fix-manager.ts +362 -362
- package/src/ai/gemini-analyzer.ts +665 -671
- package/src/ai/gemini-code-fixer.ts +539 -540
- package/src/ai/index.ts +3 -3
- package/src/ai/jules-implementer.ts +504 -460
- package/src/ai/unified-code-fixer.ts +347 -347
- package/src/commands/automation.ts +343 -343
- package/src/commands/check.ts +298 -299
- package/src/commands/config.ts +584 -583
- package/src/commands/fix.ts +269 -238
- package/src/commands/index.ts +6 -6
- package/src/commands/init.ts +155 -155
- package/src/commands/status.ts +306 -306
- package/src/core/api-key-manager.ts +298 -298
- package/src/core/baseguard.ts +757 -756
- package/src/core/baseline-checker.ts +566 -563
- package/src/core/cache-manager.ts +271 -271
- package/src/core/configuration-recovery.ts +672 -673
- package/src/core/configuration.ts +595 -595
- package/src/core/debug-logger.ts +590 -590
- package/src/core/directory-filter.ts +420 -420
- package/src/core/error-handler.ts +518 -517
- package/src/core/file-processor.ts +337 -337
- package/src/core/gitignore-manager.ts +168 -168
- package/src/core/graceful-degradation-manager.ts +596 -596
- package/src/core/index.ts +16 -16
- package/src/core/lazy-loader.ts +317 -307
- package/src/core/memory-manager.ts +290 -295
- package/src/core/parser-worker.ts +33 -0
- package/src/core/startup-optimizer.ts +246 -255
- package/src/core/system-error-handler.ts +755 -756
- package/src/git/automation-engine.ts +361 -361
- package/src/git/github-manager.ts +190 -192
- package/src/git/hook-manager.ts +210 -210
- package/src/git/index.ts +3 -3
- package/src/index.ts +7 -7
- package/src/parsers/feature-validator.ts +558 -558
- package/src/parsers/index.ts +7 -7
- package/src/parsers/parser-manager.ts +418 -419
- package/src/parsers/parser.ts +25 -25
- package/src/parsers/react-parser-optimized.ts +160 -160
- package/src/parsers/react-parser.ts +358 -358
- package/src/parsers/svelte-parser.ts +510 -510
- package/src/parsers/vanilla-parser.ts +685 -686
- package/src/parsers/vue-parser.ts +476 -478
- package/src/types/index.ts +95 -95
- package/src/ui/components.ts +567 -567
- package/src/ui/help.ts +192 -192
- package/src/ui/index.ts +3 -3
- package/src/ui/prompts.ts +680 -680
- package/src/ui/terminal-header.ts +58 -58
- package/test-build.js +40 -40
- package/test-config-commands.js +55 -55
- package/test-header-simple.js +32 -32
- package/test-terminal-header.js +11 -11
- package/test-ui.js +28 -28
- package/tests/e2e/baseguard.e2e.test.ts +515 -515
- package/tests/e2e/cross-platform.e2e.test.ts +419 -419
- package/tests/e2e/git-integration.e2e.test.ts +486 -486
- package/tests/fixtures/react-project/package.json +13 -13
- package/tests/fixtures/react-project/src/App.css +75 -75
- package/tests/fixtures/react-project/src/App.tsx +76 -76
- package/tests/fixtures/svelte-project/package.json +10 -10
- package/tests/fixtures/svelte-project/src/App.svelte +368 -368
- package/tests/fixtures/vanilla-project/index.html +75 -75
- package/tests/fixtures/vanilla-project/script.js +330 -330
- package/tests/fixtures/vanilla-project/styles.css +358 -358
- package/tests/fixtures/vue-project/package.json +11 -11
- package/tests/fixtures/vue-project/src/App.vue +215 -215
- package/tmp-smoke/.baseguard/backups/config-2026-02-19T12-04-11-067Z-auto.json +30 -0
- package/tmp-smoke/src/bad.css +3 -0
- package/tsconfig.json +34 -34
- package/vitest.config.ts +11 -11
- package/dist/terminal-header.d.ts +0 -12
- package/dist/terminal-header.js +0 -45
package/src/commands/init.ts
CHANGED
|
@@ -1,156 +1,156 @@
|
|
|
1
|
-
import { UIComponents, Prompts } from '../ui/index.js';
|
|
2
|
-
import { ConfigurationManager, BROWSER_TARGET_PRESETS, type PresetName } from '../core/index.js';
|
|
3
|
-
import { ErrorHandler } from '../core/error-handler.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Initialize BaseGuard in a project
|
|
7
|
-
*/
|
|
8
|
-
export async function init(options: {
|
|
9
|
-
preset?: string;
|
|
10
|
-
skipHooks?: boolean;
|
|
11
|
-
skipApiKeys?: boolean;
|
|
12
|
-
}): Promise<void> {
|
|
13
|
-
try {
|
|
14
|
-
UIComponents.showHeader();
|
|
15
|
-
|
|
16
|
-
// Check if already initialized
|
|
17
|
-
const configExists = await ConfigurationManager.exists();
|
|
18
|
-
if (configExists) {
|
|
19
|
-
const { default: inquirer } = await import('inquirer');
|
|
20
|
-
const { overwrite } = await inquirer.prompt([
|
|
21
|
-
{
|
|
22
|
-
type: 'confirm',
|
|
23
|
-
name: 'overwrite',
|
|
24
|
-
message: 'BaseGuard is already initialized. Overwrite existing configuration?',
|
|
25
|
-
default: false
|
|
26
|
-
}
|
|
27
|
-
]);
|
|
28
|
-
|
|
29
|
-
if (!overwrite) {
|
|
30
|
-
UIComponents.showInfoBox('Initialization cancelled. Use "base config" to modify settings.');
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const spinner = UIComponents.createSpinner('Setting up BaseGuard configuration...');
|
|
36
|
-
spinner.start();
|
|
37
|
-
|
|
38
|
-
// Create configuration based on options or run setup wizard
|
|
39
|
-
let config;
|
|
40
|
-
|
|
41
|
-
if (options.preset && options.preset !== 'custom') {
|
|
42
|
-
// Use preset configuration
|
|
43
|
-
const presetName = options.preset as PresetName;
|
|
44
|
-
if (BROWSER_TARGET_PRESETS[presetName]) {
|
|
45
|
-
config = ConfigurationManager.createWithPreset(presetName);
|
|
46
|
-
spinner.text = `Using ${presetName} preset...`;
|
|
47
|
-
} else {
|
|
48
|
-
spinner.fail(`Invalid preset: ${options.preset}`);
|
|
49
|
-
UIComponents.showErrorBox(`Available presets: ${Object.keys(BROWSER_TARGET_PRESETS).join(', ')}`);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
} else {
|
|
53
|
-
// Run interactive setup wizard
|
|
54
|
-
spinner.stop();
|
|
55
|
-
const setupResult = await Prompts.setupWizard();
|
|
56
|
-
spinner.start();
|
|
57
|
-
|
|
58
|
-
config = ConfigurationManager.createWithCustomTargets(setupResult.targets);
|
|
59
|
-
|
|
60
|
-
// Set up automation if requested and not skipped
|
|
61
|
-
if (setupResult.installHooks && !options.skipHooks) {
|
|
62
|
-
config.automation = {
|
|
63
|
-
enabled: true,
|
|
64
|
-
trigger: setupResult.hookTrigger,
|
|
65
|
-
autoAnalyze: true,
|
|
66
|
-
autoFix: false,
|
|
67
|
-
blockCommit: true
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
// Set up API keys and coding agent if not skipped
|
|
73
|
-
if (!options.skipApiKeys) {
|
|
74
|
-
spinner.stop();
|
|
75
|
-
const apiKeys = await Prompts.setupApiKeys();
|
|
76
|
-
|
|
77
|
-
if (apiKeys.julesApiKey) {
|
|
78
|
-
config.apiKeys.jules = apiKeys.julesApiKey;
|
|
79
|
-
}
|
|
80
|
-
if (apiKeys.geminiApiKey) {
|
|
81
|
-
config.apiKeys.gemini = apiKeys.geminiApiKey;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Configure coding agent based on available keys
|
|
85
|
-
if (apiKeys.julesApiKey && apiKeys.geminiApiKey) {
|
|
86
|
-
const codingAgentChoice = await Prompts.chooseCodingAgent();
|
|
87
|
-
config.codingAgent.primary = codingAgentChoice.primary;
|
|
88
|
-
config.codingAgent.fallback = codingAgentChoice.fallback;
|
|
89
|
-
} else if (apiKeys.julesApiKey) {
|
|
90
|
-
config.codingAgent.primary = 'jules';
|
|
91
|
-
config.codingAgent.fallback = 'jules';
|
|
92
|
-
} else if (apiKeys.geminiApiKey) {
|
|
93
|
-
config.codingAgent.primary = 'gemini';
|
|
94
|
-
config.codingAgent.fallback = 'gemini';
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
spinner.start();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
await ConfigurationManager.save(config);
|
|
101
|
-
spinner.succeed('BaseGuard configuration created');
|
|
102
|
-
|
|
103
|
-
UIComponents.showSuccessBox('BaseGuard has been successfully initialized!');
|
|
104
|
-
|
|
105
|
-
// Show configuration summary
|
|
106
|
-
console.log('\nš Configuration Summary:');
|
|
107
|
-
UIComponents.showList([
|
|
108
|
-
`Browser targets: ${config.targets.map(t => `${t.browser} ${t.minVersion}`).join(', ')}`,
|
|
109
|
-
`API keys: ${config.apiKeys.jules ? 'ā
' : 'ā'} Jules, ${config.apiKeys.gemini ? 'ā
' : 'ā'} Gemini`,
|
|
110
|
-
`Automation: ${config.automation.enabled ? 'ā
Enabled' : 'ā Disabled'}`
|
|
111
|
-
]);
|
|
112
|
-
|
|
113
|
-
console.log('\nš Next steps:');
|
|
114
|
-
const nextSteps = ['Run `base check` to scan for compatibility issues'];
|
|
115
|
-
|
|
116
|
-
if (config.apiKeys.jules && config.apiKeys.gemini) {
|
|
117
|
-
nextSteps.push('Run `base fix` to automatically fix issues with AI');
|
|
118
|
-
} else {
|
|
119
|
-
nextSteps.push('Run `base config set-keys` to configure AI services');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (!config.automation.enabled) {
|
|
123
|
-
nextSteps.push('Run `base automation enable` to set up git hooks');
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
UIComponents.showList(nextSteps);
|
|
127
|
-
|
|
128
|
-
} catch (error) {
|
|
129
|
-
const apiError = ErrorHandler.handleAPIError(error);
|
|
130
|
-
ErrorHandler.displayError(apiError);
|
|
131
|
-
|
|
132
|
-
// Provide specific help for common init issues
|
|
133
|
-
console.log('\nš” Common solutions:');
|
|
134
|
-
if (apiError.type === 'network') {
|
|
135
|
-
UIComponents.showList([
|
|
136
|
-
'Check your internet connection',
|
|
137
|
-
'Try running init again with --skip-api-keys to set up offline',
|
|
138
|
-
'Configure API keys later with "base config set-keys"'
|
|
139
|
-
]);
|
|
140
|
-
} else if (apiError.type === 'configuration') {
|
|
141
|
-
UIComponents.showList([
|
|
142
|
-
'Delete .baseguardrc.json and try again',
|
|
143
|
-
'Check file permissions in the current directory',
|
|
144
|
-
'Run "base config validate" to check for issues'
|
|
145
|
-
]);
|
|
146
|
-
} else {
|
|
147
|
-
UIComponents.showList([
|
|
148
|
-
'Try running "base init --skip-api-keys" for offline setup',
|
|
149
|
-
'Check the documentation at https://github.com/baseguard/baseguard#readme',
|
|
150
|
-
'Report this issue if it persists'
|
|
151
|
-
]);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
process.exit(1);
|
|
155
|
-
}
|
|
1
|
+
import { UIComponents, Prompts } from '../ui/index.js';
|
|
2
|
+
import { ConfigurationManager, BROWSER_TARGET_PRESETS, type PresetName } from '../core/index.js';
|
|
3
|
+
import { ErrorHandler } from '../core/error-handler.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Initialize BaseGuard in a project
|
|
7
|
+
*/
|
|
8
|
+
export async function init(options: {
|
|
9
|
+
preset?: string;
|
|
10
|
+
skipHooks?: boolean;
|
|
11
|
+
skipApiKeys?: boolean;
|
|
12
|
+
}): Promise<void> {
|
|
13
|
+
try {
|
|
14
|
+
UIComponents.showHeader();
|
|
15
|
+
|
|
16
|
+
// Check if already initialized
|
|
17
|
+
const configExists = await ConfigurationManager.exists();
|
|
18
|
+
if (configExists) {
|
|
19
|
+
const { default: inquirer } = await import('inquirer');
|
|
20
|
+
const { overwrite } = await inquirer.prompt([
|
|
21
|
+
{
|
|
22
|
+
type: 'confirm',
|
|
23
|
+
name: 'overwrite',
|
|
24
|
+
message: 'BaseGuard is already initialized. Overwrite existing configuration?',
|
|
25
|
+
default: false
|
|
26
|
+
}
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
if (!overwrite) {
|
|
30
|
+
UIComponents.showInfoBox('Initialization cancelled. Use "base config" to modify settings.');
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const spinner = UIComponents.createSpinner('Setting up BaseGuard configuration...');
|
|
36
|
+
spinner.start();
|
|
37
|
+
|
|
38
|
+
// Create configuration based on options or run setup wizard
|
|
39
|
+
let config;
|
|
40
|
+
|
|
41
|
+
if (options.preset && options.preset !== 'custom') {
|
|
42
|
+
// Use preset configuration
|
|
43
|
+
const presetName = options.preset as PresetName;
|
|
44
|
+
if (BROWSER_TARGET_PRESETS[presetName]) {
|
|
45
|
+
config = ConfigurationManager.createWithPreset(presetName);
|
|
46
|
+
spinner.text = `Using ${presetName} preset...`;
|
|
47
|
+
} else {
|
|
48
|
+
spinner.fail(`Invalid preset: ${options.preset}`);
|
|
49
|
+
UIComponents.showErrorBox(`Available presets: ${Object.keys(BROWSER_TARGET_PRESETS).join(', ')}`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
// Run interactive setup wizard
|
|
54
|
+
spinner.stop();
|
|
55
|
+
const setupResult = await Prompts.setupWizard();
|
|
56
|
+
spinner.start();
|
|
57
|
+
|
|
58
|
+
config = ConfigurationManager.createWithCustomTargets(setupResult.targets);
|
|
59
|
+
|
|
60
|
+
// Set up automation if requested and not skipped
|
|
61
|
+
if (setupResult.installHooks && !options.skipHooks) {
|
|
62
|
+
config.automation = {
|
|
63
|
+
enabled: true,
|
|
64
|
+
trigger: setupResult.hookTrigger,
|
|
65
|
+
autoAnalyze: true,
|
|
66
|
+
autoFix: false,
|
|
67
|
+
blockCommit: true
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Set up API keys and coding agent if not skipped
|
|
73
|
+
if (!options.skipApiKeys) {
|
|
74
|
+
spinner.stop();
|
|
75
|
+
const apiKeys = await Prompts.setupApiKeys();
|
|
76
|
+
|
|
77
|
+
if (apiKeys.julesApiKey) {
|
|
78
|
+
config.apiKeys.jules = apiKeys.julesApiKey;
|
|
79
|
+
}
|
|
80
|
+
if (apiKeys.geminiApiKey) {
|
|
81
|
+
config.apiKeys.gemini = apiKeys.geminiApiKey;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Configure coding agent based on available keys
|
|
85
|
+
if (apiKeys.julesApiKey && apiKeys.geminiApiKey) {
|
|
86
|
+
const codingAgentChoice = await Prompts.chooseCodingAgent();
|
|
87
|
+
config.codingAgent.primary = codingAgentChoice.primary;
|
|
88
|
+
config.codingAgent.fallback = codingAgentChoice.fallback;
|
|
89
|
+
} else if (apiKeys.julesApiKey) {
|
|
90
|
+
config.codingAgent.primary = 'jules';
|
|
91
|
+
config.codingAgent.fallback = 'jules';
|
|
92
|
+
} else if (apiKeys.geminiApiKey) {
|
|
93
|
+
config.codingAgent.primary = 'gemini';
|
|
94
|
+
config.codingAgent.fallback = 'gemini';
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
spinner.start();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
await ConfigurationManager.save(config);
|
|
101
|
+
spinner.succeed('BaseGuard configuration created');
|
|
102
|
+
|
|
103
|
+
UIComponents.showSuccessBox('BaseGuard has been successfully initialized!');
|
|
104
|
+
|
|
105
|
+
// Show configuration summary
|
|
106
|
+
console.log('\nš Configuration Summary:');
|
|
107
|
+
UIComponents.showList([
|
|
108
|
+
`Browser targets: ${config.targets.map(t => `${t.browser} ${t.minVersion}`).join(', ')}`,
|
|
109
|
+
`API keys: ${config.apiKeys.jules ? 'ā
' : 'ā'} Jules, ${config.apiKeys.gemini ? 'ā
' : 'ā'} Gemini`,
|
|
110
|
+
`Automation: ${config.automation.enabled ? 'ā
Enabled' : 'ā Disabled'}`
|
|
111
|
+
]);
|
|
112
|
+
|
|
113
|
+
console.log('\nš Next steps:');
|
|
114
|
+
const nextSteps = ['Run `base check` to scan for compatibility issues'];
|
|
115
|
+
|
|
116
|
+
if (config.apiKeys.jules && config.apiKeys.gemini) {
|
|
117
|
+
nextSteps.push('Run `base fix` to automatically fix issues with AI');
|
|
118
|
+
} else {
|
|
119
|
+
nextSteps.push('Run `base config set-keys` to configure AI services');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (!config.automation.enabled) {
|
|
123
|
+
nextSteps.push('Run `base automation enable` to set up git hooks');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
UIComponents.showList(nextSteps);
|
|
127
|
+
|
|
128
|
+
} catch (error) {
|
|
129
|
+
const apiError = ErrorHandler.handleAPIError(error);
|
|
130
|
+
ErrorHandler.displayError(apiError);
|
|
131
|
+
|
|
132
|
+
// Provide specific help for common init issues
|
|
133
|
+
console.log('\nš” Common solutions:');
|
|
134
|
+
if (apiError.type === 'network') {
|
|
135
|
+
UIComponents.showList([
|
|
136
|
+
'Check your internet connection',
|
|
137
|
+
'Try running init again with --skip-api-keys to set up offline',
|
|
138
|
+
'Configure API keys later with "base config set-keys"'
|
|
139
|
+
]);
|
|
140
|
+
} else if (apiError.type === 'configuration') {
|
|
141
|
+
UIComponents.showList([
|
|
142
|
+
'Delete .baseguardrc.json and try again',
|
|
143
|
+
'Check file permissions in the current directory',
|
|
144
|
+
'Run "base config validate" to check for issues'
|
|
145
|
+
]);
|
|
146
|
+
} else {
|
|
147
|
+
UIComponents.showList([
|
|
148
|
+
'Try running "base init --skip-api-keys" for offline setup',
|
|
149
|
+
'Check the documentation at https://github.com/baseguard/baseguard#readme',
|
|
150
|
+
'Report this issue if it persists'
|
|
151
|
+
]);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
156
|
}
|