@wundr.io/cli 1.0.11 → 1.0.12
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/bin/wundr.js +8 -4
- package/package.json +23 -23
- package/src/ai/ai-service.ts +16 -17
- package/src/ai/claude-client.ts +16 -16
- package/src/ai/conversation-manager.ts +29 -29
- package/src/cli.ts +4 -4
- package/src/commands/ai.ts +246 -78
- package/src/commands/alignment.ts +74 -74
- package/src/commands/analyze-optimized.ts +111 -78
- package/src/commands/analyze.ts +14 -14
- package/src/commands/batch.ts +179 -42
- package/src/commands/chat.ts +37 -30
- package/src/commands/claude-init.ts +41 -45
- package/src/commands/claude-setup.ts +204 -119
- package/src/commands/computer-setup.ts +85 -43
- package/src/commands/create-command.ts +4 -4
- package/src/commands/create.ts +27 -27
- package/src/commands/dashboard.ts +24 -24
- package/src/commands/govern.ts +25 -25
- package/src/commands/governance.ts +34 -34
- package/src/commands/guardian.ts +56 -56
- package/src/commands/init.ts +25 -22
- package/src/commands/orchestrator.ts +68 -41
- package/src/commands/performance-optimizer.ts +34 -35
- package/src/commands/plugins.ts +27 -27
- package/src/commands/project-update.ts +175 -72
- package/src/commands/rag.ts +185 -78
- package/src/commands/session.ts +35 -35
- package/src/commands/setup.ts +40 -344
- package/src/commands/test-init.ts +3 -3
- package/src/commands/test.ts +4 -4
- package/src/commands/watch.ts +28 -29
- package/src/commands/worktree.ts +49 -49
- package/src/context/context-manager.ts +10 -10
- package/src/context/session-manager.ts +41 -41
- package/src/framework/command-interface.ts +520 -0
- package/src/framework/command-registry.ts +942 -0
- package/src/framework/completion-exporter.ts +383 -0
- package/src/framework/debug-logger.ts +519 -0
- package/src/framework/error-handler.ts +867 -0
- package/src/framework/help-generator.ts +540 -0
- package/src/framework/index.ts +169 -0
- package/src/framework/interactive-repl.ts +703 -0
- package/src/framework/output-formatter.ts +834 -0
- package/src/framework/progress-manager.ts +539 -0
- package/src/index.ts +4 -4
- package/src/interactive/interactive-mode.ts +16 -16
- package/src/lib/conflict-resolution.ts +799 -9
- package/src/lib/merge-strategy.ts +529 -7
- package/src/lib/safety-mechanisms.ts +422 -18
- package/src/lib/state-detection.ts +1015 -13
- package/src/nlp/command-mapper.ts +29 -29
- package/src/nlp/command-parser.ts +17 -17
- package/src/nlp/intent-classifier.ts +7 -7
- package/src/nlp/intent-parser.ts +54 -52
- package/src/plugins/plugin-manager.ts +61 -39
- package/src/tests/computer-setup-integration.test.ts +46 -15
- package/src/types/modules.d.ts +424 -1
- package/src/utils/backup-rollback-manager.ts +11 -8
- package/src/utils/config-manager.ts +3 -3
- package/src/utils/error-handler.ts +2 -2
- package/src/utils/logger.ts +22 -22
- package/templates/batch/ci-cd.yaml +7 -7
- package/test-suites/api/health.spec.ts +20 -23
- package/test-suites/helpers/test-config.ts +14 -13
- package/test-suites/ui/accessibility.spec.ts +27 -22
- package/test-suites/ui/smoke.spec.ts +26 -21
- package/LICENSE +0 -21
- package/dist/ai/ai-service.d.ts +0 -152
- package/dist/ai/ai-service.d.ts.map +0 -1
- package/dist/ai/ai-service.js +0 -430
- package/dist/ai/ai-service.js.map +0 -1
- package/dist/ai/claude-client.d.ts +0 -130
- package/dist/ai/claude-client.d.ts.map +0 -1
- package/dist/ai/claude-client.js +0 -340
- package/dist/ai/claude-client.js.map +0 -1
- package/dist/ai/conversation-manager.d.ts +0 -164
- package/dist/ai/conversation-manager.d.ts.map +0 -1
- package/dist/ai/conversation-manager.js +0 -614
- package/dist/ai/conversation-manager.js.map +0 -1
- package/dist/ai/index.d.ts +0 -5
- package/dist/ai/index.d.ts.map +0 -1
- package/dist/ai/index.js +0 -8
- package/dist/ai/index.js.map +0 -1
- package/dist/cli.d.ts +0 -36
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -192
- package/dist/cli.js.map +0 -1
- package/dist/commands/ai.d.ts +0 -89
- package/dist/commands/ai.d.ts.map +0 -1
- package/dist/commands/ai.js +0 -799
- package/dist/commands/ai.js.map +0 -1
- package/dist/commands/alignment.d.ts +0 -78
- package/dist/commands/alignment.d.ts.map +0 -1
- package/dist/commands/alignment.js +0 -817
- package/dist/commands/alignment.js.map +0 -1
- package/dist/commands/analyze-optimized.d.ts +0 -14
- package/dist/commands/analyze-optimized.d.ts.map +0 -1
- package/dist/commands/analyze-optimized.js +0 -600
- package/dist/commands/analyze-optimized.js.map +0 -1
- package/dist/commands/analyze.d.ts +0 -65
- package/dist/commands/analyze.d.ts.map +0 -1
- package/dist/commands/analyze.js +0 -435
- package/dist/commands/analyze.js.map +0 -1
- package/dist/commands/batch.d.ts +0 -71
- package/dist/commands/batch.d.ts.map +0 -1
- package/dist/commands/batch.js +0 -738
- package/dist/commands/batch.js.map +0 -1
- package/dist/commands/chat.d.ts +0 -71
- package/dist/commands/chat.d.ts.map +0 -1
- package/dist/commands/chat.js +0 -674
- package/dist/commands/chat.js.map +0 -1
- package/dist/commands/claude-init.d.ts +0 -28
- package/dist/commands/claude-init.d.ts.map +0 -1
- package/dist/commands/claude-init.js +0 -591
- package/dist/commands/claude-init.js.map +0 -1
- package/dist/commands/claude-setup.d.ts +0 -119
- package/dist/commands/claude-setup.d.ts.map +0 -1
- package/dist/commands/claude-setup.js +0 -1073
- package/dist/commands/claude-setup.js.map +0 -1
- package/dist/commands/computer-setup-commands.d.ts +0 -53
- package/dist/commands/computer-setup-commands.d.ts.map +0 -1
- package/dist/commands/computer-setup-commands.js +0 -705
- package/dist/commands/computer-setup-commands.js.map +0 -1
- package/dist/commands/computer-setup.d.ts +0 -7
- package/dist/commands/computer-setup.d.ts.map +0 -1
- package/dist/commands/computer-setup.js +0 -849
- package/dist/commands/computer-setup.js.map +0 -1
- package/dist/commands/create-command.d.ts +0 -7
- package/dist/commands/create-command.d.ts.map +0 -1
- package/dist/commands/create-command.js +0 -158
- package/dist/commands/create-command.js.map +0 -1
- package/dist/commands/create.d.ts +0 -74
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -556
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/dashboard.d.ts +0 -91
- package/dist/commands/dashboard.d.ts.map +0 -1
- package/dist/commands/dashboard.js +0 -538
- package/dist/commands/dashboard.js.map +0 -1
- package/dist/commands/govern.d.ts +0 -70
- package/dist/commands/govern.d.ts.map +0 -1
- package/dist/commands/govern.js +0 -481
- package/dist/commands/govern.js.map +0 -1
- package/dist/commands/governance.d.ts +0 -17
- package/dist/commands/governance.d.ts.map +0 -1
- package/dist/commands/governance.js +0 -703
- package/dist/commands/governance.js.map +0 -1
- package/dist/commands/guardian.d.ts +0 -20
- package/dist/commands/guardian.d.ts.map +0 -1
- package/dist/commands/guardian.js +0 -597
- package/dist/commands/guardian.js.map +0 -1
- package/dist/commands/init.d.ts +0 -59
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -650
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/orchestrator.d.ts +0 -7
- package/dist/commands/orchestrator.d.ts.map +0 -1
- package/dist/commands/orchestrator.js +0 -571
- package/dist/commands/orchestrator.js.map +0 -1
- package/dist/commands/performance-optimizer.d.ts +0 -30
- package/dist/commands/performance-optimizer.d.ts.map +0 -1
- package/dist/commands/performance-optimizer.js +0 -650
- package/dist/commands/performance-optimizer.js.map +0 -1
- package/dist/commands/plugins.d.ts +0 -87
- package/dist/commands/plugins.d.ts.map +0 -1
- package/dist/commands/plugins.js +0 -685
- package/dist/commands/plugins.js.map +0 -1
- package/dist/commands/rag.d.ts +0 -7
- package/dist/commands/rag.d.ts.map +0 -1
- package/dist/commands/rag.js +0 -748
- package/dist/commands/rag.js.map +0 -1
- package/dist/commands/session.d.ts +0 -41
- package/dist/commands/session.d.ts.map +0 -1
- package/dist/commands/session.js +0 -441
- package/dist/commands/session.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -29
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/setup.js +0 -397
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/test-init.d.ts +0 -9
- package/dist/commands/test-init.d.ts.map +0 -1
- package/dist/commands/test-init.js +0 -222
- package/dist/commands/test-init.js.map +0 -1
- package/dist/commands/test.d.ts +0 -25
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js +0 -217
- package/dist/commands/test.js.map +0 -1
- package/dist/commands/vp.d.ts +0 -7
- package/dist/commands/vp.d.ts.map +0 -1
- package/dist/commands/vp.js +0 -571
- package/dist/commands/vp.js.map +0 -1
- package/dist/commands/watch.d.ts +0 -76
- package/dist/commands/watch.d.ts.map +0 -1
- package/dist/commands/watch.js +0 -613
- package/dist/commands/watch.js.map +0 -1
- package/dist/commands/worktree.d.ts +0 -63
- package/dist/commands/worktree.d.ts.map +0 -1
- package/dist/commands/worktree.js +0 -774
- package/dist/commands/worktree.js.map +0 -1
- package/dist/context/context-manager.d.ts +0 -155
- package/dist/context/context-manager.d.ts.map +0 -1
- package/dist/context/context-manager.js +0 -383
- package/dist/context/context-manager.js.map +0 -1
- package/dist/context/index.d.ts +0 -3
- package/dist/context/index.d.ts.map +0 -1
- package/dist/context/index.js +0 -6
- package/dist/context/index.js.map +0 -1
- package/dist/context/session-manager.d.ts +0 -207
- package/dist/context/session-manager.d.ts.map +0 -1
- package/dist/context/session-manager.js +0 -686
- package/dist/context/session-manager.js.map +0 -1
- package/dist/index.d.ts +0 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -51
- package/dist/index.js.map +0 -1
- package/dist/interactive/interactive-mode.d.ts +0 -76
- package/dist/interactive/interactive-mode.d.ts.map +0 -1
- package/dist/interactive/interactive-mode.js +0 -732
- package/dist/interactive/interactive-mode.js.map +0 -1
- package/dist/nlp/command-mapper.d.ts +0 -174
- package/dist/nlp/command-mapper.d.ts.map +0 -1
- package/dist/nlp/command-mapper.js +0 -624
- package/dist/nlp/command-mapper.js.map +0 -1
- package/dist/nlp/command-parser.d.ts +0 -106
- package/dist/nlp/command-parser.d.ts.map +0 -1
- package/dist/nlp/command-parser.js +0 -417
- package/dist/nlp/command-parser.js.map +0 -1
- package/dist/nlp/index.d.ts +0 -5
- package/dist/nlp/index.d.ts.map +0 -1
- package/dist/nlp/index.js +0 -8
- package/dist/nlp/index.js.map +0 -1
- package/dist/nlp/intent-classifier.d.ts +0 -59
- package/dist/nlp/intent-classifier.d.ts.map +0 -1
- package/dist/nlp/intent-classifier.js +0 -384
- package/dist/nlp/intent-classifier.js.map +0 -1
- package/dist/nlp/intent-parser.d.ts +0 -152
- package/dist/nlp/intent-parser.d.ts.map +0 -1
- package/dist/nlp/intent-parser.js +0 -744
- package/dist/nlp/intent-parser.js.map +0 -1
- package/dist/plugins/plugin-manager.d.ts +0 -120
- package/dist/plugins/plugin-manager.d.ts.map +0 -1
- package/dist/plugins/plugin-manager.js +0 -595
- package/dist/plugins/plugin-manager.js.map +0 -1
- package/dist/types/index.d.ts +0 -224
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -3
- package/dist/types/index.js.map +0 -1
- package/dist/utils/backup-rollback-manager.d.ts +0 -72
- package/dist/utils/backup-rollback-manager.d.ts.map +0 -1
- package/dist/utils/backup-rollback-manager.js +0 -289
- package/dist/utils/backup-rollback-manager.js.map +0 -1
- package/dist/utils/claude-config-installer.d.ts +0 -98
- package/dist/utils/claude-config-installer.d.ts.map +0 -1
- package/dist/utils/claude-config-installer.js +0 -678
- package/dist/utils/claude-config-installer.js.map +0 -1
- package/dist/utils/config-manager.d.ts +0 -73
- package/dist/utils/config-manager.d.ts.map +0 -1
- package/dist/utils/config-manager.js +0 -339
- package/dist/utils/config-manager.js.map +0 -1
- package/dist/utils/error-handler.d.ts +0 -46
- package/dist/utils/error-handler.d.ts.map +0 -1
- package/dist/utils/error-handler.js +0 -169
- package/dist/utils/error-handler.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -25
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -105
- package/dist/utils/logger.js.map +0 -1
- package/src/commands/computer-setup-commands.ts +0 -872
|
@@ -138,7 +138,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
138
138
|
*/
|
|
139
139
|
async mapIntentToCommand(
|
|
140
140
|
intentResult: IntentResult,
|
|
141
|
-
context: ExecutionContext
|
|
141
|
+
context: ExecutionContext
|
|
142
142
|
): Promise<{
|
|
143
143
|
command: string;
|
|
144
144
|
args: string[];
|
|
@@ -150,7 +150,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
150
150
|
|
|
151
151
|
if (!template) {
|
|
152
152
|
throw new Error(
|
|
153
|
-
`No command template found for intent: ${intentResult.intent}
|
|
153
|
+
`No command template found for intent: ${intentResult.intent}`
|
|
154
154
|
);
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -158,14 +158,14 @@ export class CommandMapper extends EventEmitter {
|
|
|
158
158
|
const { command, args } = await this.buildCommand(
|
|
159
159
|
template,
|
|
160
160
|
intentResult.parameters || {},
|
|
161
|
-
context
|
|
161
|
+
context
|
|
162
162
|
);
|
|
163
163
|
|
|
164
164
|
// Validate command
|
|
165
165
|
const validation = await this.validateCommand(
|
|
166
166
|
template,
|
|
167
167
|
intentResult.parameters || {},
|
|
168
|
-
context
|
|
168
|
+
context
|
|
169
169
|
);
|
|
170
170
|
|
|
171
171
|
this.emit('command_mapped', {
|
|
@@ -196,7 +196,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
196
196
|
streaming?: boolean;
|
|
197
197
|
onOutput?: (output: string) => void;
|
|
198
198
|
onError?: (error: string) => void;
|
|
199
|
-
} = {}
|
|
199
|
+
} = {}
|
|
200
200
|
): Promise<CommandResult> {
|
|
201
201
|
const startTime = Date.now();
|
|
202
202
|
const executionId = `cmd_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
@@ -333,7 +333,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
333
333
|
if (this.runningCommands.has(executionId)) {
|
|
334
334
|
childProcess.kill('SIGTERM');
|
|
335
335
|
logger.warn(
|
|
336
|
-
`Command timed out after ${this.config.timeout}ms: ${command}
|
|
336
|
+
`Command timed out after ${this.config.timeout}ms: ${command}`
|
|
337
337
|
);
|
|
338
338
|
}
|
|
339
339
|
}, this.config.timeout);
|
|
@@ -352,7 +352,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
352
352
|
streaming?: boolean;
|
|
353
353
|
onOutput?: (output: string) => void;
|
|
354
354
|
onError?: (error: string) => void;
|
|
355
|
-
} = {}
|
|
355
|
+
} = {}
|
|
356
356
|
): Promise<CommandResult> {
|
|
357
357
|
// Map intent to command
|
|
358
358
|
const mappedCommand = await this.mapIntentToCommand(intentResult, context);
|
|
@@ -360,7 +360,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
360
360
|
// Check validation
|
|
361
361
|
if (!mappedCommand.validation.valid) {
|
|
362
362
|
throw new Error(
|
|
363
|
-
`Command validation failed: ${mappedCommand.validation.errors.join(', ')}
|
|
363
|
+
`Command validation failed: ${mappedCommand.validation.errors.join(', ')}`
|
|
364
364
|
);
|
|
365
365
|
}
|
|
366
366
|
|
|
@@ -373,7 +373,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
373
373
|
) {
|
|
374
374
|
const confirmed = await this.confirmExecution(
|
|
375
375
|
mappedCommand,
|
|
376
|
-
intentResult
|
|
376
|
+
intentResult
|
|
377
377
|
);
|
|
378
378
|
if (!confirmed) {
|
|
379
379
|
throw new Error('Command execution cancelled by user');
|
|
@@ -385,7 +385,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
385
385
|
mappedCommand.command,
|
|
386
386
|
mappedCommand.args,
|
|
387
387
|
context,
|
|
388
|
-
options
|
|
388
|
+
options
|
|
389
389
|
);
|
|
390
390
|
}
|
|
391
391
|
|
|
@@ -404,7 +404,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
404
404
|
async validateCommand(
|
|
405
405
|
template: CommandTemplate,
|
|
406
406
|
parameters: Record<string, any>,
|
|
407
|
-
context: ExecutionContext
|
|
407
|
+
context: ExecutionContext
|
|
408
408
|
): Promise<ValidationResult> {
|
|
409
409
|
const result: ValidationResult = {
|
|
410
410
|
valid: true,
|
|
@@ -424,7 +424,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
424
424
|
const isValid = await this.executeValidationRule(
|
|
425
425
|
rule,
|
|
426
426
|
parameters,
|
|
427
|
-
context
|
|
427
|
+
context
|
|
428
428
|
);
|
|
429
429
|
|
|
430
430
|
if (!isValid) {
|
|
@@ -437,7 +437,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
437
437
|
}
|
|
438
438
|
} catch (error) {
|
|
439
439
|
result.errors.push(
|
|
440
|
-
`Validation error: ${error instanceof Error ? error.message : 'Unknown error'}
|
|
440
|
+
`Validation error: ${error instanceof Error ? error.message : 'Unknown error'}`
|
|
441
441
|
);
|
|
442
442
|
result.valid = false;
|
|
443
443
|
}
|
|
@@ -447,7 +447,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
447
447
|
for (const mapping of template.parameterMapping) {
|
|
448
448
|
if (mapping.required && !parameters[mapping.intentParam]) {
|
|
449
449
|
result.errors.push(
|
|
450
|
-
`Required parameter missing: ${mapping.intentParam}
|
|
450
|
+
`Required parameter missing: ${mapping.intentParam}`
|
|
451
451
|
);
|
|
452
452
|
result.valid = false;
|
|
453
453
|
}
|
|
@@ -455,7 +455,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
455
455
|
if (parameters[mapping.intentParam] && mapping.validation) {
|
|
456
456
|
if (!mapping.validation(parameters[mapping.intentParam])) {
|
|
457
457
|
result.errors.push(
|
|
458
|
-
`Invalid value for parameter: ${mapping.intentParam}
|
|
458
|
+
`Invalid value for parameter: ${mapping.intentParam}`
|
|
459
459
|
);
|
|
460
460
|
result.valid = false;
|
|
461
461
|
}
|
|
@@ -485,7 +485,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
485
485
|
successOnly?: boolean;
|
|
486
486
|
intent?: string;
|
|
487
487
|
since?: Date;
|
|
488
|
-
} = {}
|
|
488
|
+
} = {}
|
|
489
489
|
): CommandResult[] {
|
|
490
490
|
let history = [...this.commandHistory];
|
|
491
491
|
|
|
@@ -493,7 +493,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
493
493
|
history = history.filter(
|
|
494
494
|
cmd =>
|
|
495
495
|
cmd.metadata?.['startTime'] &&
|
|
496
|
-
new Date(cmd.metadata['startTime']) >= filters.since
|
|
496
|
+
new Date(cmd.metadata['startTime']) >= filters.since!
|
|
497
497
|
);
|
|
498
498
|
}
|
|
499
499
|
|
|
@@ -503,7 +503,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
503
503
|
|
|
504
504
|
if (filters.intent) {
|
|
505
505
|
history = history.filter(
|
|
506
|
-
cmd => cmd.metadata?.['intent'] === filters.intent
|
|
506
|
+
cmd => cmd.metadata?.['intent'] === filters.intent
|
|
507
507
|
);
|
|
508
508
|
}
|
|
509
509
|
|
|
@@ -560,7 +560,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
560
560
|
*/
|
|
561
561
|
async previewCommand(
|
|
562
562
|
intentResult: IntentResult,
|
|
563
|
-
context: ExecutionContext
|
|
563
|
+
context: ExecutionContext
|
|
564
564
|
): Promise<{
|
|
565
565
|
command: string;
|
|
566
566
|
explanation: string;
|
|
@@ -572,7 +572,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
572
572
|
const explanation = this.generateCommandExplanation(
|
|
573
573
|
mappedCommand.command,
|
|
574
574
|
mappedCommand.args,
|
|
575
|
-
intentResult
|
|
575
|
+
intentResult
|
|
576
576
|
);
|
|
577
577
|
|
|
578
578
|
return {
|
|
@@ -602,7 +602,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
602
602
|
commandFlag: '--focus',
|
|
603
603
|
validation: (value: string) =>
|
|
604
604
|
['dependencies', 'quality', 'security', 'performance'].includes(
|
|
605
|
-
value
|
|
605
|
+
value
|
|
606
606
|
),
|
|
607
607
|
},
|
|
608
608
|
{
|
|
@@ -745,14 +745,14 @@ export class CommandMapper extends EventEmitter {
|
|
|
745
745
|
];
|
|
746
746
|
|
|
747
747
|
defaultTemplates.forEach(template =>
|
|
748
|
-
this.registerCommandTemplate(template)
|
|
748
|
+
this.registerCommandTemplate(template)
|
|
749
749
|
);
|
|
750
750
|
}
|
|
751
751
|
|
|
752
752
|
private async buildCommand(
|
|
753
753
|
template: CommandTemplate,
|
|
754
754
|
parameters: Record<string, any>,
|
|
755
|
-
context: ExecutionContext
|
|
755
|
+
context: ExecutionContext
|
|
756
756
|
): Promise<{ command: string; args: string[] }> {
|
|
757
757
|
const commandParts = template.commandTemplate.split(' ');
|
|
758
758
|
const baseCommand = commandParts[0] || '';
|
|
@@ -796,7 +796,7 @@ export class CommandMapper extends EventEmitter {
|
|
|
796
796
|
private async executeValidationRule(
|
|
797
797
|
rule: ValidationRule,
|
|
798
798
|
parameters: Record<string, any>,
|
|
799
|
-
context: ExecutionContext
|
|
799
|
+
context: ExecutionContext
|
|
800
800
|
): Promise<boolean> {
|
|
801
801
|
switch (rule.type) {
|
|
802
802
|
case 'parameter':
|
|
@@ -811,8 +811,8 @@ export class CommandMapper extends EventEmitter {
|
|
|
811
811
|
const fsDir = await import('fs-extra');
|
|
812
812
|
const dirPath = parameters[rule.rule as string];
|
|
813
813
|
if (!dirPath) {
|
|
814
|
-
return false;
|
|
815
|
-
}
|
|
814
|
+
return false;
|
|
815
|
+
}
|
|
816
816
|
const stats = await fsDir.stat(dirPath).catch(() => null);
|
|
817
817
|
return stats ? stats.isDirectory() : false;
|
|
818
818
|
|
|
@@ -840,14 +840,14 @@ return false;
|
|
|
840
840
|
|
|
841
841
|
private async confirmExecution(
|
|
842
842
|
mappedCommand: any,
|
|
843
|
-
intentResult: IntentResult
|
|
843
|
+
intentResult: IntentResult
|
|
844
844
|
): Promise<boolean> {
|
|
845
845
|
// In a real implementation, this would show a confirmation dialog
|
|
846
846
|
// For now, we'll assume confirmation based on safety level
|
|
847
847
|
|
|
848
848
|
if (mappedCommand.safetyLevel === 'dangerous') {
|
|
849
849
|
logger.warn(
|
|
850
|
-
`Dangerous command requires confirmation: ${mappedCommand.command} ${mappedCommand.args.join(' ')}
|
|
850
|
+
`Dangerous command requires confirmation: ${mappedCommand.command} ${mappedCommand.args.join(' ')}`
|
|
851
851
|
);
|
|
852
852
|
// In a real CLI, this would prompt the user
|
|
853
853
|
return false; // Default to not confirmed for dangerous commands
|
|
@@ -859,7 +859,7 @@ return false;
|
|
|
859
859
|
private generateCommandExplanation(
|
|
860
860
|
command: string,
|
|
861
861
|
args: string[],
|
|
862
|
-
intentResult: IntentResult
|
|
862
|
+
intentResult: IntentResult
|
|
863
863
|
): string {
|
|
864
864
|
const fullCommand = `${command} ${args.join(' ')}`;
|
|
865
865
|
|
|
@@ -58,7 +58,7 @@ export class CommandParser {
|
|
|
58
58
|
*/
|
|
59
59
|
async parseCommand(
|
|
60
60
|
input: string,
|
|
61
|
-
context?: ConversationContext
|
|
61
|
+
context?: ConversationContext
|
|
62
62
|
): Promise<ParsedCommand> {
|
|
63
63
|
try {
|
|
64
64
|
// First, try template-based parsing for common patterns
|
|
@@ -80,7 +80,7 @@ export class CommandParser {
|
|
|
80
80
|
// Fall back to AI-powered parsing
|
|
81
81
|
const aiResult = await this.aiService.parseNaturalLanguageCommand(
|
|
82
82
|
input,
|
|
83
|
-
context
|
|
83
|
+
context
|
|
84
84
|
);
|
|
85
85
|
|
|
86
86
|
// Parse the command string into components
|
|
@@ -119,7 +119,7 @@ export class CommandParser {
|
|
|
119
119
|
*/
|
|
120
120
|
async parseComplexCommand(
|
|
121
121
|
input: string,
|
|
122
|
-
context?: ConversationContext
|
|
122
|
+
context?: ConversationContext
|
|
123
123
|
): Promise<ParsedCommand> {
|
|
124
124
|
try {
|
|
125
125
|
// Check if this is a complex command (contains "and", "then", "after")
|
|
@@ -143,8 +143,8 @@ export class CommandParser {
|
|
|
143
143
|
for (let i = 0; i < steps.length; i++) {
|
|
144
144
|
const step = steps[i];
|
|
145
145
|
if (!step) {
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
148
|
|
|
149
149
|
const stepResult = await this.parseCommand(step, context);
|
|
150
150
|
|
|
@@ -189,7 +189,7 @@ continue;
|
|
|
189
189
|
if (!parsedCommand.command || parsedCommand.command.trim() === '') {
|
|
190
190
|
issues.push('No valid command identified');
|
|
191
191
|
recommendations.push(
|
|
192
|
-
'Try rephrasing with a specific action like "analyze", "create", or "init"'
|
|
192
|
+
'Try rephrasing with a specific action like "analyze", "create", or "init"'
|
|
193
193
|
);
|
|
194
194
|
}
|
|
195
195
|
|
|
@@ -207,7 +207,7 @@ continue;
|
|
|
207
207
|
if (parsedCommand.confidence < 0.6) {
|
|
208
208
|
issues.push('Low confidence in command interpretation');
|
|
209
209
|
recommendations.push(
|
|
210
|
-
'Consider providing more specific details about what you want to accomplish'
|
|
210
|
+
'Consider providing more specific details about what you want to accomplish'
|
|
211
211
|
);
|
|
212
212
|
}
|
|
213
213
|
|
|
@@ -226,7 +226,7 @@ continue;
|
|
|
226
226
|
*/
|
|
227
227
|
async generateSuggestions(
|
|
228
228
|
input: string,
|
|
229
|
-
context?: ConversationContext
|
|
229
|
+
context?: ConversationContext
|
|
230
230
|
): Promise<string[]> {
|
|
231
231
|
try {
|
|
232
232
|
const suggestions = await this.aiService.suggestCommands(input, context);
|
|
@@ -445,8 +445,8 @@ continue;
|
|
|
445
445
|
step =>
|
|
446
446
|
step.length > 0 &&
|
|
447
447
|
!['and', 'then', 'after', 'next', 'followed by'].includes(
|
|
448
|
-
step.toLowerCase()
|
|
449
|
-
)
|
|
448
|
+
step.toLowerCase()
|
|
449
|
+
)
|
|
450
450
|
);
|
|
451
451
|
}
|
|
452
452
|
|
|
@@ -477,7 +477,7 @@ continue;
|
|
|
477
477
|
private async validateCommandSpecifics(
|
|
478
478
|
parsedCommand: ParsedCommand,
|
|
479
479
|
issues: string[],
|
|
480
|
-
recommendations: string[]
|
|
480
|
+
recommendations: string[]
|
|
481
481
|
): Promise<void> {
|
|
482
482
|
const commandParts = parsedCommand.command.split(' ');
|
|
483
483
|
const baseCommand = commandParts[1]; // Skip "wundr"
|
|
@@ -486,10 +486,10 @@ continue;
|
|
|
486
486
|
case 'create':
|
|
487
487
|
if (parsedCommand.args.length === 0) {
|
|
488
488
|
issues.push(
|
|
489
|
-
'Create command requires a type (service, component, etc.)'
|
|
489
|
+
'Create command requires a type (service, component, etc.)'
|
|
490
490
|
);
|
|
491
491
|
recommendations.push(
|
|
492
|
-
'Specify what you want to create: "wundr create service MyService"'
|
|
492
|
+
'Specify what you want to create: "wundr create service MyService"'
|
|
493
493
|
);
|
|
494
494
|
}
|
|
495
495
|
break;
|
|
@@ -498,7 +498,7 @@ continue;
|
|
|
498
498
|
// Analyze command is flexible, but we can suggest focus areas
|
|
499
499
|
if (!parsedCommand.options['focus']) {
|
|
500
500
|
recommendations.push(
|
|
501
|
-
'Consider using --focus to target specific areas (dependencies, duplicates, quality)'
|
|
501
|
+
'Consider using --focus to target specific areas (dependencies, duplicates, quality)'
|
|
502
502
|
);
|
|
503
503
|
}
|
|
504
504
|
break;
|
|
@@ -509,7 +509,7 @@ continue;
|
|
|
509
509
|
parsedCommand.args.length === 0
|
|
510
510
|
) {
|
|
511
511
|
recommendations.push(
|
|
512
|
-
'Specify file patterns to watch: "wundr watch --pattern "**/*.ts""'
|
|
512
|
+
'Specify file patterns to watch: "wundr watch --pattern "**/*.ts""'
|
|
513
513
|
);
|
|
514
514
|
}
|
|
515
515
|
break;
|
|
@@ -520,10 +520,10 @@ continue;
|
|
|
520
520
|
!parsedCommand.options['interactive']
|
|
521
521
|
) {
|
|
522
522
|
issues.push(
|
|
523
|
-
'Batch command requires either a batch file or interactive mode'
|
|
523
|
+
'Batch command requires either a batch file or interactive mode'
|
|
524
524
|
);
|
|
525
525
|
recommendations.push(
|
|
526
|
-
'Use --file <batch-file> or --interactive for step-by-step execution'
|
|
526
|
+
'Use --file <batch-file> or --interactive for step-by-step execution'
|
|
527
527
|
);
|
|
528
528
|
}
|
|
529
529
|
break;
|
|
@@ -44,7 +44,7 @@ export class IntentClassifier {
|
|
|
44
44
|
|
|
45
45
|
// Extract entities using pattern extractors
|
|
46
46
|
for (const [entityName, extractor] of Object.entries(
|
|
47
|
-
pattern.entityExtractors
|
|
47
|
+
pattern.entityExtractors
|
|
48
48
|
)) {
|
|
49
49
|
try {
|
|
50
50
|
entities[entityName] = extractor(match);
|
|
@@ -56,7 +56,7 @@ export class IntentClassifier {
|
|
|
56
56
|
const confidence = this.calculateConfidence(
|
|
57
57
|
match,
|
|
58
58
|
pattern,
|
|
59
|
-
normalizedInput
|
|
59
|
+
normalizedInput
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
results.push({
|
|
@@ -98,7 +98,7 @@ export class IntentClassifier {
|
|
|
98
98
|
matchesIntent(
|
|
99
99
|
input: string,
|
|
100
100
|
intentName: string,
|
|
101
|
-
minConfidence = 0.7
|
|
101
|
+
minConfidence = 0.7
|
|
102
102
|
): boolean {
|
|
103
103
|
const intents = this.classifyIntent(input);
|
|
104
104
|
const matchedIntent = intents.find(intent => intent.name === intentName);
|
|
@@ -351,7 +351,7 @@ export class IntentClassifier {
|
|
|
351
351
|
private calculateConfidence(
|
|
352
352
|
match: RegExpMatchArray,
|
|
353
353
|
pattern: IntentPattern,
|
|
354
|
-
normalizedInput: string
|
|
354
|
+
normalizedInput: string
|
|
355
355
|
): number {
|
|
356
356
|
let confidence = 0.7; // Base confidence
|
|
357
357
|
|
|
@@ -376,14 +376,14 @@ export class IntentClassifier {
|
|
|
376
376
|
// Entity extraction helper methods
|
|
377
377
|
private extractServiceName(input: string): string | undefined {
|
|
378
378
|
const match = input.match(
|
|
379
|
-
/(?:service\s+)?(?:called\s+|named\s+)?([A-Z][a-zA-Z]*)
|
|
379
|
+
/(?:service\s+)?(?:called\s+|named\s+)?([A-Z][a-zA-Z]*)/
|
|
380
380
|
);
|
|
381
381
|
return match?.[1];
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
private extractComponentName(input: string): string | undefined {
|
|
385
385
|
const match = input.match(
|
|
386
|
-
/(?:component\s+)?(?:called\s+|named\s+)?([A-Z][a-zA-Z]*)
|
|
386
|
+
/(?:component\s+)?(?:called\s+|named\s+)?([A-Z][a-zA-Z]*)/
|
|
387
387
|
);
|
|
388
388
|
return match?.[1];
|
|
389
389
|
}
|
|
@@ -425,7 +425,7 @@ export class IntentClassifier {
|
|
|
425
425
|
|
|
426
426
|
private extractBatchFile(input: string): string | undefined {
|
|
427
427
|
const match = input.match(
|
|
428
|
-
/batch\s+(?:file\s+)?([^\s]+\.(?:json|yaml|yml))
|
|
428
|
+
/batch\s+(?:file\s+)?([^\s]+\.(?:json|yaml|yml))/
|
|
429
429
|
);
|
|
430
430
|
return match?.[1];
|
|
431
431
|
}
|