@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.
Files changed (249) hide show
  1. package/dist/ai/ai-service.d.ts +152 -0
  2. package/dist/ai/ai-service.d.ts.map +1 -0
  3. package/dist/ai/ai-service.js +430 -0
  4. package/dist/ai/ai-service.js.map +1 -0
  5. package/dist/ai/claude-client.d.ts +130 -0
  6. package/dist/ai/claude-client.d.ts.map +1 -0
  7. package/dist/ai/claude-client.js +340 -0
  8. package/dist/ai/claude-client.js.map +1 -0
  9. package/dist/ai/conversation-manager.d.ts +164 -0
  10. package/dist/ai/conversation-manager.d.ts.map +1 -0
  11. package/dist/ai/conversation-manager.js +614 -0
  12. package/dist/ai/conversation-manager.js.map +1 -0
  13. package/dist/ai/index.d.ts +5 -0
  14. package/dist/ai/index.d.ts.map +1 -0
  15. package/dist/ai/index.js +8 -0
  16. package/dist/ai/index.js.map +1 -0
  17. package/dist/cli.d.ts +36 -0
  18. package/dist/cli.d.ts.map +1 -0
  19. package/dist/cli.js +192 -0
  20. package/dist/cli.js.map +1 -0
  21. package/dist/commands/ai.d.ts +89 -0
  22. package/dist/commands/ai.d.ts.map +1 -0
  23. package/dist/commands/ai.js +799 -0
  24. package/dist/commands/ai.js.map +1 -0
  25. package/dist/commands/alignment.d.ts +78 -0
  26. package/dist/commands/alignment.d.ts.map +1 -0
  27. package/dist/commands/alignment.js +817 -0
  28. package/dist/commands/alignment.js.map +1 -0
  29. package/dist/commands/analyze-optimized.d.ts +14 -0
  30. package/dist/commands/analyze-optimized.d.ts.map +1 -0
  31. package/dist/commands/analyze-optimized.js +600 -0
  32. package/dist/commands/analyze-optimized.js.map +1 -0
  33. package/dist/commands/analyze.d.ts +65 -0
  34. package/dist/commands/analyze.d.ts.map +1 -0
  35. package/dist/commands/analyze.js +435 -0
  36. package/dist/commands/analyze.js.map +1 -0
  37. package/dist/commands/batch.d.ts +71 -0
  38. package/dist/commands/batch.d.ts.map +1 -0
  39. package/dist/commands/batch.js +738 -0
  40. package/dist/commands/batch.js.map +1 -0
  41. package/dist/commands/chat.d.ts +71 -0
  42. package/dist/commands/chat.d.ts.map +1 -0
  43. package/dist/commands/chat.js +674 -0
  44. package/dist/commands/chat.js.map +1 -0
  45. package/dist/commands/claude-init.d.ts +28 -0
  46. package/dist/commands/claude-init.d.ts.map +1 -0
  47. package/dist/commands/claude-init.js +591 -0
  48. package/dist/commands/claude-init.js.map +1 -0
  49. package/dist/commands/claude-setup.d.ts +119 -0
  50. package/dist/commands/claude-setup.d.ts.map +1 -0
  51. package/dist/commands/claude-setup.js +1073 -0
  52. package/dist/commands/claude-setup.js.map +1 -0
  53. package/dist/commands/computer-setup-commands.d.ts +53 -0
  54. package/dist/commands/computer-setup-commands.d.ts.map +1 -0
  55. package/dist/commands/computer-setup-commands.js +705 -0
  56. package/dist/commands/computer-setup-commands.js.map +1 -0
  57. package/dist/commands/computer-setup.d.ts +7 -0
  58. package/dist/commands/computer-setup.d.ts.map +1 -0
  59. package/dist/commands/computer-setup.js +849 -0
  60. package/dist/commands/computer-setup.js.map +1 -0
  61. package/dist/commands/create-command.d.ts +7 -0
  62. package/dist/commands/create-command.d.ts.map +1 -0
  63. package/dist/commands/create-command.js +158 -0
  64. package/dist/commands/create-command.js.map +1 -0
  65. package/dist/commands/create.d.ts +74 -0
  66. package/dist/commands/create.d.ts.map +1 -0
  67. package/dist/commands/create.js +556 -0
  68. package/dist/commands/create.js.map +1 -0
  69. package/dist/commands/dashboard.d.ts +91 -0
  70. package/dist/commands/dashboard.d.ts.map +1 -0
  71. package/dist/commands/dashboard.js +538 -0
  72. package/dist/commands/dashboard.js.map +1 -0
  73. package/dist/commands/govern.d.ts +70 -0
  74. package/dist/commands/govern.d.ts.map +1 -0
  75. package/dist/commands/govern.js +481 -0
  76. package/dist/commands/govern.js.map +1 -0
  77. package/dist/commands/governance.d.ts +17 -0
  78. package/dist/commands/governance.d.ts.map +1 -0
  79. package/dist/commands/governance.js +703 -0
  80. package/dist/commands/governance.js.map +1 -0
  81. package/dist/commands/guardian.d.ts +20 -0
  82. package/dist/commands/guardian.d.ts.map +1 -0
  83. package/dist/commands/guardian.js +597 -0
  84. package/dist/commands/guardian.js.map +1 -0
  85. package/dist/commands/init.d.ts +59 -0
  86. package/dist/commands/init.d.ts.map +1 -0
  87. package/dist/commands/init.js +650 -0
  88. package/dist/commands/init.js.map +1 -0
  89. package/dist/commands/performance-optimizer.d.ts +30 -0
  90. package/dist/commands/performance-optimizer.d.ts.map +1 -0
  91. package/dist/commands/performance-optimizer.js +650 -0
  92. package/dist/commands/performance-optimizer.js.map +1 -0
  93. package/dist/commands/plugins.d.ts +87 -0
  94. package/dist/commands/plugins.d.ts.map +1 -0
  95. package/dist/commands/plugins.js +685 -0
  96. package/dist/commands/plugins.js.map +1 -0
  97. package/dist/commands/rag.d.ts +7 -0
  98. package/dist/commands/rag.d.ts.map +1 -0
  99. package/dist/commands/rag.js +748 -0
  100. package/dist/commands/rag.js.map +1 -0
  101. package/dist/commands/session.d.ts +41 -0
  102. package/dist/commands/session.d.ts.map +1 -0
  103. package/dist/commands/session.js +441 -0
  104. package/dist/commands/session.js.map +1 -0
  105. package/dist/commands/setup.d.ts +29 -0
  106. package/dist/commands/setup.d.ts.map +1 -0
  107. package/dist/commands/setup.js +397 -0
  108. package/dist/commands/setup.js.map +1 -0
  109. package/dist/commands/test-init.d.ts +9 -0
  110. package/dist/commands/test-init.d.ts.map +1 -0
  111. package/dist/commands/test-init.js +222 -0
  112. package/dist/commands/test-init.js.map +1 -0
  113. package/dist/commands/test.d.ts +25 -0
  114. package/dist/commands/test.d.ts.map +1 -0
  115. package/dist/commands/test.js +217 -0
  116. package/dist/commands/test.js.map +1 -0
  117. package/dist/commands/vp.d.ts +7 -0
  118. package/dist/commands/vp.d.ts.map +1 -0
  119. package/dist/commands/vp.js +571 -0
  120. package/dist/commands/vp.js.map +1 -0
  121. package/dist/commands/watch.d.ts +76 -0
  122. package/dist/commands/watch.d.ts.map +1 -0
  123. package/dist/commands/watch.js +613 -0
  124. package/dist/commands/watch.js.map +1 -0
  125. package/dist/commands/worktree.d.ts +63 -0
  126. package/dist/commands/worktree.d.ts.map +1 -0
  127. package/dist/commands/worktree.js +774 -0
  128. package/dist/commands/worktree.js.map +1 -0
  129. package/dist/context/context-manager.d.ts +155 -0
  130. package/dist/context/context-manager.d.ts.map +1 -0
  131. package/dist/context/context-manager.js +383 -0
  132. package/dist/context/context-manager.js.map +1 -0
  133. package/dist/context/index.d.ts +3 -0
  134. package/dist/context/index.d.ts.map +1 -0
  135. package/dist/context/index.js +6 -0
  136. package/dist/context/index.js.map +1 -0
  137. package/dist/context/session-manager.d.ts +207 -0
  138. package/dist/context/session-manager.d.ts.map +1 -0
  139. package/dist/context/session-manager.js +686 -0
  140. package/dist/context/session-manager.js.map +1 -0
  141. package/dist/index.d.ts +8 -0
  142. package/dist/index.d.ts.map +1 -0
  143. package/dist/index.js +51 -0
  144. package/dist/index.js.map +1 -0
  145. package/dist/interactive/interactive-mode.d.ts +76 -0
  146. package/dist/interactive/interactive-mode.d.ts.map +1 -0
  147. package/dist/interactive/interactive-mode.js +732 -0
  148. package/dist/interactive/interactive-mode.js.map +1 -0
  149. package/dist/nlp/command-mapper.d.ts +174 -0
  150. package/dist/nlp/command-mapper.d.ts.map +1 -0
  151. package/dist/nlp/command-mapper.js +624 -0
  152. package/dist/nlp/command-mapper.js.map +1 -0
  153. package/dist/nlp/command-parser.d.ts +106 -0
  154. package/dist/nlp/command-parser.d.ts.map +1 -0
  155. package/dist/nlp/command-parser.js +417 -0
  156. package/dist/nlp/command-parser.js.map +1 -0
  157. package/dist/nlp/index.d.ts +5 -0
  158. package/dist/nlp/index.d.ts.map +1 -0
  159. package/dist/nlp/index.js +8 -0
  160. package/dist/nlp/index.js.map +1 -0
  161. package/dist/nlp/intent-classifier.d.ts +59 -0
  162. package/dist/nlp/intent-classifier.d.ts.map +1 -0
  163. package/dist/nlp/intent-classifier.js +384 -0
  164. package/dist/nlp/intent-classifier.js.map +1 -0
  165. package/dist/nlp/intent-parser.d.ts +152 -0
  166. package/dist/nlp/intent-parser.d.ts.map +1 -0
  167. package/dist/nlp/intent-parser.js +744 -0
  168. package/dist/nlp/intent-parser.js.map +1 -0
  169. package/dist/plugins/plugin-manager.d.ts +120 -0
  170. package/dist/plugins/plugin-manager.d.ts.map +1 -0
  171. package/dist/plugins/plugin-manager.js +595 -0
  172. package/dist/plugins/plugin-manager.js.map +1 -0
  173. package/dist/types/index.d.ts +224 -0
  174. package/dist/types/index.d.ts.map +1 -0
  175. package/dist/types/index.js +3 -0
  176. package/dist/types/index.js.map +1 -0
  177. package/dist/utils/backup-rollback-manager.d.ts +72 -0
  178. package/dist/utils/backup-rollback-manager.d.ts.map +1 -0
  179. package/dist/utils/backup-rollback-manager.js +289 -0
  180. package/dist/utils/backup-rollback-manager.js.map +1 -0
  181. package/dist/utils/claude-config-installer.d.ts +94 -0
  182. package/dist/utils/claude-config-installer.d.ts.map +1 -0
  183. package/dist/utils/claude-config-installer.js +628 -0
  184. package/dist/utils/claude-config-installer.js.map +1 -0
  185. package/dist/utils/config-manager.d.ts +73 -0
  186. package/dist/utils/config-manager.d.ts.map +1 -0
  187. package/dist/utils/config-manager.js +339 -0
  188. package/dist/utils/config-manager.js.map +1 -0
  189. package/dist/utils/error-handler.d.ts +46 -0
  190. package/dist/utils/error-handler.d.ts.map +1 -0
  191. package/dist/utils/error-handler.js +169 -0
  192. package/dist/utils/error-handler.js.map +1 -0
  193. package/dist/utils/logger.d.ts +25 -0
  194. package/dist/utils/logger.d.ts.map +1 -0
  195. package/dist/utils/logger.js +105 -0
  196. package/dist/utils/logger.js.map +1 -0
  197. package/package.json +6 -4
  198. package/src/ai/ai-service.ts +22 -19
  199. package/src/ai/claude-client.ts +20 -16
  200. package/src/ai/conversation-manager.ts +37 -30
  201. package/src/cli.ts +46 -17
  202. package/src/commands/ai.ts +196 -88
  203. package/src/commands/alignment.ts +1212 -0
  204. package/src/commands/analyze-optimized.ts +394 -89
  205. package/src/commands/analyze.ts +22 -20
  206. package/src/commands/batch.ts +41 -38
  207. package/src/commands/chat.ts +37 -34
  208. package/src/commands/claude-init.ts +38 -30
  209. package/src/commands/claude-setup.ts +692 -97
  210. package/src/commands/computer-setup-commands.ts +45 -39
  211. package/src/commands/computer-setup.ts +490 -20
  212. package/src/commands/create-command.ts +7 -7
  213. package/src/commands/create.ts +36 -33
  214. package/src/commands/dashboard.ts +33 -28
  215. package/src/commands/govern.ts +34 -29
  216. package/src/commands/governance.ts +1005 -0
  217. package/src/commands/guardian.ts +887 -0
  218. package/src/commands/init.ts +112 -22
  219. package/src/commands/performance-optimizer.ts +48 -42
  220. package/src/commands/plugins.ts +35 -32
  221. package/src/commands/project-update.ts +1053 -0
  222. package/src/commands/rag.ts +904 -0
  223. package/src/commands/session.ts +631 -0
  224. package/src/commands/setup.ts +35 -31
  225. package/src/commands/test-init.ts +6 -5
  226. package/src/commands/test.ts +7 -6
  227. package/src/commands/vp.ts +762 -0
  228. package/src/commands/watch.ts +44 -33
  229. package/src/commands/worktree.ts +1057 -0
  230. package/src/context/context-manager.ts +15 -12
  231. package/src/context/session-manager.ts +51 -40
  232. package/src/index.ts +7 -6
  233. package/src/interactive/interactive-mode.ts +25 -18
  234. package/src/lib/conflict-resolution.ts +28 -0
  235. package/src/lib/merge-strategy.ts +28 -0
  236. package/src/lib/safety-mechanisms.ts +47 -0
  237. package/src/lib/state-detection.ts +28 -0
  238. package/src/nlp/command-mapper.ts +35 -30
  239. package/src/nlp/command-parser.ts +20 -17
  240. package/src/nlp/intent-classifier.ts +7 -7
  241. package/src/nlp/intent-parser.ts +61 -49
  242. package/src/plugins/plugin-manager.ts +27 -23
  243. package/src/types/index.ts +1 -1
  244. package/src/types/modules.d.ts +1 -0
  245. package/src/utils/backup-rollback-manager.ts +13 -11
  246. package/src/utils/claude-config-installer.ts +18 -16
  247. package/src/utils/config-manager.ts +12 -9
  248. package/src/utils/error-handler.ts +5 -3
  249. package/src/utils/logger.ts +35 -12
@@ -1,7 +1,9 @@
1
1
  import { EventEmitter } from 'events';
2
- import { ClaudeClient, ClaudeMessage } from '../ai/claude-client';
2
+
3
3
  import { logger } from '../utils/logger';
4
4
 
5
+ import type { ClaudeClient, ClaudeMessage } from '../ai/claude-client';
6
+
5
7
  /**
6
8
  * Intent classification result
7
9
  */
@@ -101,7 +103,7 @@ export class IntentParser extends EventEmitter {
101
103
 
102
104
  constructor(
103
105
  claudeClient: ClaudeClient,
104
- config: Partial<IntentParserConfig> = {}
106
+ config: Partial<IntentParserConfig> = {},
105
107
  ) {
106
108
  super();
107
109
 
@@ -129,13 +131,13 @@ export class IntentParser extends EventEmitter {
129
131
  async parseIntent(
130
132
  input: string,
131
133
  availableCommands: string[],
132
- context: IntentContext = {}
134
+ context: IntentContext = {},
133
135
  ): Promise<IntentResult> {
134
136
  const normalizedInput = this.normalizeInput(input);
135
137
  const cacheKey = this.getCacheKey(
136
138
  normalizedInput,
137
139
  availableCommands,
138
- context
140
+ context,
139
141
  );
140
142
 
141
143
  // Check cache first
@@ -149,7 +151,7 @@ export class IntentParser extends EventEmitter {
149
151
  // Step 1: Quick pattern matching for common commands
150
152
  const patternResult = await this.patternMatching(
151
153
  normalizedInput,
152
- availableCommands
154
+ availableCommands,
153
155
  );
154
156
  if (patternResult.confidence >= 0.9) {
155
157
  this.cacheResult(cacheKey, patternResult);
@@ -166,21 +168,21 @@ export class IntentParser extends EventEmitter {
166
168
  normalizedInput,
167
169
  availableCommands,
168
170
  context,
169
- entities
171
+ entities,
170
172
  );
171
173
 
172
174
  // Step 4: Combine results and validate
173
175
  const finalResult = this.combineResults(
174
176
  patternResult,
175
177
  aiResult,
176
- entities
178
+ entities,
177
179
  );
178
180
 
179
181
  // Step 5: Post-processing and validation
180
182
  const validatedResult = await this.validateAndEnrich(
181
183
  finalResult,
182
184
  availableCommands,
183
- context
185
+ context,
184
186
  );
185
187
 
186
188
  this.cacheResult(cacheKey, validatedResult);
@@ -195,7 +197,7 @@ export class IntentParser extends EventEmitter {
195
197
  return this.fallbackIntentParsing(
196
198
  normalizedInput,
197
199
  availableCommands,
198
- context
200
+ context,
199
201
  );
200
202
  }
201
203
  }
@@ -206,7 +208,7 @@ export class IntentParser extends EventEmitter {
206
208
  async extractParameters(
207
209
  input: string,
208
210
  command: string,
209
- commandPattern?: CommandPattern
211
+ commandPattern?: CommandPattern,
210
212
  ): Promise<Record<string, any>> {
211
213
  const parameters: Record<string, any> = {};
212
214
 
@@ -240,7 +242,7 @@ Extract parameters from the user input and respond with JSON only:
240
242
  {
241
243
  temperature: 0.1,
242
244
  maxTokens: 1024,
243
- }
245
+ },
244
246
  );
245
247
 
246
248
  const result = JSON.parse(response.trim());
@@ -254,7 +256,7 @@ Extract parameters from the user input and respond with JSON only:
254
256
  if (result.parameters[param.name] && param.validation) {
255
257
  if (!param.validation.test(result.parameters[param.name])) {
256
258
  logger.warn(
257
- `Parameter validation failed for ${param.name}: ${result.parameters[param.name]}`
259
+ `Parameter validation failed for ${param.name}: ${result.parameters[param.name]}`,
258
260
  );
259
261
  delete result.parameters[param.name];
260
262
  }
@@ -283,7 +285,7 @@ Extract parameters from the user input and respond with JSON only:
283
285
  partialInput: string,
284
286
  availableCommands: string[],
285
287
  context: IntentContext = {},
286
- limit: number = 5
288
+ limit: number = 5,
287
289
  ): Promise<
288
290
  Array<{
289
291
  command: string;
@@ -302,7 +304,7 @@ Extract parameters from the user input and respond with JSON only:
302
304
  // Pattern-based suggestions
303
305
  const patternSuggestions = this.getPatternSuggestions(
304
306
  partialInput,
305
- availableCommands
307
+ availableCommands,
306
308
  );
307
309
  suggestions.push(...patternSuggestions);
308
310
 
@@ -313,7 +315,7 @@ Extract parameters from the user input and respond with JSON only:
313
315
  partialInput,
314
316
  availableCommands,
315
317
  context,
316
- limit - suggestions.length
318
+ limit - suggestions.length,
317
319
  );
318
320
  suggestions.push(...aiSuggestions);
319
321
  } catch (error) {
@@ -366,7 +368,7 @@ Extract parameters from the user input and respond with JSON only:
366
368
  } {
367
369
  const now = Date.now();
368
370
  const validEntries = Array.from(this.intentCache.values()).filter(
369
- entry => now - entry.timestamp < this.config.cacheDuration
371
+ entry => now - entry.timestamp < this.config.cacheDuration,
370
372
  );
371
373
 
372
374
  const oldestEntry =
@@ -513,16 +515,16 @@ Extract parameters from the user input and respond with JSON only:
513
515
  this.entityPatterns.set('file_path', /(?:\.\/|\/|~\/)[^\s]+/g);
514
516
  this.entityPatterns.set(
515
517
  'package_name',
516
- /(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*/g
518
+ /(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*/g,
517
519
  );
518
520
  this.entityPatterns.set(
519
521
  'command',
520
- /(?:wundr\s+)?(?:analyze|create|init|help|dashboard|batch|watch)\b/g
522
+ /(?:wundr\s+)?(?:analyze|create|init|help|dashboard|batch|watch)\b/g,
521
523
  );
522
524
  this.entityPatterns.set('option', /--?[a-zA-Z][a-zA-Z0-9-]*/g);
523
525
  this.entityPatterns.set(
524
526
  'technology',
525
- /\b(?:react|angular|vue|nodejs|typescript|javascript|python|java|docker|kubernetes)\b/gi
527
+ /\b(?:react|angular|vue|nodejs|typescript|javascript|python|java|docker|kubernetes)\b/gi,
526
528
  );
527
529
  }
528
530
 
@@ -537,7 +539,7 @@ Extract parameters from the user input and respond with JSON only:
537
539
  private getCacheKey(
538
540
  input: string,
539
541
  commands: string[],
540
- context: IntentContext
542
+ context: IntentContext,
541
543
  ): string {
542
544
  const contextKey = JSON.stringify({
543
545
  projectType: context.projectType,
@@ -550,7 +552,7 @@ Extract parameters from the user input and respond with JSON only:
550
552
 
551
553
  private async patternMatching(
552
554
  input: string,
553
- availableCommands: string[]
555
+ availableCommands: string[],
554
556
  ): Promise<IntentResult> {
555
557
  let bestMatch: IntentResult = {
556
558
  intent: 'unknown',
@@ -559,7 +561,9 @@ Extract parameters from the user input and respond with JSON only:
559
561
  };
560
562
 
561
563
  for (const [intent, pattern] of this.commandPatterns) {
562
- if (!availableCommands.includes(intent)) continue;
564
+ if (!availableCommands.includes(intent)) {
565
+ continue;
566
+ }
563
567
 
564
568
  const confidence = this.calculatePatternScore(input, pattern);
565
569
 
@@ -580,7 +584,7 @@ Extract parameters from the user input and respond with JSON only:
580
584
 
581
585
  private calculatePatternScore(
582
586
  input: string,
583
- pattern: CommandPattern
587
+ pattern: CommandPattern,
584
588
  ): number {
585
589
  let score = 0;
586
590
  let totalWeight = 0;
@@ -592,7 +596,9 @@ Extract parameters from the user input and respond with JSON only:
592
596
 
593
597
  let matchCount = 0;
594
598
  for (const word of patternWords) {
595
- if (word.startsWith('{') && word.endsWith('}')) continue; // Skip parameters
599
+ if (word.startsWith('{') && word.endsWith('}')) {
600
+ continue;
601
+ } // Skip parameters
596
602
  if (inputWords.includes(word)) {
597
603
  matchCount++;
598
604
  }
@@ -610,7 +616,7 @@ Extract parameters from the user input and respond with JSON only:
610
616
  for (const example of pattern.examples) {
611
617
  const similarity = this.calculateStringSimilarity(
612
618
  input,
613
- example.toLowerCase()
619
+ example.toLowerCase(),
614
620
  );
615
621
  exampleScore = Math.max(exampleScore, similarity);
616
622
  }
@@ -661,7 +667,7 @@ Extract parameters from the user input and respond with JSON only:
661
667
  input: string,
662
668
  availableCommands: string[],
663
669
  context: IntentContext,
664
- entities: Entity[]
670
+ entities: Entity[],
665
671
  ): Promise<IntentResult> {
666
672
  const contextInfo = this.buildContextInfo(context);
667
673
  const entityInfo =
@@ -696,7 +702,7 @@ Analyze and respond with JSON only:
696
702
  {
697
703
  temperature: 0.1,
698
704
  maxTokens: 1536,
699
- }
705
+ },
700
706
  );
701
707
 
702
708
  const cleanResponse = response.trim();
@@ -731,7 +737,7 @@ Analyze and respond with JSON only:
731
737
 
732
738
  if (context.recentCommands?.length) {
733
739
  parts.push(
734
- `Recent commands: ${context.recentCommands.slice(0, 3).join(', ')}`
740
+ `Recent commands: ${context.recentCommands.slice(0, 3).join(', ')}`,
735
741
  );
736
742
  }
737
743
 
@@ -745,19 +751,19 @@ Analyze and respond with JSON only:
745
751
  private combineResults(
746
752
  patternResult: IntentResult,
747
753
  aiResult: IntentResult,
748
- entities: Entity[]
754
+ entities: Entity[],
749
755
  ): IntentResult {
750
756
  // Use AI result as base, but boost confidence if pattern matching agrees
751
757
  let finalResult = { ...aiResult };
752
758
 
753
759
  if (patternResult.intent === aiResult.intent) {
754
760
  finalResult.confidence = Math.min(0.98, aiResult.confidence + 0.1);
755
- finalResult.reasoning += ` (confirmed by pattern matching)`;
761
+ finalResult.reasoning += ' (confirmed by pattern matching)';
756
762
  } else if (patternResult.confidence > 0.8) {
757
763
  // High-confidence pattern match might override AI
758
764
  if (patternResult.confidence > aiResult.confidence) {
759
765
  finalResult = patternResult;
760
- finalResult.reasoning += ` (overridden by high-confidence pattern match)`;
766
+ finalResult.reasoning += ' (overridden by high-confidence pattern match)';
761
767
  }
762
768
  }
763
769
 
@@ -772,7 +778,7 @@ Analyze and respond with JSON only:
772
778
  private async validateAndEnrich(
773
779
  result: IntentResult,
774
780
  availableCommands: string[],
775
- context: IntentContext
781
+ context: IntentContext,
776
782
  ): Promise<IntentResult> {
777
783
  // Validate that the intent command is available
778
784
  if (!availableCommands.includes(result.intent)) {
@@ -784,7 +790,7 @@ Analyze and respond with JSON only:
784
790
  // Add safety warnings for destructive commands
785
791
  const commandPattern = this.commandPatterns.get(result.intent);
786
792
  if (commandPattern?.destructive) {
787
- result.clarification = `This is a destructive operation. Are you sure you want to proceed?`;
793
+ result.clarification = 'This is a destructive operation. Are you sure you want to proceed?';
788
794
  }
789
795
 
790
796
  // Enrich with context-aware suggestions
@@ -792,7 +798,7 @@ Analyze and respond with JSON only:
792
798
  result.alternatives = await this.getContextualAlternatives(
793
799
  result,
794
800
  availableCommands,
795
- context
801
+ context,
796
802
  );
797
803
  }
798
804
 
@@ -802,7 +808,7 @@ Analyze and respond with JSON only:
802
808
  private async getContextualAlternatives(
803
809
  result: IntentResult,
804
810
  availableCommands: string[],
805
- context: IntentContext
811
+ context: IntentContext,
806
812
  ): Promise<IntentResult['alternatives']> {
807
813
  const alternatives: NonNullable<IntentResult['alternatives']> = [];
808
814
 
@@ -813,7 +819,7 @@ Analyze and respond with JSON only:
813
819
  if (pattern) {
814
820
  const confidence = this.calculatePatternScore(
815
821
  result.command || '',
816
- pattern
822
+ pattern,
817
823
  );
818
824
  if (confidence > 0.3) {
819
825
  alternatives.push({
@@ -834,7 +840,7 @@ Analyze and respond with JSON only:
834
840
  private fallbackIntentParsing(
835
841
  input: string,
836
842
  availableCommands: string[],
837
- context: IntentContext
843
+ context: IntentContext,
838
844
  ): IntentResult {
839
845
  // Simple keyword matching as last resort
840
846
  const keywords = input.split(/\s+/);
@@ -867,7 +873,7 @@ Analyze and respond with JSON only:
867
873
 
868
874
  private fallbackParameterExtraction(
869
875
  input: string,
870
- pattern: CommandPattern
876
+ pattern: CommandPattern,
871
877
  ): Record<string, any> {
872
878
  const parameters: Record<string, any> = {};
873
879
  const words = input.split(/\s+/);
@@ -882,13 +888,13 @@ Analyze and respond with JSON only:
882
888
  } else if (param.type === 'boolean') {
883
889
  if (
884
890
  words.some(word =>
885
- ['yes', 'true', 'on', 'enable'].includes(word.toLowerCase())
891
+ ['yes', 'true', 'on', 'enable'].includes(word.toLowerCase()),
886
892
  )
887
893
  ) {
888
894
  parameters[param.name] = true;
889
895
  } else if (
890
896
  words.some(word =>
891
- ['no', 'false', 'off', 'disable'].includes(word.toLowerCase())
897
+ ['no', 'false', 'off', 'disable'].includes(word.toLowerCase()),
892
898
  )
893
899
  ) {
894
900
  parameters[param.name] = false;
@@ -906,7 +912,7 @@ Analyze and respond with JSON only:
906
912
 
907
913
  private getPatternSuggestions(
908
914
  partialInput: string,
909
- availableCommands: string[]
915
+ availableCommands: string[],
910
916
  ): Array<{
911
917
  command: string;
912
918
  description: string;
@@ -922,14 +928,16 @@ Analyze and respond with JSON only:
922
928
 
923
929
  for (const command of availableCommands) {
924
930
  const pattern = this.commandPatterns.get(command);
925
- if (!pattern) continue;
931
+ if (!pattern) {
932
+ continue;
933
+ }
926
934
 
927
935
  // Check if partial input matches command or examples
928
936
  const confidence = Math.max(
929
937
  this.calculateStringSimilarity(partialInput, command),
930
938
  ...pattern.examples.map(ex =>
931
- this.calculateStringSimilarity(partialInput, ex)
932
- )
939
+ this.calculateStringSimilarity(partialInput, ex),
940
+ ),
933
941
  );
934
942
 
935
943
  if (confidence > 0.3) {
@@ -949,7 +957,7 @@ Analyze and respond with JSON only:
949
957
  partialInput: string,
950
958
  availableCommands: string[],
951
959
  context: IntentContext,
952
- limit: number
960
+ limit: number,
953
961
  ): Promise<
954
962
  Array<{
955
963
  command: string;
@@ -1057,14 +1065,18 @@ Provide ${limit} suggestions in JSON format:
1057
1065
 
1058
1066
  const words = input.toLowerCase().split(/\s+/);
1059
1067
  const positiveCount = words.filter(word =>
1060
- positiveWords.includes(word)
1068
+ positiveWords.includes(word),
1061
1069
  ).length;
1062
1070
  const negativeCount = words.filter(word =>
1063
- negativeWords.includes(word)
1071
+ negativeWords.includes(word),
1064
1072
  ).length;
1065
1073
 
1066
- if (positiveCount > negativeCount) return 'positive';
1067
- if (negativeCount > positiveCount) return 'negative';
1074
+ if (positiveCount > negativeCount) {
1075
+ return 'positive';
1076
+ }
1077
+ if (negativeCount > positiveCount) {
1078
+ return 'negative';
1079
+ }
1068
1080
  return 'neutral';
1069
1081
  }
1070
1082
 
@@ -1,11 +1,15 @@
1
- import fs from 'fs-extra';
2
- import path from 'path';
3
1
  import { spawn, type ChildProcess } from 'child_process';
2
+ import path from 'path';
3
+
4
4
  import chalk from 'chalk';
5
- import { ConfigManager } from '../utils/config-manager';
6
- import { logger } from '../utils/logger';
5
+ import fs from 'fs-extra';
6
+
7
+
7
8
  import { errorHandler } from '../utils/error-handler';
8
- import { Plugin, PluginContext, PluginCommand, PluginHook } from '../types';
9
+ import { logger } from '../utils/logger';
10
+
11
+ import type { Plugin, PluginContext, PluginCommand, PluginHook } from '../types';
12
+ import type { ConfigManager } from '../utils/config-manager';
9
13
 
10
14
  /**
11
15
  * Plugin management system for CLI extensibility
@@ -32,7 +36,7 @@ export class PluginManager {
32
36
  'WUNDR_PLUGIN_INIT_FAILED',
33
37
  'Failed to initialize plugin system',
34
38
  {},
35
- true
39
+ true,
36
40
  );
37
41
  }
38
42
  }
@@ -61,7 +65,7 @@ export class PluginManager {
61
65
  'WUNDR_PLUGIN_LOAD_FAILED',
62
66
  'Failed to load plugins',
63
67
  {},
64
- true
68
+ true,
65
69
  );
66
70
  }
67
71
  }
@@ -100,7 +104,7 @@ export class PluginManager {
100
104
  'WUNDR_PLUGIN_LOAD_SINGLE_FAILED',
101
105
  `Failed to load plugin: ${pluginName}`,
102
106
  { pluginName },
103
- true
107
+ true,
104
108
  );
105
109
  }
106
110
  }
@@ -132,7 +136,7 @@ export class PluginManager {
132
136
  'WUNDR_PLUGIN_UNLOAD_FAILED',
133
137
  `Failed to unload plugin: ${pluginName}`,
134
138
  { pluginName },
135
- true
139
+ true,
136
140
  );
137
141
  }
138
142
  }
@@ -162,7 +166,7 @@ export class PluginManager {
162
166
  'WUNDR_PLUGIN_INSTALL_FAILED',
163
167
  `Failed to install plugin: ${pluginName}`,
164
168
  { pluginName, options },
165
- true
169
+ true,
166
170
  );
167
171
  }
168
172
  }
@@ -192,7 +196,7 @@ export class PluginManager {
192
196
  'WUNDR_PLUGIN_UNINSTALL_FAILED',
193
197
  `Failed to uninstall plugin: ${pluginName}`,
194
198
  { pluginName },
195
- true
199
+ true,
196
200
  );
197
201
  }
198
202
  }
@@ -215,7 +219,7 @@ export class PluginManager {
215
219
  'WUNDR_PLUGIN_ENABLE_FAILED',
216
220
  `Failed to enable plugin: ${pluginName}`,
217
221
  { pluginName },
218
- true
222
+ true,
219
223
  );
220
224
  }
221
225
  }
@@ -234,7 +238,7 @@ export class PluginManager {
234
238
  'WUNDR_PLUGIN_DISABLE_FAILED',
235
239
  `Failed to disable plugin: ${pluginName}`,
236
240
  { pluginName },
237
- true
241
+ true,
238
242
  );
239
243
  }
240
244
  }
@@ -344,7 +348,7 @@ export class PluginManager {
344
348
  .filter(
345
349
  plugin =>
346
350
  plugin.name.toLowerCase().includes(query.toLowerCase()) ||
347
- plugin.description.toLowerCase().includes(query.toLowerCase())
351
+ plugin.description.toLowerCase().includes(query.toLowerCase()),
348
352
  )
349
353
  .slice(0, options.limit || 20);
350
354
  } catch (error) {
@@ -371,7 +375,7 @@ export class PluginManager {
371
375
  'WUNDR_PLUGIN_UPDATE_FAILED',
372
376
  `Failed to update plugin: ${pluginName}`,
373
377
  { pluginName },
374
- true
378
+ true,
375
379
  );
376
380
  }
377
381
  }
@@ -422,7 +426,7 @@ export class PluginManager {
422
426
  'WUNDR_PLUGIN_LINK_FAILED',
423
427
  'Failed to link plugin',
424
428
  { pluginPath },
425
- true
429
+ true,
426
430
  );
427
431
  }
428
432
  }
@@ -450,7 +454,7 @@ export class PluginManager {
450
454
  'WUNDR_PLUGIN_UNLINK_FAILED',
451
455
  'Failed to unlink plugin',
452
456
  { pluginName },
453
- true
457
+ true,
454
458
  );
455
459
  }
456
460
  }
@@ -472,7 +476,7 @@ export class PluginManager {
472
476
  'WUNDR_PLUGIN_TEST_FAILED',
473
477
  `Failed to test plugin: ${pluginName}`,
474
478
  { pluginName, options },
475
- true
479
+ true,
476
480
  );
477
481
  }
478
482
  }
@@ -494,7 +498,7 @@ export class PluginManager {
494
498
  'WUNDR_PLUGIN_PUBLISH_FAILED',
495
499
  'Failed to publish plugin',
496
500
  { options },
497
- true
501
+ true,
498
502
  );
499
503
  }
500
504
  }
@@ -505,7 +509,7 @@ export class PluginManager {
505
509
  async setPluginConfig(
506
510
  pluginName: string,
507
511
  key: string,
508
- value: string
512
+ value: string,
509
513
  ): Promise<void> {
510
514
  this.configManager.set(`plugins.${pluginName}.${key}`, value);
511
515
  await this.configManager.saveConfig();
@@ -626,7 +630,7 @@ export class PluginManager {
626
630
  private removePluginHooks(pluginName: string): void {
627
631
  for (const [event, hooks] of this.pluginHooks) {
628
632
  const filteredHooks = hooks.filter(
629
- hook => !hook.event.startsWith(pluginName)
633
+ hook => !hook.event.startsWith(pluginName),
630
634
  );
631
635
  this.pluginHooks.set(event, filteredHooks);
632
636
  }
@@ -686,7 +690,7 @@ export class PluginManager {
686
690
 
687
691
  private async installNpmPlugin(
688
692
  pluginName: string,
689
- options: any
693
+ options: any,
690
694
  ): Promise<void> {
691
695
  const versionSpec = options.version ? `@${options.version}` : '';
692
696
  const targetPath = path.join(this.pluginsDir, pluginName);
@@ -733,7 +737,7 @@ export class PluginManager {
733
737
  resolve();
734
738
  } else {
735
739
  reject(
736
- new Error(`Command failed with exit code ${code}: ${command}`)
740
+ new Error(`Command failed with exit code ${code}: ${command}`),
737
741
  );
738
742
  }
739
743
  });
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import type { Command } from 'commander';
2
2
 
3
3
  /**
4
4
  * Core types for the Wundr CLI
@@ -1,3 +1,4 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-function-type */
1
2
  // Type declarations for external modules
2
3
  declare module '@wundr/computer-setup' {
3
4
  export class ComputerSetupManager {
@@ -3,10 +3,12 @@
3
3
  * Handles backup creation and restoration for configuration files
4
4
  */
5
5
 
6
+ import { existsSync } from 'fs';
6
7
  import * as fs from 'fs/promises';
7
8
  import * as path from 'path';
8
- import { existsSync } from 'fs';
9
+
9
10
  import chalk from 'chalk';
11
+
10
12
  import { logger } from './logger';
11
13
 
12
14
  export interface BackupMetadata {
@@ -65,7 +67,7 @@ export class BackupRollbackManager {
65
67
  */
66
68
  async createBackup(
67
69
  files: string[],
68
- reason: string = 'Manual backup'
70
+ reason: string = 'Manual backup',
69
71
  ): Promise<BackupMetadata> {
70
72
  const backupId = this.generateBackupId();
71
73
  const timestamp = new Date().toISOString();
@@ -104,7 +106,7 @@ export class BackupRollbackManager {
104
106
 
105
107
  logger.info('Backed up file', {
106
108
  original: expandedPath,
107
- backup: backupFilePath
109
+ backup: backupFilePath,
108
110
  });
109
111
  }
110
112
 
@@ -120,7 +122,7 @@ export class BackupRollbackManager {
120
122
 
121
123
  logger.info('Backup created successfully', {
122
124
  backupId,
123
- filesBackedUp: backupFiles.length
125
+ filesBackedUp: backupFiles.length,
124
126
  });
125
127
 
126
128
  return metadata;
@@ -159,7 +161,7 @@ export class BackupRollbackManager {
159
161
  logger.info('Rolling back', {
160
162
  backupId: metadata.backupId,
161
163
  dryRun,
162
- files: metadata.files.length
164
+ files: metadata.files.length,
163
165
  });
164
166
 
165
167
  if (dryRun) {
@@ -181,7 +183,7 @@ export class BackupRollbackManager {
181
183
  try {
182
184
  // Create directory structure
183
185
  await fs.mkdir(path.dirname(file.originalPath), {
184
- recursive: true
186
+ recursive: true,
185
187
  });
186
188
 
187
189
  // Restore file
@@ -192,7 +194,7 @@ export class BackupRollbackManager {
192
194
  } catch (error) {
193
195
  logger.error('Failed to restore file', {
194
196
  file: file.originalPath,
195
- error
197
+ error,
196
198
  });
197
199
  failedFiles.push(file.originalPath);
198
200
  }
@@ -223,7 +225,7 @@ export class BackupRollbackManager {
223
225
  const content = await fs.readFile(this.metadataFile, 'utf-8');
224
226
  const backups = JSON.parse(content) as BackupMetadata[];
225
227
  return backups.sort((a, b) =>
226
- new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime()
228
+ new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime(),
227
229
  );
228
230
  } catch (error) {
229
231
  logger.error('Failed to list backups', error);
@@ -256,7 +258,7 @@ export class BackupRollbackManager {
256
258
  if (backups.length <= retainCount) {
257
259
  logger.info('No backups to clean up', {
258
260
  current: backups.length,
259
- retain: retainCount
261
+ retain: retainCount,
260
262
  });
261
263
  return;
262
264
  }
@@ -273,7 +275,7 @@ export class BackupRollbackManager {
273
275
  } catch (error) {
274
276
  logger.error('Failed to delete backup', {
275
277
  backupId: backup.backupId,
276
- error
278
+ error,
277
279
  });
278
280
  }
279
281
  }
@@ -346,7 +348,7 @@ export class BackupRollbackManager {
346
348
  console.log(chalk.white('Timestamp:'), chalk.gray(metadata.timestamp));
347
349
  console.log(chalk.white('Reason:'), chalk.gray(metadata.reason));
348
350
  console.log(chalk.white('Status:'),
349
- metadata.success ? chalk.green('Success') : chalk.red('Failed')
351
+ metadata.success ? chalk.green('Success') : chalk.red('Failed'),
350
352
  );
351
353
  console.log(chalk.white('Files:'), chalk.cyan(metadata.files.length));
352
354