@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
package/src/commands/batch.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import fs from 'fs-extra';
|
|
3
1
|
import path from 'path';
|
|
2
|
+
|
|
4
3
|
import chalk from 'chalk';
|
|
5
|
-
import
|
|
4
|
+
import fs from 'fs-extra';
|
|
6
5
|
import { Listr } from 'listr2';
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import { logger } from '../utils/logger';
|
|
6
|
+
import YAML from 'yaml';
|
|
7
|
+
|
|
10
8
|
import { errorHandler } from '../utils/error-handler';
|
|
11
|
-
import {
|
|
9
|
+
import { logger } from '../utils/logger';
|
|
10
|
+
|
|
11
|
+
import type { PluginManager } from '../plugins/plugin-manager';
|
|
12
|
+
import type { BatchJob, BatchCommand } from '../types';
|
|
13
|
+
import type { ConfigManager } from '../utils/config-manager';
|
|
14
|
+
import type { Command } from 'commander';
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* Batch commands for YAML automation and batch processing
|
|
@@ -19,7 +22,7 @@ export class BatchCommands {
|
|
|
19
22
|
constructor(
|
|
20
23
|
private program: Command,
|
|
21
24
|
private configManager: ConfigManager,
|
|
22
|
-
private pluginManager: PluginManager
|
|
25
|
+
private pluginManager: PluginManager,
|
|
23
26
|
) {
|
|
24
27
|
this.registerCommands();
|
|
25
28
|
}
|
|
@@ -38,7 +41,7 @@ export class BatchCommands {
|
|
|
38
41
|
.option('--continue-on-error', 'continue execution on command failures')
|
|
39
42
|
.option(
|
|
40
43
|
'--vars <vars>',
|
|
41
|
-
'variables to pass to batch job (JSON or key=value)'
|
|
44
|
+
'variables to pass to batch job (JSON or key=value)',
|
|
42
45
|
)
|
|
43
46
|
.option('--timeout <ms>', 'global timeout for batch job')
|
|
44
47
|
.action(async (file, options) => {
|
|
@@ -108,7 +111,7 @@ export class BatchCommands {
|
|
|
108
111
|
.option(
|
|
109
112
|
'--format <format>',
|
|
110
113
|
'export format (json, shell, dockerfile)',
|
|
111
|
-
'json'
|
|
114
|
+
'json',
|
|
112
115
|
)
|
|
113
116
|
.option('--output <path>', 'output file path')
|
|
114
117
|
.action(async (file, options) => {
|
|
@@ -121,7 +124,7 @@ export class BatchCommands {
|
|
|
121
124
|
.description('import batch job from different formats')
|
|
122
125
|
.option(
|
|
123
126
|
'--format <format>',
|
|
124
|
-
'source format (json, shell, package-scripts)'
|
|
127
|
+
'source format (json, shell, package-scripts)',
|
|
125
128
|
)
|
|
126
129
|
.option('--name <name>', 'batch job name')
|
|
127
130
|
.action(async (file, options) => {
|
|
@@ -186,7 +189,7 @@ export class BatchCommands {
|
|
|
186
189
|
'WUNDR_BATCH_RUN_FAILED',
|
|
187
190
|
'Failed to run batch job',
|
|
188
191
|
{ file, options },
|
|
189
|
-
true
|
|
192
|
+
true,
|
|
190
193
|
);
|
|
191
194
|
}
|
|
192
195
|
}
|
|
@@ -212,7 +215,7 @@ export class BatchCommands {
|
|
|
212
215
|
process.cwd(),
|
|
213
216
|
'.wundr',
|
|
214
217
|
'batch',
|
|
215
|
-
`${name}.yaml
|
|
218
|
+
`${name}.yaml`,
|
|
216
219
|
);
|
|
217
220
|
await fs.ensureDir(path.dirname(jobPath));
|
|
218
221
|
await fs.writeFile(jobPath, YAML.stringify(job));
|
|
@@ -223,7 +226,7 @@ export class BatchCommands {
|
|
|
223
226
|
'WUNDR_BATCH_CREATE_FAILED',
|
|
224
227
|
'Failed to create batch job',
|
|
225
228
|
{ name, options },
|
|
226
|
-
true
|
|
229
|
+
true,
|
|
227
230
|
);
|
|
228
231
|
}
|
|
229
232
|
}
|
|
@@ -243,7 +246,7 @@ export class BatchCommands {
|
|
|
243
246
|
|
|
244
247
|
const files = await fs.readdir(batchDir);
|
|
245
248
|
const yamlFiles = files.filter(
|
|
246
|
-
f => f.endsWith('.yaml') || f.endsWith('.yml')
|
|
249
|
+
f => f.endsWith('.yaml') || f.endsWith('.yml'),
|
|
247
250
|
);
|
|
248
251
|
|
|
249
252
|
if (yamlFiles.length === 0) {
|
|
@@ -285,7 +288,7 @@ export class BatchCommands {
|
|
|
285
288
|
'WUNDR_BATCH_LIST_FAILED',
|
|
286
289
|
'Failed to list batch jobs',
|
|
287
290
|
{ options },
|
|
288
|
-
true
|
|
291
|
+
true,
|
|
289
292
|
);
|
|
290
293
|
}
|
|
291
294
|
}
|
|
@@ -322,7 +325,7 @@ export class BatchCommands {
|
|
|
322
325
|
'WUNDR_BATCH_VALIDATE_FAILED',
|
|
323
326
|
'Failed to validate batch job',
|
|
324
327
|
{ file },
|
|
325
|
-
true
|
|
328
|
+
true,
|
|
326
329
|
);
|
|
327
330
|
}
|
|
328
331
|
}
|
|
@@ -349,7 +352,7 @@ export class BatchCommands {
|
|
|
349
352
|
'WUNDR_BATCH_STOP_FAILED',
|
|
350
353
|
'Failed to stop batch job',
|
|
351
354
|
{ jobId },
|
|
352
|
-
true
|
|
355
|
+
true,
|
|
353
356
|
);
|
|
354
357
|
}
|
|
355
358
|
}
|
|
@@ -384,7 +387,7 @@ export class BatchCommands {
|
|
|
384
387
|
File: path.basename(job.file),
|
|
385
388
|
Status: job.status,
|
|
386
389
|
Duration: `${Date.now() - job.startTime}ms`,
|
|
387
|
-
})
|
|
390
|
+
}),
|
|
388
391
|
);
|
|
389
392
|
|
|
390
393
|
console.table(jobData);
|
|
@@ -394,7 +397,7 @@ export class BatchCommands {
|
|
|
394
397
|
'WUNDR_BATCH_STATUS_FAILED',
|
|
395
398
|
'Failed to show job status',
|
|
396
399
|
{ jobId },
|
|
397
|
-
true
|
|
400
|
+
true,
|
|
398
401
|
);
|
|
399
402
|
}
|
|
400
403
|
}
|
|
@@ -428,7 +431,7 @@ export class BatchCommands {
|
|
|
428
431
|
'WUNDR_BATCH_SCHEDULE_FAILED',
|
|
429
432
|
'Failed to schedule batch job',
|
|
430
433
|
{ file, options },
|
|
431
|
-
true
|
|
434
|
+
true,
|
|
432
435
|
);
|
|
433
436
|
}
|
|
434
437
|
}
|
|
@@ -468,7 +471,7 @@ export class BatchCommands {
|
|
|
468
471
|
'WUNDR_BATCH_EXPORT_FAILED',
|
|
469
472
|
'Failed to export batch job',
|
|
470
473
|
{ file, options },
|
|
471
|
-
true
|
|
474
|
+
true,
|
|
472
475
|
);
|
|
473
476
|
}
|
|
474
477
|
}
|
|
@@ -501,7 +504,7 @@ export class BatchCommands {
|
|
|
501
504
|
process.cwd(),
|
|
502
505
|
'.wundr',
|
|
503
506
|
'batch',
|
|
504
|
-
`${jobName}.yaml
|
|
507
|
+
`${jobName}.yaml`,
|
|
505
508
|
);
|
|
506
509
|
|
|
507
510
|
await fs.ensureDir(path.dirname(jobPath));
|
|
@@ -513,7 +516,7 @@ export class BatchCommands {
|
|
|
513
516
|
'WUNDR_BATCH_IMPORT_FAILED',
|
|
514
517
|
'Failed to import batch job',
|
|
515
518
|
{ file, options },
|
|
516
|
-
true
|
|
519
|
+
true,
|
|
517
520
|
);
|
|
518
521
|
}
|
|
519
522
|
}
|
|
@@ -539,7 +542,7 @@ export class BatchCommands {
|
|
|
539
542
|
}
|
|
540
543
|
|
|
541
544
|
private async validateJobStructure(
|
|
542
|
-
job: BatchJob
|
|
545
|
+
job: BatchJob,
|
|
543
546
|
): Promise<{ valid: boolean; errors: string[] }> {
|
|
544
547
|
const errors: string[] = [];
|
|
545
548
|
|
|
@@ -562,7 +565,7 @@ export class BatchCommands {
|
|
|
562
565
|
|
|
563
566
|
private async processJobVariables(
|
|
564
567
|
job: BatchJob,
|
|
565
|
-
vars?: string
|
|
568
|
+
vars?: string,
|
|
566
569
|
): Promise<BatchJob> {
|
|
567
570
|
let variables: Record<string, any> = {};
|
|
568
571
|
|
|
@@ -624,7 +627,7 @@ export class BatchCommands {
|
|
|
624
627
|
private async executeBatchJob(
|
|
625
628
|
job: BatchJob,
|
|
626
629
|
_jobId: string,
|
|
627
|
-
_options: any
|
|
630
|
+
_options: any,
|
|
628
631
|
): Promise<void> {
|
|
629
632
|
const tasks = job.commands.map((cmd, _index) => ({
|
|
630
633
|
title: cmd.command,
|
|
@@ -648,7 +651,7 @@ export class BatchCommands {
|
|
|
648
651
|
|
|
649
652
|
private async executeCommand(
|
|
650
653
|
cmd: BatchCommand,
|
|
651
|
-
_options: any
|
|
654
|
+
_options: any,
|
|
652
655
|
): Promise<void> {
|
|
653
656
|
// Check condition if specified
|
|
654
657
|
if (cmd.condition && !(await this.evaluateCondition(cmd.condition))) {
|
|
@@ -798,13 +801,13 @@ export class BatchCommands {
|
|
|
798
801
|
|
|
799
802
|
private async createJobFromTemplate(
|
|
800
803
|
name: string,
|
|
801
|
-
template: string
|
|
804
|
+
template: string,
|
|
802
805
|
): Promise<BatchJob> {
|
|
803
806
|
// Load template and create job
|
|
804
807
|
const templatePath = path.join(
|
|
805
808
|
__dirname,
|
|
806
809
|
'../../templates/batch',
|
|
807
|
-
`${template}.yaml
|
|
810
|
+
`${template}.yaml`,
|
|
808
811
|
);
|
|
809
812
|
if (await fs.pathExists(templatePath)) {
|
|
810
813
|
const templateJob = await this.loadBatchJob(templatePath);
|
|
@@ -834,14 +837,14 @@ export class BatchCommands {
|
|
|
834
837
|
|
|
835
838
|
private convertToDockerfile(job: BatchJob): string {
|
|
836
839
|
let dockerfile = `# Generated from batch job: ${job.name}\n`;
|
|
837
|
-
dockerfile +=
|
|
840
|
+
dockerfile += 'FROM node:18-alpine\n\n';
|
|
838
841
|
|
|
839
842
|
if (job.description) {
|
|
840
843
|
dockerfile += `# ${job.description}\n`;
|
|
841
844
|
}
|
|
842
845
|
|
|
843
|
-
dockerfile +=
|
|
844
|
-
dockerfile +=
|
|
846
|
+
dockerfile += 'WORKDIR /app\n';
|
|
847
|
+
dockerfile += 'COPY . .\n\n';
|
|
845
848
|
|
|
846
849
|
job.commands.forEach(cmd => {
|
|
847
850
|
dockerfile += `RUN ${cmd.command}\n`;
|
|
@@ -857,7 +860,7 @@ export class BatchCommands {
|
|
|
857
860
|
|
|
858
861
|
private async importFromShell(
|
|
859
862
|
file: string,
|
|
860
|
-
name?: string
|
|
863
|
+
name?: string,
|
|
861
864
|
): Promise<BatchJob> {
|
|
862
865
|
const content = await fs.readFile(file, 'utf8');
|
|
863
866
|
const commands = content
|
|
@@ -874,7 +877,7 @@ export class BatchCommands {
|
|
|
874
877
|
|
|
875
878
|
private async importFromPackageScripts(
|
|
876
879
|
file: string,
|
|
877
|
-
name?: string
|
|
880
|
+
name?: string,
|
|
878
881
|
): Promise<BatchJob> {
|
|
879
882
|
const packageJson = await fs.readJson(file);
|
|
880
883
|
const scripts = packageJson.scripts || {};
|
|
@@ -887,7 +890,7 @@ export class BatchCommands {
|
|
|
887
890
|
|
|
888
891
|
return {
|
|
889
892
|
name: name || 'package-scripts',
|
|
890
|
-
description:
|
|
893
|
+
description: 'Imported from package.json scripts',
|
|
891
894
|
commands,
|
|
892
895
|
};
|
|
893
896
|
}
|
|
@@ -897,7 +900,7 @@ export class BatchCommands {
|
|
|
897
900
|
if (await fs.pathExists(templatesDir)) {
|
|
898
901
|
const templates = await fs.readdir(templatesDir);
|
|
899
902
|
const yamlTemplates = templates.filter(
|
|
900
|
-
t => t.endsWith('.yaml') || t.endsWith('.yml')
|
|
903
|
+
t => t.endsWith('.yaml') || t.endsWith('.yml'),
|
|
901
904
|
);
|
|
902
905
|
|
|
903
906
|
if (yamlTemplates.length > 0) {
|
|
@@ -921,7 +924,7 @@ export class BatchCommands {
|
|
|
921
924
|
const templatePath = path.join(
|
|
922
925
|
__dirname,
|
|
923
926
|
'../../templates/batch',
|
|
924
|
-
`${name}.yaml
|
|
927
|
+
`${name}.yaml`,
|
|
925
928
|
);
|
|
926
929
|
|
|
927
930
|
await fs.ensureDir(path.dirname(templatePath));
|
package/src/commands/chat.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import inquirer from 'inquirer';
|
|
3
|
-
import fs from 'fs-extra';
|
|
4
1
|
import path from 'path';
|
|
2
|
+
|
|
5
3
|
import chalk from 'chalk';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import inquirer from 'inquirer';
|
|
6
|
+
|
|
9
7
|
import { errorHandler } from '../utils/error-handler';
|
|
10
|
-
import {
|
|
8
|
+
import { logger } from '../utils/logger';
|
|
9
|
+
|
|
10
|
+
import type { PluginManager } from '../plugins/plugin-manager';
|
|
11
|
+
import type { ChatSession, ChatMessage } from '../types';
|
|
12
|
+
import type { ConfigManager } from '../utils/config-manager';
|
|
13
|
+
import type { Command } from 'commander';
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
16
|
* Chat commands for natural language interface
|
|
@@ -18,7 +21,7 @@ export class ChatCommands {
|
|
|
18
21
|
constructor(
|
|
19
22
|
private program: Command,
|
|
20
23
|
private configManager: ConfigManager,
|
|
21
|
-
private pluginManager: PluginManager
|
|
24
|
+
private pluginManager: PluginManager,
|
|
22
25
|
) {
|
|
23
26
|
this.registerCommands();
|
|
24
27
|
}
|
|
@@ -38,7 +41,7 @@ export class ChatCommands {
|
|
|
38
41
|
.option(
|
|
39
42
|
'--persona <persona>',
|
|
40
43
|
'AI persona (developer, architect, reviewer)',
|
|
41
|
-
'developer'
|
|
44
|
+
'developer',
|
|
42
45
|
)
|
|
43
46
|
.option('--session-name <name>', 'custom session name')
|
|
44
47
|
.action(async options => {
|
|
@@ -81,7 +84,7 @@ export class ChatCommands {
|
|
|
81
84
|
.option(
|
|
82
85
|
'--format <format>',
|
|
83
86
|
'export format (json, markdown, txt)',
|
|
84
|
-
'markdown'
|
|
87
|
+
'markdown',
|
|
85
88
|
)
|
|
86
89
|
.option('--output <path>', 'output file path')
|
|
87
90
|
.action(async (sessionId, options) => {
|
|
@@ -130,7 +133,7 @@ export class ChatCommands {
|
|
|
130
133
|
.option(
|
|
131
134
|
'--action <action>',
|
|
132
135
|
'action to perform (explain, review, improve)',
|
|
133
|
-
'explain'
|
|
136
|
+
'explain',
|
|
134
137
|
)
|
|
135
138
|
.option('--model <model>', 'AI model to use')
|
|
136
139
|
.action(async (file, options) => {
|
|
@@ -145,7 +148,7 @@ export class ChatCommands {
|
|
|
145
148
|
.option(
|
|
146
149
|
'--action <action>',
|
|
147
150
|
'action to perform (explain, review, improve)',
|
|
148
|
-
'explain'
|
|
151
|
+
'explain',
|
|
149
152
|
)
|
|
150
153
|
.action(async options => {
|
|
151
154
|
await this.chatWithCode(options);
|
|
@@ -186,7 +189,7 @@ export class ChatCommands {
|
|
|
186
189
|
console.log(chalk.gray(`Context: ${session.context}`));
|
|
187
190
|
}
|
|
188
191
|
console.log(
|
|
189
|
-
chalk.gray('Type "exit" to end the session, "help" for commands\n')
|
|
192
|
+
chalk.gray('Type "exit" to end the session, "help" for commands\n'),
|
|
190
193
|
);
|
|
191
194
|
|
|
192
195
|
await this.runChatLoop(session);
|
|
@@ -195,7 +198,7 @@ export class ChatCommands {
|
|
|
195
198
|
'WUNDR_CHAT_START_FAILED',
|
|
196
199
|
'Failed to start chat session',
|
|
197
200
|
{ options },
|
|
198
|
-
true
|
|
201
|
+
true,
|
|
199
202
|
);
|
|
200
203
|
}
|
|
201
204
|
}
|
|
@@ -218,7 +221,7 @@ export class ChatCommands {
|
|
|
218
221
|
console.log(chalk.gray(`Session ID: ${session.id}`));
|
|
219
222
|
console.log(chalk.gray(`Messages: ${session.history.length}`));
|
|
220
223
|
console.log(
|
|
221
|
-
chalk.gray(`Last updated: ${session.updated.toLocaleString()}\n`)
|
|
224
|
+
chalk.gray(`Last updated: ${session.updated.toLocaleString()}\n`),
|
|
222
225
|
);
|
|
223
226
|
|
|
224
227
|
// Show recent messages
|
|
@@ -241,7 +244,7 @@ export class ChatCommands {
|
|
|
241
244
|
'WUNDR_CHAT_RESUME_FAILED',
|
|
242
245
|
'Failed to resume chat session',
|
|
243
246
|
{ sessionId },
|
|
244
|
-
true
|
|
247
|
+
true,
|
|
245
248
|
);
|
|
246
249
|
}
|
|
247
250
|
}
|
|
@@ -278,7 +281,7 @@ export class ChatCommands {
|
|
|
278
281
|
'WUNDR_CHAT_LIST_FAILED',
|
|
279
282
|
'Failed to list chat sessions',
|
|
280
283
|
{ options },
|
|
281
|
-
true
|
|
284
|
+
true,
|
|
282
285
|
);
|
|
283
286
|
}
|
|
284
287
|
}
|
|
@@ -288,7 +291,7 @@ export class ChatCommands {
|
|
|
288
291
|
*/
|
|
289
292
|
private async askSingleQuestion(
|
|
290
293
|
message: string,
|
|
291
|
-
options: any
|
|
294
|
+
options: any,
|
|
292
295
|
): Promise<void> {
|
|
293
296
|
try {
|
|
294
297
|
logger.debug('Processing single question...');
|
|
@@ -323,7 +326,7 @@ export class ChatCommands {
|
|
|
323
326
|
'WUNDR_CHAT_ASK_FAILED',
|
|
324
327
|
'Failed to process question',
|
|
325
328
|
{ message, options },
|
|
326
|
-
true
|
|
329
|
+
true,
|
|
327
330
|
);
|
|
328
331
|
}
|
|
329
332
|
}
|
|
@@ -333,7 +336,7 @@ export class ChatCommands {
|
|
|
333
336
|
*/
|
|
334
337
|
private async exportChatSession(
|
|
335
338
|
sessionId: string,
|
|
336
|
-
options: any
|
|
339
|
+
options: any,
|
|
337
340
|
): Promise<void> {
|
|
338
341
|
try {
|
|
339
342
|
logger.info(`Exporting chat session: ${sessionId}`);
|
|
@@ -369,7 +372,7 @@ export class ChatCommands {
|
|
|
369
372
|
'WUNDR_CHAT_EXPORT_FAILED',
|
|
370
373
|
'Failed to export chat session',
|
|
371
374
|
{ sessionId, options },
|
|
372
|
-
true
|
|
375
|
+
true,
|
|
373
376
|
);
|
|
374
377
|
}
|
|
375
378
|
}
|
|
@@ -410,7 +413,7 @@ export class ChatCommands {
|
|
|
410
413
|
'WUNDR_CHAT_IMPORT_FAILED',
|
|
411
414
|
'Failed to import chat session',
|
|
412
415
|
{ file, options },
|
|
413
|
-
true
|
|
416
|
+
true,
|
|
414
417
|
);
|
|
415
418
|
}
|
|
416
419
|
}
|
|
@@ -420,7 +423,7 @@ export class ChatCommands {
|
|
|
420
423
|
*/
|
|
421
424
|
private async deleteChatSession(
|
|
422
425
|
sessionId: string,
|
|
423
|
-
options: any
|
|
426
|
+
options: any,
|
|
424
427
|
): Promise<void> {
|
|
425
428
|
try {
|
|
426
429
|
const session = await this.loadChatSession(sessionId);
|
|
@@ -453,7 +456,7 @@ export class ChatCommands {
|
|
|
453
456
|
'WUNDR_CHAT_DELETE_FAILED',
|
|
454
457
|
'Failed to delete chat session',
|
|
455
458
|
{ sessionId, options },
|
|
456
|
-
true
|
|
459
|
+
true,
|
|
457
460
|
);
|
|
458
461
|
}
|
|
459
462
|
}
|
|
@@ -487,7 +490,7 @@ export class ChatCommands {
|
|
|
487
490
|
'WUNDR_CHAT_FILE_FAILED',
|
|
488
491
|
'Failed to chat with file',
|
|
489
492
|
{ file, options },
|
|
490
|
-
true
|
|
493
|
+
true,
|
|
491
494
|
);
|
|
492
495
|
}
|
|
493
496
|
}
|
|
@@ -530,7 +533,7 @@ export class ChatCommands {
|
|
|
530
533
|
'WUNDR_CHAT_CODE_FAILED',
|
|
531
534
|
'Failed to chat with code',
|
|
532
535
|
{ options },
|
|
533
|
-
true
|
|
536
|
+
true,
|
|
534
537
|
);
|
|
535
538
|
}
|
|
536
539
|
}
|
|
@@ -582,7 +585,7 @@ export class ChatCommands {
|
|
|
582
585
|
} catch (error) {
|
|
583
586
|
logger.error('Chat error:', error);
|
|
584
587
|
console.log(
|
|
585
|
-
chalk.red('Sorry, there was an error processing your message.\n')
|
|
588
|
+
chalk.red('Sorry, there was an error processing your message.\n'),
|
|
586
589
|
);
|
|
587
590
|
}
|
|
588
591
|
}
|
|
@@ -595,7 +598,7 @@ export class ChatCommands {
|
|
|
595
598
|
|
|
596
599
|
private async sendMessage(
|
|
597
600
|
session: ChatSession,
|
|
598
|
-
message: string
|
|
601
|
+
message: string,
|
|
599
602
|
): Promise<string> {
|
|
600
603
|
// Add user message to history
|
|
601
604
|
const userMessage: ChatMessage = {
|
|
@@ -641,7 +644,7 @@ export class ChatCommands {
|
|
|
641
644
|
|
|
642
645
|
private async handleChatCommand(
|
|
643
646
|
session: ChatSession,
|
|
644
|
-
command: string
|
|
647
|
+
command: string,
|
|
645
648
|
): Promise<void> {
|
|
646
649
|
const [cmd, ...args] = command.slice(1).split(' ');
|
|
647
650
|
|
|
@@ -690,20 +693,20 @@ export class ChatCommands {
|
|
|
690
693
|
process.cwd(),
|
|
691
694
|
'.wundr',
|
|
692
695
|
'chat',
|
|
693
|
-
`${session.id}.json
|
|
696
|
+
`${session.id}.json`,
|
|
694
697
|
);
|
|
695
698
|
await fs.ensureDir(path.dirname(sessionPath));
|
|
696
699
|
await fs.writeJson(sessionPath, session, { spaces: 2 });
|
|
697
700
|
}
|
|
698
701
|
|
|
699
702
|
private async loadChatSession(
|
|
700
|
-
sessionId: string
|
|
703
|
+
sessionId: string,
|
|
701
704
|
): Promise<ChatSession | null> {
|
|
702
705
|
const sessionPath = path.join(
|
|
703
706
|
process.cwd(),
|
|
704
707
|
'.wundr',
|
|
705
708
|
'chat',
|
|
706
|
-
`${sessionId}.json
|
|
709
|
+
`${sessionId}.json`,
|
|
707
710
|
);
|
|
708
711
|
if (await fs.pathExists(sessionPath)) {
|
|
709
712
|
const data = await fs.readJson(sessionPath);
|
|
@@ -748,7 +751,7 @@ export class ChatCommands {
|
|
|
748
751
|
process.cwd(),
|
|
749
752
|
'.wundr',
|
|
750
753
|
'chat',
|
|
751
|
-
`${sessionId}.json
|
|
754
|
+
`${sessionId}.json`,
|
|
752
755
|
);
|
|
753
756
|
if (await fs.pathExists(sessionPath)) {
|
|
754
757
|
await fs.remove(sessionPath);
|
|
@@ -866,7 +869,7 @@ export class ChatCommands {
|
|
|
866
869
|
Object.entries(variables).forEach(([key, value]) => {
|
|
867
870
|
processedTemplate = processedTemplate.replace(
|
|
868
871
|
`{{${key}}}`,
|
|
869
|
-
String(value)
|
|
872
|
+
String(value),
|
|
870
873
|
);
|
|
871
874
|
});
|
|
872
875
|
}
|