@wundr.io/cli 1.0.0 → 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.
Files changed (224) hide show
  1. package/README.md +696 -280
  2. package/dist/ai/ai-service.d.ts +2 -2
  3. package/dist/ai/ai-service.d.ts.map +1 -1
  4. package/dist/ai/ai-service.js +1 -1
  5. package/dist/ai/ai-service.js.map +1 -1
  6. package/dist/ai/claude-client.d.ts.map +1 -1
  7. package/dist/ai/claude-client.js +2 -1
  8. package/dist/ai/claude-client.js.map +1 -1
  9. package/dist/ai/conversation-manager.d.ts +2 -2
  10. package/dist/ai/conversation-manager.d.ts.map +1 -1
  11. package/dist/ai/conversation-manager.js +5 -3
  12. package/dist/ai/conversation-manager.js.map +1 -1
  13. package/dist/cli.d.ts.map +1 -1
  14. package/dist/cli.js +32 -13
  15. package/dist/cli.js.map +1 -1
  16. package/dist/commands/ai.d.ts +3 -3
  17. package/dist/commands/ai.d.ts.map +1 -1
  18. package/dist/commands/ai.js +2 -2
  19. package/dist/commands/ai.js.map +1 -1
  20. package/dist/commands/alignment.d.ts +78 -0
  21. package/dist/commands/alignment.d.ts.map +1 -0
  22. package/dist/commands/alignment.js +817 -0
  23. package/dist/commands/alignment.js.map +1 -0
  24. package/dist/commands/analyze-optimized.d.ts.map +1 -1
  25. package/dist/commands/analyze-optimized.js +9 -6
  26. package/dist/commands/analyze-optimized.js.map +1 -1
  27. package/dist/commands/analyze.d.ts +3 -3
  28. package/dist/commands/analyze.d.ts.map +1 -1
  29. package/dist/commands/analyze.js +2 -2
  30. package/dist/commands/analyze.js.map +1 -1
  31. package/dist/commands/batch.d.ts +3 -3
  32. package/dist/commands/batch.d.ts.map +1 -1
  33. package/dist/commands/batch.js +7 -7
  34. package/dist/commands/batch.js.map +1 -1
  35. package/dist/commands/chat.d.ts +3 -3
  36. package/dist/commands/chat.d.ts.map +1 -1
  37. package/dist/commands/chat.js +3 -3
  38. package/dist/commands/chat.js.map +1 -1
  39. package/dist/commands/claude-init.d.ts +1 -1
  40. package/dist/commands/claude-init.d.ts.map +1 -1
  41. package/dist/commands/claude-init.js +11 -7
  42. package/dist/commands/claude-init.js.map +1 -1
  43. package/dist/commands/claude-setup.d.ts +88 -1
  44. package/dist/commands/claude-setup.d.ts.map +1 -1
  45. package/dist/commands/claude-setup.js +549 -46
  46. package/dist/commands/claude-setup.js.map +1 -1
  47. package/dist/commands/computer-setup-commands.d.ts +17 -3
  48. package/dist/commands/computer-setup-commands.d.ts.map +1 -1
  49. package/dist/commands/computer-setup-commands.js +145 -3
  50. package/dist/commands/computer-setup-commands.js.map +1 -1
  51. package/dist/commands/computer-setup.d.ts.map +1 -1
  52. package/dist/commands/computer-setup.js +372 -4
  53. package/dist/commands/computer-setup.js.map +1 -1
  54. package/dist/commands/create-command.d.ts.map +1 -1
  55. package/dist/commands/create-command.js +3 -3
  56. package/dist/commands/create-command.js.map +1 -1
  57. package/dist/commands/create.d.ts +3 -3
  58. package/dist/commands/create.d.ts.map +1 -1
  59. package/dist/commands/create.js +3 -3
  60. package/dist/commands/create.js.map +1 -1
  61. package/dist/commands/dashboard.d.ts +3 -3
  62. package/dist/commands/dashboard.d.ts.map +1 -1
  63. package/dist/commands/dashboard.js +4 -3
  64. package/dist/commands/dashboard.js.map +1 -1
  65. package/dist/commands/govern.d.ts +3 -3
  66. package/dist/commands/govern.d.ts.map +1 -1
  67. package/dist/commands/govern.js +4 -3
  68. package/dist/commands/govern.js.map +1 -1
  69. package/dist/commands/governance.d.ts +17 -0
  70. package/dist/commands/governance.d.ts.map +1 -0
  71. package/dist/commands/governance.js +703 -0
  72. package/dist/commands/governance.js.map +1 -0
  73. package/dist/commands/guardian.d.ts +20 -0
  74. package/dist/commands/guardian.d.ts.map +1 -0
  75. package/dist/commands/guardian.js +597 -0
  76. package/dist/commands/guardian.js.map +1 -0
  77. package/dist/commands/init.d.ts +7 -3
  78. package/dist/commands/init.d.ts.map +1 -1
  79. package/dist/commands/init.js +71 -5
  80. package/dist/commands/init.js.map +1 -1
  81. package/dist/commands/performance-optimizer.d.ts +2 -2
  82. package/dist/commands/performance-optimizer.d.ts.map +1 -1
  83. package/dist/commands/performance-optimizer.js +8 -7
  84. package/dist/commands/performance-optimizer.js.map +1 -1
  85. package/dist/commands/plugins.d.ts +3 -3
  86. package/dist/commands/plugins.d.ts.map +1 -1
  87. package/dist/commands/plugins.js +2 -2
  88. package/dist/commands/plugins.js.map +1 -1
  89. package/dist/commands/rag.d.ts +7 -0
  90. package/dist/commands/rag.d.ts.map +1 -0
  91. package/dist/commands/rag.js +748 -0
  92. package/dist/commands/rag.js.map +1 -0
  93. package/dist/commands/session.d.ts +41 -0
  94. package/dist/commands/session.d.ts.map +1 -0
  95. package/dist/commands/session.js +441 -0
  96. package/dist/commands/session.js.map +1 -0
  97. package/dist/commands/setup.d.ts +3 -3
  98. package/dist/commands/setup.d.ts.map +1 -1
  99. package/dist/commands/setup.js +1 -3
  100. package/dist/commands/setup.js.map +1 -1
  101. package/dist/commands/test-init.d.ts.map +1 -1
  102. package/dist/commands/test-init.js +2 -2
  103. package/dist/commands/test-init.js.map +1 -1
  104. package/dist/commands/test.d.ts.map +1 -1
  105. package/dist/commands/test.js +2 -2
  106. package/dist/commands/test.js.map +1 -1
  107. package/dist/commands/vp.d.ts +7 -0
  108. package/dist/commands/vp.d.ts.map +1 -0
  109. package/dist/commands/vp.js +571 -0
  110. package/dist/commands/vp.js.map +1 -0
  111. package/dist/commands/watch.d.ts +3 -3
  112. package/dist/commands/watch.d.ts.map +1 -1
  113. package/dist/commands/watch.js +10 -7
  114. package/dist/commands/watch.js.map +1 -1
  115. package/dist/commands/worktree.d.ts +63 -0
  116. package/dist/commands/worktree.d.ts.map +1 -0
  117. package/dist/commands/worktree.js +774 -0
  118. package/dist/commands/worktree.js.map +1 -0
  119. package/dist/context/context-manager.d.ts +1 -1
  120. package/dist/context/context-manager.d.ts.map +1 -1
  121. package/dist/context/context-manager.js +1 -1
  122. package/dist/context/context-manager.js.map +1 -1
  123. package/dist/context/session-manager.d.ts +2 -2
  124. package/dist/context/session-manager.d.ts.map +1 -1
  125. package/dist/context/session-manager.js +9 -5
  126. package/dist/context/session-manager.js.map +1 -1
  127. package/dist/index.d.ts.map +1 -1
  128. package/dist/index.js +1 -1
  129. package/dist/index.js.map +1 -1
  130. package/dist/interactive/interactive-mode.d.ts +2 -2
  131. package/dist/interactive/interactive-mode.d.ts.map +1 -1
  132. package/dist/interactive/interactive-mode.js +6 -4
  133. package/dist/interactive/interactive-mode.js.map +1 -1
  134. package/dist/nlp/command-mapper.d.ts +1 -1
  135. package/dist/nlp/command-mapper.d.ts.map +1 -1
  136. package/dist/nlp/command-mapper.js +3 -2
  137. package/dist/nlp/command-mapper.js.map +1 -1
  138. package/dist/nlp/command-parser.d.ts +1 -1
  139. package/dist/nlp/command-parser.d.ts.map +1 -1
  140. package/dist/nlp/command-parser.js +2 -1
  141. package/dist/nlp/command-parser.js.map +1 -1
  142. package/dist/nlp/intent-parser.d.ts +1 -1
  143. package/dist/nlp/intent-parser.d.ts.map +1 -1
  144. package/dist/nlp/intent-parser.js +14 -9
  145. package/dist/nlp/intent-parser.js.map +1 -1
  146. package/dist/plugins/plugin-manager.d.ts +2 -2
  147. package/dist/plugins/plugin-manager.d.ts.map +1 -1
  148. package/dist/plugins/plugin-manager.js +3 -3
  149. package/dist/plugins/plugin-manager.js.map +1 -1
  150. package/dist/types/index.d.ts +1 -1
  151. package/dist/types/index.d.ts.map +1 -1
  152. package/dist/utils/backup-rollback-manager.d.ts +72 -0
  153. package/dist/utils/backup-rollback-manager.d.ts.map +1 -0
  154. package/dist/utils/backup-rollback-manager.js +289 -0
  155. package/dist/utils/backup-rollback-manager.js.map +1 -0
  156. package/dist/utils/claude-config-installer.d.ts +94 -0
  157. package/dist/utils/claude-config-installer.d.ts.map +1 -0
  158. package/dist/utils/claude-config-installer.js +628 -0
  159. package/dist/utils/claude-config-installer.js.map +1 -0
  160. package/dist/utils/config-manager.d.ts +1 -1
  161. package/dist/utils/config-manager.d.ts.map +1 -1
  162. package/dist/utils/config-manager.js +5 -5
  163. package/dist/utils/config-manager.js.map +1 -1
  164. package/dist/utils/error-handler.d.ts +1 -1
  165. package/dist/utils/error-handler.d.ts.map +1 -1
  166. package/dist/utils/error-handler.js.map +1 -1
  167. package/dist/utils/logger.d.ts +1 -1
  168. package/dist/utils/logger.d.ts.map +1 -1
  169. package/dist/utils/logger.js +22 -11
  170. package/dist/utils/logger.js.map +1 -1
  171. package/package.json +26 -7
  172. package/src/ai/ai-service.ts +22 -19
  173. package/src/ai/claude-client.ts +20 -16
  174. package/src/ai/conversation-manager.ts +37 -30
  175. package/src/cli.ts +42 -13
  176. package/src/commands/ai.ts +59 -57
  177. package/src/commands/alignment.ts +1212 -0
  178. package/src/commands/analyze-optimized.ts +70 -62
  179. package/src/commands/analyze.ts +22 -20
  180. package/src/commands/batch.ts +41 -38
  181. package/src/commands/chat.ts +37 -34
  182. package/src/commands/claude-init.ts +38 -30
  183. package/src/commands/claude-setup.ts +692 -97
  184. package/src/commands/computer-setup-commands.ts +203 -37
  185. package/src/commands/computer-setup.ts +474 -4
  186. package/src/commands/create-command.ts +7 -7
  187. package/src/commands/create.ts +36 -33
  188. package/src/commands/dashboard.ts +33 -28
  189. package/src/commands/govern.ts +34 -29
  190. package/src/commands/governance.ts +1005 -0
  191. package/src/commands/guardian.ts +887 -0
  192. package/src/commands/init.ts +112 -22
  193. package/src/commands/performance-optimizer.ts +48 -42
  194. package/src/commands/plugins.ts +35 -32
  195. package/src/commands/project-update.ts +1053 -0
  196. package/src/commands/rag.ts +904 -0
  197. package/src/commands/session.ts +631 -0
  198. package/src/commands/setup.ts +35 -31
  199. package/src/commands/test-init.ts +6 -5
  200. package/src/commands/test.ts +7 -6
  201. package/src/commands/vp.ts +762 -0
  202. package/src/commands/watch.ts +44 -33
  203. package/src/commands/worktree.ts +1057 -0
  204. package/src/context/context-manager.ts +15 -12
  205. package/src/context/session-manager.ts +51 -40
  206. package/src/index.ts +7 -6
  207. package/src/interactive/interactive-mode.ts +25 -18
  208. package/src/lib/conflict-resolution.ts +28 -0
  209. package/src/lib/merge-strategy.ts +28 -0
  210. package/src/lib/safety-mechanisms.ts +47 -0
  211. package/src/lib/state-detection.ts +28 -0
  212. package/src/nlp/command-mapper.ts +35 -30
  213. package/src/nlp/command-parser.ts +20 -17
  214. package/src/nlp/intent-classifier.ts +7 -7
  215. package/src/nlp/intent-parser.ts +61 -49
  216. package/src/plugins/plugin-manager.ts +27 -23
  217. package/src/tests/computer-setup-integration.test.ts +439 -0
  218. package/src/types/index.ts +1 -1
  219. package/src/types/modules.d.ts +1 -0
  220. package/src/utils/backup-rollback-manager.ts +363 -0
  221. package/src/utils/claude-config-installer.ts +734 -0
  222. package/src/utils/config-manager.ts +12 -9
  223. package/src/utils/error-handler.ts +5 -3
  224. package/src/utils/logger.ts +35 -12
@@ -1,12 +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 { ConfigManager } from '../utils/config-manager';
7
- import { PluginManager } from '../plugins/plugin-manager';
8
- import { logger } from '../utils/logger';
4
+ import fs from 'fs-extra';
5
+ import inquirer from 'inquirer';
6
+
7
+ import { initProjectRag, type RagInitOptions } from '@wundr.io/core';
9
8
  import { errorHandler } from '../utils/error-handler';
9
+ import { logger } from '../utils/logger';
10
+
11
+ import type { PluginManager } from '../plugins/plugin-manager';
12
+ import type { ConfigManager } from '../utils/config-manager';
13
+ import type { Command } from 'commander';
10
14
 
11
15
  /**
12
16
  * Init commands for project setup and configuration
@@ -15,7 +19,7 @@ export class InitCommands {
15
19
  constructor(
16
20
  private program: Command,
17
21
  private configManager: ConfigManager,
18
- private pluginManager: PluginManager
22
+ private pluginManager: PluginManager,
19
23
  ) {
20
24
  this.registerCommands();
21
25
  }
@@ -33,10 +37,22 @@ export class InitCommands {
33
37
  .option('--skip-git', 'skip git initialization')
34
38
  .option('--skip-install', 'skip dependency installation')
35
39
  .option('--monorepo', 'initialize as monorepo')
40
+ .option('--with-rag', 'initialize RAG (Retrieval-Augmented Generation) support')
36
41
  .action(async (name, options) => {
37
42
  await this.initProject(name, options);
38
43
  });
39
44
 
45
+ // Initialize RAG for existing project
46
+ initCmd
47
+ .command('rag')
48
+ .description('initialize RAG support for an existing project')
49
+ .option('--force', 'force re-initialization even if config exists')
50
+ .option('--skip-indexing', 'skip initial file indexing')
51
+ .option('--project-name <name>', 'override project name')
52
+ .action(async options => {
53
+ await this.initRag(options);
54
+ });
55
+
40
56
  // Initialize configuration
41
57
  initCmd
42
58
  .command('config')
@@ -107,16 +123,90 @@ export class InitCommands {
107
123
  await this.installDependencies(projectPath);
108
124
  }
109
125
 
126
+ // Initialize RAG if --with-rag flag is provided
127
+ if (options.withRag) {
128
+ logger.info('Initializing RAG support...');
129
+ const ragResult = await initProjectRag(projectPath, {
130
+ projectName,
131
+ });
132
+
133
+ if (ragResult.success) {
134
+ logger.success(
135
+ `RAG initialized: ${ragResult.filesIndexed} files indexed`,
136
+ );
137
+ logger.info(
138
+ ` Framework detected: ${chalk.cyan(ragResult.framework.name)}`,
139
+ );
140
+ } else {
141
+ logger.warn('RAG initialization had issues:');
142
+ for (const error of ragResult.errors) {
143
+ logger.warn(` - ${error}`);
144
+ }
145
+ }
146
+
147
+ for (const warning of ragResult.warnings) {
148
+ logger.warn(` Warning: ${warning}`);
149
+ }
150
+ }
151
+
110
152
  logger.success(`Project ${projectName} initialized successfully!`);
111
- logger.info(`Next steps:`);
153
+ logger.info('Next steps:');
112
154
  logger.info(` cd ${projectName}`);
113
- logger.info(` wundr analyze`);
155
+ logger.info(' wundr analyze');
114
156
  } catch (error) {
115
157
  throw errorHandler.createError(
116
158
  'WUNDR_INIT_PROJECT_FAILED',
117
159
  'Failed to initialize project',
118
160
  { name, options },
119
- true
161
+ true,
162
+ );
163
+ }
164
+ }
165
+
166
+ /**
167
+ * Initialize RAG support for existing project
168
+ */
169
+ private async initRag(options: {
170
+ force?: boolean;
171
+ skipIndexing?: boolean;
172
+ projectName?: string;
173
+ }): Promise<void> {
174
+ try {
175
+ const projectPath = process.cwd();
176
+ logger.info(`Initializing RAG support in: ${chalk.cyan(projectPath)}`);
177
+
178
+ const ragOptions: RagInitOptions = {
179
+ force: options.force,
180
+ skipIndexing: options.skipIndexing,
181
+ projectName: options.projectName,
182
+ };
183
+
184
+ const result = await initProjectRag(projectPath, ragOptions);
185
+
186
+ if (result.success) {
187
+ logger.success('RAG initialization complete!');
188
+ logger.info(` Config: ${chalk.cyan(result.configPath)}`);
189
+ logger.info(` Exclusions: ${chalk.cyan(result.excludePath)}`);
190
+ logger.info(` Files indexed: ${chalk.cyan(result.filesIndexed)}`);
191
+ logger.info(
192
+ ` Framework: ${chalk.cyan(result.framework.name)} (${result.framework.projectType})`,
193
+ );
194
+ } else {
195
+ logger.error('RAG initialization failed:');
196
+ for (const error of result.errors) {
197
+ logger.error(` - ${error}`);
198
+ }
199
+ }
200
+
201
+ for (const warning of result.warnings) {
202
+ logger.warn(` Warning: ${warning}`);
203
+ }
204
+ } catch (error) {
205
+ throw errorHandler.createError(
206
+ 'WUNDR_INIT_RAG_FAILED',
207
+ 'Failed to initialize RAG',
208
+ { options },
209
+ true,
120
210
  );
121
211
  }
122
212
  }
@@ -144,7 +234,7 @@ export class InitCommands {
144
234
  'WUNDR_INIT_CONFIG_FAILED',
145
235
  'Failed to initialize configuration',
146
236
  { options },
147
- true
237
+ true,
148
238
  );
149
239
  }
150
240
  }
@@ -179,7 +269,7 @@ export class InitCommands {
179
269
  // Create workspace-specific wundr config
180
270
  await this.configManager.loadConfig();
181
271
  await this.configManager.saveConfig(
182
- path.join(process.cwd(), 'wundr.config.json')
272
+ path.join(process.cwd(), 'wundr.config.json'),
183
273
  );
184
274
 
185
275
  logger.success('Workspace initialized successfully!');
@@ -188,7 +278,7 @@ export class InitCommands {
188
278
  'WUNDR_INIT_WORKSPACE_FAILED',
189
279
  'Failed to initialize workspace',
190
280
  { options },
191
- true
281
+ true,
192
282
  );
193
283
  }
194
284
  }
@@ -215,7 +305,7 @@ export class InitCommands {
215
305
  'WUNDR_INIT_PLUGINS_FAILED',
216
306
  'Failed to initialize plugins',
217
307
  { options },
218
- true
308
+ true,
219
309
  );
220
310
  }
221
311
  }
@@ -225,7 +315,7 @@ export class InitCommands {
225
315
  */
226
316
  private async createProjectStructure(
227
317
  projectPath: string,
228
- options: any
318
+ options: any,
229
319
  ): Promise<void> {
230
320
  await fs.ensureDir(projectPath);
231
321
 
@@ -242,7 +332,7 @@ export class InitCommands {
242
332
  // Create project-specific config
243
333
  const config = await this.configManager.loadConfig();
244
334
  await this.configManager.saveConfig(
245
- path.join(projectPath, 'wundr.config.json')
335
+ path.join(projectPath, 'wundr.config.json'),
246
336
  );
247
337
  }
248
338
 
@@ -251,7 +341,7 @@ export class InitCommands {
251
341
  */
252
342
  private async createDefaultStructure(
253
343
  projectPath: string,
254
- options: any
344
+ options: any,
255
345
  ): Promise<void> {
256
346
  const directories = options.monorepo
257
347
  ? ['packages', 'apps', 'tools', 'docs', 'scripts', '.claude-flow']
@@ -554,11 +644,11 @@ fi
554
644
 
555
645
  await fs.writeFile(
556
646
  path.join(projectPath, 'scripts', 'verify-claims.sh'),
557
- verifyScript
647
+ verifyScript,
558
648
  );
559
649
  await fs.chmod(
560
650
  path.join(projectPath, 'scripts', 'verify-claims.sh'),
561
- '755'
651
+ '755',
562
652
  );
563
653
 
564
654
  // Create FAILURES.md
@@ -588,7 +678,7 @@ _(None yet - will be populated when failures are resolved)_
588
678
 
589
679
  await fs.writeFile(
590
680
  path.join(projectPath, 'docs', 'FAILURES.md'),
591
- failuresMd
681
+ failuresMd,
592
682
  );
593
683
 
594
684
  // Create verification hooks
@@ -628,7 +718,7 @@ _(None yet - will be populated when failures are resolved)_
628
718
  await fs.writeJson(
629
719
  path.join(projectPath, '.claude-flow', 'verification-hooks.json'),
630
720
  verificationHooks,
631
- { spaces: 2 }
721
+ { spaces: 2 },
632
722
  );
633
723
 
634
724
  // Create agent verification protocol
@@ -669,7 +759,7 @@ Remember: It's better to report a failure honestly than to claim false success.
669
759
 
670
760
  await fs.writeFile(
671
761
  path.join(projectPath, 'docs', 'AGENT_VERIFICATION_PROTOCOL.md'),
672
- agentProtocol
762
+ agentProtocol,
673
763
  );
674
764
 
675
765
  logger.debug('Verification files created');
@@ -3,17 +3,21 @@
3
3
  * Implements intelligent optimization strategies for Wundr platform performance
4
4
  */
5
5
 
6
- import { Command } from 'commander';
7
- import fs from 'fs-extra';
8
- import path from 'path';
9
- import chalk from 'chalk';
10
- import { ConfigManager } from '../utils/config-manager';
11
- import { logger } from '../utils/logger';
12
- import { errorHandler } from '../utils/error-handler';
13
6
  import { spawn } from 'child_process';
7
+ import path from 'path';
14
8
  import { performance } from 'perf_hooks';
15
9
  import { memoryUsage, cpuUsage } from 'process';
16
10
 
11
+ import chalk from 'chalk';
12
+ import fs from 'fs-extra';
13
+
14
+ import { errorHandler } from '../utils/error-handler';
15
+ import { logger } from '../utils/logger';
16
+
17
+ import type { ConfigManager } from '../utils/config-manager';
18
+ import type { Command } from 'commander';
19
+
20
+
17
21
  interface OptimizationResult {
18
22
  category: 'memory' | 'concurrency' | 'cpu' | 'io' | 'network';
19
23
  description: string;
@@ -133,7 +137,7 @@ class MemoryOptimizer {
133
137
  }
134
138
 
135
139
  async optimizeMemoryUsage(
136
- optimizations: OptimizationResult[]
140
+ optimizations: OptimizationResult[],
137
141
  ): Promise<void> {
138
142
  for (const opt of optimizations.filter(o => o.automated && !o.applied)) {
139
143
  logger.info(`Applying memory optimization: ${opt.description}`);
@@ -152,7 +156,7 @@ class MemoryOptimizer {
152
156
  }
153
157
 
154
158
  private async applyMemoryOptimization(
155
- opt: OptimizationResult
159
+ opt: OptimizationResult,
156
160
  ): Promise<void> {
157
161
  // Force garbage collection if available
158
162
  if (
@@ -171,7 +175,7 @@ class MemoryOptimizer {
171
175
  ) {
172
176
  // 1GB
173
177
  logger.warn(
174
- 'Consider increasing Node.js heap size with --max-old-space-size'
178
+ 'Consider increasing Node.js heap size with --max-old-space-size',
175
179
  );
176
180
  }
177
181
  }
@@ -247,7 +251,7 @@ class ConcurrencyOptimizer {
247
251
  }
248
252
 
249
253
  async optimizeConcurrency(
250
- optimizations: OptimizationResult[]
254
+ optimizations: OptimizationResult[],
251
255
  ): Promise<void> {
252
256
  for (const opt of optimizations.filter(o => o.automated && !o.applied)) {
253
257
  logger.info(`Applying concurrency optimization: ${opt.description}`);
@@ -262,16 +266,16 @@ class ConcurrencyOptimizer {
262
266
  }
263
267
 
264
268
  private async applyConcurrencyOptimization(
265
- opt: OptimizationResult
269
+ opt: OptimizationResult,
266
270
  ): Promise<void> {
267
271
  if (opt.metrics?.['utilization'] && opt.metrics['utilization'] < 0.7) {
268
272
  // Increase worker thread pool for better CPU utilization
269
273
  const newWorkerCount = Math.min(
270
274
  this.workerThreads,
271
- Math.floor(this.workerThreads * 1.2)
275
+ Math.floor(this.workerThreads * 1.2),
272
276
  );
273
277
  logger.info(
274
- `Increasing worker threads from ${this.activeWorkers} to ${newWorkerCount}`
278
+ `Increasing worker threads from ${this.activeWorkers} to ${newWorkerCount}`,
275
279
  );
276
280
  // Implementation would update the actual worker pool
277
281
  }
@@ -355,7 +359,7 @@ export class PerformanceOptimizerCommands {
355
359
 
356
360
  constructor(
357
361
  private program: Command,
358
- private configManager: ConfigManager
362
+ private configManager: ConfigManager,
359
363
  ) {
360
364
  this.registerCommands();
361
365
  }
@@ -403,7 +407,7 @@ export class PerformanceOptimizerCommands {
403
407
  .description('run all optimization analyses and apply safe optimizations')
404
408
  .option(
405
409
  '--dry-run',
406
- 'show what would be optimized without applying changes'
410
+ 'show what would be optimized without applying changes',
407
411
  )
408
412
  .option('--report <path>', 'generate comprehensive optimization report')
409
413
  .action(async options => {
@@ -443,7 +447,7 @@ export class PerformanceOptimizerCommands {
443
447
  }
444
448
 
445
449
  logger.info(
446
- `Found ${optimizations.length} memory optimization opportunities:`
450
+ `Found ${optimizations.length} memory optimization opportunities:`,
447
451
  );
448
452
  optimizations.forEach(opt => {
449
453
  const impactColor =
@@ -453,7 +457,7 @@ export class PerformanceOptimizerCommands {
453
457
  ? 'yellow'
454
458
  : 'green';
455
459
  console.log(
456
- ` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}`
460
+ ` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}`,
457
461
  );
458
462
  });
459
463
 
@@ -468,7 +472,7 @@ export class PerformanceOptimizerCommands {
468
472
  await this.generateOptimizationReport(
469
473
  optimizations,
470
474
  options.report,
471
- 'memory'
475
+ 'memory',
472
476
  );
473
477
  }
474
478
  } catch (error) {
@@ -476,7 +480,7 @@ export class PerformanceOptimizerCommands {
476
480
  'WUNDR_MEMORY_OPTIMIZATION_FAILED',
477
481
  'Failed to optimize memory usage',
478
482
  { options },
479
- true
483
+ true,
480
484
  );
481
485
  }
482
486
  }
@@ -487,7 +491,7 @@ export class PerformanceOptimizerCommands {
487
491
 
488
492
  if (options.workers) {
489
493
  this.concurrencyOptimizer.updateActiveWorkers(
490
- parseInt(options.workers)
494
+ parseInt(options.workers),
491
495
  );
492
496
  }
493
497
 
@@ -500,7 +504,7 @@ export class PerformanceOptimizerCommands {
500
504
  }
501
505
 
502
506
  logger.info(
503
- `Found ${optimizations.length} concurrency optimization opportunities:`
507
+ `Found ${optimizations.length} concurrency optimization opportunities:`,
504
508
  );
505
509
  optimizations.forEach(opt => {
506
510
  const impactColor =
@@ -510,7 +514,7 @@ export class PerformanceOptimizerCommands {
510
514
  ? 'yellow'
511
515
  : 'green';
512
516
  console.log(
513
- ` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}`
517
+ ` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}`,
514
518
  );
515
519
  });
516
520
 
@@ -525,7 +529,7 @@ export class PerformanceOptimizerCommands {
525
529
  'WUNDR_CONCURRENCY_OPTIMIZATION_FAILED',
526
530
  'Failed to optimize concurrency',
527
531
  { options },
528
- true
532
+ true,
529
533
  );
530
534
  }
531
535
  }
@@ -544,7 +548,7 @@ export class PerformanceOptimizerCommands {
544
548
  }
545
549
 
546
550
  logger.info(
547
- `Found ${optimizations.length} bundle optimization opportunities:`
551
+ `Found ${optimizations.length} bundle optimization opportunities:`,
548
552
  );
549
553
  optimizations.forEach(opt => {
550
554
  const impactColor =
@@ -554,7 +558,7 @@ export class PerformanceOptimizerCommands {
554
558
  ? 'yellow'
555
559
  : 'green';
556
560
  console.log(
557
- ` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}`
561
+ ` ${chalk[impactColor](`[${opt.impact.toUpperCase()}]`)} ${opt.description}`,
558
562
  );
559
563
  opt.recommendations.forEach(rec => console.log(` • ${rec}`));
560
564
  });
@@ -563,7 +567,7 @@ export class PerformanceOptimizerCommands {
563
567
  'WUNDR_BUNDLE_OPTIMIZATION_FAILED',
564
568
  'Failed to optimize bundle',
565
569
  { options },
566
- true
570
+ true,
567
571
  );
568
572
  }
569
573
  }
@@ -579,7 +583,7 @@ export class PerformanceOptimizerCommands {
579
583
  const concurrencyOpts =
580
584
  await this.concurrencyOptimizer.analyzeConcurrency();
581
585
  const bundleOpts = await this.assetOptimizer.analyzeBundleSize(
582
- process.cwd()
586
+ process.cwd(),
583
587
  );
584
588
 
585
589
  allOptimizations.push(...memoryOpts, ...concurrencyOpts, ...bundleOpts);
@@ -593,18 +597,20 @@ export class PerformanceOptimizerCommands {
593
597
  const grouped = allOptimizations.reduce(
594
598
  (acc, opt) => {
595
599
  if (opt && opt.category) {
596
- if (!acc[opt.category]) acc[opt.category] = [];
600
+ if (!acc[opt.category]) {
601
+ acc[opt.category] = [];
602
+ }
597
603
  acc[opt.category]!.push(opt);
598
604
  }
599
605
  return acc;
600
606
  },
601
- {} as Record<string, OptimizationResult[]>
607
+ {} as Record<string, OptimizationResult[]>,
602
608
  );
603
609
 
604
- logger.info(`\nšŸ“Š Optimization Summary:`);
610
+ logger.info('\nšŸ“Š Optimization Summary:');
605
611
  Object.entries(grouped).forEach(([category, opts]) => {
606
612
  console.log(
607
- ` ${chalk.bold(category.toUpperCase())}: ${opts.length} opportunities`
613
+ ` ${chalk.bold(category.toUpperCase())}: ${opts.length} opportunities`,
608
614
  );
609
615
  });
610
616
 
@@ -613,7 +619,7 @@ export class PerformanceOptimizerCommands {
613
619
  const automated = allOptimizations.filter(o => o.automated);
614
620
  if (automated.length > 0) {
615
621
  logger.info(
616
- `\nšŸ”§ Applying ${automated.length} automated optimizations...`
622
+ `\nšŸ”§ Applying ${automated.length} automated optimizations...`,
617
623
  );
618
624
 
619
625
  for (const opt of automated) {
@@ -635,7 +641,7 @@ export class PerformanceOptimizerCommands {
635
641
  const manual = allOptimizations.filter(o => !o.automated).length;
636
642
  if (manual > 0) {
637
643
  logger.info(
638
- `ā„¹ļø ${manual} optimizations require manual intervention`
644
+ `ā„¹ļø ${manual} optimizations require manual intervention`,
639
645
  );
640
646
  }
641
647
  }
@@ -644,7 +650,7 @@ export class PerformanceOptimizerCommands {
644
650
  await this.generateOptimizationReport(
645
651
  allOptimizations,
646
652
  options.report,
647
- 'comprehensive'
653
+ 'comprehensive',
648
654
  );
649
655
  }
650
656
  } catch (error) {
@@ -652,7 +658,7 @@ export class PerformanceOptimizerCommands {
652
658
  'WUNDR_COMPREHENSIVE_OPTIMIZATION_FAILED',
653
659
  'Failed to run comprehensive optimization',
654
660
  { options },
655
- true
661
+ true,
656
662
  );
657
663
  }
658
664
  }
@@ -663,7 +669,7 @@ export class PerformanceOptimizerCommands {
663
669
  const startTime = Date.now();
664
670
 
665
671
  logger.info(
666
- `šŸ” Starting performance monitoring for ${options.duration} seconds...`
672
+ `šŸ” Starting performance monitoring for ${options.duration} seconds...`,
667
673
  );
668
674
 
669
675
  const metrics: SystemMetrics[] = [];
@@ -700,7 +706,7 @@ export class PerformanceOptimizerCommands {
700
706
  const heapMB = (memory.heapUsed / 1024 / 1024).toFixed(2);
701
707
  const rssMB = (memory.rss / 1024 / 1024).toFixed(2);
702
708
  process.stdout.write(
703
- `\ršŸ’¾ Heap: ${heapMB}MB | RSS: ${rssMB}MB | CPU: ${cpu.user}μs`
709
+ `\ršŸ’¾ Heap: ${heapMB}MB | RSS: ${rssMB}MB | CPU: ${cpu.user}μs`,
704
710
  );
705
711
  }, interval);
706
712
 
@@ -716,7 +722,7 @@ export class PerformanceOptimizerCommands {
716
722
  const peakHeap = Math.max(...metrics.map(m => m.memory.heapUsed));
717
723
  const peakRSS = Math.max(...metrics.map(m => m.memory.rss));
718
724
 
719
- console.log(`\nMemory Statistics:`);
725
+ console.log('\nMemory Statistics:');
720
726
  console.log(` Average Heap: ${(avgHeap / 1024 / 1024).toFixed(2)} MB`);
721
727
  console.log(` Average RSS: ${(avgRSS / 1024 / 1024).toFixed(2)} MB`);
722
728
  console.log(` Peak Heap: ${(peakHeap / 1024 / 1024).toFixed(2)} MB`);
@@ -786,7 +792,7 @@ export class PerformanceOptimizerCommands {
786
792
  'WUNDR_BENCHMARK_FAILED',
787
793
  'Failed to run performance benchmarks',
788
794
  { options },
789
- true
795
+ true,
790
796
  );
791
797
  }
792
798
  }
@@ -813,7 +819,7 @@ export class PerformanceOptimizerCommands {
813
819
  // Simulate concurrent task processing
814
820
  const tasks = Array.from(
815
821
  { length: 100 },
816
- (_, i) => new Promise(resolve => setTimeout(resolve, Math.random() * 10))
822
+ (_, i) => new Promise(resolve => setTimeout(resolve, Math.random() * 10)),
817
823
  );
818
824
  await Promise.all(tasks);
819
825
  }
@@ -833,7 +839,7 @@ export class PerformanceOptimizerCommands {
833
839
  private async generateOptimizationReport(
834
840
  optimizations: OptimizationResult[],
835
841
  reportPath: string,
836
- type: string
842
+ type: string,
837
843
  ): Promise<void> {
838
844
  const report = {
839
845
  timestamp: new Date().toISOString(),