@wundr.io/cli 1.0.12 → 1.0.14

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 (233) hide show
  1. package/dist/ai/ai-service.d.ts +152 -0
  2. package/dist/ai/ai-service.d.ts.map +1 -0
  3. package/dist/ai/ai-service.js +430 -0
  4. package/dist/ai/ai-service.js.map +1 -0
  5. package/dist/ai/claude-client.d.ts +130 -0
  6. package/dist/ai/claude-client.d.ts.map +1 -0
  7. package/dist/ai/claude-client.js +340 -0
  8. package/dist/ai/claude-client.js.map +1 -0
  9. package/dist/ai/conversation-manager.d.ts +164 -0
  10. package/dist/ai/conversation-manager.d.ts.map +1 -0
  11. package/dist/ai/conversation-manager.js +614 -0
  12. package/dist/ai/conversation-manager.js.map +1 -0
  13. package/dist/ai/index.d.ts +5 -0
  14. package/dist/ai/index.d.ts.map +1 -0
  15. package/dist/ai/index.js +8 -0
  16. package/dist/ai/index.js.map +1 -0
  17. package/dist/cli.d.ts +36 -0
  18. package/dist/cli.d.ts.map +1 -0
  19. package/dist/cli.js +192 -0
  20. package/dist/cli.js.map +1 -0
  21. package/dist/commands/ai.d.ts +89 -0
  22. package/dist/commands/ai.d.ts.map +1 -0
  23. package/dist/commands/ai.js +954 -0
  24. package/dist/commands/ai.js.map +1 -0
  25. package/dist/commands/alignment.d.ts +78 -0
  26. package/dist/commands/alignment.d.ts.map +1 -0
  27. package/dist/commands/alignment.js +817 -0
  28. package/dist/commands/alignment.js.map +1 -0
  29. package/dist/commands/analyze-optimized.d.ts +14 -0
  30. package/dist/commands/analyze-optimized.d.ts.map +1 -0
  31. package/dist/commands/analyze-optimized.js +609 -0
  32. package/dist/commands/analyze-optimized.js.map +1 -0
  33. package/dist/commands/analyze.d.ts +65 -0
  34. package/dist/commands/analyze.d.ts.map +1 -0
  35. package/dist/commands/analyze.js +435 -0
  36. package/dist/commands/analyze.js.map +1 -0
  37. package/dist/commands/batch.d.ts +93 -0
  38. package/dist/commands/batch.d.ts.map +1 -0
  39. package/dist/commands/batch.js +854 -0
  40. package/dist/commands/batch.js.map +1 -0
  41. package/dist/commands/chat.d.ts +72 -0
  42. package/dist/commands/chat.d.ts.map +1 -0
  43. package/dist/commands/chat.js +678 -0
  44. package/dist/commands/chat.js.map +1 -0
  45. package/dist/commands/claude-init.d.ts +28 -0
  46. package/dist/commands/claude-init.d.ts.map +1 -0
  47. package/dist/commands/claude-init.js +591 -0
  48. package/dist/commands/claude-init.js.map +1 -0
  49. package/dist/commands/claude-setup.d.ts +119 -0
  50. package/dist/commands/claude-setup.d.ts.map +1 -0
  51. package/dist/commands/claude-setup.js +1079 -0
  52. package/dist/commands/claude-setup.js.map +1 -0
  53. package/dist/commands/computer-setup.d.ts +8 -0
  54. package/dist/commands/computer-setup.d.ts.map +1 -0
  55. package/dist/commands/computer-setup.js +877 -0
  56. package/dist/commands/computer-setup.js.map +1 -0
  57. package/dist/commands/create-command.d.ts +7 -0
  58. package/dist/commands/create-command.d.ts.map +1 -0
  59. package/dist/commands/create-command.js +158 -0
  60. package/dist/commands/create-command.js.map +1 -0
  61. package/dist/commands/create.d.ts +74 -0
  62. package/dist/commands/create.d.ts.map +1 -0
  63. package/dist/commands/create.js +556 -0
  64. package/dist/commands/create.js.map +1 -0
  65. package/dist/commands/dashboard.d.ts +91 -0
  66. package/dist/commands/dashboard.d.ts.map +1 -0
  67. package/dist/commands/dashboard.js +538 -0
  68. package/dist/commands/dashboard.js.map +1 -0
  69. package/dist/commands/govern.d.ts +70 -0
  70. package/dist/commands/govern.d.ts.map +1 -0
  71. package/dist/commands/govern.js +481 -0
  72. package/dist/commands/govern.js.map +1 -0
  73. package/dist/commands/governance.d.ts +17 -0
  74. package/dist/commands/governance.d.ts.map +1 -0
  75. package/dist/commands/governance.js +703 -0
  76. package/dist/commands/governance.js.map +1 -0
  77. package/dist/commands/guardian.d.ts +20 -0
  78. package/dist/commands/guardian.d.ts.map +1 -0
  79. package/dist/commands/guardian.js +597 -0
  80. package/dist/commands/guardian.js.map +1 -0
  81. package/dist/commands/init.d.ts +59 -0
  82. package/dist/commands/init.d.ts.map +1 -0
  83. package/dist/commands/init.js +650 -0
  84. package/dist/commands/init.js.map +1 -0
  85. package/dist/commands/orchestrator.d.ts +7 -0
  86. package/dist/commands/orchestrator.d.ts.map +1 -0
  87. package/dist/commands/orchestrator.js +578 -0
  88. package/dist/commands/orchestrator.js.map +1 -0
  89. package/dist/commands/performance-optimizer.d.ts +30 -0
  90. package/dist/commands/performance-optimizer.d.ts.map +1 -0
  91. package/dist/commands/performance-optimizer.js +650 -0
  92. package/dist/commands/performance-optimizer.js.map +1 -0
  93. package/dist/commands/plugins.d.ts +87 -0
  94. package/dist/commands/plugins.d.ts.map +1 -0
  95. package/dist/commands/plugins.js +685 -0
  96. package/dist/commands/plugins.js.map +1 -0
  97. package/dist/commands/rag.d.ts +7 -0
  98. package/dist/commands/rag.d.ts.map +1 -0
  99. package/dist/commands/rag.js +751 -0
  100. package/dist/commands/rag.js.map +1 -0
  101. package/dist/commands/session.d.ts +41 -0
  102. package/dist/commands/session.d.ts.map +1 -0
  103. package/dist/commands/session.js +441 -0
  104. package/dist/commands/session.js.map +1 -0
  105. package/dist/commands/setup.d.ts +24 -0
  106. package/dist/commands/setup.d.ts.map +1 -0
  107. package/dist/commands/setup.js +172 -0
  108. package/dist/commands/setup.js.map +1 -0
  109. package/dist/commands/test-init.d.ts +9 -0
  110. package/dist/commands/test-init.d.ts.map +1 -0
  111. package/dist/commands/test-init.js +222 -0
  112. package/dist/commands/test-init.js.map +1 -0
  113. package/dist/commands/test.d.ts +25 -0
  114. package/dist/commands/test.d.ts.map +1 -0
  115. package/dist/commands/test.js +217 -0
  116. package/dist/commands/test.js.map +1 -0
  117. package/dist/commands/watch.d.ts +76 -0
  118. package/dist/commands/watch.d.ts.map +1 -0
  119. package/dist/commands/watch.js +613 -0
  120. package/dist/commands/watch.js.map +1 -0
  121. package/dist/commands/worktree.d.ts +63 -0
  122. package/dist/commands/worktree.d.ts.map +1 -0
  123. package/dist/commands/worktree.js +774 -0
  124. package/dist/commands/worktree.js.map +1 -0
  125. package/dist/context/context-manager.d.ts +155 -0
  126. package/dist/context/context-manager.d.ts.map +1 -0
  127. package/dist/context/context-manager.js +383 -0
  128. package/dist/context/context-manager.js.map +1 -0
  129. package/dist/context/index.d.ts +3 -0
  130. package/dist/context/index.d.ts.map +1 -0
  131. package/dist/context/index.js +6 -0
  132. package/dist/context/index.js.map +1 -0
  133. package/dist/context/session-manager.d.ts +207 -0
  134. package/dist/context/session-manager.d.ts.map +1 -0
  135. package/dist/context/session-manager.js +686 -0
  136. package/dist/context/session-manager.js.map +1 -0
  137. package/dist/framework/command-interface.d.ts +349 -0
  138. package/dist/framework/command-interface.d.ts.map +1 -0
  139. package/dist/framework/command-interface.js +101 -0
  140. package/dist/framework/command-interface.js.map +1 -0
  141. package/dist/framework/command-registry.d.ts +173 -0
  142. package/dist/framework/command-registry.d.ts.map +1 -0
  143. package/dist/framework/command-registry.js +734 -0
  144. package/dist/framework/command-registry.js.map +1 -0
  145. package/dist/framework/completion-exporter.d.ts +79 -0
  146. package/dist/framework/completion-exporter.d.ts.map +1 -0
  147. package/dist/framework/completion-exporter.js +259 -0
  148. package/dist/framework/completion-exporter.js.map +1 -0
  149. package/dist/framework/debug-logger.d.ts +163 -0
  150. package/dist/framework/debug-logger.d.ts.map +1 -0
  151. package/dist/framework/debug-logger.js +373 -0
  152. package/dist/framework/debug-logger.js.map +1 -0
  153. package/dist/framework/error-handler.d.ts +196 -0
  154. package/dist/framework/error-handler.d.ts.map +1 -0
  155. package/dist/framework/error-handler.js +613 -0
  156. package/dist/framework/error-handler.js.map +1 -0
  157. package/dist/framework/help-generator.d.ts +78 -0
  158. package/dist/framework/help-generator.d.ts.map +1 -0
  159. package/dist/framework/help-generator.js +414 -0
  160. package/dist/framework/help-generator.js.map +1 -0
  161. package/dist/framework/index.d.ts +62 -0
  162. package/dist/framework/index.d.ts.map +1 -0
  163. package/dist/framework/index.js +95 -0
  164. package/dist/framework/index.js.map +1 -0
  165. package/dist/framework/interactive-repl.d.ts +138 -0
  166. package/dist/framework/interactive-repl.d.ts.map +1 -0
  167. package/dist/framework/interactive-repl.js +567 -0
  168. package/dist/framework/interactive-repl.js.map +1 -0
  169. package/dist/framework/output-formatter.d.ts +274 -0
  170. package/dist/framework/output-formatter.d.ts.map +1 -0
  171. package/dist/framework/output-formatter.js +545 -0
  172. package/dist/framework/output-formatter.js.map +1 -0
  173. package/dist/framework/progress-manager.d.ts +192 -0
  174. package/dist/framework/progress-manager.d.ts.map +1 -0
  175. package/dist/framework/progress-manager.js +408 -0
  176. package/dist/framework/progress-manager.js.map +1 -0
  177. package/dist/index.d.ts +8 -0
  178. package/dist/index.d.ts.map +1 -0
  179. package/dist/index.js +51 -0
  180. package/dist/index.js.map +1 -0
  181. package/dist/interactive/interactive-mode.d.ts +76 -0
  182. package/dist/interactive/interactive-mode.d.ts.map +1 -0
  183. package/dist/interactive/interactive-mode.js +732 -0
  184. package/dist/interactive/interactive-mode.js.map +1 -0
  185. package/dist/nlp/command-mapper.d.ts +174 -0
  186. package/dist/nlp/command-mapper.d.ts.map +1 -0
  187. package/dist/nlp/command-mapper.js +624 -0
  188. package/dist/nlp/command-mapper.js.map +1 -0
  189. package/dist/nlp/command-parser.d.ts +106 -0
  190. package/dist/nlp/command-parser.d.ts.map +1 -0
  191. package/dist/nlp/command-parser.js +417 -0
  192. package/dist/nlp/command-parser.js.map +1 -0
  193. package/dist/nlp/index.d.ts +5 -0
  194. package/dist/nlp/index.d.ts.map +1 -0
  195. package/dist/nlp/index.js +8 -0
  196. package/dist/nlp/index.js.map +1 -0
  197. package/dist/nlp/intent-classifier.d.ts +59 -0
  198. package/dist/nlp/intent-classifier.d.ts.map +1 -0
  199. package/dist/nlp/intent-classifier.js +384 -0
  200. package/dist/nlp/intent-classifier.js.map +1 -0
  201. package/dist/nlp/intent-parser.d.ts +152 -0
  202. package/dist/nlp/intent-parser.d.ts.map +1 -0
  203. package/dist/nlp/intent-parser.js +746 -0
  204. package/dist/nlp/intent-parser.js.map +1 -0
  205. package/dist/plugins/plugin-manager.d.ts +121 -0
  206. package/dist/plugins/plugin-manager.d.ts.map +1 -0
  207. package/dist/plugins/plugin-manager.js +606 -0
  208. package/dist/plugins/plugin-manager.js.map +1 -0
  209. package/dist/types/index.d.ts +224 -0
  210. package/dist/types/index.d.ts.map +1 -0
  211. package/dist/types/index.js +3 -0
  212. package/dist/types/index.js.map +1 -0
  213. package/dist/utils/backup-rollback-manager.d.ts +72 -0
  214. package/dist/utils/backup-rollback-manager.d.ts.map +1 -0
  215. package/dist/utils/backup-rollback-manager.js +288 -0
  216. package/dist/utils/backup-rollback-manager.js.map +1 -0
  217. package/dist/utils/claude-config-installer.d.ts +98 -0
  218. package/dist/utils/claude-config-installer.d.ts.map +1 -0
  219. package/dist/utils/claude-config-installer.js +678 -0
  220. package/dist/utils/claude-config-installer.js.map +1 -0
  221. package/dist/utils/config-manager.d.ts +73 -0
  222. package/dist/utils/config-manager.d.ts.map +1 -0
  223. package/dist/utils/config-manager.js +339 -0
  224. package/dist/utils/config-manager.js.map +1 -0
  225. package/dist/utils/error-handler.d.ts +46 -0
  226. package/dist/utils/error-handler.d.ts.map +1 -0
  227. package/dist/utils/error-handler.js +169 -0
  228. package/dist/utils/error-handler.js.map +1 -0
  229. package/dist/utils/logger.d.ts +25 -0
  230. package/dist/utils/logger.d.ts.map +1 -0
  231. package/dist/utils/logger.js +105 -0
  232. package/dist/utils/logger.js.map +1 -0
  233. package/package.json +6 -6
@@ -0,0 +1,678 @@
1
+ "use strict";
2
+ /**
3
+ * Claude Code Configuration Installer
4
+ * Handles installation of CLAUDE.md, hooks, conventions, and agent templates
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ClaudeConfigInstaller = void 0;
8
+ const tslib_1 = require("tslib");
9
+ const fs_1 = require("fs");
10
+ const fs = tslib_1.__importStar(require("fs/promises"));
11
+ const path = tslib_1.__importStar(require("path"));
12
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
13
+ const ora_1 = tslib_1.__importDefault(require("ora"));
14
+ const backup_rollback_manager_1 = require("./backup-rollback-manager");
15
+ const logger_1 = require("./logger");
16
+ class ClaudeConfigInstaller {
17
+ claudeDir;
18
+ sourceDir;
19
+ backupManager;
20
+ homeDir;
21
+ constructor(options = {}) {
22
+ this.homeDir = process.env.HOME || process.env.USERPROFILE || '';
23
+ this.claudeDir = options.claudeDir || path.join(this.homeDir, '.claude');
24
+ this.sourceDir = options.sourceDir || process.cwd();
25
+ this.backupManager = new backup_rollback_manager_1.BackupRollbackManager();
26
+ }
27
+ /**
28
+ * Initialize installer
29
+ */
30
+ async initialize() {
31
+ await this.backupManager.initialize();
32
+ // Create Claude directory structure
33
+ await this.createDirectoryStructure();
34
+ }
35
+ /**
36
+ * Install all Claude Code configurations
37
+ */
38
+ async install(options = {}) {
39
+ const { dryRun = false, skipBackup = false, overwrite = false, verbose = false, } = options;
40
+ const result = {
41
+ success: false,
42
+ installed: [],
43
+ skipped: [],
44
+ errors: [],
45
+ };
46
+ try {
47
+ console.log(chalk_1.default.cyan('\nšŸ”§ Installing Claude Code Configuration\n'));
48
+ // Create backup of existing configs
49
+ if (!skipBackup && !dryRun) {
50
+ const existingFiles = await this.getExistingConfigFiles();
51
+ if (existingFiles.length > 0) {
52
+ const spinner = (0, ora_1.default)('Creating backup of existing configurations...').start();
53
+ const backup = await this.backupManager.createBackup(existingFiles, 'Pre-installation backup');
54
+ result.backupId = backup.backupId;
55
+ spinner.succeed(`Backup created: ${backup.backupId}`);
56
+ }
57
+ }
58
+ // Install CLAUDE.md
59
+ await this.installClaudeMd(result, { dryRun, overwrite, verbose });
60
+ // Install hooks
61
+ await this.installHooks(result, { dryRun, overwrite, verbose });
62
+ // Install conventions
63
+ await this.installConventions(result, { dryRun, overwrite, verbose });
64
+ // Install agent templates
65
+ await this.installAgentTemplates(result, { dryRun, overwrite, verbose });
66
+ // Install git-worktree workflows
67
+ await this.installGitWorktreeWorkflows(result, {
68
+ dryRun,
69
+ overwrite,
70
+ verbose,
71
+ });
72
+ // Install validation scripts
73
+ await this.installValidationScripts(result, {
74
+ dryRun,
75
+ overwrite,
76
+ verbose,
77
+ });
78
+ result.success = result.errors.length === 0;
79
+ // Display summary
80
+ this.displayInstallSummary(result, dryRun);
81
+ return result;
82
+ }
83
+ catch (error) {
84
+ logger_1.logger.error('Installation failed', error);
85
+ result.errors.push({
86
+ file: 'general',
87
+ error: error instanceof Error ? error.message : String(error),
88
+ });
89
+ return result;
90
+ }
91
+ }
92
+ /**
93
+ * Install enhanced CLAUDE.md to ~/.claude/
94
+ */
95
+ async installClaudeMd(result, options) {
96
+ const spinner = (0, ora_1.default)('Installing CLAUDE.md...').start();
97
+ try {
98
+ const sourcePath = path.join(this.sourceDir, 'CLAUDE.md');
99
+ const targetPath = path.join(this.claudeDir, 'CLAUDE.md');
100
+ if (!(0, fs_1.existsSync)(sourcePath)) {
101
+ spinner.warn('CLAUDE.md not found in source directory');
102
+ result.skipped.push('CLAUDE.md');
103
+ return;
104
+ }
105
+ if ((0, fs_1.existsSync)(targetPath) && !options.overwrite) {
106
+ if (options.verbose) {
107
+ spinner.info('CLAUDE.md already exists (use --overwrite to replace)');
108
+ }
109
+ result.skipped.push('CLAUDE.md');
110
+ return;
111
+ }
112
+ if (options.dryRun) {
113
+ spinner.info('Would install CLAUDE.md');
114
+ result.installed.push('CLAUDE.md (dry-run)');
115
+ return;
116
+ }
117
+ await fs.copyFile(sourcePath, targetPath);
118
+ spinner.succeed('CLAUDE.md installed');
119
+ result.installed.push('CLAUDE.md');
120
+ logger_1.logger.info('CLAUDE.md installed', { target: targetPath });
121
+ }
122
+ catch (error) {
123
+ spinner.fail('Failed to install CLAUDE.md');
124
+ result.errors.push({
125
+ file: 'CLAUDE.md',
126
+ error: error instanceof Error ? error.message : String(error),
127
+ });
128
+ logger_1.logger.error('CLAUDE.md installation failed', error);
129
+ }
130
+ }
131
+ /**
132
+ * Install hooks configuration
133
+ */
134
+ async installHooks(result, options) {
135
+ const spinner = (0, ora_1.default)('Installing hooks...').start();
136
+ try {
137
+ const hooksDir = path.join(this.claudeDir, 'hooks');
138
+ await fs.mkdir(hooksDir, { recursive: true });
139
+ const hooks = this.generateHooksConfig();
140
+ for (const [hookName, hookContent] of Object.entries(hooks)) {
141
+ const hookPath = path.join(hooksDir, hookName);
142
+ if ((0, fs_1.existsSync)(hookPath) && !options.overwrite) {
143
+ result.skipped.push(`hooks/${hookName}`);
144
+ continue;
145
+ }
146
+ if (options.dryRun) {
147
+ result.installed.push(`hooks/${hookName} (dry-run)`);
148
+ continue;
149
+ }
150
+ await fs.writeFile(hookPath, hookContent);
151
+ await fs.chmod(hookPath, 0o755); // Make executable
152
+ result.installed.push(`hooks/${hookName}`);
153
+ }
154
+ spinner.succeed(`Hooks installed (${Object.keys(hooks).length} files)`);
155
+ logger_1.logger.info('Hooks installed', { count: Object.keys(hooks).length });
156
+ }
157
+ catch (error) {
158
+ spinner.fail('Failed to install hooks');
159
+ result.errors.push({
160
+ file: 'hooks',
161
+ error: error instanceof Error ? error.message : String(error),
162
+ });
163
+ logger_1.logger.error('Hooks installation failed', error);
164
+ }
165
+ }
166
+ /**
167
+ * Install conventions
168
+ */
169
+ async installConventions(result, options) {
170
+ const spinner = (0, ora_1.default)('Installing conventions...').start();
171
+ try {
172
+ const conventionsPath = path.join(this.claudeDir, 'conventions.json');
173
+ const conventions = this.generateConventions();
174
+ if ((0, fs_1.existsSync)(conventionsPath) && !options.overwrite) {
175
+ spinner.info('Conventions already exist');
176
+ result.skipped.push('conventions.json');
177
+ return;
178
+ }
179
+ if (options.dryRun) {
180
+ spinner.info('Would install conventions');
181
+ result.installed.push('conventions.json (dry-run)');
182
+ return;
183
+ }
184
+ await fs.writeFile(conventionsPath, JSON.stringify(conventions, null, 2));
185
+ spinner.succeed('Conventions installed');
186
+ result.installed.push('conventions.json');
187
+ logger_1.logger.info('Conventions installed', { path: conventionsPath });
188
+ }
189
+ catch (error) {
190
+ spinner.fail('Failed to install conventions');
191
+ result.errors.push({
192
+ file: 'conventions.json',
193
+ error: error instanceof Error ? error.message : String(error),
194
+ });
195
+ logger_1.logger.error('Conventions installation failed', error);
196
+ }
197
+ }
198
+ /**
199
+ * Install agent templates
200
+ */
201
+ async installAgentTemplates(result, options) {
202
+ const spinner = (0, ora_1.default)('Installing agent templates...').start();
203
+ try {
204
+ const agentsDir = path.join(this.claudeDir, 'agents');
205
+ await fs.mkdir(agentsDir, { recursive: true });
206
+ const templates = this.generateAgentTemplates();
207
+ for (const [agentName, agentConfig] of Object.entries(templates)) {
208
+ // Generate .md files with proper YAML frontmatter (not .json)
209
+ const agentPath = path.join(agentsDir, `${agentName}.md`);
210
+ if ((0, fs_1.existsSync)(agentPath) && !options.overwrite) {
211
+ result.skipped.push(`agents/${agentName}.md`);
212
+ continue;
213
+ }
214
+ if (options.dryRun) {
215
+ result.installed.push(`agents/${agentName}.md (dry-run)`);
216
+ continue;
217
+ }
218
+ // Generate markdown with YAML frontmatter
219
+ const mdContent = this.generateAgentMarkdownContent(agentName, agentConfig);
220
+ await fs.writeFile(agentPath, mdContent);
221
+ result.installed.push(`agents/${agentName}.md`);
222
+ }
223
+ spinner.succeed(`Agent templates installed (${Object.keys(templates).length} templates)`);
224
+ logger_1.logger.info('Agent templates installed', {
225
+ count: Object.keys(templates).length,
226
+ });
227
+ }
228
+ catch (error) {
229
+ spinner.fail('Failed to install agent templates');
230
+ result.errors.push({
231
+ file: 'agent-templates',
232
+ error: error instanceof Error ? error.message : String(error),
233
+ });
234
+ logger_1.logger.error('Agent templates installation failed', error);
235
+ }
236
+ }
237
+ /**
238
+ * Generate markdown content with proper YAML frontmatter for agent files
239
+ */
240
+ generateAgentMarkdownContent(agentName, config) {
241
+ const firstResponsibility = config.responsibilities[0] ?? 'software development';
242
+ const description = `${config.name} specialist for ${firstResponsibility.toLowerCase()}.`;
243
+ const toolsList = 'Read, Write, Edit, Bash, Glob, Grep';
244
+ const useFor = config.responsibilities.slice(0, 2).join(', ').toLowerCase() ||
245
+ 'development tasks';
246
+ return `---
247
+ name: ${agentName}
248
+ description: >
249
+ ${description}
250
+ Use for ${useFor}.
251
+ tools: ${toolsList}
252
+ model: sonnet
253
+ ---
254
+
255
+ # ${config.name}
256
+
257
+ ## Role
258
+ ${config.role}
259
+
260
+ ## Responsibilities
261
+ ${config.responsibilities.map(r => `- ${r}`).join('\n')}
262
+
263
+ ## Tools & Technologies
264
+ ${config.tools.map(t => `- ${t}`).join('\n')}
265
+
266
+ ## Patterns
267
+ ${config.patterns.map(p => `- ${p}`).join('\n')}
268
+ `;
269
+ }
270
+ /**
271
+ * Install git-worktree workflows
272
+ */
273
+ async installGitWorktreeWorkflows(result, options) {
274
+ const spinner = (0, ora_1.default)('Installing git-worktree workflows...').start();
275
+ try {
276
+ const workflowsDir = path.join(this.claudeDir, 'workflows');
277
+ await fs.mkdir(workflowsDir, { recursive: true });
278
+ const workflows = this.generateGitWorktreeWorkflows();
279
+ for (const [workflowName, workflowContent] of Object.entries(workflows)) {
280
+ const workflowPath = path.join(workflowsDir, `${workflowName}.json`);
281
+ if ((0, fs_1.existsSync)(workflowPath) && !options.overwrite) {
282
+ result.skipped.push(`workflows/${workflowName}.json`);
283
+ continue;
284
+ }
285
+ if (options.dryRun) {
286
+ result.installed.push(`workflows/${workflowName}.json (dry-run)`);
287
+ continue;
288
+ }
289
+ await fs.writeFile(workflowPath, JSON.stringify(workflowContent, null, 2));
290
+ result.installed.push(`workflows/${workflowName}.json`);
291
+ }
292
+ spinner.succeed(`Git-worktree workflows installed (${Object.keys(workflows).length} workflows)`);
293
+ logger_1.logger.info('Git-worktree workflows installed', {
294
+ count: Object.keys(workflows).length,
295
+ });
296
+ }
297
+ catch (error) {
298
+ spinner.fail('Failed to install git-worktree workflows');
299
+ result.errors.push({
300
+ file: 'git-worktree-workflows',
301
+ error: error instanceof Error ? error.message : String(error),
302
+ });
303
+ logger_1.logger.error('Git-worktree workflows installation failed', error);
304
+ }
305
+ }
306
+ /**
307
+ * Install validation scripts
308
+ */
309
+ async installValidationScripts(result, options) {
310
+ const spinner = (0, ora_1.default)('Installing validation scripts...').start();
311
+ try {
312
+ const scriptsDir = path.join(this.claudeDir, 'scripts');
313
+ await fs.mkdir(scriptsDir, { recursive: true });
314
+ const scripts = this.generateValidationScripts();
315
+ for (const [scriptName, scriptContent] of Object.entries(scripts)) {
316
+ const scriptPath = path.join(scriptsDir, scriptName);
317
+ if ((0, fs_1.existsSync)(scriptPath) && !options.overwrite) {
318
+ result.skipped.push(`scripts/${scriptName}`);
319
+ continue;
320
+ }
321
+ if (options.dryRun) {
322
+ result.installed.push(`scripts/${scriptName} (dry-run)`);
323
+ continue;
324
+ }
325
+ await fs.writeFile(scriptPath, scriptContent);
326
+ await fs.chmod(scriptPath, 0o755); // Make executable
327
+ result.installed.push(`scripts/${scriptName}`);
328
+ }
329
+ spinner.succeed(`Validation scripts installed (${Object.keys(scripts).length} scripts)`);
330
+ logger_1.logger.info('Validation scripts installed', {
331
+ count: Object.keys(scripts).length,
332
+ });
333
+ }
334
+ catch (error) {
335
+ spinner.fail('Failed to install validation scripts');
336
+ result.errors.push({
337
+ file: 'validation-scripts',
338
+ error: error instanceof Error ? error.message : String(error),
339
+ });
340
+ logger_1.logger.error('Validation scripts installation failed', error);
341
+ }
342
+ }
343
+ /**
344
+ * Create directory structure
345
+ */
346
+ async createDirectoryStructure() {
347
+ const dirs = [
348
+ this.claudeDir,
349
+ path.join(this.claudeDir, 'hooks'),
350
+ path.join(this.claudeDir, 'agents'),
351
+ path.join(this.claudeDir, 'workflows'),
352
+ path.join(this.claudeDir, 'scripts'),
353
+ path.join(this.claudeDir, 'templates'),
354
+ ];
355
+ for (const dir of dirs) {
356
+ await fs.mkdir(dir, { recursive: true });
357
+ }
358
+ }
359
+ /**
360
+ * Get existing config files for backup
361
+ */
362
+ async getExistingConfigFiles() {
363
+ const files = [];
364
+ const checkFiles = [
365
+ path.join(this.claudeDir, 'CLAUDE.md'),
366
+ path.join(this.claudeDir, 'conventions.json'),
367
+ ];
368
+ for (const file of checkFiles) {
369
+ if ((0, fs_1.existsSync)(file)) {
370
+ files.push(file);
371
+ }
372
+ }
373
+ return files;
374
+ }
375
+ /**
376
+ * Generate hooks configuration files
377
+ */
378
+ generateHooksConfig() {
379
+ return {
380
+ 'pre-commit': `#!/bin/bash
381
+ # Claude Code pre-commit hook
382
+ # Auto-generated by Wundr computer-setup
383
+
384
+ echo "šŸ” Running pre-commit checks..."
385
+
386
+ # Run linting
387
+ if command -v npm &> /dev/null; then
388
+ npm run lint --if-present || true
389
+ fi
390
+
391
+ # Run type checking
392
+ if command -v npm &> /dev/null; then
393
+ npm run typecheck --if-present || true
394
+ fi
395
+
396
+ echo "āœ… Pre-commit checks completed"
397
+ `,
398
+ 'post-checkout': `#!/bin/bash
399
+ # Claude Code post-checkout hook
400
+ # Auto-generated by Wundr computer-setup
401
+
402
+ echo "šŸ”„ Post-checkout: Installing dependencies..."
403
+
404
+ # Install dependencies if package.json changed
405
+ if command -v npm &> /dev/null; then
406
+ npm install --if-present || true
407
+ fi
408
+
409
+ echo "āœ… Post-checkout completed"
410
+ `,
411
+ };
412
+ }
413
+ /**
414
+ * Generate conventions configuration
415
+ */
416
+ generateConventions() {
417
+ return {
418
+ fileNaming: {
419
+ components: 'PascalCase',
420
+ utilities: 'camelCase',
421
+ constants: 'UPPER_SNAKE_CASE',
422
+ types: 'PascalCase',
423
+ },
424
+ codeStyle: {
425
+ indentation: 2,
426
+ quotes: 'single',
427
+ semicolons: true,
428
+ trailingComma: 'es5',
429
+ },
430
+ imports: {
431
+ order: ['external', 'internal', 'parent', 'sibling', 'index'],
432
+ grouping: true,
433
+ },
434
+ testing: {
435
+ framework: 'jest',
436
+ coverage: {
437
+ statements: 80,
438
+ branches: 80,
439
+ functions: 80,
440
+ lines: 80,
441
+ },
442
+ },
443
+ git: {
444
+ commitMessage: 'conventional-commits',
445
+ branchNaming: 'feature/*, fix/*, chore/*',
446
+ },
447
+ };
448
+ }
449
+ /**
450
+ * Generate agent templates
451
+ */
452
+ generateAgentTemplates() {
453
+ return {
454
+ 'backend-developer': {
455
+ name: 'Backend Developer',
456
+ role: 'backend-dev',
457
+ responsibilities: [
458
+ 'Design RESTful and GraphQL APIs',
459
+ 'Implement database models and queries',
460
+ 'Create authentication and authorization',
461
+ 'Write comprehensive API documentation',
462
+ ],
463
+ tools: ['node', 'typescript', 'postgresql', 'redis'],
464
+ patterns: [
465
+ 'Controller-Service-Repository',
466
+ 'DTO pattern',
467
+ 'Middleware pattern',
468
+ ],
469
+ },
470
+ 'frontend-developer': {
471
+ name: 'Frontend Developer',
472
+ role: 'frontend-dev',
473
+ responsibilities: [
474
+ 'Build responsive user interfaces',
475
+ 'Implement state management',
476
+ 'Create reusable components',
477
+ 'Optimize performance',
478
+ ],
479
+ tools: ['react', 'typescript', 'tailwind', 'vite'],
480
+ patterns: ['Component composition', 'Custom hooks', 'Context API'],
481
+ },
482
+ 'fullstack-developer': {
483
+ name: 'Fullstack Developer',
484
+ role: 'fullstack-dev',
485
+ responsibilities: [
486
+ 'Develop end-to-end features',
487
+ 'Integrate frontend and backend',
488
+ 'Manage database schemas',
489
+ 'Deploy applications',
490
+ ],
491
+ tools: ['node', 'react', 'typescript', 'docker'],
492
+ patterns: ['Full-stack architecture', 'API integration', 'CI/CD'],
493
+ },
494
+ };
495
+ }
496
+ /**
497
+ * Generate git-worktree workflows
498
+ */
499
+ generateGitWorktreeWorkflows() {
500
+ return {
501
+ 'feature-development': {
502
+ name: 'Feature Development Workflow',
503
+ description: 'Workflow for developing new features in isolation',
504
+ steps: [
505
+ {
506
+ name: 'Create worktree',
507
+ command: 'git worktree add ../feature-name feature/name',
508
+ },
509
+ {
510
+ name: 'Setup environment',
511
+ command: 'cd ../feature-name && npm install',
512
+ },
513
+ {
514
+ name: 'Run tests',
515
+ command: 'npm test',
516
+ },
517
+ {
518
+ name: 'Commit changes',
519
+ command: 'git add . && git commit -m "feat: description"',
520
+ },
521
+ ],
522
+ },
523
+ 'bug-fix': {
524
+ name: 'Bug Fix Workflow',
525
+ description: 'Workflow for fixing bugs without affecting main development',
526
+ steps: [
527
+ {
528
+ name: 'Create worktree',
529
+ command: 'git worktree add ../fix-bug fix/bug-name',
530
+ },
531
+ {
532
+ name: 'Reproduce bug',
533
+ command: 'npm test -- bug.test.ts',
534
+ },
535
+ {
536
+ name: 'Fix and verify',
537
+ command: 'npm test',
538
+ },
539
+ {
540
+ name: 'Commit fix',
541
+ command: 'git add . && git commit -m "fix: description"',
542
+ },
543
+ ],
544
+ },
545
+ };
546
+ }
547
+ /**
548
+ * Generate validation scripts
549
+ */
550
+ generateValidationScripts() {
551
+ return {
552
+ 'validate-setup.sh': `#!/bin/bash
553
+ # Validate Claude Code setup
554
+ # Auto-generated by Wundr computer-setup
555
+
556
+ echo "šŸ” Validating Claude Code setup..."
557
+
558
+ # Check for required files
559
+ FILES=(
560
+ "$HOME/.claude/CLAUDE.md"
561
+ "$HOME/.claude/conventions.json"
562
+ )
563
+
564
+ MISSING=0
565
+ for file in "\${FILES[@]}"; do
566
+ if [ ! -f "$file" ]; then
567
+ echo "āŒ Missing: $file"
568
+ MISSING=$((MISSING + 1))
569
+ else
570
+ echo "āœ… Found: $file"
571
+ fi
572
+ done
573
+
574
+ # Check for required directories
575
+ DIRS=(
576
+ "$HOME/.claude/hooks"
577
+ "$HOME/.claude/agents"
578
+ "$HOME/.claude/workflows"
579
+ )
580
+
581
+ for dir in "\${DIRS[@]}"; do
582
+ if [ ! -d "$dir" ]; then
583
+ echo "āŒ Missing directory: $dir"
584
+ MISSING=$((MISSING + 1))
585
+ else
586
+ echo "āœ… Found directory: $dir"
587
+ fi
588
+ done
589
+
590
+ if [ $MISSING -eq 0 ]; then
591
+ echo "āœ… All validations passed!"
592
+ exit 0
593
+ else
594
+ echo "āŒ $MISSING validation(s) failed"
595
+ exit 1
596
+ fi
597
+ `,
598
+ 'check-config.sh': `#!/bin/bash
599
+ # Check Claude Code configuration
600
+ # Auto-generated by Wundr computer-setup
601
+
602
+ echo "šŸ”§ Checking Claude Code configuration..."
603
+
604
+ # Check Claude CLI
605
+ if command -v claude &> /dev/null; then
606
+ echo "āœ… Claude CLI: $(claude --version)"
607
+ else
608
+ echo "āš ļø Claude CLI not found"
609
+ fi
610
+
611
+ # Check Node.js
612
+ if command -v node &> /dev/null; then
613
+ echo "āœ… Node.js: $(node --version)"
614
+ else
615
+ echo "āŒ Node.js not found"
616
+ fi
617
+
618
+ # Check Git
619
+ if command -v git &> /dev/null; then
620
+ echo "āœ… Git: $(git --version)"
621
+ else
622
+ echo "āŒ Git not found"
623
+ fi
624
+
625
+ echo "āœ… Configuration check complete"
626
+ `,
627
+ };
628
+ }
629
+ /**
630
+ * Display installation summary
631
+ */
632
+ displayInstallSummary(result, dryRun) {
633
+ console.log(chalk_1.default.cyan('\nšŸ“Š Installation Summary\n'));
634
+ if (dryRun) {
635
+ console.log(chalk_1.default.yellow('šŸ” DRY RUN MODE - No files were modified\n'));
636
+ }
637
+ if (result.backupId) {
638
+ console.log(chalk_1.default.gray(`Backup ID: ${result.backupId}\n`));
639
+ }
640
+ if (result.installed.length > 0) {
641
+ console.log(chalk_1.default.green(`āœ… Installed (${result.installed.length}):`));
642
+ result.installed.forEach(file => {
643
+ console.log(chalk_1.default.white(` • ${file}`));
644
+ });
645
+ console.log();
646
+ }
647
+ if (result.skipped.length > 0) {
648
+ console.log(chalk_1.default.yellow(`ā­ļø Skipped (${result.skipped.length}):`));
649
+ result.skipped.forEach(file => {
650
+ console.log(chalk_1.default.gray(` • ${file}`));
651
+ });
652
+ console.log();
653
+ }
654
+ if (result.errors.length > 0) {
655
+ console.log(chalk_1.default.red(`āŒ Errors (${result.errors.length}):`));
656
+ result.errors.forEach(error => {
657
+ console.log(chalk_1.default.red(` • ${error.file}: ${error.error}`));
658
+ });
659
+ console.log();
660
+ }
661
+ if (result.success) {
662
+ console.log(chalk_1.default.green('āœ… Installation completed successfully!\n'));
663
+ console.log(chalk_1.default.cyan('Next steps:'));
664
+ console.log(chalk_1.default.white(' 1. Review installed configurations'));
665
+ console.log(chalk_1.default.white(' 2. Run validation: ~/.claude/scripts/validate-setup.sh'));
666
+ console.log(chalk_1.default.white(' 3. Customize agent templates as needed'));
667
+ }
668
+ else {
669
+ console.log(chalk_1.default.red('āŒ Installation completed with errors\n'));
670
+ if (result.backupId) {
671
+ console.log(chalk_1.default.cyan('To rollback:'));
672
+ console.log(chalk_1.default.white(` wundr computer-setup rollback --backup ${result.backupId}`));
673
+ }
674
+ }
675
+ }
676
+ }
677
+ exports.ClaudeConfigInstaller = ClaudeConfigInstaller;
678
+ //# sourceMappingURL=claude-config-installer.js.map