@wundr.io/cli 1.0.10 → 1.0.12

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 (269) hide show
  1. package/bin/wundr.js +8 -4
  2. package/package.json +23 -23
  3. package/src/ai/ai-service.ts +16 -17
  4. package/src/ai/claude-client.ts +16 -16
  5. package/src/ai/conversation-manager.ts +29 -29
  6. package/src/cli.ts +4 -4
  7. package/src/commands/ai.ts +246 -78
  8. package/src/commands/alignment.ts +74 -74
  9. package/src/commands/analyze-optimized.ts +111 -78
  10. package/src/commands/analyze.ts +14 -14
  11. package/src/commands/batch.ts +179 -42
  12. package/src/commands/chat.ts +37 -30
  13. package/src/commands/claude-init.ts +41 -45
  14. package/src/commands/claude-setup.ts +204 -119
  15. package/src/commands/computer-setup.ts +85 -43
  16. package/src/commands/create-command.ts +4 -4
  17. package/src/commands/create.ts +27 -27
  18. package/src/commands/dashboard.ts +24 -24
  19. package/src/commands/govern.ts +25 -25
  20. package/src/commands/governance.ts +34 -34
  21. package/src/commands/guardian.ts +56 -56
  22. package/src/commands/init.ts +25 -22
  23. package/src/commands/orchestrator.ts +68 -41
  24. package/src/commands/performance-optimizer.ts +34 -35
  25. package/src/commands/plugins.ts +27 -27
  26. package/src/commands/project-update.ts +175 -72
  27. package/src/commands/rag.ts +185 -78
  28. package/src/commands/session.ts +35 -35
  29. package/src/commands/setup.ts +40 -344
  30. package/src/commands/test-init.ts +3 -3
  31. package/src/commands/test.ts +4 -4
  32. package/src/commands/watch.ts +28 -29
  33. package/src/commands/worktree.ts +49 -49
  34. package/src/context/context-manager.ts +10 -10
  35. package/src/context/session-manager.ts +41 -41
  36. package/src/framework/command-interface.ts +520 -0
  37. package/src/framework/command-registry.ts +942 -0
  38. package/src/framework/completion-exporter.ts +383 -0
  39. package/src/framework/debug-logger.ts +519 -0
  40. package/src/framework/error-handler.ts +867 -0
  41. package/src/framework/help-generator.ts +540 -0
  42. package/src/framework/index.ts +169 -0
  43. package/src/framework/interactive-repl.ts +703 -0
  44. package/src/framework/output-formatter.ts +834 -0
  45. package/src/framework/progress-manager.ts +539 -0
  46. package/src/index.ts +4 -4
  47. package/src/interactive/interactive-mode.ts +16 -16
  48. package/src/lib/conflict-resolution.ts +799 -9
  49. package/src/lib/merge-strategy.ts +529 -7
  50. package/src/lib/safety-mechanisms.ts +422 -18
  51. package/src/lib/state-detection.ts +1015 -13
  52. package/src/nlp/command-mapper.ts +29 -29
  53. package/src/nlp/command-parser.ts +17 -17
  54. package/src/nlp/intent-classifier.ts +7 -7
  55. package/src/nlp/intent-parser.ts +54 -52
  56. package/src/plugins/plugin-manager.ts +61 -39
  57. package/src/tests/computer-setup-integration.test.ts +46 -15
  58. package/src/types/modules.d.ts +424 -1
  59. package/src/utils/backup-rollback-manager.ts +11 -8
  60. package/src/utils/config-manager.ts +3 -3
  61. package/src/utils/error-handler.ts +2 -2
  62. package/src/utils/logger.ts +22 -22
  63. package/templates/batch/ci-cd.yaml +7 -7
  64. package/test-suites/api/health.spec.ts +20 -23
  65. package/test-suites/helpers/test-config.ts +14 -13
  66. package/test-suites/ui/accessibility.spec.ts +27 -22
  67. package/test-suites/ui/smoke.spec.ts +26 -21
  68. package/LICENSE +0 -21
  69. package/dist/ai/ai-service.d.ts +0 -152
  70. package/dist/ai/ai-service.d.ts.map +0 -1
  71. package/dist/ai/ai-service.js +0 -430
  72. package/dist/ai/ai-service.js.map +0 -1
  73. package/dist/ai/claude-client.d.ts +0 -130
  74. package/dist/ai/claude-client.d.ts.map +0 -1
  75. package/dist/ai/claude-client.js +0 -340
  76. package/dist/ai/claude-client.js.map +0 -1
  77. package/dist/ai/conversation-manager.d.ts +0 -164
  78. package/dist/ai/conversation-manager.d.ts.map +0 -1
  79. package/dist/ai/conversation-manager.js +0 -614
  80. package/dist/ai/conversation-manager.js.map +0 -1
  81. package/dist/ai/index.d.ts +0 -5
  82. package/dist/ai/index.d.ts.map +0 -1
  83. package/dist/ai/index.js +0 -8
  84. package/dist/ai/index.js.map +0 -1
  85. package/dist/cli.d.ts +0 -36
  86. package/dist/cli.d.ts.map +0 -1
  87. package/dist/cli.js +0 -192
  88. package/dist/cli.js.map +0 -1
  89. package/dist/commands/ai.d.ts +0 -89
  90. package/dist/commands/ai.d.ts.map +0 -1
  91. package/dist/commands/ai.js +0 -799
  92. package/dist/commands/ai.js.map +0 -1
  93. package/dist/commands/alignment.d.ts +0 -78
  94. package/dist/commands/alignment.d.ts.map +0 -1
  95. package/dist/commands/alignment.js +0 -817
  96. package/dist/commands/alignment.js.map +0 -1
  97. package/dist/commands/analyze-optimized.d.ts +0 -14
  98. package/dist/commands/analyze-optimized.d.ts.map +0 -1
  99. package/dist/commands/analyze-optimized.js +0 -600
  100. package/dist/commands/analyze-optimized.js.map +0 -1
  101. package/dist/commands/analyze.d.ts +0 -65
  102. package/dist/commands/analyze.d.ts.map +0 -1
  103. package/dist/commands/analyze.js +0 -435
  104. package/dist/commands/analyze.js.map +0 -1
  105. package/dist/commands/batch.d.ts +0 -71
  106. package/dist/commands/batch.d.ts.map +0 -1
  107. package/dist/commands/batch.js +0 -738
  108. package/dist/commands/batch.js.map +0 -1
  109. package/dist/commands/chat.d.ts +0 -71
  110. package/dist/commands/chat.d.ts.map +0 -1
  111. package/dist/commands/chat.js +0 -674
  112. package/dist/commands/chat.js.map +0 -1
  113. package/dist/commands/claude-init.d.ts +0 -28
  114. package/dist/commands/claude-init.d.ts.map +0 -1
  115. package/dist/commands/claude-init.js +0 -591
  116. package/dist/commands/claude-init.js.map +0 -1
  117. package/dist/commands/claude-setup.d.ts +0 -119
  118. package/dist/commands/claude-setup.d.ts.map +0 -1
  119. package/dist/commands/claude-setup.js +0 -1073
  120. package/dist/commands/claude-setup.js.map +0 -1
  121. package/dist/commands/computer-setup-commands.d.ts +0 -53
  122. package/dist/commands/computer-setup-commands.d.ts.map +0 -1
  123. package/dist/commands/computer-setup-commands.js +0 -705
  124. package/dist/commands/computer-setup-commands.js.map +0 -1
  125. package/dist/commands/computer-setup.d.ts +0 -7
  126. package/dist/commands/computer-setup.d.ts.map +0 -1
  127. package/dist/commands/computer-setup.js +0 -849
  128. package/dist/commands/computer-setup.js.map +0 -1
  129. package/dist/commands/create-command.d.ts +0 -7
  130. package/dist/commands/create-command.d.ts.map +0 -1
  131. package/dist/commands/create-command.js +0 -158
  132. package/dist/commands/create-command.js.map +0 -1
  133. package/dist/commands/create.d.ts +0 -74
  134. package/dist/commands/create.d.ts.map +0 -1
  135. package/dist/commands/create.js +0 -556
  136. package/dist/commands/create.js.map +0 -1
  137. package/dist/commands/dashboard.d.ts +0 -91
  138. package/dist/commands/dashboard.d.ts.map +0 -1
  139. package/dist/commands/dashboard.js +0 -538
  140. package/dist/commands/dashboard.js.map +0 -1
  141. package/dist/commands/govern.d.ts +0 -70
  142. package/dist/commands/govern.d.ts.map +0 -1
  143. package/dist/commands/govern.js +0 -481
  144. package/dist/commands/govern.js.map +0 -1
  145. package/dist/commands/governance.d.ts +0 -17
  146. package/dist/commands/governance.d.ts.map +0 -1
  147. package/dist/commands/governance.js +0 -703
  148. package/dist/commands/governance.js.map +0 -1
  149. package/dist/commands/guardian.d.ts +0 -20
  150. package/dist/commands/guardian.d.ts.map +0 -1
  151. package/dist/commands/guardian.js +0 -597
  152. package/dist/commands/guardian.js.map +0 -1
  153. package/dist/commands/init.d.ts +0 -59
  154. package/dist/commands/init.d.ts.map +0 -1
  155. package/dist/commands/init.js +0 -650
  156. package/dist/commands/init.js.map +0 -1
  157. package/dist/commands/orchestrator.d.ts +0 -7
  158. package/dist/commands/orchestrator.d.ts.map +0 -1
  159. package/dist/commands/orchestrator.js +0 -571
  160. package/dist/commands/orchestrator.js.map +0 -1
  161. package/dist/commands/performance-optimizer.d.ts +0 -30
  162. package/dist/commands/performance-optimizer.d.ts.map +0 -1
  163. package/dist/commands/performance-optimizer.js +0 -650
  164. package/dist/commands/performance-optimizer.js.map +0 -1
  165. package/dist/commands/plugins.d.ts +0 -87
  166. package/dist/commands/plugins.d.ts.map +0 -1
  167. package/dist/commands/plugins.js +0 -685
  168. package/dist/commands/plugins.js.map +0 -1
  169. package/dist/commands/rag.d.ts +0 -7
  170. package/dist/commands/rag.d.ts.map +0 -1
  171. package/dist/commands/rag.js +0 -748
  172. package/dist/commands/rag.js.map +0 -1
  173. package/dist/commands/session.d.ts +0 -41
  174. package/dist/commands/session.d.ts.map +0 -1
  175. package/dist/commands/session.js +0 -441
  176. package/dist/commands/session.js.map +0 -1
  177. package/dist/commands/setup.d.ts +0 -29
  178. package/dist/commands/setup.d.ts.map +0 -1
  179. package/dist/commands/setup.js +0 -397
  180. package/dist/commands/setup.js.map +0 -1
  181. package/dist/commands/test-init.d.ts +0 -9
  182. package/dist/commands/test-init.d.ts.map +0 -1
  183. package/dist/commands/test-init.js +0 -222
  184. package/dist/commands/test-init.js.map +0 -1
  185. package/dist/commands/test.d.ts +0 -25
  186. package/dist/commands/test.d.ts.map +0 -1
  187. package/dist/commands/test.js +0 -217
  188. package/dist/commands/test.js.map +0 -1
  189. package/dist/commands/vp.d.ts +0 -7
  190. package/dist/commands/vp.d.ts.map +0 -1
  191. package/dist/commands/vp.js +0 -571
  192. package/dist/commands/vp.js.map +0 -1
  193. package/dist/commands/watch.d.ts +0 -76
  194. package/dist/commands/watch.d.ts.map +0 -1
  195. package/dist/commands/watch.js +0 -613
  196. package/dist/commands/watch.js.map +0 -1
  197. package/dist/commands/worktree.d.ts +0 -63
  198. package/dist/commands/worktree.d.ts.map +0 -1
  199. package/dist/commands/worktree.js +0 -774
  200. package/dist/commands/worktree.js.map +0 -1
  201. package/dist/context/context-manager.d.ts +0 -155
  202. package/dist/context/context-manager.d.ts.map +0 -1
  203. package/dist/context/context-manager.js +0 -383
  204. package/dist/context/context-manager.js.map +0 -1
  205. package/dist/context/index.d.ts +0 -3
  206. package/dist/context/index.d.ts.map +0 -1
  207. package/dist/context/index.js +0 -6
  208. package/dist/context/index.js.map +0 -1
  209. package/dist/context/session-manager.d.ts +0 -207
  210. package/dist/context/session-manager.d.ts.map +0 -1
  211. package/dist/context/session-manager.js +0 -686
  212. package/dist/context/session-manager.js.map +0 -1
  213. package/dist/index.d.ts +0 -8
  214. package/dist/index.d.ts.map +0 -1
  215. package/dist/index.js +0 -51
  216. package/dist/index.js.map +0 -1
  217. package/dist/interactive/interactive-mode.d.ts +0 -76
  218. package/dist/interactive/interactive-mode.d.ts.map +0 -1
  219. package/dist/interactive/interactive-mode.js +0 -732
  220. package/dist/interactive/interactive-mode.js.map +0 -1
  221. package/dist/nlp/command-mapper.d.ts +0 -174
  222. package/dist/nlp/command-mapper.d.ts.map +0 -1
  223. package/dist/nlp/command-mapper.js +0 -624
  224. package/dist/nlp/command-mapper.js.map +0 -1
  225. package/dist/nlp/command-parser.d.ts +0 -106
  226. package/dist/nlp/command-parser.d.ts.map +0 -1
  227. package/dist/nlp/command-parser.js +0 -417
  228. package/dist/nlp/command-parser.js.map +0 -1
  229. package/dist/nlp/index.d.ts +0 -5
  230. package/dist/nlp/index.d.ts.map +0 -1
  231. package/dist/nlp/index.js +0 -8
  232. package/dist/nlp/index.js.map +0 -1
  233. package/dist/nlp/intent-classifier.d.ts +0 -59
  234. package/dist/nlp/intent-classifier.d.ts.map +0 -1
  235. package/dist/nlp/intent-classifier.js +0 -384
  236. package/dist/nlp/intent-classifier.js.map +0 -1
  237. package/dist/nlp/intent-parser.d.ts +0 -152
  238. package/dist/nlp/intent-parser.d.ts.map +0 -1
  239. package/dist/nlp/intent-parser.js +0 -744
  240. package/dist/nlp/intent-parser.js.map +0 -1
  241. package/dist/plugins/plugin-manager.d.ts +0 -120
  242. package/dist/plugins/plugin-manager.d.ts.map +0 -1
  243. package/dist/plugins/plugin-manager.js +0 -595
  244. package/dist/plugins/plugin-manager.js.map +0 -1
  245. package/dist/types/index.d.ts +0 -224
  246. package/dist/types/index.d.ts.map +0 -1
  247. package/dist/types/index.js +0 -3
  248. package/dist/types/index.js.map +0 -1
  249. package/dist/utils/backup-rollback-manager.d.ts +0 -72
  250. package/dist/utils/backup-rollback-manager.d.ts.map +0 -1
  251. package/dist/utils/backup-rollback-manager.js +0 -289
  252. package/dist/utils/backup-rollback-manager.js.map +0 -1
  253. package/dist/utils/claude-config-installer.d.ts +0 -98
  254. package/dist/utils/claude-config-installer.d.ts.map +0 -1
  255. package/dist/utils/claude-config-installer.js +0 -678
  256. package/dist/utils/claude-config-installer.js.map +0 -1
  257. package/dist/utils/config-manager.d.ts +0 -73
  258. package/dist/utils/config-manager.d.ts.map +0 -1
  259. package/dist/utils/config-manager.js +0 -339
  260. package/dist/utils/config-manager.js.map +0 -1
  261. package/dist/utils/error-handler.d.ts +0 -46
  262. package/dist/utils/error-handler.d.ts.map +0 -1
  263. package/dist/utils/error-handler.js +0 -169
  264. package/dist/utils/error-handler.js.map +0 -1
  265. package/dist/utils/logger.d.ts +0 -25
  266. package/dist/utils/logger.d.ts.map +0 -1
  267. package/dist/utils/logger.js +0 -105
  268. package/dist/utils/logger.js.map +0 -1
  269. package/src/commands/computer-setup-commands.ts +0 -872
@@ -1,1073 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ClaudeSetupCommands = void 0;
4
- exports.createClaudeSetupCommand = createClaudeSetupCommand;
5
- const tslib_1 = require("tslib");
6
- const child_process_1 = require("child_process");
7
- const fs = tslib_1.__importStar(require("fs"));
8
- const path = tslib_1.__importStar(require("path"));
9
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
10
- const commander_1 = require("commander");
11
- const ora_1 = tslib_1.__importDefault(require("ora"));
12
- /**
13
- * Claude Setup Commands
14
- * Comprehensive setup for Claude Code, Claude Flow, and MCP tools
15
- *
16
- * Consolidated from:
17
- * - /src/cli/commands/claude-setup.ts (374 lines) - function-based approach
18
- * - /packages/@wundr/cli/src/commands/claude-setup.ts (697 lines) - class-based approach
19
- *
20
- * This version preserves ALL functionality from both implementations.
21
- */
22
- class ClaudeSetupCommands {
23
- program;
24
- constructor(program) {
25
- this.program = program;
26
- this.registerCommands();
27
- }
28
- registerCommands() {
29
- const claudeSetup = this.program
30
- .command('claude-setup')
31
- .alias('cs')
32
- .description('Setup Claude Code, Claude Flow, and MCP tools')
33
- .addHelpText('after', chalk_1.default.gray(`
34
- Examples:
35
- ${chalk_1.default.green('wundr claude-setup')} Interactive Claude setup
36
- ${chalk_1.default.green('wundr claude-setup install')} Complete ecosystem installation
37
- ${chalk_1.default.green('wundr claude-setup mcp')} Install all MCP tools
38
- ${chalk_1.default.green('wundr claude-setup agents')} Configure all 54 agents
39
- ${chalk_1.default.green('wundr claude-setup optimize')} Setup hardware-adaptive optimizations
40
- ${chalk_1.default.green('wundr claude-setup validate')} Validate Claude installation
41
- ${chalk_1.default.green('wundr claude-setup project')} Setup project with templates
42
- `));
43
- // Main setup command (default)
44
- claudeSetup
45
- .command('install', { isDefault: true })
46
- .description('Complete Claude ecosystem installation')
47
- .option('--skip-chrome', 'Skip Chrome installation')
48
- .option('--skip-mcp', 'Skip MCP tools installation')
49
- .option('--skip-agents', 'Skip agent configuration')
50
- .option('--skip-flow', 'Skip Claude Flow setup')
51
- .option('-g, --global', 'Install tools globally')
52
- .action(async (options) => {
53
- await this.runCompleteSetup(options);
54
- });
55
- // Project setup with templates (from /src/cli/commands/claude-setup.ts)
56
- claudeSetup
57
- .command('project [path]')
58
- .description('Setup Claude Code in a project directory with optional template')
59
- .option('-g, --global', 'Install tools globally')
60
- .option('--skip-mcp', 'Skip MCP tools installation')
61
- .option('--skip-flow', 'Skip Claude Flow setup')
62
- .option('-t, --template <name>', 'Use specific project template (typescript, react, nodejs, monorepo)')
63
- .action(async (projectPath = '.', options) => {
64
- await this.runProjectSetup(projectPath, options);
65
- });
66
- // MCP tools installation
67
- claudeSetup
68
- .command('mcp')
69
- .description('Install and configure MCP tools')
70
- .option('--tool <tool>', 'Install specific tool (firecrawl, context7, playwright, browser, sequentialthinking, claude-flow)')
71
- .action(async (options) => {
72
- await this.installMcpTools(options);
73
- });
74
- // Agent configuration
75
- claudeSetup
76
- .command('agents')
77
- .description('Configure Claude Flow agents')
78
- .option('--list', 'List available agents')
79
- .option('--enable <agents>', 'Enable specific agents (comma-separated)')
80
- .option('--profile <profile>', 'Use profile-specific agents')
81
- .action(async (options) => {
82
- await this.configureAgents(options);
83
- });
84
- // Validation
85
- claudeSetup
86
- .command('validate')
87
- .description('Validate Claude installation')
88
- .option('--fix', 'Attempt to fix issues')
89
- .action(async (options) => {
90
- await this.validateInstallation(options);
91
- });
92
- // Chrome extension
93
- claudeSetup
94
- .command('extension')
95
- .description('Install Browser MCP Chrome extension')
96
- .action(async () => {
97
- await this.installChromeExtension();
98
- });
99
- // Hardware optimization
100
- claudeSetup
101
- .command('optimize')
102
- .description('Setup hardware-adaptive Claude Code optimizations')
103
- .option('--force', 'Force reinstallation of optimization scripts')
104
- .action(async (options) => {
105
- await this.setupOptimizations(options);
106
- });
107
- // Generate CLAUDE.md
108
- claudeSetup
109
- .command('config')
110
- .description('Generate or update CLAUDE.md configuration')
111
- .argument('[path]', 'Path to repository (defaults to current directory)', '.')
112
- .action(async (repoPath) => {
113
- await this.generateClaudeConfig(repoPath);
114
- });
115
- }
116
- /**
117
- * Complete setup - combines both implementations' main flows
118
- */
119
- async runCompleteSetup(options) {
120
- const spinner = (0, ora_1.default)();
121
- console.log(chalk_1.default.cyan.bold('\nšŸ¤– Claude Ecosystem Setup\n'));
122
- try {
123
- // Step 1: Install Claude CLI
124
- if (!this.isClaudeInstalled()) {
125
- spinner.start('Installing Claude CLI...');
126
- (0, child_process_1.execSync)('npm install -g @anthropic/claude-cli', { stdio: 'inherit' });
127
- spinner.succeed('Claude CLI installed');
128
- }
129
- else {
130
- console.log(chalk_1.default.green('āœ“ Claude CLI already installed'));
131
- }
132
- // Step 2: Install Chrome (if needed and not skipped)
133
- if (!options.skipChrome && !this.isChromeInstalled()) {
134
- spinner.start('Installing Google Chrome...');
135
- await this.installChrome();
136
- spinner.succeed('Chrome installed');
137
- }
138
- // Step 3: Claude Flow setup
139
- if (!options.skipFlow) {
140
- await this.setupClaudeFlow(spinner, process.cwd(), options.global);
141
- }
142
- // Step 4: Install MCP tools (if not skipped)
143
- if (!options.skipMcp) {
144
- await this.installMcpTools({});
145
- }
146
- // Step 5: Configure agents (if not skipped)
147
- if (!options.skipAgents) {
148
- await this.configureAgents({ profile: 'fullstack' });
149
- }
150
- // Step 6: Setup Claude configuration
151
- spinner.start('Configuring Claude settings...');
152
- await this.setupClaudeSettings();
153
- spinner.succeed('Claude configured');
154
- console.log(chalk_1.default.green.bold('\nāœ… Claude ecosystem setup complete!\n'));
155
- this.printNextSteps();
156
- }
157
- catch (error) {
158
- spinner.fail('Setup failed');
159
- console.error(chalk_1.default.red(error));
160
- process.exit(1);
161
- }
162
- }
163
- /**
164
- * Project setup - from /src/cli/commands/claude-setup.ts
165
- */
166
- async runProjectSetup(projectPath, options) {
167
- const spinner = (0, ora_1.default)('Starting Claude Code project setup...').start();
168
- try {
169
- const repoPath = path.resolve(projectPath);
170
- // Verify git repository
171
- if (!fs.existsSync(path.join(repoPath, '.git'))) {
172
- spinner.stop();
173
- const inquirer = await Promise.resolve().then(() => tslib_1.__importStar(require('inquirer')));
174
- const { shouldInitGit } = await inquirer.default.prompt([{
175
- type: 'confirm',
176
- name: 'shouldInitGit',
177
- message: 'Not a git repository. Initialize git?',
178
- default: true,
179
- }]);
180
- if (shouldInitGit) {
181
- spinner.start('Initializing git repository...');
182
- (0, child_process_1.execSync)('git init', { cwd: repoPath });
183
- spinner.succeed('Git repository initialized');
184
- }
185
- else {
186
- console.log(chalk_1.default.yellow('Continuing without git...'));
187
- }
188
- }
189
- // Step 1: Claude Flow setup
190
- if (!options.skipFlow) {
191
- await this.setupClaudeFlow(spinner, repoPath, options.global);
192
- }
193
- // Step 2: MCP Tools setup
194
- if (!options.skipMcp) {
195
- await this.setupMCPToolsDirectory(spinner, repoPath);
196
- }
197
- // Step 3: Generate CLAUDE.md
198
- await this.generateClaudeConfigForPath(spinner, repoPath);
199
- // Step 4: Setup project template if specified
200
- if (options.template) {
201
- await this.setupProjectTemplate(spinner, repoPath, options.template);
202
- }
203
- // Step 5: Initialize swarm if Claude Flow is available
204
- if (!options.skipFlow) {
205
- await this.initializeSwarm(spinner, repoPath);
206
- }
207
- // Step 6: Validation
208
- await this.validateProjectSetup(spinner, repoPath);
209
- spinner.succeed('Claude Code project setup completed successfully!');
210
- // Final instructions
211
- this.displayProjectFinalInstructions(repoPath, options);
212
- }
213
- catch (error) {
214
- spinner.stop();
215
- console.error(chalk_1.default.red('āŒ Setup failed:'));
216
- console.error(chalk_1.default.red(error instanceof Error ? error.message : String(error)));
217
- process.exit(1);
218
- }
219
- }
220
- /**
221
- * Setup Claude Flow - from /src/cli/commands/claude-setup.ts
222
- */
223
- async setupClaudeFlow(spinner, repoPath, global) {
224
- spinner.text = 'Setting up Claude Flow...';
225
- try {
226
- // Check if Claude Flow is already installed
227
- (0, child_process_1.execSync)('npx claude-flow --version', { stdio: 'ignore' });
228
- spinner.text = 'Claude Flow already available, configuring...';
229
- }
230
- catch {
231
- spinner.text = 'Installing Claude Flow...';
232
- if (global) {
233
- (0, child_process_1.execSync)('npm install -g claude-flow@alpha', { stdio: 'inherit' });
234
- }
235
- else {
236
- // Add to package.json dev dependencies if it exists
237
- if (fs.existsSync(path.join(repoPath, 'package.json'))) {
238
- (0, child_process_1.execSync)('npm install --save-dev claude-flow@alpha', { cwd: repoPath, stdio: 'inherit' });
239
- }
240
- }
241
- }
242
- // Add MCP server configuration
243
- spinner.text = 'Configuring Claude MCP server...';
244
- try {
245
- (0, child_process_1.execSync)('claude mcp add claude-flow npx claude-flow@alpha mcp start', {
246
- cwd: repoPath,
247
- stdio: 'pipe',
248
- });
249
- }
250
- catch {
251
- // MCP configuration might fail if Claude Desktop isn't installed
252
- console.log(chalk_1.default.yellow('\nāš ļø Could not configure MCP server automatically.'));
253
- console.log(chalk_1.default.yellow('Please run manually: claude mcp add claude-flow npx claude-flow@alpha mcp start'));
254
- }
255
- spinner.text = 'Claude Flow setup completed';
256
- }
257
- /**
258
- * Setup MCP Tools directory - from /src/cli/commands/claude-setup.ts
259
- */
260
- async setupMCPToolsDirectory(spinner, repoPath) {
261
- spinner.text = 'Setting up MCP Tools directory...';
262
- const mcpToolsPath = path.join(repoPath, 'mcp-tools');
263
- // Create mcp-tools directory if it doesn't exist
264
- if (!fs.existsSync(mcpToolsPath)) {
265
- fs.mkdirSync(mcpToolsPath, { recursive: true });
266
- // Create basic install script
267
- const installScript = `#!/bin/bash
268
- # MCP Tools Installation Script
269
- echo "Installing Wundr MCP Tools..."
270
-
271
- # Add your MCP tool installations here
272
- echo "āœ… MCP Tools installation template created"
273
- echo "Customize this script with your specific MCP tools"
274
- `;
275
- fs.writeFileSync(path.join(mcpToolsPath, 'install.sh'), installScript);
276
- (0, child_process_1.execSync)(`chmod +x ${path.join(mcpToolsPath, 'install.sh')}`);
277
- // Create package.json for MCP tools
278
- const mcpPackageJson = {
279
- name: 'mcp-tools',
280
- version: '1.0.0',
281
- description: 'MCP Tools for Claude Code integration',
282
- private: true,
283
- scripts: {
284
- install: './install.sh',
285
- },
286
- };
287
- fs.writeFileSync(path.join(mcpToolsPath, 'package.json'), JSON.stringify(mcpPackageJson, null, 2));
288
- }
289
- spinner.text = 'MCP Tools directory setup completed';
290
- }
291
- /**
292
- * Install MCP tools via script or specific tool
293
- */
294
- async installMcpTools(options) {
295
- const spinner = (0, ora_1.default)();
296
- const scriptPath = path.join(__dirname, '../../../../scripts/install-mcp-tools.sh');
297
- console.log(chalk_1.default.cyan('\nšŸ“¦ Installing MCP Tools...\n'));
298
- if (options.tool) {
299
- // Install specific tool
300
- spinner.start(`Installing ${options.tool} MCP...`);
301
- try {
302
- const installCommands = {
303
- firecrawl: 'npx claude mcp add firecrawl npx @firecrawl/mcp-server',
304
- context7: 'npx claude mcp add context7 npx @context7/mcp-server',
305
- playwright: 'npx claude mcp add playwright npx @playwright/mcp-server',
306
- browser: 'npx claude mcp add browser npx @browser/mcp-server',
307
- sequentialthinking: 'npm install -g @modelcontextprotocol/server-sequentialthinking',
308
- 'claude-flow': 'claude mcp add claude-flow npx claude-flow@alpha mcp start',
309
- };
310
- const command = installCommands[options.tool];
311
- if (command) {
312
- (0, child_process_1.execSync)(command, { stdio: 'inherit' });
313
- spinner.succeed(`${options.tool} MCP installed`);
314
- }
315
- else {
316
- spinner.fail(`Unknown tool: ${options.tool}`);
317
- console.log(chalk_1.default.yellow(`Available tools: ${Object.keys(installCommands).join(', ')}`));
318
- }
319
- }
320
- catch (error) {
321
- spinner.fail(`Failed to install ${options.tool}`);
322
- console.error(error);
323
- }
324
- }
325
- else {
326
- // Try to install all tools using the script if it exists
327
- if (fs.existsSync(scriptPath)) {
328
- console.log(chalk_1.default.gray('Running comprehensive MCP tools installation...'));
329
- const install = (0, child_process_1.spawn)('bash', [scriptPath], {
330
- stdio: 'inherit',
331
- shell: true,
332
- });
333
- return new Promise((resolve, reject) => {
334
- install.on('close', code => {
335
- if (code === 0) {
336
- console.log(chalk_1.default.green('\nāœ… All MCP tools installed successfully'));
337
- resolve();
338
- }
339
- else {
340
- reject(new Error(`Installation failed with code ${code}`));
341
- }
342
- });
343
- });
344
- }
345
- else {
346
- // Fallback: install core tools
347
- console.log(chalk_1.default.gray('Installing core MCP tools...'));
348
- const coreTools = ['claude-flow', 'sequentialthinking'];
349
- for (const tool of coreTools) {
350
- try {
351
- await this.installMcpTools({ tool });
352
- }
353
- catch {
354
- console.log(chalk_1.default.yellow(`āš ļø Could not install ${tool}`));
355
- }
356
- }
357
- console.log(chalk_1.default.green('\nāœ… Core MCP tools installed'));
358
- }
359
- }
360
- }
361
- /**
362
- * Configure Claude Flow agents
363
- */
364
- async configureAgents(options) {
365
- const spinner = (0, ora_1.default)();
366
- if (options.list) {
367
- this.listAgents();
368
- return;
369
- }
370
- spinner.start('Configuring Claude Flow agents...');
371
- const agents = options.enable
372
- ? options.enable.split(',')
373
- : this.getProfileAgents(options.profile || 'fullstack');
374
- // Create agent configurations
375
- const homeDir = process.env['HOME'] || process.env['USERPROFILE'] || '';
376
- const agentsDir = path.join(homeDir, '.claude', 'agents');
377
- try {
378
- fs.mkdirSync(agentsDir, { recursive: true });
379
- for (const agent of agents) {
380
- const config = this.generateAgentConfig(agent);
381
- fs.writeFileSync(path.join(agentsDir, `${agent}.json`), JSON.stringify(config, null, 2));
382
- }
383
- spinner.succeed(`${agents.length} agents configured`);
384
- }
385
- catch (error) {
386
- spinner.fail('Failed to configure agents');
387
- console.error(error);
388
- }
389
- }
390
- /**
391
- * Validate Claude installation
392
- */
393
- async validateInstallation(options) {
394
- console.log(chalk_1.default.cyan('\nšŸ” Validating Claude Installation...\n'));
395
- const checks = [
396
- { name: 'Claude CLI', check: () => this.isClaudeInstalled() },
397
- { name: 'Claude Flow', check: () => this.isClaudeFlowInstalled() },
398
- { name: 'Chrome Browser', check: () => this.isChromeInstalled() },
399
- { name: 'Claude Directory', check: () => this.claudeDirExists() },
400
- { name: 'Agent Configurations', check: () => this.agentsConfigured() },
401
- { name: 'MCP Servers', check: () => this.mcpServersConfigured() },
402
- ];
403
- let allPassed = true;
404
- for (const check of checks) {
405
- const passed = check.check();
406
- if (passed) {
407
- console.log(chalk_1.default.green(`āœ“ ${check.name}`));
408
- }
409
- else {
410
- console.log(chalk_1.default.red(`āœ— ${check.name}`));
411
- allPassed = false;
412
- }
413
- }
414
- if (allPassed) {
415
- console.log(chalk_1.default.green.bold('\nāœ… All checks passed!'));
416
- }
417
- else if (options.fix) {
418
- console.log(chalk_1.default.yellow('\nšŸ”§ Attempting to fix issues...'));
419
- await this.runCompleteSetup({});
420
- }
421
- else {
422
- console.log(chalk_1.default.yellow('\nāš ļø Some checks failed. Run with --fix to attempt repairs.'));
423
- }
424
- }
425
- /**
426
- * Install Chrome extension instructions
427
- */
428
- async installChromeExtension() {
429
- console.log(chalk_1.default.cyan('\nšŸ”Œ Browser MCP Chrome Extension Setup\n'));
430
- const homeDir = process.env['HOME'] || process.env['USERPROFILE'] || '';
431
- const extensionDir = path.join(homeDir, '.claude', 'browser-extension');
432
- console.log(chalk_1.default.white('Extension location: ' + extensionDir));
433
- console.log(chalk_1.default.yellow('\nTo install:'));
434
- console.log('1. Open Chrome and navigate to chrome://extensions');
435
- console.log('2. Enable "Developer mode" (top right)');
436
- console.log('3. Click "Load unpacked"');
437
- console.log(`4. Select: ${extensionDir}`);
438
- console.log('\nāœ… The extension will then be active!');
439
- }
440
- /**
441
- * Setup hardware-adaptive optimizations
442
- */
443
- async setupOptimizations(options) {
444
- const spinner = (0, ora_1.default)();
445
- console.log(chalk_1.default.cyan.bold('\n⚔ Claude Code Hardware-Adaptive Optimization Setup\n'));
446
- try {
447
- const homeDir = process.env['HOME'] || process.env['USERPROFILE'] || '';
448
- const scriptsDir = path.join(homeDir, '.claude', 'scripts');
449
- const resourcesDir = path.join(__dirname, '../../../computer-setup/resources/scripts');
450
- // Check if optimization scripts already exist
451
- const scriptsExist = fs.existsSync(scriptsDir);
452
- if (scriptsExist && !options.force) {
453
- const inquirer = await Promise.resolve().then(() => tslib_1.__importStar(require('inquirer')));
454
- const { overwrite } = await inquirer.default.prompt([
455
- {
456
- type: 'confirm',
457
- name: 'overwrite',
458
- message: 'Optimization scripts already exist. Do you want to reinstall?',
459
- default: false,
460
- },
461
- ]);
462
- if (!overwrite) {
463
- console.log(chalk_1.default.yellow('Optimization setup cancelled'));
464
- return;
465
- }
466
- }
467
- // Step 1: Create scripts directory
468
- spinner.start('Creating scripts directory...');
469
- fs.mkdirSync(scriptsDir, { recursive: true });
470
- spinner.succeed('Scripts directory ready');
471
- // Step 2: Copy optimization scripts
472
- spinner.start('Installing optimization scripts...');
473
- if (!fs.existsSync(resourcesDir)) {
474
- spinner.fail('Optimization scripts not found in resources');
475
- console.error(chalk_1.default.red(`Expected scripts at: ${resourcesDir}\nPlease ensure @wundr/computer-setup is installed.`));
476
- return;
477
- }
478
- // Copy all scripts
479
- const scripts = [
480
- 'detect-hardware-limits.js',
481
- 'claude-optimized',
482
- 'orchestrator.js',
483
- 'cleanup-zombies.sh',
484
- 'README-ORCHESTRATION.md',
485
- 'QUICK-START.md',
486
- ];
487
- for (const script of scripts) {
488
- const src = path.join(resourcesDir, script);
489
- const dest = path.join(scriptsDir, script);
490
- if (fs.existsSync(src)) {
491
- fs.copyFileSync(src, dest);
492
- }
493
- else {
494
- console.warn(chalk_1.default.yellow(`āš ļø Script not found: ${script}`));
495
- }
496
- }
497
- // Make executable scripts executable
498
- const executableScripts = ['claude-optimized', 'cleanup-zombies.sh'];
499
- for (const script of executableScripts) {
500
- const scriptPath = path.join(scriptsDir, script);
501
- if (fs.existsSync(scriptPath)) {
502
- (0, child_process_1.execSync)(`chmod +x "${scriptPath}"`, { stdio: 'pipe' });
503
- }
504
- }
505
- spinner.succeed('Optimization scripts installed');
506
- // Step 3: Configure shell
507
- spinner.start('Configuring shell environment...');
508
- await this.addOptimizationToShell(homeDir);
509
- spinner.succeed('Shell configuration updated');
510
- console.log(chalk_1.default.green.bold('\nāœ… Optimization setup complete!\n'));
511
- // Show what was installed
512
- console.log(chalk_1.default.cyan('šŸ“¦ Installed Scripts:'));
513
- console.log(chalk_1.default.white(' • detect-hardware-limits.js - Hardware detection'));
514
- console.log(chalk_1.default.white(' • claude-optimized - Optimized Claude wrapper'));
515
- console.log(chalk_1.default.white(' • orchestrator.js - Fault-tolerant orchestration'));
516
- console.log(chalk_1.default.white(' • cleanup-zombies.sh - Process cleanup utility'));
517
- console.log(chalk_1.default.cyan('\nšŸ”§ Shell Aliases:'));
518
- console.log(chalk_1.default.white(' • claude - Hardware-optimized Claude wrapper'));
519
- console.log(chalk_1.default.white(' • claude-stats - Show hardware statistics'));
520
- console.log(chalk_1.default.white(' • claude-cleanup - Clean up zombie processes'));
521
- console.log(chalk_1.default.white(' • claude-orchestrate - Run multi-task orchestrator'));
522
- console.log(chalk_1.default.cyan('\nšŸ“ Next Steps:'));
523
- console.log('1. Restart your terminal (or run: source ~/.zshrc)');
524
- console.log('2. Run "claude-stats" to see your hardware configuration');
525
- console.log('3. Use "claude" command as normal - now optimized!');
526
- console.log('4. Read ~/.claude/scripts/QUICK-START.md for advanced usage');
527
- }
528
- catch (error) {
529
- spinner.fail('Optimization setup failed');
530
- console.error(chalk_1.default.red(error));
531
- throw error;
532
- }
533
- }
534
- /**
535
- * Generate CLAUDE.md configuration
536
- */
537
- async generateClaudeConfig(repoPath) {
538
- const spinner = (0, ora_1.default)('Generating CLAUDE.md configuration...').start();
539
- try {
540
- const resolvedPath = path.resolve(repoPath);
541
- await this.generateClaudeConfigForPath(spinner, resolvedPath);
542
- spinner.succeed('CLAUDE.md generated successfully');
543
- console.log(chalk_1.default.green(`\nāœ… CLAUDE.md created at: ${path.join(resolvedPath, 'CLAUDE.md')}`));
544
- }
545
- catch (error) {
546
- spinner.fail('Failed to generate CLAUDE.md');
547
- console.error(chalk_1.default.red(error instanceof Error ? error.message : String(error)));
548
- }
549
- }
550
- /**
551
- * Generate CLAUDE.md for a specific path
552
- */
553
- async generateClaudeConfigForPath(spinner, repoPath) {
554
- spinner.text = 'Generating CLAUDE.md configuration...';
555
- try {
556
- // Try to use the ClaudeConfigGenerator if available
557
- // Use path.resolve to construct the path at runtime to avoid TypeScript rootDir issues
558
- const generatorPath = path.resolve(__dirname, '../../../../../src/claude-generator/claude-config-generator.js');
559
- const { ClaudeConfigGenerator } = await Promise.resolve(`${generatorPath}`).then(s => tslib_1.__importStar(require(s)));
560
- const generator = new ClaudeConfigGenerator(repoPath);
561
- const claudeContent = await generator.generateClaudeMarkdown();
562
- const claudeFilePath = path.join(repoPath, 'CLAUDE.md');
563
- fs.writeFileSync(claudeFilePath, claudeContent, 'utf-8');
564
- }
565
- catch {
566
- // Fallback: Create a basic CLAUDE.md
567
- spinner.text = 'Creating basic CLAUDE.md...';
568
- const basicContent = this.generateBasicClaudeConfig(repoPath);
569
- fs.writeFileSync(path.join(repoPath, 'CLAUDE.md'), basicContent, 'utf-8');
570
- }
571
- spinner.text = 'CLAUDE.md generated successfully';
572
- }
573
- /**
574
- * Generate basic CLAUDE.md content as fallback
575
- */
576
- generateBasicClaudeConfig(repoPath) {
577
- const projectName = path.basename(repoPath);
578
- return `# Claude Code Configuration - ${projectName}
579
-
580
- ## Project Overview
581
- This project uses Claude Code for AI-assisted development.
582
-
583
- ## Commands
584
- - \`npm run build\` - Build the project
585
- - \`npm run test\` - Run tests
586
- - \`npm run lint\` - Run linting
587
-
588
- ## Code Style
589
- - Follow existing patterns in the codebase
590
- - Write clear, descriptive commit messages
591
- - Add tests for new features
592
-
593
- ## MCP Tools
594
- Claude Flow is configured for enhanced AI coordination.
595
- Run \`npx claude-flow sparc modes\` to see available modes.
596
- `;
597
- }
598
- /**
599
- * Setup project template - from /src/cli/commands/claude-setup.ts
600
- */
601
- async setupProjectTemplate(spinner, repoPath, templateName) {
602
- spinner.text = `Applying ${templateName} template...`;
603
- const templates = {
604
- 'typescript': () => this.setupTypeScriptTemplate(repoPath),
605
- 'react': () => this.setupReactTemplate(repoPath),
606
- 'nodejs': () => this.setupNodeTemplate(repoPath),
607
- 'monorepo': () => this.setupMonorepoTemplate(repoPath),
608
- };
609
- const setupFunction = templates[templateName];
610
- if (!setupFunction) {
611
- throw new Error(`Unknown template: ${templateName}. Available: ${Object.keys(templates).join(', ')}`);
612
- }
613
- setupFunction();
614
- spinner.text = `${templateName} template applied`;
615
- }
616
- setupTypeScriptTemplate(repoPath) {
617
- // Create basic TypeScript configuration if not exists
618
- const tsconfigPath = path.join(repoPath, 'tsconfig.json');
619
- if (!fs.existsSync(tsconfigPath)) {
620
- const tsconfig = {
621
- compilerOptions: {
622
- target: 'ES2020',
623
- module: 'ESNext',
624
- moduleResolution: 'node',
625
- strict: true,
626
- esModuleInterop: true,
627
- skipLibCheck: true,
628
- forceConsistentCasingInFileNames: true,
629
- declaration: true,
630
- outDir: 'dist',
631
- rootDir: 'src',
632
- },
633
- include: ['src/**/*'],
634
- exclude: ['node_modules', 'dist'],
635
- };
636
- fs.writeFileSync(tsconfigPath, JSON.stringify(tsconfig, null, 2));
637
- }
638
- // Create src directory
639
- const srcPath = path.join(repoPath, 'src');
640
- if (!fs.existsSync(srcPath)) {
641
- fs.mkdirSync(srcPath, { recursive: true });
642
- fs.writeFileSync(path.join(srcPath, 'index.ts'), '// Your TypeScript code here\n');
643
- }
644
- }
645
- setupReactTemplate(repoPath) {
646
- // Ensure React-specific structure
647
- const srcPath = path.join(repoPath, 'src');
648
- if (!fs.existsSync(srcPath)) {
649
- fs.mkdirSync(srcPath, { recursive: true });
650
- }
651
- // Create components directory
652
- const componentsPath = path.join(srcPath, 'components');
653
- if (!fs.existsSync(componentsPath)) {
654
- fs.mkdirSync(componentsPath, { recursive: true });
655
- }
656
- // Create hooks directory
657
- const hooksPath = path.join(srcPath, 'hooks');
658
- if (!fs.existsSync(hooksPath)) {
659
- fs.mkdirSync(hooksPath, { recursive: true });
660
- }
661
- }
662
- setupNodeTemplate(repoPath) {
663
- // Create basic Node.js structure
664
- const srcPath = path.join(repoPath, 'src');
665
- if (!fs.existsSync(srcPath)) {
666
- fs.mkdirSync(srcPath, { recursive: true });
667
- fs.writeFileSync(path.join(srcPath, 'index.js'), '// Your Node.js code here\n');
668
- }
669
- // Create routes directory
670
- const routesPath = path.join(srcPath, 'routes');
671
- if (!fs.existsSync(routesPath)) {
672
- fs.mkdirSync(routesPath, { recursive: true });
673
- }
674
- }
675
- setupMonorepoTemplate(repoPath) {
676
- // Create packages directory
677
- const packagesPath = path.join(repoPath, 'packages');
678
- if (!fs.existsSync(packagesPath)) {
679
- fs.mkdirSync(packagesPath, { recursive: true });
680
- }
681
- // Create apps directory
682
- const appsPath = path.join(repoPath, 'apps');
683
- if (!fs.existsSync(appsPath)) {
684
- fs.mkdirSync(appsPath, { recursive: true });
685
- }
686
- // Create workspace package.json if not exists
687
- const packageJsonPath = path.join(repoPath, 'package.json');
688
- if (!fs.existsSync(packageJsonPath)) {
689
- const packageJson = {
690
- name: 'monorepo-workspace',
691
- version: '1.0.0',
692
- private: true,
693
- workspaces: ['packages/*', 'apps/*'],
694
- devDependencies: {
695
- 'turbo': '^2.0.0',
696
- },
697
- };
698
- fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2));
699
- }
700
- }
701
- /**
702
- * Initialize swarm - from /src/cli/commands/claude-setup.ts
703
- */
704
- async initializeSwarm(spinner, repoPath) {
705
- spinner.text = 'Initializing Claude Flow swarm...';
706
- try {
707
- // Initialize basic swarm configuration
708
- (0, child_process_1.execSync)('npx claude-flow@alpha init', {
709
- cwd: repoPath,
710
- stdio: 'pipe',
711
- });
712
- }
713
- catch {
714
- // Swarm init might fail if not properly configured
715
- console.log(chalk_1.default.yellow('\nāš ļø Could not initialize swarm automatically.'));
716
- console.log(chalk_1.default.yellow('You can initialize manually later with: npx claude-flow init'));
717
- }
718
- spinner.text = 'Swarm initialization completed';
719
- }
720
- /**
721
- * Validate project setup - from /src/cli/commands/claude-setup.ts
722
- */
723
- async validateProjectSetup(spinner, repoPath) {
724
- spinner.text = 'Validating setup...';
725
- const validations = [
726
- { name: 'CLAUDE.md', path: path.join(repoPath, 'CLAUDE.md') },
727
- { name: 'MCP Tools', path: path.join(repoPath, 'mcp-tools') },
728
- { name: 'Git repository', path: path.join(repoPath, '.git') },
729
- ];
730
- const results = validations.map(validation => ({
731
- ...validation,
732
- exists: fs.existsSync(validation.path),
733
- }));
734
- const failures = results.filter(r => !r.exists);
735
- if (failures.length > 0) {
736
- throw new Error(`Setup validation failed: Missing ${failures.map(f => f.name).join(', ')}`);
737
- }
738
- spinner.text = 'Setup validation passed';
739
- }
740
- /**
741
- * Add shell optimization configuration
742
- */
743
- async addOptimizationToShell(homeDir) {
744
- const shellConfigs = [
745
- path.join(homeDir, '.zshrc'),
746
- path.join(homeDir, '.bashrc'),
747
- ];
748
- const optimizationConfig = `
749
- # ═══════════════════════════════════════════════════════════════════════════
750
- # Claude Code - Hardware-Adaptive Configuration (Auto-generated by Wundr)
751
- # ═══════════════════════════════════════════════════════════════════════════
752
-
753
- # Ensure PATH includes usr/local/bin
754
- export PATH="/usr/local/bin:$PATH"
755
-
756
- # Hardware-adaptive V8 memory configuration
757
- if [ -f "$HOME/.claude/scripts/detect-hardware-limits.js" ]; then
758
- eval "$(node $HOME/.claude/scripts/detect-hardware-limits.js export 2>/dev/null)"
759
- fi
760
-
761
- # Alias 'claude' to use hardware-optimized wrapper
762
- if [ -f "$HOME/.claude/scripts/claude-optimized" ]; then
763
- alias claude="$HOME/.claude/scripts/claude-optimized"
764
- else
765
- # Fallback to standard claude if optimization scripts not available
766
- alias claude='npx @anthropic-ai/claude-code'
767
- fi
768
-
769
- # Convenience aliases for Claude optimization tools
770
- alias claude-stats='node $HOME/.claude/scripts/detect-hardware-limits.js 2>/dev/null'
771
- alias claude-cleanup='$HOME/.claude/scripts/cleanup-zombies.sh 2>/dev/null'
772
- alias claude-orchestrate='node $HOME/.claude/scripts/orchestrator.js'
773
-
774
- # ═══════════════════════════════════════════════════════════════════════════
775
- `;
776
- for (const configFile of shellConfigs) {
777
- if (fs.existsSync(configFile)) {
778
- const content = fs.readFileSync(configFile, 'utf8');
779
- // Check if optimization config already exists
780
- if (content.includes('Claude Code - Hardware-Adaptive Configuration (Auto-generated by Wundr)')) {
781
- // Remove old config and add new one
782
- const lines = content.split('\n');
783
- const startIdx = lines.findIndex(line => line.includes('Claude Code - Hardware-Adaptive Configuration (Auto-generated by Wundr)'));
784
- if (startIdx !== -1) {
785
- // Find the end of the config block
786
- let endIdx = startIdx;
787
- for (let i = startIdx + 1; i < lines.length; i++) {
788
- if (lines[i]?.includes('═══════════════')) {
789
- endIdx = i;
790
- break;
791
- }
792
- }
793
- // Remove old config
794
- lines.splice(startIdx - 1, endIdx - startIdx + 3);
795
- const newContent = lines.join('\n');
796
- fs.writeFileSync(configFile, newContent + optimizationConfig);
797
- }
798
- }
799
- else {
800
- // Add new config
801
- fs.appendFileSync(configFile, optimizationConfig);
802
- }
803
- }
804
- }
805
- }
806
- /**
807
- * Install Chrome browser
808
- */
809
- async installChrome() {
810
- if (process.platform === 'darwin') {
811
- (0, child_process_1.execSync)('curl -L -o ~/Downloads/googlechrome.dmg "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg"');
812
- (0, child_process_1.execSync)('hdiutil attach ~/Downloads/googlechrome.dmg');
813
- (0, child_process_1.execSync)('cp -R "/Volumes/Google Chrome/Google Chrome.app" /Applications/');
814
- (0, child_process_1.execSync)('hdiutil detach "/Volumes/Google Chrome"');
815
- (0, child_process_1.execSync)('rm ~/Downloads/googlechrome.dmg');
816
- }
817
- else {
818
- console.log(chalk_1.default.yellow('Chrome installation is only automated for macOS'));
819
- }
820
- }
821
- /**
822
- * Setup Claude settings.json
823
- */
824
- async setupClaudeSettings() {
825
- const homeDir = process.env['HOME'] || process.env['USERPROFILE'] || '';
826
- const configPath = path.join(homeDir, '.claude', 'settings.json');
827
- const config = {
828
- claudeCodeOptions: {
829
- enabledMcpjsonServers: [
830
- 'claude-flow',
831
- 'firecrawl',
832
- 'context7',
833
- 'playwright',
834
- 'browser',
835
- 'sequentialthinking',
836
- ],
837
- gitAutoCompact: true,
838
- contextCompactionThreshold: 100000,
839
- enableHooks: true,
840
- enableAgentCoordination: true,
841
- enableNeuralTraining: true,
842
- enablePerformanceTracking: true,
843
- },
844
- };
845
- fs.mkdirSync(path.dirname(configPath), { recursive: true });
846
- fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
847
- }
848
- // ==================== Helper Methods ====================
849
- isClaudeInstalled() {
850
- try {
851
- (0, child_process_1.execSync)('claude --version', { stdio: 'ignore' });
852
- return true;
853
- }
854
- catch {
855
- return false;
856
- }
857
- }
858
- isClaudeFlowInstalled() {
859
- try {
860
- (0, child_process_1.execSync)('npx claude-flow@alpha --version', { stdio: 'ignore' });
861
- return true;
862
- }
863
- catch {
864
- return false;
865
- }
866
- }
867
- isChromeInstalled() {
868
- if (process.platform === 'darwin') {
869
- return fs.existsSync('/Applications/Google Chrome.app');
870
- }
871
- return true; // Assume installed on other platforms
872
- }
873
- claudeDirExists() {
874
- const homeDir = process.env['HOME'] || process.env['USERPROFILE'] || '';
875
- return fs.existsSync(path.join(homeDir, '.claude'));
876
- }
877
- agentsConfigured() {
878
- const homeDir = process.env['HOME'] || process.env['USERPROFILE'] || '';
879
- const agentsDir = path.join(homeDir, '.claude', 'agents');
880
- if (!fs.existsSync(agentsDir)) {
881
- return false;
882
- }
883
- const files = fs.readdirSync(agentsDir);
884
- return files.length > 0;
885
- }
886
- mcpServersConfigured() {
887
- const homeDir = process.env['HOME'] || process.env['USERPROFILE'] || '';
888
- const settingsPath = path.join(homeDir, '.claude', 'settings.json');
889
- if (!fs.existsSync(settingsPath)) {
890
- return false;
891
- }
892
- try {
893
- const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
894
- return settings.claudeCodeOptions?.enabledMcpjsonServers?.length > 0;
895
- }
896
- catch {
897
- return false;
898
- }
899
- }
900
- listAgents() {
901
- console.log(chalk_1.default.cyan('\nšŸ“‹ Available Claude Flow Agents:\n'));
902
- const categories = {
903
- 'Core Development': [
904
- 'coder',
905
- 'reviewer',
906
- 'tester',
907
- 'planner',
908
- 'researcher',
909
- ],
910
- 'Swarm Coordination': [
911
- 'hierarchical-coordinator',
912
- 'mesh-coordinator',
913
- 'adaptive-coordinator',
914
- 'collective-intelligence-coordinator',
915
- 'swarm-memory-manager',
916
- ],
917
- 'Consensus & Distributed': [
918
- 'byzantine-coordinator',
919
- 'raft-manager',
920
- 'gossip-coordinator',
921
- 'consensus-builder',
922
- 'crdt-synchronizer',
923
- 'quorum-manager',
924
- 'security-manager',
925
- ],
926
- 'Performance & Optimization': [
927
- 'perf-analyzer',
928
- 'performance-benchmarker',
929
- 'task-orchestrator',
930
- 'memory-coordinator',
931
- 'smart-agent',
932
- ],
933
- 'GitHub & Repository': [
934
- 'github-modes',
935
- 'pr-manager',
936
- 'code-review-swarm',
937
- 'issue-tracker',
938
- 'release-manager',
939
- 'workflow-automation',
940
- 'project-board-sync',
941
- 'repo-architect',
942
- 'multi-repo-swarm',
943
- ],
944
- 'SPARC Methodology': [
945
- 'sparc-coord',
946
- 'sparc-coder',
947
- 'specification',
948
- 'pseudocode',
949
- 'architecture',
950
- 'refinement',
951
- ],
952
- 'Specialized Development': [
953
- 'backend-dev',
954
- 'mobile-dev',
955
- 'ml-developer',
956
- 'cicd-engineer',
957
- 'api-docs',
958
- 'system-architect',
959
- 'code-analyzer',
960
- 'base-template-generator',
961
- ],
962
- 'Testing & Validation': [
963
- 'tdd-london-swarm',
964
- 'production-validator',
965
- ],
966
- 'Migration & Planning': [
967
- 'migration-planner',
968
- 'swarm-init',
969
- ],
970
- };
971
- for (const [category, agents] of Object.entries(categories)) {
972
- console.log(chalk_1.default.yellow(`${category}:`));
973
- agents.forEach(agent => console.log(` • ${agent}`));
974
- console.log();
975
- }
976
- console.log(chalk_1.default.gray('Total: 54 agents available'));
977
- }
978
- getProfileAgents(profile) {
979
- const profileAgents = {
980
- frontend: ['coder', 'reviewer', 'tester', 'mobile-dev', 'ui-designer'],
981
- backend: [
982
- 'coder',
983
- 'reviewer',
984
- 'tester',
985
- 'backend-dev',
986
- 'system-architect',
987
- 'api-docs',
988
- ],
989
- fullstack: [
990
- 'coder',
991
- 'reviewer',
992
- 'tester',
993
- 'planner',
994
- 'researcher',
995
- 'system-architect',
996
- 'backend-dev',
997
- ],
998
- devops: ['planner', 'cicd-engineer', 'perf-analyzer', 'github-modes', 'workflow-automation'],
999
- ml: ['ml-developer', 'coder', 'tester', 'perf-analyzer', 'researcher'],
1000
- };
1001
- return (profileAgents[profile] ||
1002
- profileAgents['fullstack'] || ['coder', 'reviewer', 'tester']);
1003
- }
1004
- generateAgentConfig(agentName) {
1005
- return {
1006
- name: agentName,
1007
- enabled: true,
1008
- description: `${agentName} agent for Claude Flow`,
1009
- configuration: {
1010
- maxTokens: 8000,
1011
- temperature: 0.7,
1012
- topP: 0.9,
1013
- enableMemory: true,
1014
- enableLearning: true,
1015
- },
1016
- };
1017
- }
1018
- /**
1019
- * Display final instructions for project setup
1020
- */
1021
- displayProjectFinalInstructions(repoPath, options) {
1022
- console.log(chalk_1.default.green('\nšŸŽ‰ Claude Code Setup Complete!'));
1023
- console.log(chalk_1.default.blue('================================'));
1024
- console.log(chalk_1.default.yellow('\nšŸ“‹ What was set up:'));
1025
- console.log('āœ… CLAUDE.md configuration generated');
1026
- if (!options.skipFlow) {
1027
- console.log('āœ… Claude Flow installed and configured');
1028
- }
1029
- if (!options.skipMcp) {
1030
- console.log('āœ… MCP Tools directory created');
1031
- }
1032
- console.log('āœ… Project structure validated');
1033
- console.log(chalk_1.default.yellow('\nšŸš€ Next Steps:'));
1034
- console.log('1. Review and customize CLAUDE.md as needed');
1035
- console.log('2. Install MCP tools: cd mcp-tools && ./install.sh');
1036
- console.log('3. Verify Claude Desktop MCP connection');
1037
- if (!options.skipFlow) {
1038
- console.log('4. Test Claude Flow: npx claude-flow sparc modes');
1039
- }
1040
- console.log('5. Start coding with optimized Claude Code integration!');
1041
- console.log(chalk_1.default.yellow('\nšŸ“š Resources:'));
1042
- console.log('• Claude Flow: https://github.com/ruvnet/claude-flow');
1043
- console.log('• MCP Documentation: https://modelcontextprotocol.io/docs');
1044
- console.log('• Wundr Documentation: ./docs/');
1045
- console.log(chalk_1.default.green('\n✨ Happy coding with Claude!'));
1046
- }
1047
- /**
1048
- * Print next steps after complete setup
1049
- */
1050
- printNextSteps() {
1051
- console.log(chalk_1.default.cyan('šŸ“‹ Next Steps:'));
1052
- console.log('1. Configure API keys for MCP tools (if needed)');
1053
- console.log('2. Install Browser MCP Chrome extension: wundr claude-setup extension');
1054
- console.log('3. Restart Claude Desktop to load new configurations');
1055
- console.log('4. Initialize a project: wundr claude-setup project');
1056
- console.log('5. Start coding with Claude Flow: npx claude-flow@alpha sparc tdd "feature"');
1057
- }
1058
- }
1059
- exports.ClaudeSetupCommands = ClaudeSetupCommands;
1060
- /**
1061
- * Factory function for backwards compatibility with function-based approach
1062
- * This allows both import patterns to work:
1063
- * - import claudeSetupCommand from './claude-setup' (class-based)
1064
- * - import { createClaudeSetupCommand } from './claude-setup' (function-based)
1065
- */
1066
- function createClaudeSetupCommand() {
1067
- const program = new commander_1.Command();
1068
- new ClaudeSetupCommands(program);
1069
- return program.commands.find(cmd => cmd.name() === 'claude-setup') || program;
1070
- }
1071
- const createClaudeSetupCommands = (program) => new ClaudeSetupCommands(program);
1072
- exports.default = createClaudeSetupCommands;
1073
- //# sourceMappingURL=claude-setup.js.map