@wundr.io/cli 1.0.1 ā 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/ai-service.d.ts +152 -0
- package/dist/ai/ai-service.d.ts.map +1 -0
- package/dist/ai/ai-service.js +430 -0
- package/dist/ai/ai-service.js.map +1 -0
- package/dist/ai/claude-client.d.ts +130 -0
- package/dist/ai/claude-client.d.ts.map +1 -0
- package/dist/ai/claude-client.js +340 -0
- package/dist/ai/claude-client.js.map +1 -0
- package/dist/ai/conversation-manager.d.ts +164 -0
- package/dist/ai/conversation-manager.d.ts.map +1 -0
- package/dist/ai/conversation-manager.js +614 -0
- package/dist/ai/conversation-manager.js.map +1 -0
- package/dist/ai/index.d.ts +5 -0
- package/dist/ai/index.d.ts.map +1 -0
- package/dist/ai/index.js +8 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/cli.d.ts +36 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +192 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/ai.d.ts +89 -0
- package/dist/commands/ai.d.ts.map +1 -0
- package/dist/commands/ai.js +735 -0
- package/dist/commands/ai.js.map +1 -0
- package/dist/commands/alignment.d.ts +78 -0
- package/dist/commands/alignment.d.ts.map +1 -0
- package/dist/commands/alignment.js +817 -0
- package/dist/commands/alignment.js.map +1 -0
- package/dist/commands/analyze-optimized.d.ts +14 -0
- package/dist/commands/analyze-optimized.d.ts.map +1 -0
- package/dist/commands/analyze-optimized.js +440 -0
- package/dist/commands/analyze-optimized.js.map +1 -0
- package/dist/commands/analyze.d.ts +65 -0
- package/dist/commands/analyze.d.ts.map +1 -0
- package/dist/commands/analyze.js +435 -0
- package/dist/commands/analyze.js.map +1 -0
- package/dist/commands/batch.d.ts +71 -0
- package/dist/commands/batch.d.ts.map +1 -0
- package/dist/commands/batch.js +738 -0
- package/dist/commands/batch.js.map +1 -0
- package/dist/commands/chat.d.ts +71 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +674 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/claude-init.d.ts +28 -0
- package/dist/commands/claude-init.d.ts.map +1 -0
- package/dist/commands/claude-init.js +591 -0
- package/dist/commands/claude-init.js.map +1 -0
- package/dist/commands/claude-setup.d.ts +119 -0
- package/dist/commands/claude-setup.d.ts.map +1 -0
- package/dist/commands/claude-setup.js +1073 -0
- package/dist/commands/claude-setup.js.map +1 -0
- package/dist/commands/computer-setup-commands.d.ts +53 -0
- package/dist/commands/computer-setup-commands.d.ts.map +1 -0
- package/dist/commands/computer-setup-commands.js +705 -0
- package/dist/commands/computer-setup-commands.js.map +1 -0
- package/dist/commands/computer-setup.d.ts +7 -0
- package/dist/commands/computer-setup.d.ts.map +1 -0
- package/dist/commands/computer-setup.js +849 -0
- package/dist/commands/computer-setup.js.map +1 -0
- package/dist/commands/create-command.d.ts +7 -0
- package/dist/commands/create-command.d.ts.map +1 -0
- package/dist/commands/create-command.js +158 -0
- package/dist/commands/create-command.js.map +1 -0
- package/dist/commands/create.d.ts +74 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +556 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/dashboard.d.ts +91 -0
- package/dist/commands/dashboard.d.ts.map +1 -0
- package/dist/commands/dashboard.js +538 -0
- package/dist/commands/dashboard.js.map +1 -0
- package/dist/commands/govern.d.ts +70 -0
- package/dist/commands/govern.d.ts.map +1 -0
- package/dist/commands/govern.js +481 -0
- package/dist/commands/govern.js.map +1 -0
- package/dist/commands/governance.d.ts +17 -0
- package/dist/commands/governance.d.ts.map +1 -0
- package/dist/commands/governance.js +703 -0
- package/dist/commands/governance.js.map +1 -0
- package/dist/commands/guardian.d.ts +20 -0
- package/dist/commands/guardian.d.ts.map +1 -0
- package/dist/commands/guardian.js +597 -0
- package/dist/commands/guardian.js.map +1 -0
- package/dist/commands/init.d.ts +59 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +650 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/performance-optimizer.d.ts +30 -0
- package/dist/commands/performance-optimizer.d.ts.map +1 -0
- package/dist/commands/performance-optimizer.js +650 -0
- package/dist/commands/performance-optimizer.js.map +1 -0
- package/dist/commands/plugins.d.ts +87 -0
- package/dist/commands/plugins.d.ts.map +1 -0
- package/dist/commands/plugins.js +685 -0
- package/dist/commands/plugins.js.map +1 -0
- package/dist/commands/rag.d.ts +7 -0
- package/dist/commands/rag.d.ts.map +1 -0
- package/dist/commands/rag.js +748 -0
- package/dist/commands/rag.js.map +1 -0
- package/dist/commands/session.d.ts +41 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +441 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/setup.d.ts +29 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +397 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/test-init.d.ts +9 -0
- package/dist/commands/test-init.d.ts.map +1 -0
- package/dist/commands/test-init.js +222 -0
- package/dist/commands/test-init.js.map +1 -0
- package/dist/commands/test.d.ts +25 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +217 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/vp.d.ts +7 -0
- package/dist/commands/vp.d.ts.map +1 -0
- package/dist/commands/vp.js +571 -0
- package/dist/commands/vp.js.map +1 -0
- package/dist/commands/watch.d.ts +76 -0
- package/dist/commands/watch.d.ts.map +1 -0
- package/dist/commands/watch.js +613 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/commands/worktree.d.ts +63 -0
- package/dist/commands/worktree.d.ts.map +1 -0
- package/dist/commands/worktree.js +774 -0
- package/dist/commands/worktree.js.map +1 -0
- package/dist/context/context-manager.d.ts +155 -0
- package/dist/context/context-manager.d.ts.map +1 -0
- package/dist/context/context-manager.js +383 -0
- package/dist/context/context-manager.js.map +1 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +6 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/session-manager.d.ts +207 -0
- package/dist/context/session-manager.d.ts.map +1 -0
- package/dist/context/session-manager.js +686 -0
- package/dist/context/session-manager.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/interactive/interactive-mode.d.ts +76 -0
- package/dist/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/interactive/interactive-mode.js +732 -0
- package/dist/interactive/interactive-mode.js.map +1 -0
- package/dist/nlp/command-mapper.d.ts +174 -0
- package/dist/nlp/command-mapper.d.ts.map +1 -0
- package/dist/nlp/command-mapper.js +624 -0
- package/dist/nlp/command-mapper.js.map +1 -0
- package/dist/nlp/command-parser.d.ts +106 -0
- package/dist/nlp/command-parser.d.ts.map +1 -0
- package/dist/nlp/command-parser.js +417 -0
- package/dist/nlp/command-parser.js.map +1 -0
- package/dist/nlp/index.d.ts +5 -0
- package/dist/nlp/index.d.ts.map +1 -0
- package/dist/nlp/index.js +8 -0
- package/dist/nlp/index.js.map +1 -0
- package/dist/nlp/intent-classifier.d.ts +59 -0
- package/dist/nlp/intent-classifier.d.ts.map +1 -0
- package/dist/nlp/intent-classifier.js +384 -0
- package/dist/nlp/intent-classifier.js.map +1 -0
- package/dist/nlp/intent-parser.d.ts +152 -0
- package/dist/nlp/intent-parser.d.ts.map +1 -0
- package/dist/nlp/intent-parser.js +744 -0
- package/dist/nlp/intent-parser.js.map +1 -0
- package/dist/plugins/plugin-manager.d.ts +120 -0
- package/dist/plugins/plugin-manager.d.ts.map +1 -0
- package/dist/plugins/plugin-manager.js +595 -0
- package/dist/plugins/plugin-manager.js.map +1 -0
- package/dist/types/index.d.ts +224 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/backup-rollback-manager.d.ts +72 -0
- package/dist/utils/backup-rollback-manager.d.ts.map +1 -0
- package/dist/utils/backup-rollback-manager.js +289 -0
- package/dist/utils/backup-rollback-manager.js.map +1 -0
- package/dist/utils/claude-config-installer.d.ts +94 -0
- package/dist/utils/claude-config-installer.d.ts.map +1 -0
- package/dist/utils/claude-config-installer.js +628 -0
- package/dist/utils/claude-config-installer.js.map +1 -0
- package/dist/utils/config-manager.d.ts +73 -0
- package/dist/utils/config-manager.d.ts.map +1 -0
- package/dist/utils/config-manager.js +339 -0
- package/dist/utils/config-manager.js.map +1 -0
- package/dist/utils/error-handler.d.ts +46 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +169 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/logger.d.ts +25 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +105 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +23 -4
- package/src/ai/ai-service.ts +22 -19
- package/src/ai/claude-client.ts +20 -16
- package/src/ai/conversation-manager.ts +37 -30
- package/src/cli.ts +42 -13
- package/src/commands/ai.ts +59 -57
- package/src/commands/alignment.ts +1212 -0
- package/src/commands/analyze-optimized.ts +70 -62
- package/src/commands/analyze.ts +22 -20
- package/src/commands/batch.ts +41 -38
- package/src/commands/chat.ts +37 -34
- package/src/commands/claude-init.ts +38 -30
- package/src/commands/claude-setup.ts +692 -97
- package/src/commands/computer-setup-commands.ts +45 -39
- package/src/commands/computer-setup.ts +474 -4
- package/src/commands/create-command.ts +7 -7
- package/src/commands/create.ts +36 -33
- package/src/commands/dashboard.ts +33 -28
- package/src/commands/govern.ts +34 -29
- package/src/commands/governance.ts +1005 -0
- package/src/commands/guardian.ts +887 -0
- package/src/commands/init.ts +112 -22
- package/src/commands/performance-optimizer.ts +48 -42
- package/src/commands/plugins.ts +35 -32
- package/src/commands/project-update.ts +1053 -0
- package/src/commands/rag.ts +904 -0
- package/src/commands/session.ts +631 -0
- package/src/commands/setup.ts +35 -31
- package/src/commands/test-init.ts +6 -5
- package/src/commands/test.ts +7 -6
- package/src/commands/vp.ts +762 -0
- package/src/commands/watch.ts +44 -33
- package/src/commands/worktree.ts +1057 -0
- package/src/context/context-manager.ts +15 -12
- package/src/context/session-manager.ts +51 -40
- package/src/index.ts +7 -6
- package/src/interactive/interactive-mode.ts +25 -18
- package/src/lib/conflict-resolution.ts +28 -0
- package/src/lib/merge-strategy.ts +28 -0
- package/src/lib/safety-mechanisms.ts +47 -0
- package/src/lib/state-detection.ts +28 -0
- package/src/nlp/command-mapper.ts +35 -30
- package/src/nlp/command-parser.ts +20 -17
- package/src/nlp/intent-classifier.ts +7 -7
- package/src/nlp/intent-parser.ts +61 -49
- package/src/plugins/plugin-manager.ts +27 -23
- package/src/types/index.ts +1 -1
- package/src/types/modules.d.ts +1 -0
- package/src/utils/backup-rollback-manager.ts +13 -11
- package/src/utils/claude-config-installer.ts +18 -16
- package/src/utils/config-manager.ts +12 -9
- package/src/utils/error-handler.ts +5 -3
- package/src/utils/logger.ts +35 -12
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
* Handles installation of CLAUDE.md, hooks, conventions, and agent templates
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { existsSync } from 'fs';
|
|
6
7
|
import * as fs from 'fs/promises';
|
|
7
8
|
import * as path from 'path';
|
|
8
|
-
|
|
9
|
+
|
|
9
10
|
import chalk from 'chalk';
|
|
10
11
|
import ora from 'ora';
|
|
11
|
-
|
|
12
|
+
|
|
12
13
|
import { BackupRollbackManager } from './backup-rollback-manager';
|
|
14
|
+
import { logger } from './logger';
|
|
13
15
|
|
|
14
16
|
export interface ClaudeConfigOptions {
|
|
15
17
|
claudeDir?: string;
|
|
@@ -74,7 +76,7 @@ export class ClaudeConfigInstaller {
|
|
|
74
76
|
const spinner = ora('Creating backup of existing configurations...').start();
|
|
75
77
|
const backup = await this.backupManager.createBackup(
|
|
76
78
|
existingFiles,
|
|
77
|
-
'Pre-installation backup'
|
|
79
|
+
'Pre-installation backup',
|
|
78
80
|
);
|
|
79
81
|
result.backupId = backup.backupId;
|
|
80
82
|
spinner.succeed(`Backup created: ${backup.backupId}`);
|
|
@@ -109,7 +111,7 @@ export class ClaudeConfigInstaller {
|
|
|
109
111
|
logger.error('Installation failed', error);
|
|
110
112
|
result.errors.push({
|
|
111
113
|
file: 'general',
|
|
112
|
-
error: error instanceof Error ? error.message : String(error)
|
|
114
|
+
error: error instanceof Error ? error.message : String(error),
|
|
113
115
|
});
|
|
114
116
|
return result;
|
|
115
117
|
}
|
|
@@ -120,7 +122,7 @@ export class ClaudeConfigInstaller {
|
|
|
120
122
|
*/
|
|
121
123
|
private async installClaudeMd(
|
|
122
124
|
result: InstallResult,
|
|
123
|
-
options: { dryRun: boolean; overwrite: boolean; verbose: boolean }
|
|
125
|
+
options: { dryRun: boolean; overwrite: boolean; verbose: boolean },
|
|
124
126
|
): Promise<void> {
|
|
125
127
|
const spinner = ora('Installing CLAUDE.md...').start();
|
|
126
128
|
|
|
@@ -157,7 +159,7 @@ export class ClaudeConfigInstaller {
|
|
|
157
159
|
spinner.fail('Failed to install CLAUDE.md');
|
|
158
160
|
result.errors.push({
|
|
159
161
|
file: 'CLAUDE.md',
|
|
160
|
-
error: error instanceof Error ? error.message : String(error)
|
|
162
|
+
error: error instanceof Error ? error.message : String(error),
|
|
161
163
|
});
|
|
162
164
|
logger.error('CLAUDE.md installation failed', error);
|
|
163
165
|
}
|
|
@@ -168,7 +170,7 @@ export class ClaudeConfigInstaller {
|
|
|
168
170
|
*/
|
|
169
171
|
private async installHooks(
|
|
170
172
|
result: InstallResult,
|
|
171
|
-
options: { dryRun: boolean; overwrite: boolean; verbose: boolean }
|
|
173
|
+
options: { dryRun: boolean; overwrite: boolean; verbose: boolean },
|
|
172
174
|
): Promise<void> {
|
|
173
175
|
const spinner = ora('Installing hooks...').start();
|
|
174
176
|
|
|
@@ -202,7 +204,7 @@ export class ClaudeConfigInstaller {
|
|
|
202
204
|
spinner.fail('Failed to install hooks');
|
|
203
205
|
result.errors.push({
|
|
204
206
|
file: 'hooks',
|
|
205
|
-
error: error instanceof Error ? error.message : String(error)
|
|
207
|
+
error: error instanceof Error ? error.message : String(error),
|
|
206
208
|
});
|
|
207
209
|
logger.error('Hooks installation failed', error);
|
|
208
210
|
}
|
|
@@ -213,7 +215,7 @@ export class ClaudeConfigInstaller {
|
|
|
213
215
|
*/
|
|
214
216
|
private async installConventions(
|
|
215
217
|
result: InstallResult,
|
|
216
|
-
options: { dryRun: boolean; overwrite: boolean; verbose: boolean }
|
|
218
|
+
options: { dryRun: boolean; overwrite: boolean; verbose: boolean },
|
|
217
219
|
): Promise<void> {
|
|
218
220
|
const spinner = ora('Installing conventions...').start();
|
|
219
221
|
|
|
@@ -242,7 +244,7 @@ export class ClaudeConfigInstaller {
|
|
|
242
244
|
spinner.fail('Failed to install conventions');
|
|
243
245
|
result.errors.push({
|
|
244
246
|
file: 'conventions.json',
|
|
245
|
-
error: error instanceof Error ? error.message : String(error)
|
|
247
|
+
error: error instanceof Error ? error.message : String(error),
|
|
246
248
|
});
|
|
247
249
|
logger.error('Conventions installation failed', error);
|
|
248
250
|
}
|
|
@@ -253,7 +255,7 @@ export class ClaudeConfigInstaller {
|
|
|
253
255
|
*/
|
|
254
256
|
private async installAgentTemplates(
|
|
255
257
|
result: InstallResult,
|
|
256
|
-
options: { dryRun: boolean; overwrite: boolean; verbose: boolean }
|
|
258
|
+
options: { dryRun: boolean; overwrite: boolean; verbose: boolean },
|
|
257
259
|
): Promise<void> {
|
|
258
260
|
const spinner = ora('Installing agent templates...').start();
|
|
259
261
|
|
|
@@ -286,7 +288,7 @@ export class ClaudeConfigInstaller {
|
|
|
286
288
|
spinner.fail('Failed to install agent templates');
|
|
287
289
|
result.errors.push({
|
|
288
290
|
file: 'agent-templates',
|
|
289
|
-
error: error instanceof Error ? error.message : String(error)
|
|
291
|
+
error: error instanceof Error ? error.message : String(error),
|
|
290
292
|
});
|
|
291
293
|
logger.error('Agent templates installation failed', error);
|
|
292
294
|
}
|
|
@@ -297,7 +299,7 @@ export class ClaudeConfigInstaller {
|
|
|
297
299
|
*/
|
|
298
300
|
private async installGitWorktreeWorkflows(
|
|
299
301
|
result: InstallResult,
|
|
300
|
-
options: { dryRun: boolean; overwrite: boolean; verbose: boolean }
|
|
302
|
+
options: { dryRun: boolean; overwrite: boolean; verbose: boolean },
|
|
301
303
|
): Promise<void> {
|
|
302
304
|
const spinner = ora('Installing git-worktree workflows...').start();
|
|
303
305
|
|
|
@@ -330,7 +332,7 @@ export class ClaudeConfigInstaller {
|
|
|
330
332
|
spinner.fail('Failed to install git-worktree workflows');
|
|
331
333
|
result.errors.push({
|
|
332
334
|
file: 'git-worktree-workflows',
|
|
333
|
-
error: error instanceof Error ? error.message : String(error)
|
|
335
|
+
error: error instanceof Error ? error.message : String(error),
|
|
334
336
|
});
|
|
335
337
|
logger.error('Git-worktree workflows installation failed', error);
|
|
336
338
|
}
|
|
@@ -341,7 +343,7 @@ export class ClaudeConfigInstaller {
|
|
|
341
343
|
*/
|
|
342
344
|
private async installValidationScripts(
|
|
343
345
|
result: InstallResult,
|
|
344
|
-
options: { dryRun: boolean; overwrite: boolean; verbose: boolean }
|
|
346
|
+
options: { dryRun: boolean; overwrite: boolean; verbose: boolean },
|
|
345
347
|
): Promise<void> {
|
|
346
348
|
const spinner = ora('Installing validation scripts...').start();
|
|
347
349
|
|
|
@@ -375,7 +377,7 @@ export class ClaudeConfigInstaller {
|
|
|
375
377
|
spinner.fail('Failed to install validation scripts');
|
|
376
378
|
result.errors.push({
|
|
377
379
|
file: 'validation-scripts',
|
|
378
|
-
error: error instanceof Error ? error.message : String(error)
|
|
380
|
+
error: error instanceof Error ? error.message : String(error),
|
|
379
381
|
});
|
|
380
382
|
logger.error('Validation scripts installation failed', error);
|
|
381
383
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import path from 'path';
|
|
3
1
|
import os from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
import fs from 'fs-extra';
|
|
4
5
|
import { z } from 'zod';
|
|
5
|
-
|
|
6
|
-
import { logger } from './logger';
|
|
6
|
+
|
|
7
7
|
import { errorHandler } from './error-handler';
|
|
8
|
+
import { logger } from './logger';
|
|
9
|
+
|
|
10
|
+
import type { WundrConfig } from '../types';
|
|
8
11
|
|
|
9
12
|
// Zod schema for configuration validation
|
|
10
13
|
const WundrConfigSchema = z.object({
|
|
@@ -101,7 +104,7 @@ export class ConfigManager {
|
|
|
101
104
|
'WUNDR_CONFIG_INVALID',
|
|
102
105
|
'Failed to load or parse configuration file',
|
|
103
106
|
{ configPath: configFile },
|
|
104
|
-
true
|
|
107
|
+
true,
|
|
105
108
|
);
|
|
106
109
|
}
|
|
107
110
|
}
|
|
@@ -126,7 +129,7 @@ export class ConfigManager {
|
|
|
126
129
|
'WUNDR_CONFIG_INVALID',
|
|
127
130
|
'Failed to save configuration file',
|
|
128
131
|
{ configPath: configFile },
|
|
129
|
-
false
|
|
132
|
+
false,
|
|
130
133
|
);
|
|
131
134
|
}
|
|
132
135
|
}
|
|
@@ -166,7 +169,7 @@ export class ConfigManager {
|
|
|
166
169
|
return {
|
|
167
170
|
valid: false,
|
|
168
171
|
errors: error.issues.map(
|
|
169
|
-
issue => `${issue.path.join('.')}: ${issue.message}
|
|
172
|
+
issue => `${issue.path.join('.')}: ${issue.message}`,
|
|
170
173
|
),
|
|
171
174
|
};
|
|
172
175
|
}
|
|
@@ -213,7 +216,7 @@ export class ConfigManager {
|
|
|
213
216
|
throw new Error(`Invalid path: empty key at position ${i}`);
|
|
214
217
|
}
|
|
215
218
|
if (!current || typeof current !== 'object') {
|
|
216
|
-
throw new Error(
|
|
219
|
+
throw new Error('Invalid path: cannot set property on non-object');
|
|
217
220
|
}
|
|
218
221
|
if (!current[key] || typeof current[key] !== 'object') {
|
|
219
222
|
current[key] = {};
|
|
@@ -226,7 +229,7 @@ export class ConfigManager {
|
|
|
226
229
|
throw new Error('Invalid path: empty final key');
|
|
227
230
|
}
|
|
228
231
|
if (!finalKey || !current || typeof current !== 'object') {
|
|
229
|
-
throw new Error(
|
|
232
|
+
throw new Error('Invalid path: cannot set property');
|
|
230
233
|
}
|
|
231
234
|
current[finalKey] = value;
|
|
232
235
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { logger } from './logger';
|
|
4
4
|
|
|
5
|
+
import type { WundrError } from '../types';
|
|
6
|
+
|
|
5
7
|
/**
|
|
6
8
|
* Centralized error handling system
|
|
7
9
|
*/
|
|
@@ -114,7 +116,7 @@ class ErrorHandler {
|
|
|
114
116
|
|
|
115
117
|
console.error(chalk.yellow('\nš” This appears to be an unexpected error.'));
|
|
116
118
|
console.error(
|
|
117
|
-
chalk.yellow(' Please report this issue with the above details.')
|
|
119
|
+
chalk.yellow(' Please report this issue with the above details.'),
|
|
118
120
|
);
|
|
119
121
|
}
|
|
120
122
|
|
|
@@ -165,7 +167,7 @@ class ErrorHandler {
|
|
|
165
167
|
code: string,
|
|
166
168
|
message: string,
|
|
167
169
|
context?: Record<string, any>,
|
|
168
|
-
recoverable = false
|
|
170
|
+
recoverable = false,
|
|
169
171
|
): WundrError {
|
|
170
172
|
const error = new Error(message) as WundrError;
|
|
171
173
|
error.code = code;
|
package/src/utils/logger.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import type { Logger } from '../types';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Enhanced logger with multiple levels and colored output
|
|
@@ -17,7 +18,9 @@ class WundrLogger implements Logger {
|
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
private shouldLog(level: string): boolean {
|
|
20
|
-
if (this.silent)
|
|
21
|
+
if (this.silent) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
21
24
|
|
|
22
25
|
const levels = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
23
26
|
return levels[level as keyof typeof levels] >= levels[this.level];
|
|
@@ -36,54 +39,74 @@ class WundrLogger implements Logger {
|
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
debug(message: string, ...args: any[]): void {
|
|
39
|
-
if (!this.shouldLog('debug'))
|
|
42
|
+
if (!this.shouldLog('debug')) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
40
45
|
console.log(chalk.gray(this.formatMessage('debug', message, ...args)));
|
|
41
46
|
}
|
|
42
47
|
|
|
43
48
|
info(message: string, ...args: any[]): void {
|
|
44
|
-
if (!this.shouldLog('info'))
|
|
49
|
+
if (!this.shouldLog('info')) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
45
52
|
console.log(chalk.blue(this.formatMessage('info', message, ...args)));
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
warn(message: string, ...args: any[]): void {
|
|
49
|
-
if (!this.shouldLog('warn'))
|
|
56
|
+
if (!this.shouldLog('warn')) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
50
59
|
console.warn(chalk.yellow(this.formatMessage('warn', message, ...args)));
|
|
51
60
|
}
|
|
52
61
|
|
|
53
62
|
error(message: string, ...args: any[]): void {
|
|
54
|
-
if (!this.shouldLog('error'))
|
|
63
|
+
if (!this.shouldLog('error')) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
55
66
|
console.error(chalk.red(this.formatMessage('error', message, ...args)));
|
|
56
67
|
}
|
|
57
68
|
|
|
58
69
|
success(message: string, ...args: any[]): void {
|
|
59
|
-
if (!this.shouldLog('info'))
|
|
70
|
+
if (!this.shouldLog('info')) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
60
73
|
console.log(chalk.green(this.formatMessage('success', message, ...args)));
|
|
61
74
|
}
|
|
62
75
|
|
|
63
76
|
// Utility methods for structured logging
|
|
64
77
|
table(data: any[]): void {
|
|
65
|
-
if (this.silent)
|
|
78
|
+
if (this.silent) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
66
81
|
console.table(data);
|
|
67
82
|
}
|
|
68
83
|
|
|
69
84
|
json(data: any): void {
|
|
70
|
-
if (this.silent)
|
|
85
|
+
if (this.silent) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
71
88
|
console.log(JSON.stringify(data, null, 2));
|
|
72
89
|
}
|
|
73
90
|
|
|
74
91
|
group(label: string): void {
|
|
75
|
-
if (this.silent)
|
|
92
|
+
if (this.silent) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
76
95
|
console.group(chalk.cyan(label));
|
|
77
96
|
}
|
|
78
97
|
|
|
79
98
|
groupEnd(): void {
|
|
80
|
-
if (this.silent)
|
|
99
|
+
if (this.silent) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
81
102
|
console.groupEnd();
|
|
82
103
|
}
|
|
83
104
|
|
|
84
105
|
// Progress logging
|
|
85
106
|
progress(current: number, total: number, message?: string): void {
|
|
86
|
-
if (this.silent)
|
|
107
|
+
if (this.silent) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
87
110
|
const percentage = Math.round((current / total) * 100);
|
|
88
111
|
const bar = 'ā'.repeat(Math.round(percentage / 2));
|
|
89
112
|
const empty = 'ā'.repeat(50 - Math.round(percentage / 2));
|