@wundr.io/cli 1.0.0

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 (213) hide show
  1. package/README.md +551 -0
  2. package/bin/wundr.js +39 -0
  3. package/dist/ai/ai-service.d.ts +152 -0
  4. package/dist/ai/ai-service.d.ts.map +1 -0
  5. package/dist/ai/ai-service.js +430 -0
  6. package/dist/ai/ai-service.js.map +1 -0
  7. package/dist/ai/claude-client.d.ts +130 -0
  8. package/dist/ai/claude-client.d.ts.map +1 -0
  9. package/dist/ai/claude-client.js +339 -0
  10. package/dist/ai/claude-client.js.map +1 -0
  11. package/dist/ai/conversation-manager.d.ts +164 -0
  12. package/dist/ai/conversation-manager.d.ts.map +1 -0
  13. package/dist/ai/conversation-manager.js +612 -0
  14. package/dist/ai/conversation-manager.js.map +1 -0
  15. package/dist/ai/index.d.ts +5 -0
  16. package/dist/ai/index.d.ts.map +1 -0
  17. package/dist/ai/index.js +8 -0
  18. package/dist/ai/index.js.map +1 -0
  19. package/dist/cli.d.ts +36 -0
  20. package/dist/cli.d.ts.map +1 -0
  21. package/dist/cli.js +173 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/commands/ai.d.ts +89 -0
  24. package/dist/commands/ai.d.ts.map +1 -0
  25. package/dist/commands/ai.js +735 -0
  26. package/dist/commands/ai.js.map +1 -0
  27. package/dist/commands/analyze-optimized.d.ts +14 -0
  28. package/dist/commands/analyze-optimized.d.ts.map +1 -0
  29. package/dist/commands/analyze-optimized.js +437 -0
  30. package/dist/commands/analyze-optimized.js.map +1 -0
  31. package/dist/commands/analyze.d.ts +65 -0
  32. package/dist/commands/analyze.d.ts.map +1 -0
  33. package/dist/commands/analyze.js +435 -0
  34. package/dist/commands/analyze.js.map +1 -0
  35. package/dist/commands/batch.d.ts +71 -0
  36. package/dist/commands/batch.d.ts.map +1 -0
  37. package/dist/commands/batch.js +738 -0
  38. package/dist/commands/batch.js.map +1 -0
  39. package/dist/commands/chat.d.ts +71 -0
  40. package/dist/commands/chat.d.ts.map +1 -0
  41. package/dist/commands/chat.js +674 -0
  42. package/dist/commands/chat.js.map +1 -0
  43. package/dist/commands/claude-init.d.ts +28 -0
  44. package/dist/commands/claude-init.d.ts.map +1 -0
  45. package/dist/commands/claude-init.js +587 -0
  46. package/dist/commands/claude-init.js.map +1 -0
  47. package/dist/commands/claude-setup.d.ts +32 -0
  48. package/dist/commands/claude-setup.d.ts.map +1 -0
  49. package/dist/commands/claude-setup.js +570 -0
  50. package/dist/commands/claude-setup.js.map +1 -0
  51. package/dist/commands/computer-setup-commands.d.ts +39 -0
  52. package/dist/commands/computer-setup-commands.d.ts.map +1 -0
  53. package/dist/commands/computer-setup-commands.js +563 -0
  54. package/dist/commands/computer-setup-commands.js.map +1 -0
  55. package/dist/commands/computer-setup.d.ts +7 -0
  56. package/dist/commands/computer-setup.d.ts.map +1 -0
  57. package/dist/commands/computer-setup.js +481 -0
  58. package/dist/commands/computer-setup.js.map +1 -0
  59. package/dist/commands/create-command.d.ts +7 -0
  60. package/dist/commands/create-command.d.ts.map +1 -0
  61. package/dist/commands/create-command.js +158 -0
  62. package/dist/commands/create-command.js.map +1 -0
  63. package/dist/commands/create.d.ts +74 -0
  64. package/dist/commands/create.d.ts.map +1 -0
  65. package/dist/commands/create.js +556 -0
  66. package/dist/commands/create.js.map +1 -0
  67. package/dist/commands/dashboard.d.ts +91 -0
  68. package/dist/commands/dashboard.d.ts.map +1 -0
  69. package/dist/commands/dashboard.js +537 -0
  70. package/dist/commands/dashboard.js.map +1 -0
  71. package/dist/commands/govern.d.ts +70 -0
  72. package/dist/commands/govern.d.ts.map +1 -0
  73. package/dist/commands/govern.js +480 -0
  74. package/dist/commands/govern.js.map +1 -0
  75. package/dist/commands/init.d.ts +55 -0
  76. package/dist/commands/init.d.ts.map +1 -0
  77. package/dist/commands/init.js +584 -0
  78. package/dist/commands/init.js.map +1 -0
  79. package/dist/commands/performance-optimizer.d.ts +30 -0
  80. package/dist/commands/performance-optimizer.d.ts.map +1 -0
  81. package/dist/commands/performance-optimizer.js +649 -0
  82. package/dist/commands/performance-optimizer.js.map +1 -0
  83. package/dist/commands/plugins.d.ts +87 -0
  84. package/dist/commands/plugins.d.ts.map +1 -0
  85. package/dist/commands/plugins.js +685 -0
  86. package/dist/commands/plugins.js.map +1 -0
  87. package/dist/commands/setup.d.ts +29 -0
  88. package/dist/commands/setup.d.ts.map +1 -0
  89. package/dist/commands/setup.js +399 -0
  90. package/dist/commands/setup.js.map +1 -0
  91. package/dist/commands/test-init.d.ts +9 -0
  92. package/dist/commands/test-init.d.ts.map +1 -0
  93. package/dist/commands/test-init.js +222 -0
  94. package/dist/commands/test-init.js.map +1 -0
  95. package/dist/commands/test.d.ts +25 -0
  96. package/dist/commands/test.d.ts.map +1 -0
  97. package/dist/commands/test.js +217 -0
  98. package/dist/commands/test.js.map +1 -0
  99. package/dist/commands/watch.d.ts +76 -0
  100. package/dist/commands/watch.d.ts.map +1 -0
  101. package/dist/commands/watch.js +610 -0
  102. package/dist/commands/watch.js.map +1 -0
  103. package/dist/context/context-manager.d.ts +155 -0
  104. package/dist/context/context-manager.d.ts.map +1 -0
  105. package/dist/context/context-manager.js +383 -0
  106. package/dist/context/context-manager.js.map +1 -0
  107. package/dist/context/index.d.ts +3 -0
  108. package/dist/context/index.d.ts.map +1 -0
  109. package/dist/context/index.js +6 -0
  110. package/dist/context/index.js.map +1 -0
  111. package/dist/context/session-manager.d.ts +207 -0
  112. package/dist/context/session-manager.d.ts.map +1 -0
  113. package/dist/context/session-manager.js +682 -0
  114. package/dist/context/session-manager.js.map +1 -0
  115. package/dist/index.d.ts +8 -0
  116. package/dist/index.d.ts.map +1 -0
  117. package/dist/index.js +51 -0
  118. package/dist/index.js.map +1 -0
  119. package/dist/interactive/interactive-mode.d.ts +76 -0
  120. package/dist/interactive/interactive-mode.d.ts.map +1 -0
  121. package/dist/interactive/interactive-mode.js +730 -0
  122. package/dist/interactive/interactive-mode.js.map +1 -0
  123. package/dist/nlp/command-mapper.d.ts +174 -0
  124. package/dist/nlp/command-mapper.d.ts.map +1 -0
  125. package/dist/nlp/command-mapper.js +623 -0
  126. package/dist/nlp/command-mapper.js.map +1 -0
  127. package/dist/nlp/command-parser.d.ts +106 -0
  128. package/dist/nlp/command-parser.d.ts.map +1 -0
  129. package/dist/nlp/command-parser.js +416 -0
  130. package/dist/nlp/command-parser.js.map +1 -0
  131. package/dist/nlp/index.d.ts +5 -0
  132. package/dist/nlp/index.d.ts.map +1 -0
  133. package/dist/nlp/index.js +8 -0
  134. package/dist/nlp/index.js.map +1 -0
  135. package/dist/nlp/intent-classifier.d.ts +59 -0
  136. package/dist/nlp/intent-classifier.d.ts.map +1 -0
  137. package/dist/nlp/intent-classifier.js +384 -0
  138. package/dist/nlp/intent-classifier.js.map +1 -0
  139. package/dist/nlp/intent-parser.d.ts +152 -0
  140. package/dist/nlp/intent-parser.d.ts.map +1 -0
  141. package/dist/nlp/intent-parser.js +739 -0
  142. package/dist/nlp/intent-parser.js.map +1 -0
  143. package/dist/plugins/plugin-manager.d.ts +120 -0
  144. package/dist/plugins/plugin-manager.d.ts.map +1 -0
  145. package/dist/plugins/plugin-manager.js +595 -0
  146. package/dist/plugins/plugin-manager.js.map +1 -0
  147. package/dist/types/index.d.ts +224 -0
  148. package/dist/types/index.d.ts.map +1 -0
  149. package/dist/types/index.js +3 -0
  150. package/dist/types/index.js.map +1 -0
  151. package/dist/utils/config-manager.d.ts +73 -0
  152. package/dist/utils/config-manager.d.ts.map +1 -0
  153. package/dist/utils/config-manager.js +339 -0
  154. package/dist/utils/config-manager.js.map +1 -0
  155. package/dist/utils/error-handler.d.ts +46 -0
  156. package/dist/utils/error-handler.d.ts.map +1 -0
  157. package/dist/utils/error-handler.js +169 -0
  158. package/dist/utils/error-handler.js.map +1 -0
  159. package/dist/utils/logger.d.ts +25 -0
  160. package/dist/utils/logger.d.ts.map +1 -0
  161. package/dist/utils/logger.js +94 -0
  162. package/dist/utils/logger.js.map +1 -0
  163. package/package.json +119 -0
  164. package/src/ai/ai-service.ts +595 -0
  165. package/src/ai/claude-client.ts +490 -0
  166. package/src/ai/conversation-manager.ts +907 -0
  167. package/src/ai/index.ts +8 -0
  168. package/src/cli.ts +202 -0
  169. package/src/commands/ai.ts +995 -0
  170. package/src/commands/analyze-optimized.ts +641 -0
  171. package/src/commands/analyze.ts +576 -0
  172. package/src/commands/batch.ts +935 -0
  173. package/src/commands/chat.ts +876 -0
  174. package/src/commands/claude-init.ts +715 -0
  175. package/src/commands/claude-setup.ts +697 -0
  176. package/src/commands/computer-setup-commands.ts +709 -0
  177. package/src/commands/computer-setup.ts +565 -0
  178. package/src/commands/create-command.ts +175 -0
  179. package/src/commands/create.ts +727 -0
  180. package/src/commands/dashboard.ts +691 -0
  181. package/src/commands/govern.ts +635 -0
  182. package/src/commands/init.ts +677 -0
  183. package/src/commands/performance-optimizer.ts +864 -0
  184. package/src/commands/plugins.ts +848 -0
  185. package/src/commands/setup.ts +508 -0
  186. package/src/commands/test-init.ts +242 -0
  187. package/src/commands/test.ts +264 -0
  188. package/src/commands/watch.ts +755 -0
  189. package/src/context/context-manager.ts +546 -0
  190. package/src/context/index.ts +9 -0
  191. package/src/context/session-manager.ts +1019 -0
  192. package/src/index.ts +64 -0
  193. package/src/interactive/interactive-mode.ts +830 -0
  194. package/src/nlp/command-mapper.ts +885 -0
  195. package/src/nlp/command-parser.ts +564 -0
  196. package/src/nlp/index.ts +4 -0
  197. package/src/nlp/intent-classifier.ts +458 -0
  198. package/src/nlp/intent-parser.ts +1101 -0
  199. package/src/plugins/plugin-manager.ts +744 -0
  200. package/src/types/index.ts +252 -0
  201. package/src/types/modules.d.ts +56 -0
  202. package/src/utils/config-manager.ts +391 -0
  203. package/src/utils/error-handler.ts +192 -0
  204. package/src/utils/logger.ts +104 -0
  205. package/templates/batch/ci-cd.yaml +62 -0
  206. package/templates/component/{{fileName}}.test.tsx +17 -0
  207. package/templates/component/{{fileName}}.tsx +21 -0
  208. package/templates/service/{{fileName}}.ts +98 -0
  209. package/templates/wundr-test.config.js +0 -0
  210. package/test-suites/api/health.spec.ts +134 -0
  211. package/test-suites/helpers/test-config.ts +84 -0
  212. package/test-suites/ui/accessibility.spec.ts +102 -0
  213. package/test-suites/ui/smoke.spec.ts +92 -0
@@ -0,0 +1,677 @@
1
+ import { Command } from 'commander';
2
+ import inquirer from 'inquirer';
3
+ import fs from 'fs-extra';
4
+ import path from 'path';
5
+ import chalk from 'chalk';
6
+ import { ConfigManager } from '../utils/config-manager';
7
+ import { PluginManager } from '../plugins/plugin-manager';
8
+ import { logger } from '../utils/logger';
9
+ import { errorHandler } from '../utils/error-handler';
10
+
11
+ /**
12
+ * Init commands for project setup and configuration
13
+ */
14
+ export class InitCommands {
15
+ constructor(
16
+ private program: Command,
17
+ private configManager: ConfigManager,
18
+ private pluginManager: PluginManager
19
+ ) {
20
+ this.registerCommands();
21
+ }
22
+
23
+ private registerCommands(): void {
24
+ const initCmd = this.program
25
+ .command('init')
26
+ .description('initialize Wundr project or configuration');
27
+
28
+ // Initialize new project
29
+ initCmd
30
+ .command('project [name]')
31
+ .description('initialize a new Wundr project')
32
+ .option('--template <template>', 'project template to use', 'default')
33
+ .option('--skip-git', 'skip git initialization')
34
+ .option('--skip-install', 'skip dependency installation')
35
+ .option('--monorepo', 'initialize as monorepo')
36
+ .action(async (name, options) => {
37
+ await this.initProject(name, options);
38
+ });
39
+
40
+ // Initialize configuration
41
+ initCmd
42
+ .command('config')
43
+ .description('initialize Wundr configuration')
44
+ .option('--interactive', 'use interactive setup')
45
+ .option('--global', 'create global configuration')
46
+ .action(async options => {
47
+ await this.initConfig(options);
48
+ });
49
+
50
+ // Initialize workspace
51
+ initCmd
52
+ .command('workspace')
53
+ .description('initialize multi-project workspace')
54
+ .option('--name <name>', 'workspace name')
55
+ .option('--packages <pattern>', 'packages pattern', 'packages/*')
56
+ .action(async options => {
57
+ await this.initWorkspace(options);
58
+ });
59
+
60
+ // Initialize plugins
61
+ initCmd
62
+ .command('plugins')
63
+ .description('initialize plugin system')
64
+ .option('--install <plugins>', 'plugins to install (comma-separated)')
65
+ .action(async options => {
66
+ await this.initPlugins(options);
67
+ });
68
+ }
69
+
70
+ /**
71
+ * Initialize a new Wundr project
72
+ */
73
+ private async initProject(name: string, options: any): Promise<void> {
74
+ try {
75
+ const projectName = name || (await this.promptProjectName());
76
+ const projectPath = path.join(process.cwd(), projectName);
77
+
78
+ logger.info(`Initializing project: ${chalk.cyan(projectName)}`);
79
+
80
+ // Check if directory already exists
81
+ if (await fs.pathExists(projectPath)) {
82
+ const { overwrite } = await inquirer.prompt([
83
+ {
84
+ type: 'confirm',
85
+ name: 'overwrite',
86
+ message: 'Directory already exists. Overwrite?',
87
+ default: false,
88
+ },
89
+ ]);
90
+
91
+ if (!overwrite) {
92
+ logger.info('Project initialization cancelled');
93
+ return;
94
+ }
95
+ }
96
+
97
+ // Create project structure
98
+ await this.createProjectStructure(projectPath, options);
99
+
100
+ // Initialize git if not skipped
101
+ if (!options.skipGit) {
102
+ await this.initializeGit(projectPath);
103
+ }
104
+
105
+ // Install dependencies if not skipped
106
+ if (!options.skipInstall) {
107
+ await this.installDependencies(projectPath);
108
+ }
109
+
110
+ logger.success(`Project ${projectName} initialized successfully!`);
111
+ logger.info(`Next steps:`);
112
+ logger.info(` cd ${projectName}`);
113
+ logger.info(` wundr analyze`);
114
+ } catch (error) {
115
+ throw errorHandler.createError(
116
+ 'WUNDR_INIT_PROJECT_FAILED',
117
+ 'Failed to initialize project',
118
+ { name, options },
119
+ true
120
+ );
121
+ }
122
+ }
123
+
124
+ /**
125
+ * Initialize Wundr configuration
126
+ */
127
+ private async initConfig(options: any): Promise<void> {
128
+ try {
129
+ if (options.interactive) {
130
+ await this.interactiveConfigSetup();
131
+ } else {
132
+ await this.configManager.loadConfig();
133
+ logger.success('Configuration initialized with defaults');
134
+ }
135
+
136
+ const configPaths = this.configManager.getConfigPaths();
137
+ const configPath = options.global
138
+ ? configPaths.user
139
+ : configPaths.project;
140
+
141
+ logger.info(`Configuration saved to: ${chalk.cyan(configPath)}`);
142
+ } catch (error) {
143
+ throw errorHandler.createError(
144
+ 'WUNDR_INIT_CONFIG_FAILED',
145
+ 'Failed to initialize configuration',
146
+ { options },
147
+ true
148
+ );
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Initialize workspace for multiple projects
154
+ */
155
+ private async initWorkspace(options: any): Promise<void> {
156
+ try {
157
+ const workspaceName = options.name || (await this.promptWorkspaceName());
158
+
159
+ logger.info(`Initializing workspace: ${chalk.cyan(workspaceName)}`);
160
+
161
+ const workspaceConfig = {
162
+ name: workspaceName,
163
+ version: '1.0.0',
164
+ workspaces: [options.packages],
165
+ scripts: {
166
+ build: 'wundr build --workspace',
167
+ test: 'wundr test --workspace',
168
+ lint: 'wundr lint --workspace',
169
+ analyze: 'wundr analyze --workspace',
170
+ },
171
+ devDependencies: {
172
+ '@wundr/cli': '^1.0.0',
173
+ },
174
+ };
175
+
176
+ await fs.writeJson('package.json', workspaceConfig, { spaces: 2 });
177
+ await fs.ensureDir('packages');
178
+
179
+ // Create workspace-specific wundr config
180
+ await this.configManager.loadConfig();
181
+ await this.configManager.saveConfig(
182
+ path.join(process.cwd(), 'wundr.config.json')
183
+ );
184
+
185
+ logger.success('Workspace initialized successfully!');
186
+ } catch (error) {
187
+ throw errorHandler.createError(
188
+ 'WUNDR_INIT_WORKSPACE_FAILED',
189
+ 'Failed to initialize workspace',
190
+ { options },
191
+ true
192
+ );
193
+ }
194
+ }
195
+
196
+ /**
197
+ * Initialize plugin system
198
+ */
199
+ private async initPlugins(options: any): Promise<void> {
200
+ try {
201
+ logger.info('Initializing plugin system...');
202
+
203
+ await this.pluginManager.initialize();
204
+
205
+ if (options.install) {
206
+ const plugins = options.install.split(',').map((p: string) => p.trim());
207
+ for (const plugin of plugins) {
208
+ await this.pluginManager.installPlugin(plugin);
209
+ }
210
+ }
211
+
212
+ logger.success('Plugin system initialized!');
213
+ } catch (error) {
214
+ throw errorHandler.createError(
215
+ 'WUNDR_INIT_PLUGINS_FAILED',
216
+ 'Failed to initialize plugins',
217
+ { options },
218
+ true
219
+ );
220
+ }
221
+ }
222
+
223
+ /**
224
+ * Create project structure based on template
225
+ */
226
+ private async createProjectStructure(
227
+ projectPath: string,
228
+ options: any
229
+ ): Promise<void> {
230
+ await fs.ensureDir(projectPath);
231
+
232
+ const template = options.template || 'default';
233
+ const templatePath = this.getTemplatePath(template);
234
+
235
+ if (await fs.pathExists(templatePath)) {
236
+ await fs.copy(templatePath, projectPath);
237
+ } else {
238
+ // Create default structure
239
+ await this.createDefaultStructure(projectPath, options);
240
+ }
241
+
242
+ // Create project-specific config
243
+ const config = await this.configManager.loadConfig();
244
+ await this.configManager.saveConfig(
245
+ path.join(projectPath, 'wundr.config.json')
246
+ );
247
+ }
248
+
249
+ /**
250
+ * Create default project structure
251
+ */
252
+ private async createDefaultStructure(
253
+ projectPath: string,
254
+ options: any
255
+ ): Promise<void> {
256
+ const directories = options.monorepo
257
+ ? ['packages', 'apps', 'tools', 'docs', 'scripts', '.claude-flow']
258
+ : ['src', 'tests', 'docs', 'scripts', '.claude-flow'];
259
+
260
+ for (const dir of directories) {
261
+ await fs.ensureDir(path.join(projectPath, dir));
262
+ }
263
+
264
+ // Create package.json
265
+ const packageJson = {
266
+ name: path.basename(projectPath),
267
+ version: '1.0.0',
268
+ description: '',
269
+ main: options.monorepo ? undefined : 'src/index.ts',
270
+ scripts: {
271
+ build: 'wundr build',
272
+ test: 'wundr test',
273
+ lint: 'wundr lint',
274
+ analyze: 'wundr analyze',
275
+ verify: './scripts/verify-claims.sh',
276
+ },
277
+ devDependencies: {
278
+ '@wundr/cli': '^1.0.0',
279
+ },
280
+ ...(options.monorepo && { workspaces: ['packages/*', 'apps/*'] }),
281
+ };
282
+
283
+ await fs.writeJson(path.join(projectPath, 'package.json'), packageJson, {
284
+ spaces: 2,
285
+ });
286
+
287
+ // Create README
288
+ const readme = this.generateReadme(path.basename(projectPath), options);
289
+ await fs.writeFile(path.join(projectPath, 'README.md'), readme);
290
+
291
+ // Create verification files
292
+ await this.createVerificationFiles(projectPath);
293
+ }
294
+
295
+ /**
296
+ * Interactive configuration setup
297
+ */
298
+ private async interactiveConfigSetup(): Promise<void> {
299
+ const answers = await inquirer.prompt([
300
+ {
301
+ type: 'list',
302
+ name: 'defaultMode',
303
+ message: 'Default CLI mode:',
304
+ choices: [
305
+ { name: 'Command Line', value: 'cli' },
306
+ { name: 'Interactive Wizard', value: 'interactive' },
307
+ { name: 'Chat Interface', value: 'chat' },
308
+ { name: 'Terminal UI', value: 'tui' },
309
+ ],
310
+ default: 'cli',
311
+ },
312
+ {
313
+ type: 'input',
314
+ name: 'aiProvider',
315
+ message: 'AI provider:',
316
+ default: 'claude',
317
+ },
318
+ {
319
+ type: 'input',
320
+ name: 'aiModel',
321
+ message: 'AI model:',
322
+ default: 'claude-3',
323
+ },
324
+ {
325
+ type: 'confirm',
326
+ name: 'enableGitHub',
327
+ message: 'Enable GitHub integration?',
328
+ default: false,
329
+ },
330
+ {
331
+ type: 'input',
332
+ name: 'githubToken',
333
+ message: 'GitHub token:',
334
+ when: answers => answers.enableGitHub,
335
+ validate: input => input.length > 0 || 'GitHub token is required',
336
+ },
337
+ ]);
338
+
339
+ await this.configManager.loadConfig();
340
+
341
+ this.configManager.updateConfig({
342
+ defaultMode: answers.defaultMode,
343
+ ai: {
344
+ provider: answers.aiProvider,
345
+ model: answers.aiModel,
346
+ },
347
+ ...(answers.enableGitHub && {
348
+ integrations: {
349
+ github: {
350
+ token: answers.githubToken,
351
+ owner: '',
352
+ repo: '',
353
+ },
354
+ },
355
+ }),
356
+ });
357
+
358
+ await this.configManager.saveConfig();
359
+ }
360
+
361
+ /**
362
+ * Utility methods
363
+ */
364
+ private async promptProjectName(): Promise<string> {
365
+ const { name } = await inquirer.prompt([
366
+ {
367
+ type: 'input',
368
+ name: 'name',
369
+ message: 'Project name:',
370
+ default: 'my-wundr-project',
371
+ validate: input => input.length > 0 || 'Project name is required',
372
+ },
373
+ ]);
374
+ return name;
375
+ }
376
+
377
+ private async promptWorkspaceName(): Promise<string> {
378
+ const { name } = await inquirer.prompt([
379
+ {
380
+ type: 'input',
381
+ name: 'name',
382
+ message: 'Workspace name:',
383
+ default: 'my-workspace',
384
+ validate: input => input.length > 0 || 'Workspace name is required',
385
+ },
386
+ ]);
387
+ return name;
388
+ }
389
+
390
+ private getTemplatePath(template: string): string {
391
+ return path.join(__dirname, '../../templates', template);
392
+ }
393
+
394
+ private generateReadme(projectName: string, options: any): string {
395
+ return `# ${projectName}
396
+
397
+ Generated with Wundr CLI
398
+
399
+ ## Getting Started
400
+
401
+ \`\`\`bash
402
+ # Analyze your project
403
+ wundr analyze
404
+
405
+ # Run governance checks
406
+ wundr govern check
407
+
408
+ # Launch dashboard
409
+ wundr dashboard
410
+ \`\`\`
411
+
412
+ ## Available Commands
413
+
414
+ - \`wundr analyze\` - Analyze code dependencies and quality
415
+ - \`wundr create\` - Generate new components and services
416
+ - \`wundr govern\` - Run governance and compliance checks
417
+ - \`wundr ai\` - AI-powered development assistance
418
+ - \`wundr dashboard\` - Launch web dashboard
419
+
420
+ ## Configuration
421
+
422
+ Project configuration is stored in \`wundr.config.json\`.
423
+
424
+ Run \`wundr init config --interactive\` to set up your preferences.
425
+ `;
426
+ }
427
+
428
+ private async initializeGit(projectPath: string): Promise<void> {
429
+ // Implementation for git initialization
430
+ logger.debug('Initializing git repository...');
431
+ // This would call git commands or use a git library
432
+ }
433
+
434
+ private async installDependencies(projectPath: string): Promise<void> {
435
+ // Implementation for dependency installation
436
+ logger.debug('Installing dependencies...');
437
+ // This would call npm/yarn/pnpm install
438
+ }
439
+
440
+ /**
441
+ * Create verification files for preventing hallucinations
442
+ */
443
+ private async createVerificationFiles(projectPath: string): Promise<void> {
444
+ // Create CLAUDE.md with verification protocols
445
+ const claudeMd = `# Claude Code Configuration - WITH VERIFICATION PROTOCOLS
446
+
447
+ ## 🚨 CRITICAL: VERIFICATION PROTOCOL & REALITY CHECKS
448
+
449
+ ### MANDATORY: ALWAYS VERIFY, NEVER ASSUME
450
+
451
+ **After EVERY code change or implementation:**
452
+ 1. **TEST IT**: Run the actual command and show real output
453
+ 2. **PROVE IT**: Show file contents, build results, test output
454
+ 3. **FAIL LOUDLY**: If something fails, say "❌ FAILED:" immediately
455
+ 4. **VERIFY SUCCESS**: Only claim "complete" after showing it working
456
+
457
+ **FORBIDDEN BEHAVIORS:**
458
+ - ❌ NEVER claim "build successful" without running build
459
+ - ❌ NEVER say "tests pass" without running tests
460
+ - ❌ NEVER report "implemented" without verification
461
+ - ❌ NEVER hide or minimize errors
462
+ - ❌ NEVER generate fictional terminal output
463
+ - ❌ NEVER assume code works because you wrote it
464
+
465
+ **REQUIRED BEHAVIORS:**
466
+ - ✅ Run actual commands
467
+ - ✅ Show real output
468
+ - ✅ Report failures immediately
469
+ - ✅ Document issues in FAILURES.md
470
+ - ✅ Test before claiming done
471
+ - ✅ Be honest about state
472
+
473
+ ### FAILURE REPORTING FORMAT
474
+ \`\`\`
475
+ ❌ FAILURE: [Component Name]
476
+ Error: [Exact error message]
477
+ Location: [File and line if available]
478
+ Status: BLOCKED/PARTIAL/NEEDS_INVESTIGATION
479
+ \`\`\`
480
+
481
+ ### SUCCESS REPORTING FORMAT
482
+ \`\`\`
483
+ ✅ VERIFIED: [Component Name]
484
+ Build Output: [Show actual npm run build success]
485
+ Test Output: [Show actual test results]
486
+ Execution: [Show feature actually running]
487
+ \`\`\`
488
+
489
+ ## Project Commands
490
+
491
+ - \`npm run build\` - Build the project
492
+ - \`npm run test\` - Run tests
493
+ - \`npm run verify\` - Run verification script
494
+ - \`wundr analyze\` - Analyze project
495
+ `;
496
+
497
+ await fs.writeFile(path.join(projectPath, 'CLAUDE.md'), claudeMd);
498
+
499
+ // Create verification script
500
+ const verifyScript = `#!/bin/bash
501
+
502
+ # Verification Script - MUST pass before claiming tasks complete
503
+ set -e
504
+
505
+ RED='\\033[0;31m'
506
+ GREEN='\\033[0;32m'
507
+ YELLOW='\\033[1;33m'
508
+ NC='\\033[0m'
509
+
510
+ echo "================================================"
511
+ echo "🔍 VERIFICATION SCRIPT"
512
+ echo "================================================"
513
+
514
+ FAILURES=0
515
+ SUCCESSES=0
516
+
517
+ test_command() {
518
+ local description=$1
519
+ local command=$2
520
+
521
+ echo -n "Testing: $description... "
522
+
523
+ if eval "$command" > /dev/null 2>&1; then
524
+ echo -e "\${GREEN}✅ PASSED\${NC}"
525
+ ((SUCCESSES++))
526
+ else
527
+ echo -e "\${RED}❌ FAILED\${NC}"
528
+ echo " Command: $command"
529
+ ((FAILURES++))
530
+ fi
531
+ }
532
+
533
+ echo "1. CHECKING BUILD SYSTEM"
534
+ test_command "Project build" "npm run build"
535
+
536
+ echo ""
537
+ echo "2. CHECKING TESTS"
538
+ test_command "Project tests" "npm test"
539
+
540
+ echo ""
541
+ echo "================================================"
542
+ echo -e "Successes: \${GREEN}$SUCCESSES\${NC}"
543
+ echo -e "Failures: \${RED}$FAILURES\${NC}"
544
+
545
+ if [ $FAILURES -gt 0 ]; then
546
+ echo -e "\${RED}❌ VERIFICATION FAILED\${NC}"
547
+ echo "Cannot claim tasks complete with $FAILURES failures!"
548
+ exit 1
549
+ else
550
+ echo -e "\${GREEN}✅ ALL VERIFICATIONS PASSED\${NC}"
551
+ exit 0
552
+ fi
553
+ `;
554
+
555
+ await fs.writeFile(
556
+ path.join(projectPath, 'scripts', 'verify-claims.sh'),
557
+ verifyScript
558
+ );
559
+ await fs.chmod(
560
+ path.join(projectPath, 'scripts', 'verify-claims.sh'),
561
+ '755'
562
+ );
563
+
564
+ // Create FAILURES.md
565
+ const failuresMd = `# Failure Tracking
566
+
567
+ This file tracks actual failures encountered during development.
568
+ Always update this when encountering issues that block progress.
569
+
570
+ ## Format
571
+
572
+ ### [Date] - [Component]
573
+ **Error**: Exact error message
574
+ **Command**: Command that failed
575
+ **Status**: BLOCKED/PARTIAL/RESOLVED
576
+ **Solution**: What fixed it (if resolved)
577
+
578
+ ---
579
+
580
+ ## Active Failures
581
+
582
+ _(None yet - will be populated when failures occur)_
583
+
584
+ ## Resolved Failures
585
+
586
+ _(None yet - will be populated when failures are resolved)_
587
+ `;
588
+
589
+ await fs.writeFile(
590
+ path.join(projectPath, 'docs', 'FAILURES.md'),
591
+ failuresMd
592
+ );
593
+
594
+ // Create verification hooks
595
+ const verificationHooks = {
596
+ version: '1.0.0',
597
+ hooks: {
598
+ 'pre-completion': {
599
+ enabled: true,
600
+ required: true,
601
+ commands: ['./scripts/verify-claims.sh'],
602
+ failureMessage: '❌ Cannot mark complete - verification failed!',
603
+ },
604
+ 'post-implementation': {
605
+ enabled: true,
606
+ commands: ['npm run build', 'npm test'],
607
+ continueOnFailure: false,
608
+ },
609
+ 'reality-check': {
610
+ enabled: true,
611
+ interval: 'after-each-task',
612
+ checks: [
613
+ 'build-passes',
614
+ 'tests-pass',
615
+ 'no-typescript-errors',
616
+ 'dependencies-installed',
617
+ ],
618
+ },
619
+ },
620
+ enforcement: {
621
+ blockHallucinatedSuccess: true,
622
+ requireActualOutput: true,
623
+ documentFailures: true,
624
+ verifyBeforeClaiming: true,
625
+ },
626
+ };
627
+
628
+ await fs.writeJson(
629
+ path.join(projectPath, '.claude-flow', 'verification-hooks.json'),
630
+ verificationHooks,
631
+ { spaces: 2 }
632
+ );
633
+
634
+ // Create agent verification protocol
635
+ const agentProtocol = `# 🚨 AGENT VERIFICATION PROTOCOL
636
+
637
+ ## MANDATORY FOR ALL AGENTS
638
+
639
+ ### CORE PRINCIPLE: VERIFY, DON'T HALLUCINATE
640
+
641
+ ## BEFORE CLAIMING SUCCESS
642
+
643
+ **ALWAYS run these commands and show output:**
644
+ \`\`\`bash
645
+ npm run build # or appropriate build command
646
+ npm test # if tests exist
647
+ \`\`\`
648
+
649
+ ## FORBIDDEN BEHAVIORS
650
+
651
+ **NEVER DO THIS:**
652
+ - ❌ Claim "build successful" without running build
653
+ - ❌ Say "tests pass" without running tests
654
+ - ❌ Report "implemented" without verification
655
+ - ❌ Hide or minimize errors
656
+ - ❌ Generate fictional terminal output
657
+
658
+ ## REQUIRED BEHAVIORS
659
+
660
+ **ALWAYS DO THIS:**
661
+ - ✅ Run actual commands
662
+ - ✅ Show real output
663
+ - ✅ Report failures immediately
664
+ - ✅ Document issues in FAILURES.md
665
+ - ✅ Test before claiming done
666
+
667
+ Remember: It's better to report a failure honestly than to claim false success.
668
+ `;
669
+
670
+ await fs.writeFile(
671
+ path.join(projectPath, 'docs', 'AGENT_VERIFICATION_PROTOCOL.md'),
672
+ agentProtocol
673
+ );
674
+
675
+ logger.debug('Verification files created');
676
+ }
677
+ }