@wundr.io/cli 1.0.1 → 1.0.4
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 +799 -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 +600 -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 +6 -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 +46 -17
- package/src/commands/ai.ts +196 -88
- package/src/commands/alignment.ts +1212 -0
- package/src/commands/analyze-optimized.ts +394 -89
- 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 +490 -20
- 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
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Logger } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Enhanced logger with multiple levels and colored output
|
|
4
|
+
*/
|
|
5
|
+
declare class WundrLogger implements Logger {
|
|
6
|
+
private level;
|
|
7
|
+
private silent;
|
|
8
|
+
setLevel(level: 'debug' | 'info' | 'warn' | 'error'): void;
|
|
9
|
+
setSilent(silent: boolean): void;
|
|
10
|
+
private shouldLog;
|
|
11
|
+
private formatMessage;
|
|
12
|
+
debug(message: string, ...args: any[]): void;
|
|
13
|
+
info(message: string, ...args: any[]): void;
|
|
14
|
+
warn(message: string, ...args: any[]): void;
|
|
15
|
+
error(message: string, ...args: any[]): void;
|
|
16
|
+
success(message: string, ...args: any[]): void;
|
|
17
|
+
table(data: any[]): void;
|
|
18
|
+
json(data: any): void;
|
|
19
|
+
group(label: string): void;
|
|
20
|
+
groupEnd(): void;
|
|
21
|
+
progress(current: number, total: number, message?: string): void;
|
|
22
|
+
}
|
|
23
|
+
export declare const logger: WundrLogger;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;GAEG;AACH,cAAM,WAAY,YAAW,MAAM;IACjC,OAAO,CAAC,KAAK,CAA+C;IAC5D,OAAO,CAAC,MAAM,CAAS;IAEvB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI;IAI1D,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAIhC,OAAO,CAAC,SAAS;IASjB,OAAO,CAAC,aAAa;IAYrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAO5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAO3C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAO3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAO5C,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAQ9C,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAOxB,IAAI,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI;IAOrB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAO1B,QAAQ,IAAI,IAAI;IAQhB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;CAmBjE;AAED,eAAO,MAAM,MAAM,aAAoB,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.logger = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
/**
|
|
7
|
+
* Enhanced logger with multiple levels and colored output
|
|
8
|
+
*/
|
|
9
|
+
class WundrLogger {
|
|
10
|
+
level = 'info';
|
|
11
|
+
silent = false;
|
|
12
|
+
setLevel(level) {
|
|
13
|
+
this.level = level;
|
|
14
|
+
}
|
|
15
|
+
setSilent(silent) {
|
|
16
|
+
this.silent = silent;
|
|
17
|
+
}
|
|
18
|
+
shouldLog(level) {
|
|
19
|
+
if (this.silent) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const levels = { debug: 0, info: 1, warn: 2, error: 3 };
|
|
23
|
+
return levels[level] >= levels[this.level];
|
|
24
|
+
}
|
|
25
|
+
formatMessage(level, message, ...args) {
|
|
26
|
+
const timestamp = new Date().toISOString();
|
|
27
|
+
const prefix = `[${timestamp}] [${level.toUpperCase()}]`;
|
|
28
|
+
const fullMessage = args.length > 0 ? `${message} ${args.join(' ')}` : message;
|
|
29
|
+
return `${prefix} ${fullMessage}`;
|
|
30
|
+
}
|
|
31
|
+
debug(message, ...args) {
|
|
32
|
+
if (!this.shouldLog('debug')) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
console.log(chalk_1.default.gray(this.formatMessage('debug', message, ...args)));
|
|
36
|
+
}
|
|
37
|
+
info(message, ...args) {
|
|
38
|
+
if (!this.shouldLog('info')) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
console.log(chalk_1.default.blue(this.formatMessage('info', message, ...args)));
|
|
42
|
+
}
|
|
43
|
+
warn(message, ...args) {
|
|
44
|
+
if (!this.shouldLog('warn')) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
console.warn(chalk_1.default.yellow(this.formatMessage('warn', message, ...args)));
|
|
48
|
+
}
|
|
49
|
+
error(message, ...args) {
|
|
50
|
+
if (!this.shouldLog('error')) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
console.error(chalk_1.default.red(this.formatMessage('error', message, ...args)));
|
|
54
|
+
}
|
|
55
|
+
success(message, ...args) {
|
|
56
|
+
if (!this.shouldLog('info')) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
console.log(chalk_1.default.green(this.formatMessage('success', message, ...args)));
|
|
60
|
+
}
|
|
61
|
+
// Utility methods for structured logging
|
|
62
|
+
table(data) {
|
|
63
|
+
if (this.silent) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
console.table(data);
|
|
67
|
+
}
|
|
68
|
+
json(data) {
|
|
69
|
+
if (this.silent) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
console.log(JSON.stringify(data, null, 2));
|
|
73
|
+
}
|
|
74
|
+
group(label) {
|
|
75
|
+
if (this.silent) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
console.group(chalk_1.default.cyan(label));
|
|
79
|
+
}
|
|
80
|
+
groupEnd() {
|
|
81
|
+
if (this.silent) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
console.groupEnd();
|
|
85
|
+
}
|
|
86
|
+
// Progress logging
|
|
87
|
+
progress(current, total, message) {
|
|
88
|
+
if (this.silent) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const percentage = Math.round((current / total) * 100);
|
|
92
|
+
const bar = '█'.repeat(Math.round(percentage / 2));
|
|
93
|
+
const empty = '░'.repeat(50 - Math.round(percentage / 2));
|
|
94
|
+
const progress = `[${bar}${empty}] ${percentage}%`;
|
|
95
|
+
const output = message
|
|
96
|
+
? `${chalk_1.default.cyan(progress)} ${message}`
|
|
97
|
+
: chalk_1.default.cyan(progress);
|
|
98
|
+
process.stdout.write(`\r${output}`);
|
|
99
|
+
if (current === total) {
|
|
100
|
+
process.stdout.write('\n');
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.logger = new WundrLogger();
|
|
105
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAI1B;;GAEG;AACH,MAAM,WAAW;IACP,KAAK,GAAwC,MAAM,CAAC;IACpD,MAAM,GAAG,KAAK,CAAC;IAEvB,QAAQ,CAAC,KAA0C;QACjD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,SAAS,CAAC,MAAe;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEO,SAAS,CAAC,KAAa;QAC7B,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACtB,OAAO,KAAK,CAAC;QACb,CAAC;QAEG,MAAM,MAAM,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACxD,OAAO,MAAM,CAAC,KAA4B,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpE,CAAC;IAEO,aAAa,CACnB,KAAa,EACb,OAAe,EACf,GAAG,IAAW;QAEd,MAAM,SAAS,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC3C,MAAM,MAAM,GAAG,IAAI,SAAS,MAAM,KAAK,CAAC,WAAW,EAAE,GAAG,CAAC;QACzD,MAAM,WAAW,GACf,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CA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,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;QACnD,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;QAC1D,MAAM,QAAQ,GAAG,IAAI,GAAG,GAAG,KAAK,KAAK,UAAU,GAAG,CAAC;QAEnD,MAAM,MAAM,GAAG,OAAO;YACpB,CAAC,CAAC,GAAG,eAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,OAAO,EAAE;YACtC,CAAC,CAAC,eAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAEzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC;QAEpC,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;YACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;CACF;AAEY,QAAA,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wundr.io/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Unified CLI framework for the Wundr platform",
|
|
5
5
|
"keywords": ["wundr", "cli", "commander", "interactive", "tui", "automation"],
|
|
6
6
|
"homepage": "https://wundr.io",
|
|
@@ -42,9 +42,11 @@
|
|
|
42
42
|
"@oclif/plugin-plugins": "^4.1.0",
|
|
43
43
|
"@types/axios": "^0.9.36",
|
|
44
44
|
"@types/open": "^6.2.1",
|
|
45
|
-
"@wundr.io/computer-setup": "
|
|
46
|
-
"@wundr.io/config": "
|
|
47
|
-
"@wundr.io/core": "
|
|
45
|
+
"@wundr.io/computer-setup": "workspace:*",
|
|
46
|
+
"@wundr.io/config": "workspace:*",
|
|
47
|
+
"@wundr.io/core": "workspace:*",
|
|
48
|
+
"@wundr.io/governance": "workspace:*",
|
|
49
|
+
"@wundr.io/guardian-dashboard": "workspace:*",
|
|
48
50
|
"axios": "^1.11.0",
|
|
49
51
|
"blessed": "^0.1.81",
|
|
50
52
|
"blessed-contrib": "^4.11.0",
|
package/src/ai/ai-service.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { ClaudeClient
|
|
2
|
-
import { ConfigManager } from '../utils/config-manager';
|
|
1
|
+
import { ClaudeClient } from './claude-client';
|
|
3
2
|
import { logger } from '../utils/logger';
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
import type { ChatSession, ChatMessage } from '../types';
|
|
5
|
+
import type { ClaudeMessage } from './claude-client';
|
|
6
|
+
import type { ConfigManager } from '../utils/config-manager';
|
|
7
|
+
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* AI service configuration
|
|
@@ -51,7 +54,7 @@ export class AIService {
|
|
|
51
54
|
if (this.config.provider === 'claude') {
|
|
52
55
|
if (!this.config.apiKey) {
|
|
53
56
|
logger.warn(
|
|
54
|
-
'Claude API key not configured. AI features will be limited.'
|
|
57
|
+
'Claude API key not configured. AI features will be limited.',
|
|
55
58
|
);
|
|
56
59
|
logger.info('Configure your API key using: wundr ai setup');
|
|
57
60
|
logger.info('Or set the CLAUDE_API_KEY environment variable');
|
|
@@ -67,7 +70,7 @@ export class AIService {
|
|
|
67
70
|
});
|
|
68
71
|
|
|
69
72
|
logger.info(
|
|
70
|
-
`Initialized Claude client with model: ${this.config.model}
|
|
73
|
+
`Initialized Claude client with model: ${this.config.model}`,
|
|
71
74
|
);
|
|
72
75
|
} else {
|
|
73
76
|
throw new Error(`Unsupported AI provider: ${this.config.provider}`);
|
|
@@ -115,7 +118,7 @@ export class AIService {
|
|
|
115
118
|
async sendMessage(
|
|
116
119
|
sessionId: string,
|
|
117
120
|
message: string,
|
|
118
|
-
context?: ConversationContext
|
|
121
|
+
context?: ConversationContext,
|
|
119
122
|
): Promise<string> {
|
|
120
123
|
this.ensureClientInitialized();
|
|
121
124
|
|
|
@@ -131,7 +134,7 @@ export class AIService {
|
|
|
131
134
|
const systemPrompt = this.buildSystemPrompt(context);
|
|
132
135
|
const response = await this.claudeClient!.sendConversation(
|
|
133
136
|
conversationMessages,
|
|
134
|
-
systemPrompt
|
|
137
|
+
systemPrompt,
|
|
135
138
|
);
|
|
136
139
|
|
|
137
140
|
// Add AI response to history
|
|
@@ -156,7 +159,7 @@ export class AIService {
|
|
|
156
159
|
async *streamMessage(
|
|
157
160
|
sessionId: string,
|
|
158
161
|
message: string,
|
|
159
|
-
context?: ConversationContext
|
|
162
|
+
context?: ConversationContext,
|
|
160
163
|
): AsyncGenerator<string, string, unknown> {
|
|
161
164
|
this.ensureClientInitialized();
|
|
162
165
|
|
|
@@ -174,7 +177,7 @@ export class AIService {
|
|
|
174
177
|
|
|
175
178
|
for await (const chunk of this.claudeClient!.streamConversation(
|
|
176
179
|
conversationMessages,
|
|
177
|
-
systemPrompt
|
|
180
|
+
systemPrompt,
|
|
178
181
|
)) {
|
|
179
182
|
fullResponse += chunk;
|
|
180
183
|
yield chunk;
|
|
@@ -201,7 +204,7 @@ export class AIService {
|
|
|
201
204
|
*/
|
|
202
205
|
async parseNaturalLanguageCommand(
|
|
203
206
|
input: string,
|
|
204
|
-
_context?: ConversationContext
|
|
207
|
+
_context?: ConversationContext,
|
|
205
208
|
): Promise<{
|
|
206
209
|
intent: string;
|
|
207
210
|
command: string;
|
|
@@ -226,7 +229,7 @@ export class AIService {
|
|
|
226
229
|
|
|
227
230
|
const result = await this.claudeClient!.analyzeIntent(
|
|
228
231
|
input,
|
|
229
|
-
availableCommands
|
|
232
|
+
availableCommands,
|
|
230
233
|
);
|
|
231
234
|
|
|
232
235
|
return {
|
|
@@ -248,7 +251,7 @@ export class AIService {
|
|
|
248
251
|
*/
|
|
249
252
|
async suggestCommands(
|
|
250
253
|
goal: string,
|
|
251
|
-
context?: ConversationContext
|
|
254
|
+
context?: ConversationContext,
|
|
252
255
|
): Promise<
|
|
253
256
|
Array<{
|
|
254
257
|
command: string;
|
|
@@ -276,7 +279,7 @@ export class AIService {
|
|
|
276
279
|
const result = await this.claudeClient!.suggestCommands(
|
|
277
280
|
projectContext,
|
|
278
281
|
goal,
|
|
279
|
-
availableCommands
|
|
282
|
+
availableCommands,
|
|
280
283
|
);
|
|
281
284
|
|
|
282
285
|
return result.suggestions.map(suggestion => ({
|
|
@@ -295,7 +298,7 @@ export class AIService {
|
|
|
295
298
|
async explainCommandResults(
|
|
296
299
|
command: string,
|
|
297
300
|
output: string,
|
|
298
|
-
context?: ConversationContext
|
|
301
|
+
context?: ConversationContext,
|
|
299
302
|
): Promise<string> {
|
|
300
303
|
this.ensureClientInitialized();
|
|
301
304
|
|
|
@@ -306,7 +309,7 @@ export class AIService {
|
|
|
306
309
|
return await this.claudeClient!.explainResults(
|
|
307
310
|
command,
|
|
308
311
|
output,
|
|
309
|
-
contextString
|
|
312
|
+
contextString,
|
|
310
313
|
);
|
|
311
314
|
} catch (error) {
|
|
312
315
|
logger.error('Failed to explain command results:', error);
|
|
@@ -320,7 +323,7 @@ export class AIService {
|
|
|
320
323
|
async generateContextualHelp(
|
|
321
324
|
command: string,
|
|
322
325
|
context?: ConversationContext,
|
|
323
|
-
userLevel: 'beginner' | 'intermediate' | 'advanced' = 'intermediate'
|
|
326
|
+
userLevel: 'beginner' | 'intermediate' | 'advanced' = 'intermediate',
|
|
324
327
|
): Promise<string> {
|
|
325
328
|
this.ensureClientInitialized();
|
|
326
329
|
|
|
@@ -329,7 +332,7 @@ export class AIService {
|
|
|
329
332
|
return await this.claudeClient!.generateHelp(
|
|
330
333
|
command,
|
|
331
334
|
userContext,
|
|
332
|
-
userLevel
|
|
335
|
+
userLevel,
|
|
333
336
|
);
|
|
334
337
|
} catch (error) {
|
|
335
338
|
logger.error('Failed to generate contextual help:', error);
|
|
@@ -489,12 +492,12 @@ export class AIService {
|
|
|
489
492
|
|
|
490
493
|
if (!configuredKey) {
|
|
491
494
|
throw new Error(
|
|
492
|
-
|
|
495
|
+
'AI API key not configured.\n\nTo set up AI features:\n1. Run: wundr ai setup\n2. Or set environment variable: export CLAUDE_API_KEY=your_key_here\n3. Or add to config: wundr ai config set apiKey your_key_here',
|
|
493
496
|
);
|
|
494
497
|
}
|
|
495
498
|
|
|
496
499
|
throw new Error(
|
|
497
|
-
'AI client failed to initialize. Please check your configuration.'
|
|
500
|
+
'AI client failed to initialize. Please check your configuration.',
|
|
498
501
|
);
|
|
499
502
|
}
|
|
500
503
|
}
|
package/src/ai/claude-client.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
|
|
2
3
|
import { logger } from '../utils/logger';
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
import type { WundrError } from '../types';
|
|
4
6
|
|
|
5
7
|
/**
|
|
6
8
|
* Claude API client configuration
|
|
@@ -92,7 +94,7 @@ export class ClaudeClient {
|
|
|
92
94
|
async sendMessage(
|
|
93
95
|
message: string,
|
|
94
96
|
systemPrompt?: string,
|
|
95
|
-
options?: Partial<ClaudeConfig
|
|
97
|
+
options?: Partial<ClaudeConfig>,
|
|
96
98
|
): Promise<string> {
|
|
97
99
|
try {
|
|
98
100
|
const messages: ClaudeMessage[] = [];
|
|
@@ -122,7 +124,7 @@ export class ClaudeClient {
|
|
|
122
124
|
async sendConversation(
|
|
123
125
|
messages: ClaudeMessage[],
|
|
124
126
|
systemPrompt?: string,
|
|
125
|
-
options?: Partial<ClaudeConfig
|
|
127
|
+
options?: Partial<ClaudeConfig>,
|
|
126
128
|
): Promise<string> {
|
|
127
129
|
try {
|
|
128
130
|
const conversationMessages = [...messages];
|
|
@@ -150,7 +152,7 @@ export class ClaudeClient {
|
|
|
150
152
|
async *streamConversation(
|
|
151
153
|
messages: ClaudeMessage[],
|
|
152
154
|
systemPrompt?: string,
|
|
153
|
-
options?: Partial<ClaudeConfig
|
|
155
|
+
options?: Partial<ClaudeConfig>,
|
|
154
156
|
): AsyncGenerator<string, void, unknown> {
|
|
155
157
|
try {
|
|
156
158
|
const conversationMessages = [...messages];
|
|
@@ -170,7 +172,7 @@ export class ClaudeClient {
|
|
|
170
172
|
},
|
|
171
173
|
{
|
|
172
174
|
responseType: 'stream',
|
|
173
|
-
}
|
|
175
|
+
},
|
|
174
176
|
);
|
|
175
177
|
|
|
176
178
|
let buffer = '';
|
|
@@ -183,7 +185,9 @@ export class ClaudeClient {
|
|
|
183
185
|
for (const line of lines) {
|
|
184
186
|
if (line.startsWith('data: ')) {
|
|
185
187
|
const data = line.slice(6);
|
|
186
|
-
if (data === '[DONE]')
|
|
188
|
+
if (data === '[DONE]') {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
187
191
|
|
|
188
192
|
try {
|
|
189
193
|
const parsed: ClaudeStreamChunk = JSON.parse(data);
|
|
@@ -200,7 +204,7 @@ export class ClaudeClient {
|
|
|
200
204
|
} catch (error) {
|
|
201
205
|
throw this.handleError(
|
|
202
206
|
error,
|
|
203
|
-
'Failed to stream conversation with Claude'
|
|
207
|
+
'Failed to stream conversation with Claude',
|
|
204
208
|
);
|
|
205
209
|
}
|
|
206
210
|
}
|
|
@@ -210,7 +214,7 @@ export class ClaudeClient {
|
|
|
210
214
|
*/
|
|
211
215
|
async analyzeIntent(
|
|
212
216
|
input: string,
|
|
213
|
-
availableCommands: string[]
|
|
217
|
+
availableCommands: string[],
|
|
214
218
|
): Promise<{
|
|
215
219
|
intent: string;
|
|
216
220
|
confidence: number;
|
|
@@ -251,7 +255,7 @@ Respond with JSON only in this format:
|
|
|
251
255
|
async suggestCommands(
|
|
252
256
|
projectContext: string,
|
|
253
257
|
userGoal: string,
|
|
254
|
-
availableCommands: string[]
|
|
258
|
+
availableCommands: string[],
|
|
255
259
|
): Promise<{
|
|
256
260
|
suggestions: Array<{
|
|
257
261
|
command: string;
|
|
@@ -294,7 +298,7 @@ Respond with JSON only:
|
|
|
294
298
|
async explainResults(
|
|
295
299
|
command: string,
|
|
296
300
|
output: string,
|
|
297
|
-
context?: string
|
|
301
|
+
context?: string,
|
|
298
302
|
): Promise<string> {
|
|
299
303
|
const systemPrompt = `You are a helpful CLI assistant. Explain the results of a CLI command in clear, natural language. Focus on:
|
|
300
304
|
1. What the command did
|
|
@@ -324,7 +328,7 @@ ${output}`;
|
|
|
324
328
|
async generateHelp(
|
|
325
329
|
command: string,
|
|
326
330
|
userContext: string,
|
|
327
|
-
difficulty: 'beginner' | 'intermediate' | 'advanced' = 'intermediate'
|
|
331
|
+
difficulty: 'beginner' | 'intermediate' | 'advanced' = 'intermediate',
|
|
328
332
|
): Promise<string> {
|
|
329
333
|
const systemPrompt = `You are a CLI documentation assistant. Generate helpful, contextual guidance for CLI commands. Adapt the explanation level to: ${difficulty}
|
|
330
334
|
|
|
@@ -360,7 +364,7 @@ User Context: ${userContext}`;
|
|
|
360
364
|
'Respond with just "OK" if you can understand this message.',
|
|
361
365
|
{
|
|
362
366
|
maxTokens: 10,
|
|
363
|
-
}
|
|
367
|
+
},
|
|
364
368
|
);
|
|
365
369
|
return true;
|
|
366
370
|
} catch (error) {
|
|
@@ -414,28 +418,28 @@ User Context: ${userContext}`;
|
|
|
414
418
|
this.client.interceptors.request.use(
|
|
415
419
|
(config: any) => {
|
|
416
420
|
logger.debug(
|
|
417
|
-
`Claude API Request: ${config.method?.toUpperCase()} ${config.url}
|
|
421
|
+
`Claude API Request: ${config.method?.toUpperCase()} ${config.url}`,
|
|
418
422
|
);
|
|
419
423
|
return config;
|
|
420
424
|
},
|
|
421
425
|
(error: any) => {
|
|
422
426
|
logger.error('Claude API Request Error:', error);
|
|
423
427
|
return Promise.reject(error);
|
|
424
|
-
}
|
|
428
|
+
},
|
|
425
429
|
);
|
|
426
430
|
|
|
427
431
|
// Response interceptor
|
|
428
432
|
this.client.interceptors.response.use(
|
|
429
433
|
(response: any) => {
|
|
430
434
|
logger.debug(
|
|
431
|
-
`Claude API Response: ${response.status} ${response.statusText}
|
|
435
|
+
`Claude API Response: ${response.status} ${response.statusText}`,
|
|
432
436
|
);
|
|
433
437
|
return response;
|
|
434
438
|
},
|
|
435
439
|
(error: any) => {
|
|
436
440
|
logger.error('Claude API Response Error:', error);
|
|
437
441
|
return Promise.reject(error);
|
|
438
|
-
}
|
|
442
|
+
},
|
|
439
443
|
);
|
|
440
444
|
}
|
|
441
445
|
|