@wundr.io/cli 1.0.11 → 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,872 +0,0 @@
1
- /**
2
- * Computer Setup Commands
3
- * Integrates real setup orchestrator for provisioning developer machines
4
- */
5
-
6
- import { execSync } from 'child_process';
7
- import * as fs from 'fs/promises';
8
- import * as os from 'os';
9
-
10
- import chalk from 'chalk';
11
- import inquirer from 'inquirer';
12
- import ora from 'ora';
13
-
14
- import {
15
- RealSetupOrchestrator,
16
- } from '@wundr.io/computer-setup';
17
- import { BackupRollbackManager } from '../utils/backup-rollback-manager';
18
- import { ClaudeConfigInstaller } from '../utils/claude-config-installer';
19
- import { logger } from '../utils/logger';
20
-
21
- import type {
22
- SetupPlatform,
23
- SetupProgress,
24
- SetupResult,
25
- DeveloperProfile} from '@wundr.io/computer-setup';
26
- import type { PluginManager } from '../plugins/plugin-manager';
27
- import type { ConfigManager } from '../utils/config-manager';
28
- import type { Command } from 'commander';
29
-
30
-
31
- // Additional local types
32
- interface LocalSetupOptions {
33
- profile?: string;
34
- team?: string;
35
- mode?: string;
36
- os?: string;
37
- dryRun?: boolean;
38
- skipExisting?: boolean;
39
- parallel?: boolean;
40
- report?: boolean;
41
- }
42
-
43
- export class ComputerSetupCommands {
44
- private orchestrator: RealSetupOrchestrator;
45
- private platform: SetupPlatform;
46
- private backupManager: BackupRollbackManager;
47
- private claudeInstaller: ClaudeConfigInstaller;
48
-
49
- constructor(
50
- private program: Command,
51
- private configManager: ConfigManager,
52
- private pluginManager: PluginManager,
53
- ) {
54
- this.platform = this.detectPlatform();
55
- this.orchestrator = new RealSetupOrchestrator(this.platform);
56
- this.backupManager = new BackupRollbackManager();
57
- this.claudeInstaller = new ClaudeConfigInstaller();
58
- this.registerCommands();
59
- }
60
-
61
- private registerCommands(): void {
62
- const computerSetup = this.program
63
- .command('computer-setup')
64
- .alias('setup-machine')
65
- .alias('provision')
66
- .description(
67
- 'Set up a new developer machine with all required tools and configurations',
68
- )
69
- .addHelpText(
70
- 'after',
71
- chalk.gray(`
72
- Examples:
73
- ${chalk.green('wundr computer-setup')} Interactive setup for new machine
74
- ${chalk.green('wundr computer-setup --profile frontend')} Use frontend developer profile
75
- ${chalk.green('wundr computer-setup --team platform')} Apply platform team configuration
76
- ${chalk.green('wundr computer-setup doctor')} Diagnose setup issues
77
- ${chalk.green('wundr computer-setup validate')} Validate current setup
78
- `),
79
- );
80
-
81
- // Main setup command
82
- computerSetup
83
- .command('run', { isDefault: true })
84
- .description('Run computer setup for new developer machine')
85
- .option(
86
- '-p, --profile <profile>',
87
- 'Use specific profile (frontend, backend, fullstack, devops)',
88
- )
89
- .option('-t, --team <team>', 'Apply team-specific configurations')
90
- .option('-m, --mode <mode>', 'Setup mode', 'interactive')
91
- .option('--os <os>', 'Target OS (auto-detected by default)')
92
- .option(
93
- '--dry-run',
94
- 'Show what would be installed without making changes',
95
- )
96
- .option('--skip-existing', 'Skip tools that are already installed')
97
- .option('--parallel', 'Install tools in parallel where possible')
98
- .option('--report', 'Generate detailed setup report')
99
- .action(async options => {
100
- await this.runSetup(options);
101
- });
102
-
103
- // Resume command
104
- computerSetup
105
- .command('resume')
106
- .description('Resume failed setup from saved state')
107
- .action(async () => {
108
- await this.resumeSetup();
109
- });
110
-
111
- // List profiles command
112
- computerSetup
113
- .command('list-profiles')
114
- .description('List available developer profiles')
115
- .action(async () => {
116
- await this.listAvailableProfiles();
117
- });
118
-
119
- // Profile management
120
- computerSetup
121
- .command('profile')
122
- .description('Manage developer profiles')
123
- .option('-l, --list', 'List available profiles')
124
- .option('-c, --create', 'Create new profile')
125
- .option('-e, --edit <name>', 'Edit existing profile')
126
- .option('-d, --delete <name>', 'Delete profile')
127
- .option('--export <path>', 'Export profiles')
128
- .option('--import <path>', 'Import profiles')
129
- .action(async options => {
130
- await this.manageProfiles(options);
131
- });
132
-
133
- // Team configuration
134
- computerSetup
135
- .command('team')
136
- .description('Manage team configurations')
137
- .argument('[team]', 'Team identifier')
138
- .option('--download', 'Download team configuration')
139
- .option('--apply', 'Apply team configuration')
140
- .option('--sync', 'Sync with team repository')
141
- .action(async (team, options) => {
142
- await this.manageTeamConfig(team, options);
143
- });
144
-
145
- // Validation
146
- computerSetup
147
- .command('validate')
148
- .description('Validate current machine setup')
149
- .option('--profile <profile>', 'Validate against specific profile')
150
- .option('--fix', 'Attempt to fix issues')
151
- .option('--report', 'Generate validation report')
152
- .action(async options => {
153
- await this.validateSetup(options);
154
- });
155
-
156
- // Doctor - diagnose issues
157
- computerSetup
158
- .command('doctor')
159
- .description('Diagnose and fix common setup issues')
160
- .option('--check <tool>', 'Check specific tool')
161
- .option('--fix', 'Attempt automatic fixes')
162
- .option('--verbose', 'Show detailed diagnostics')
163
- .action(async options => {
164
- await this.runDoctor(options);
165
- });
166
-
167
- // Tool-specific setup commands
168
- computerSetup
169
- .command('install')
170
- .description('Install specific tools')
171
- .argument('<tool>', 'Tool to install (node, python, docker, etc.)')
172
- .option('--version <version>', 'Specific version to install')
173
- .option('--global', 'Install globally')
174
- .action(async (tool, options) => {
175
- await this.installTool(tool, options);
176
- });
177
-
178
- // Claude Code configuration commands
179
- computerSetup
180
- .command('claude-config')
181
- .description('Install Claude Code configuration')
182
- .option('--dry-run', 'Show what would be installed')
183
- .option('--skip-backup', 'Skip backup creation')
184
- .option('--overwrite', 'Overwrite existing configurations')
185
- .option('--verbose', 'Show detailed output')
186
- .action(async options => {
187
- await this.installClaudeConfig(options);
188
- });
189
-
190
- // Backup management commands
191
- computerSetup
192
- .command('backup')
193
- .description('Manage configuration backups')
194
- .option('-l, --list', 'List all backups')
195
- .option('-c, --create', 'Create new backup')
196
- .option('-v, --verify <id>', 'Verify backup integrity')
197
- .option('--cleanup', 'Clean up old backups')
198
- .action(async options => {
199
- await this.manageBackups(options);
200
- });
201
-
202
- // Rollback command
203
- computerSetup
204
- .command('rollback')
205
- .description('Restore from backup')
206
- .option('--backup <id>', 'Specific backup to restore')
207
- .option('--dry-run', 'Show what would be restored')
208
- .option('--verbose', 'Show detailed output')
209
- .action(async options => {
210
- await this.rollbackConfiguration(options);
211
- });
212
- }
213
-
214
- private async runSetup(options: any): Promise<void> {
215
- console.log(chalk.cyan('\nšŸ–„ļø Wundr Computer Setup'));
216
- console.log(chalk.gray('Setting up your development machine...\n'));
217
-
218
- try {
219
- // Check for resumable setup
220
- const canResume = await this.orchestrator.canResume();
221
- if (canResume) {
222
- const { resume } = await inquirer.prompt([
223
- {
224
- type: 'confirm',
225
- name: 'resume',
226
- message: 'Found incomplete setup. Resume from where you left off?',
227
- default: true,
228
- },
229
- ]);
230
-
231
- if (resume) {
232
- return await this.resumeSetup();
233
- }
234
- }
235
-
236
- // Get profile
237
- let profileName = options.profile;
238
- if (!profileName) {
239
- if (options.mode === 'interactive') {
240
- profileName = await this.selectProfile();
241
- } else {
242
- profileName = 'fullstack'; // Default
243
- }
244
- }
245
-
246
- // Validate profile
247
- const availableProfiles = this.orchestrator.getAvailableProfiles();
248
- const profile = availableProfiles.find(p =>
249
- p.name.toLowerCase().includes(profileName.toLowerCase()),
250
- );
251
-
252
- if (!profile) {
253
- console.error(chalk.red(`āŒ Unknown profile: ${profileName}`));
254
- console.log(chalk.cyan('\nAvailable profiles:'));
255
- availableProfiles.forEach(p =>
256
- console.log(` • ${p.name}: ${p.description}`),
257
- );
258
- return;
259
- }
260
-
261
- console.log(
262
- chalk.cyan(`\nšŸ“‹ Selected Profile: ${chalk.white(profile.name)}`),
263
- );
264
- console.log(chalk.gray(`${profile.description}`));
265
- console.log(
266
- chalk.gray(`Estimated time: ${profile.estimatedTimeMinutes} minutes\n`),
267
- );
268
-
269
- // Show what will be installed
270
- console.log(chalk.cyan('šŸ› ļø Tools to install:'));
271
- profile.requiredTools.forEach(tool => console.log(` • ${tool}`));
272
-
273
- if (profile.optionalTools.length > 0) {
274
- console.log(chalk.cyan('\nšŸ”§ Optional tools:'));
275
- profile.optionalTools.forEach(tool => console.log(` • ${tool}`));
276
- }
277
-
278
- if (options.dryRun) {
279
- console.log(chalk.yellow('\nāš ļø DRY RUN - No changes will be made'));
280
- return;
281
- }
282
-
283
- // Confirm before proceeding
284
- if (options.mode === 'interactive') {
285
- const { proceed } = await inquirer.prompt([
286
- {
287
- type: 'confirm',
288
- name: 'proceed',
289
- message: 'Proceed with setup?',
290
- default: true,
291
- },
292
- ]);
293
-
294
- if (!proceed) {
295
- console.log(chalk.yellow('Setup cancelled'));
296
- return;
297
- }
298
- }
299
-
300
- // Run the orchestrator with progress tracking
301
- const progressCallback = (progress: SetupProgress) => {
302
- // Update progress display
303
- process.stdout.clearLine(0);
304
- process.stdout.cursorTo(0);
305
- process.stdout.write(
306
- `${chalk.cyan('[')}${progress.percentage.toFixed(1)}%${chalk.cyan(']')} ${progress.currentStep}`,
307
- );
308
- };
309
-
310
- console.log(chalk.cyan('\nšŸš€ Starting setup...\n'));
311
-
312
- const result: SetupResult = await this.orchestrator.orchestrate(
313
- profileName,
314
- {
315
- dryRun: options.dryRun,
316
- skipExisting: options.skipExisting,
317
- parallel: options.parallel,
318
- generateReport: options.report,
319
- },
320
- progressCallback,
321
- );
322
-
323
- console.log('\n'); // New line after progress
324
-
325
- if (result.success) {
326
- console.log(chalk.green('āœ… Computer setup completed successfully!'));
327
- console.log(
328
- chalk.gray(
329
- `Setup took ${Math.round(result.duration / 1000)} seconds\n`,
330
- ),
331
- );
332
-
333
- if (result.completedSteps.length > 0) {
334
- console.log(
335
- chalk.cyan(`šŸŽÆ Completed steps (${result.completedSteps.length}):`),
336
- );
337
- result.completedSteps
338
- .slice(0, 5)
339
- .forEach(step => console.log(` āœ… ${step}`));
340
- if (result.completedSteps.length > 5) {
341
- console.log(` ... and ${result.completedSteps.length - 5} more`);
342
- }
343
- }
344
-
345
- if (result.skippedSteps.length > 0) {
346
- console.log(
347
- chalk.yellow(`ā­ļø Skipped steps (${result.skippedSteps.length}):`),
348
- );
349
- result.skippedSteps.forEach(step => console.log(` ā­ļø ${step}`));
350
- }
351
-
352
- this.displayNextSteps();
353
- } else {
354
- console.log(chalk.red('āŒ Setup failed!'));
355
-
356
- if (result.failedSteps.length > 0) {
357
- console.log(
358
- chalk.red(`Failed steps (${result.failedSteps.length}):`),
359
- );
360
- result.failedSteps.forEach(step => console.log(` āŒ ${step}`));
361
- }
362
-
363
- if (result.errors.length > 0) {
364
- console.log(chalk.red('\nErrors:'));
365
- result.errors.forEach(error => console.log(` • ${error.message}`));
366
- }
367
-
368
- console.log(
369
- chalk.cyan(
370
- '\nšŸ’” You can resume setup by running: wundr computer-setup resume',
371
- ),
372
- );
373
- process.exit(1);
374
- }
375
- } catch (error) {
376
- console.error(chalk.red('\nāŒ Setup failed with error:'), error);
377
- console.log(
378
- chalk.cyan(
379
- '\nšŸ’” You can resume setup by running: wundr computer-setup resume',
380
- ),
381
- );
382
- process.exit(1);
383
- }
384
- }
385
-
386
- private async manageProfiles(options: any): Promise<void> {
387
- if (options.list) {
388
- const profiles = await this.listProfiles();
389
- console.log(chalk.cyan('\nšŸ“‹ Available Profiles:\n'));
390
- profiles.forEach(p => {
391
- console.log(chalk.white(` • ${p.name} (${p.role})`));
392
- });
393
- } else if (options.create) {
394
- await this.createInteractiveProfile();
395
- } else if (options.edit) {
396
- await this.editProfile(options.edit);
397
- } else if (options.delete) {
398
- await this.deleteProfile(options.delete);
399
- } else if (options.export) {
400
- await this.exportProfiles(options.export);
401
- } else if (options.import) {
402
- await this.importProfiles(options.import);
403
- }
404
- }
405
-
406
- private async validateSetup(options: any): Promise<void> {
407
- const spinner = ora('Validating setup...').start();
408
-
409
- const checks = [
410
- { name: 'Node.js', cmd: 'node --version', required: true },
411
- { name: 'Git', cmd: 'git --version', required: true },
412
- { name: 'Docker', cmd: 'docker --version', required: false },
413
- { name: 'Claude Code', cmd: 'claude --version', required: false },
414
- ];
415
-
416
- const results: any[] = [];
417
-
418
- for (const check of checks) {
419
- try {
420
- // Would execute command and check
421
- results.push({ ...check, status: 'passed' });
422
- } catch (error) {
423
- results.push({ ...check, status: 'failed' });
424
- }
425
- }
426
-
427
- spinner.stop();
428
-
429
- console.log(chalk.cyan('\nšŸ” Validation Results:\n'));
430
- results.forEach(r => {
431
- const icon = r.status === 'passed' ? 'āœ…' : 'āŒ';
432
- const color = r.status === 'passed' ? chalk.green : chalk.red;
433
- console.log(color(` ${icon} ${r.name}`));
434
- });
435
-
436
- if (options.fix) {
437
- await this.attemptFixes(results.filter(r => r.status === 'failed'));
438
- }
439
- }
440
-
441
- private async runDoctor(options: any): Promise<void> {
442
- console.log(chalk.cyan('\nšŸ„ Computer Setup Doctor\n'));
443
-
444
- const diagnostics = [
445
- 'Checking system requirements...',
446
- 'Verifying network connectivity...',
447
- 'Checking disk space...',
448
- 'Validating permissions...',
449
- 'Checking installed tools...',
450
- 'Verifying configurations...',
451
- ];
452
-
453
- for (const diagnostic of diagnostics) {
454
- const spinner = ora(diagnostic).start();
455
- await new Promise(resolve => setTimeout(resolve, 500));
456
- spinner.succeed();
457
- }
458
-
459
- console.log(chalk.green('\nāœ… All checks passed!'));
460
- console.log(chalk.cyan('\nšŸ’Š Recommendations:'));
461
- console.log(' 1. Keep your tools updated');
462
- console.log(' 2. Regular security updates');
463
- console.log(' 3. Backup your configurations');
464
- }
465
-
466
- private async createInteractiveProfile(): Promise<any> {
467
- console.log(chalk.cyan('\nšŸ‘¤ Create Developer Profile\n'));
468
-
469
- const answers = await inquirer.prompt([
470
- {
471
- type: 'input',
472
- name: 'name',
473
- message: 'Your name:',
474
- validate: input => input.length > 0,
475
- },
476
- {
477
- type: 'input',
478
- name: 'email',
479
- message: 'Your email:',
480
- validate: input => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(input),
481
- },
482
- {
483
- type: 'list',
484
- name: 'role',
485
- message: 'Your role:',
486
- choices: [
487
- 'Frontend Developer',
488
- 'Backend Developer',
489
- 'Full Stack Developer',
490
- 'DevOps Engineer',
491
- 'Machine Learning Engineer',
492
- 'Mobile Developer',
493
- ],
494
- },
495
- {
496
- type: 'checkbox',
497
- name: 'tools',
498
- message: 'Select tools to install:',
499
- choices: [
500
- { name: 'Node.js', checked: true },
501
- { name: 'Python' },
502
- { name: 'Docker', checked: true },
503
- { name: 'Kubernetes' },
504
- { name: 'AWS CLI' },
505
- { name: 'Claude Code', checked: true },
506
- { name: 'GitHub CLI', checked: true },
507
- ],
508
- },
509
- ]);
510
-
511
- console.log(chalk.green('\nāœ… Profile created successfully!'));
512
-
513
- // Map answers to DeveloperProfile structure
514
- const profile: DeveloperProfile = {
515
- name: 'custom',
516
- role: answers.role,
517
- languages: {
518
- javascript: answers.tools.includes('Node.js'),
519
- typescript: answers.tools.includes('TypeScript'),
520
- python: answers.tools.includes('Python'),
521
- },
522
- frameworks: {},
523
- tools: {
524
- packageManagers: {
525
- npm: answers.tools.includes('Node.js'),
526
- yarn: answers.tools.includes('Yarn'),
527
- pnpm: answers.tools.includes('pnpm'),
528
- },
529
- containers: {
530
- docker: answers.tools.includes('Docker'),
531
- dockerCompose: answers.tools.includes('Docker'),
532
- kubernetes: answers.tools.includes('Kubernetes'),
533
- },
534
- editors: {
535
- vscode: answers.tools.includes('VS Code'),
536
- vim: answers.tools.includes('Vim'),
537
- claude: answers.tools.includes('Claude Code'),
538
- },
539
- databases: {
540
- postgresql: answers.tools.includes('PostgreSQL'),
541
- mysql: answers.tools.includes('MySQL'),
542
- mongodb: answers.tools.includes('MongoDB'),
543
- redis: answers.tools.includes('Redis'),
544
- },
545
- },
546
- };
547
-
548
- return profile;
549
- }
550
-
551
- private detectPlatform(os?: string): SetupPlatform {
552
- return {
553
- os: (os || process.platform) as 'darwin' | 'linux' | 'win32',
554
- arch: process.arch as 'x64' | 'arm64',
555
- version: process.version,
556
- node: process.version,
557
- shell: process.env.SHELL,
558
- };
559
- }
560
-
561
- private async selectProfile(): Promise<string> {
562
- const profiles = this.orchestrator.getAvailableProfiles();
563
-
564
- const { selectedProfile } = await inquirer.prompt([
565
- {
566
- type: 'list',
567
- name: 'selectedProfile',
568
- message: 'Select a developer profile:',
569
- choices: profiles.map(p => ({
570
- name: `${p.name} - ${p.description}`,
571
- value: p.name.toLowerCase().replace(' ', ''),
572
- short: p.name,
573
- })),
574
- },
575
- ]);
576
-
577
- return selectedProfile;
578
- }
579
-
580
- private async resumeSetup(): Promise<void> {
581
- console.log(chalk.cyan('\nšŸ”„ Resuming setup from saved state...\n'));
582
-
583
- const progressCallback = (progress: SetupProgress) => {
584
- process.stdout.clearLine(0);
585
- process.stdout.cursorTo(0);
586
- process.stdout.write(
587
- `${chalk.cyan('[')}${progress.percentage.toFixed(1)}%${chalk.cyan(']')} ${progress.currentStep}`,
588
- );
589
- };
590
-
591
- try {
592
- const result = await this.orchestrator.resume(progressCallback);
593
- console.log('\n'); // New line after progress
594
-
595
- if (result.success) {
596
- console.log(
597
- chalk.green('āœ… Setup resumed and completed successfully!'),
598
- );
599
- this.displayNextSteps();
600
- } else {
601
- console.log(chalk.red('āŒ Resume failed!'));
602
- if (result.errors.length > 0) {
603
- console.log(chalk.red('Errors:'));
604
- result.errors.forEach(error => console.log(` • ${error.message}`));
605
- }
606
- process.exit(1);
607
- }
608
- } catch (error) {
609
- console.error(chalk.red('āŒ Resume failed:'), error);
610
- process.exit(1);
611
- }
612
- }
613
-
614
- private async listAvailableProfiles(): Promise<void> {
615
- console.log(chalk.cyan('\nšŸ‘¤ Available Developer Profiles:\n'));
616
-
617
- const profiles = this.orchestrator.getAvailableProfiles();
618
- profiles.forEach(profile => {
619
- console.log(chalk.white(`šŸ“‹ ${profile.name}`));
620
- console.log(chalk.gray(` ${profile.description}`));
621
- console.log(
622
- chalk.gray(` Categories: ${profile.categories.join(', ')}`),
623
- );
624
- console.log(chalk.gray(` Tools: ${profile.requiredTools.join(', ')}`));
625
- console.log(
626
- chalk.gray(` Estimated time: ${profile.estimatedTimeMinutes} minutes`),
627
- );
628
- console.log();
629
- });
630
-
631
- console.log(
632
- chalk.cyan('Usage: wundr computer-setup --profile <profile-name>'),
633
- );
634
- console.log(
635
- chalk.gray('Example: wundr computer-setup --profile frontend\n'),
636
- );
637
- }
638
-
639
- private generateSetupSteps(profile: any, platform: any): any[] {
640
- const steps: Array<{ name: string; required: boolean }> = [];
641
-
642
- // Platform-specific setup
643
- if (platform.os === 'darwin') {
644
- steps.push({ name: 'Install Homebrew', required: true });
645
- steps.push({ name: 'Install Xcode Command Line Tools', required: true });
646
- }
647
-
648
- // Common tools
649
- steps.push({ name: 'Configure Git', required: true });
650
- steps.push({ name: 'Generate SSH keys', required: true });
651
-
652
- // Profile-specific tools
653
- if (profile.tools?.includes('Node.js')) {
654
- steps.push({ name: 'Install Node.js via nvm', required: true });
655
- steps.push({ name: 'Install pnpm', required: true });
656
- }
657
-
658
- if (profile.tools?.includes('Docker')) {
659
- steps.push({ name: 'Install Docker Desktop', required: false });
660
- }
661
-
662
- if (profile.tools?.includes('Claude Code')) {
663
- steps.push({ name: 'Install Claude Code', required: false });
664
- steps.push({ name: 'Configure Claude Flow', required: false });
665
- }
666
-
667
- // Final steps
668
- steps.push({ name: 'Configure shell environment', required: true });
669
- steps.push({ name: 'Install VS Code extensions', required: false });
670
-
671
- return steps;
672
- }
673
-
674
- private async executeSetupStep(step: any, options: any): Promise<void> {
675
- // Simulate execution
676
- await new Promise(resolve => setTimeout(resolve, 500));
677
-
678
- if (Math.random() > 0.95 && !step.required) {
679
- throw new Error('Simulated error');
680
- }
681
- }
682
-
683
- private displayNextSteps(): void {
684
- console.log(chalk.cyan('\nšŸ“ Next Steps:\n'));
685
- const steps = [
686
- 'Restart your terminal to apply changes',
687
- 'Run "wundr computer-setup validate" to verify',
688
- 'Sign in to your team tools (Slack, GitHub, etc.)',
689
- 'Clone your team repositories',
690
- 'Review team documentation',
691
- ];
692
-
693
- steps.forEach((step, i) => {
694
- console.log(chalk.white(` ${i + 1}. ${step}`));
695
- });
696
- }
697
-
698
- private async loadProfile(name: string): Promise<any> {
699
- // Load profile from config
700
- return {
701
- name: name,
702
- role: 'fullstack',
703
- tools: ['Node.js', 'Docker', 'Claude Code'],
704
- };
705
- }
706
-
707
- private async getDefaultProfile(): Promise<any> {
708
- return {
709
- name: 'default',
710
- role: 'fullstack',
711
- tools: ['Node.js', 'Git'],
712
- };
713
- }
714
-
715
- private async listProfiles(): Promise<any[]> {
716
- return [
717
- { name: 'frontend', role: 'Frontend Developer' },
718
- { name: 'backend', role: 'Backend Developer' },
719
- { name: 'fullstack', role: 'Full Stack Developer' },
720
- ];
721
- }
722
-
723
- private async editProfile(name: string): Promise<void> {
724
- console.log(chalk.cyan(`Editing profile: ${name}`));
725
- }
726
-
727
- private async deleteProfile(name: string): Promise<void> {
728
- console.log(chalk.yellow(`Deleting profile: ${name}`));
729
- }
730
-
731
- private async exportProfiles(path: string): Promise<void> {
732
- console.log(chalk.green(`Profiles exported to: ${path}`));
733
- }
734
-
735
- private async importProfiles(path: string): Promise<void> {
736
- console.log(chalk.green(`Profiles imported from: ${path}`));
737
- }
738
-
739
- private async manageTeamConfig(team: string, options: any): Promise<void> {
740
- console.log(chalk.cyan(`Managing team configuration: ${team}`));
741
- }
742
-
743
- private async installTool(tool: string, options: any): Promise<void> {
744
- console.log(chalk.cyan(`Installing ${tool}...`));
745
- }
746
-
747
- private async attemptFixes(failures: any[]): Promise<void> {
748
- console.log(chalk.yellow('\nAttempting fixes...'));
749
- for (const failure of failures) {
750
- console.log(chalk.gray(` Fixing ${failure.name}...`));
751
- }
752
- }
753
-
754
- /**
755
- * Install Claude Code configuration
756
- */
757
- private async installClaudeConfig(options: any): Promise<void> {
758
- console.log(chalk.cyan('\nšŸ”§ Claude Code Configuration Installer\n'));
759
-
760
- try {
761
- // Initialize managers
762
- await this.backupManager.initialize();
763
- await this.claudeInstaller.initialize();
764
-
765
- // Install configurations
766
- const result = await this.claudeInstaller.install({
767
- dryRun: options.dryRun,
768
- skipBackup: options.skipBackup,
769
- overwrite: options.overwrite,
770
- verbose: options.verbose,
771
- });
772
-
773
- if (!result.success) {
774
- process.exit(1);
775
- }
776
- } catch (error) {
777
- console.error(chalk.red('āŒ Installation failed:'), error);
778
- logger.error('Claude config installation failed', error);
779
- process.exit(1);
780
- }
781
- }
782
-
783
- /**
784
- * Manage backups
785
- */
786
- private async manageBackups(options: any): Promise<void> {
787
- await this.backupManager.initialize();
788
-
789
- if (options.list) {
790
- const backups = await this.backupManager.listBackups();
791
-
792
- if (backups.length === 0) {
793
- console.log(chalk.yellow('No backups found'));
794
- return;
795
- }
796
-
797
- console.log(chalk.cyan('\nšŸ“¦ Available Backups\n'));
798
- backups.forEach(backup => {
799
- const date = new Date(backup.timestamp).toLocaleString();
800
- const status = backup.success
801
- ? chalk.green('āœ… Success')
802
- : chalk.red('āŒ Failed');
803
-
804
- console.log(chalk.white(`ID: ${backup.backupId}`));
805
- console.log(chalk.gray(` Date: ${date}`));
806
- console.log(chalk.gray(` Reason: ${backup.reason}`));
807
- console.log(chalk.gray(` Status: ${status}`));
808
- console.log(chalk.gray(` Files: ${backup.files.length}`));
809
- console.log();
810
- });
811
- } else if (options.create) {
812
- const { files } = await inquirer.prompt([
813
- {
814
- type: 'input',
815
- name: 'files',
816
- message: 'Enter file paths (comma-separated):',
817
- validate: input => input.length > 0,
818
- },
819
- ]);
820
-
821
- const fileList = files.split(',').map((f: string) => f.trim());
822
- const backup = await this.backupManager.createBackup(
823
- fileList,
824
- 'Manual backup',
825
- );
826
-
827
- this.backupManager.displayBackupInfo(backup);
828
- } else if (options.verify) {
829
- const isValid = await this.backupManager.verifyBackup(options.verify);
830
-
831
- if (isValid) {
832
- console.log(chalk.green(`āœ… Backup ${options.verify} is valid`));
833
- } else {
834
- console.log(chalk.red(`āŒ Backup ${options.verify} is invalid`));
835
- process.exit(1);
836
- }
837
- } else if (options.cleanup) {
838
- await this.backupManager.cleanupOldBackups();
839
- console.log(chalk.green('āœ… Old backups cleaned up'));
840
- } else {
841
- console.log(chalk.yellow('Please specify an option. Use --help for details.'));
842
- }
843
- }
844
-
845
- /**
846
- * Rollback configuration
847
- */
848
- private async rollbackConfiguration(options: any): Promise<void> {
849
- console.log(chalk.cyan('\nšŸ”„ Configuration Rollback\n'));
850
-
851
- await this.backupManager.initialize();
852
-
853
- const success = await this.backupManager.rollback({
854
- backupId: options.backup,
855
- dryRun: options.dryRun,
856
- verbose: options.verbose,
857
- });
858
-
859
- if (!success) {
860
- console.log(chalk.red('\nāŒ Rollback failed'));
861
- process.exit(1);
862
- }
863
-
864
- if (!options.dryRun) {
865
- console.log(chalk.green('\nāœ… Rollback completed successfully'));
866
- console.log(chalk.cyan('\nNext steps:'));
867
- console.log(chalk.white(' 1. Verify restored configurations'));
868
- console.log(chalk.white(' 2. Restart terminal if needed'));
869
- console.log(chalk.white(' 3. Run validation script'));
870
- }
871
- }
872
- }