@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,685 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PluginCommands = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const path_1 = tslib_1.__importDefault(require("path"));
6
+ const chalk_1 = tslib_1.__importDefault(require("chalk"));
7
+ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
8
+ const error_handler_1 = require("../utils/error-handler");
9
+ const logger_1 = require("../utils/logger");
10
+ /**
11
+ * Plugin commands for managing CLI extensions
12
+ */
13
+ class PluginCommands {
14
+ program;
15
+ configManager;
16
+ pluginManager;
17
+ constructor(program, configManager, pluginManager) {
18
+ this.program = program;
19
+ this.configManager = configManager;
20
+ this.pluginManager = pluginManager;
21
+ this.registerCommands();
22
+ }
23
+ registerCommands() {
24
+ const pluginCmd = this.program
25
+ .command('plugin')
26
+ .alias('plugins')
27
+ .description('manage CLI plugins and extensions');
28
+ // List plugins
29
+ pluginCmd
30
+ .command('list')
31
+ .alias('ls')
32
+ .description('list installed plugins')
33
+ .option('--available', 'show available plugins from registry')
34
+ .option('--enabled-only', 'show only enabled plugins')
35
+ .action(async (options) => {
36
+ await this.listPlugins(options);
37
+ });
38
+ // Install plugin
39
+ pluginCmd
40
+ .command('install <plugin>')
41
+ .description('install a plugin')
42
+ .option('--version <version>', 'specific version to install')
43
+ .option('--registry <url>', 'custom registry URL')
44
+ .option('--force', 'force reinstall if already exists')
45
+ .action(async (plugin, options) => {
46
+ await this.installPlugin(plugin, options);
47
+ });
48
+ // Uninstall plugin
49
+ pluginCmd
50
+ .command('uninstall <plugin>')
51
+ .alias('remove')
52
+ .description('uninstall a plugin')
53
+ .option('--force', 'skip confirmation')
54
+ .action(async (plugin, options) => {
55
+ await this.uninstallPlugin(plugin, options);
56
+ });
57
+ // Enable plugin
58
+ pluginCmd
59
+ .command('enable <plugin>')
60
+ .description('enable a plugin')
61
+ .action(async (plugin) => {
62
+ await this.enablePlugin(plugin);
63
+ });
64
+ // Disable plugin
65
+ pluginCmd
66
+ .command('disable <plugin>')
67
+ .description('disable a plugin')
68
+ .action(async (plugin) => {
69
+ await this.disablePlugin(plugin);
70
+ });
71
+ // Plugin info
72
+ pluginCmd
73
+ .command('info <plugin>')
74
+ .description('show plugin information')
75
+ .action(async (plugin) => {
76
+ await this.showPluginInfo(plugin);
77
+ });
78
+ // Update plugins
79
+ pluginCmd
80
+ .command('update [plugin]')
81
+ .description('update plugin(s)')
82
+ .option('--all', 'update all plugins')
83
+ .action(async (plugin, options) => {
84
+ await this.updatePlugin(plugin, options);
85
+ });
86
+ // Create plugin
87
+ pluginCmd
88
+ .command('create <name>')
89
+ .description('create a new plugin')
90
+ .option('--template <template>', 'plugin template', 'basic')
91
+ .option('--interactive', 'create plugin interactively')
92
+ .action(async (name, options) => {
93
+ await this.createPlugin(name, options);
94
+ });
95
+ // Publish plugin
96
+ pluginCmd
97
+ .command('publish')
98
+ .description('publish plugin to registry')
99
+ .option('--registry <url>', 'registry URL')
100
+ .option('--dry-run', 'show what would be published')
101
+ .action(async (options) => {
102
+ await this.publishPlugin(options);
103
+ });
104
+ // Search plugins
105
+ pluginCmd
106
+ .command('search <query>')
107
+ .description('search for plugins')
108
+ .option('--registry <url>', 'registry URL')
109
+ .option('--limit <count>', 'limit results', '20')
110
+ .action(async (query, options) => {
111
+ await this.searchPlugins(query, options);
112
+ });
113
+ // Plugin development
114
+ pluginCmd.command('dev').description('plugin development tools');
115
+ pluginCmd
116
+ .command('dev link <path>')
117
+ .description('link local plugin for development')
118
+ .action(async (pluginPath) => {
119
+ await this.linkPlugin(pluginPath);
120
+ });
121
+ pluginCmd
122
+ .command('dev unlink <plugin>')
123
+ .description('unlink development plugin')
124
+ .action(async (plugin) => {
125
+ await this.unlinkPlugin(plugin);
126
+ });
127
+ pluginCmd
128
+ .command('dev test <plugin>')
129
+ .description('test a plugin')
130
+ .option('--coverage', 'run with coverage')
131
+ .action(async (plugin, options) => {
132
+ await this.testPlugin(plugin, options);
133
+ });
134
+ // Plugin configuration
135
+ pluginCmd
136
+ .command('config <plugin>')
137
+ .description('configure plugin settings');
138
+ pluginCmd
139
+ .command('config <plugin> set <key> <value>')
140
+ .description('set plugin configuration')
141
+ .action(async (plugin, key, value) => {
142
+ await this.setPluginConfig(plugin, key, value);
143
+ });
144
+ pluginCmd
145
+ .command('config <plugin> get [key]')
146
+ .description('get plugin configuration')
147
+ .action(async (plugin, key) => {
148
+ await this.getPluginConfig(plugin, key);
149
+ });
150
+ }
151
+ /**
152
+ * List installed plugins
153
+ */
154
+ async listPlugins(options) {
155
+ try {
156
+ if (options.available) {
157
+ await this.listAvailablePlugins();
158
+ }
159
+ else {
160
+ await this.listInstalledPlugins(options.enabledOnly);
161
+ }
162
+ }
163
+ catch (error) {
164
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_LIST_FAILED', 'Failed to list plugins', { options }, true);
165
+ }
166
+ }
167
+ /**
168
+ * Install a plugin
169
+ */
170
+ async installPlugin(plugin, options) {
171
+ try {
172
+ logger_1.logger.info(`Installing plugin: ${chalk_1.default.cyan(plugin)}`);
173
+ // Check if plugin already exists
174
+ if (!options.force &&
175
+ (await this.pluginManager.isPluginInstalled(plugin))) {
176
+ logger_1.logger.warn(`Plugin ${plugin} is already installed. Use --force to reinstall.`);
177
+ return;
178
+ }
179
+ await this.pluginManager.installPlugin(plugin, {
180
+ version: options.version,
181
+ registry: options.registry,
182
+ force: options.force,
183
+ });
184
+ logger_1.logger.success(`Plugin ${plugin} installed successfully`);
185
+ }
186
+ catch (error) {
187
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_INSTALL_FAILED', 'Failed to install plugin', { plugin, options }, true);
188
+ }
189
+ }
190
+ /**
191
+ * Uninstall a plugin
192
+ */
193
+ async uninstallPlugin(plugin, options) {
194
+ try {
195
+ if (!(await this.pluginManager.isPluginInstalled(plugin))) {
196
+ logger_1.logger.warn(`Plugin ${plugin} is not installed`);
197
+ return;
198
+ }
199
+ if (!options.force) {
200
+ const inquirer = await Promise.resolve().then(() => tslib_1.__importStar(require('inquirer')));
201
+ const { confirm } = await inquirer.default.prompt([
202
+ {
203
+ type: 'confirm',
204
+ name: 'confirm',
205
+ message: `Uninstall plugin ${plugin}?`,
206
+ default: false,
207
+ },
208
+ ]);
209
+ if (!confirm) {
210
+ logger_1.logger.info('Uninstall cancelled');
211
+ return;
212
+ }
213
+ }
214
+ await this.pluginManager.uninstallPlugin(plugin);
215
+ logger_1.logger.success(`Plugin ${plugin} uninstalled successfully`);
216
+ }
217
+ catch (error) {
218
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_UNINSTALL_FAILED', 'Failed to uninstall plugin', { plugin, options }, true);
219
+ }
220
+ }
221
+ /**
222
+ * Enable a plugin
223
+ */
224
+ async enablePlugin(plugin) {
225
+ try {
226
+ if (!(await this.pluginManager.isPluginInstalled(plugin))) {
227
+ throw new Error(`Plugin ${plugin} is not installed`);
228
+ }
229
+ await this.pluginManager.enablePlugin(plugin);
230
+ logger_1.logger.success(`Plugin ${plugin} enabled`);
231
+ }
232
+ catch (error) {
233
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_ENABLE_FAILED', 'Failed to enable plugin', { plugin }, true);
234
+ }
235
+ }
236
+ /**
237
+ * Disable a plugin
238
+ */
239
+ async disablePlugin(plugin) {
240
+ try {
241
+ if (!(await this.pluginManager.isPluginInstalled(plugin))) {
242
+ throw new Error(`Plugin ${plugin} is not installed`);
243
+ }
244
+ await this.pluginManager.disablePlugin(plugin);
245
+ logger_1.logger.success(`Plugin ${plugin} disabled`);
246
+ }
247
+ catch (error) {
248
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_DISABLE_FAILED', 'Failed to disable plugin', { plugin }, true);
249
+ }
250
+ }
251
+ /**
252
+ * Show plugin information
253
+ */
254
+ async showPluginInfo(plugin) {
255
+ try {
256
+ const pluginInfo = await this.pluginManager.getPluginInfo(plugin);
257
+ if (!pluginInfo) {
258
+ logger_1.logger.warn(`Plugin ${plugin} not found`);
259
+ return;
260
+ }
261
+ console.log(chalk_1.default.blue(`\nPlugin Information: ${plugin}`));
262
+ console.log(`Name: ${pluginInfo.name}`);
263
+ console.log(`Version: ${pluginInfo.version}`);
264
+ console.log(`Description: ${pluginInfo.description || 'No description'}`);
265
+ console.log(`Author: ${pluginInfo.author || 'Unknown'}`);
266
+ console.log(`Status: ${pluginInfo.enabled ? 'Enabled' : 'Disabled'}`);
267
+ console.log(`Commands: ${pluginInfo.commands?.length || 0}`);
268
+ console.log(`Hooks: ${pluginInfo.hooks?.length || 0}`);
269
+ if (pluginInfo.dependencies && pluginInfo.dependencies.length > 0) {
270
+ console.log(`Dependencies: ${pluginInfo.dependencies.join(', ')}`);
271
+ }
272
+ }
273
+ catch (error) {
274
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_INFO_FAILED', 'Failed to show plugin info', { plugin }, true);
275
+ }
276
+ }
277
+ /**
278
+ * Update plugin(s)
279
+ */
280
+ async updatePlugin(plugin, options) {
281
+ try {
282
+ if (options.all) {
283
+ logger_1.logger.info('Updating all plugins...');
284
+ await this.pluginManager.updateAllPlugins();
285
+ logger_1.logger.success('All plugins updated');
286
+ }
287
+ else if (plugin) {
288
+ logger_1.logger.info(`Updating plugin: ${chalk_1.default.cyan(plugin)}`);
289
+ await this.pluginManager.updatePlugin(plugin);
290
+ logger_1.logger.success(`Plugin ${plugin} updated`);
291
+ }
292
+ else {
293
+ throw new Error('Specify a plugin name or use --all');
294
+ }
295
+ }
296
+ catch (error) {
297
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_UPDATE_FAILED', 'Failed to update plugin(s)', { plugin, options }, true);
298
+ }
299
+ }
300
+ /**
301
+ * Create a new plugin
302
+ */
303
+ async createPlugin(name, options) {
304
+ try {
305
+ logger_1.logger.info(`Creating plugin: ${chalk_1.default.cyan(name)}`);
306
+ let pluginConfig;
307
+ if (options.interactive) {
308
+ pluginConfig = await this.createInteractivePlugin(name);
309
+ }
310
+ else {
311
+ pluginConfig = await this.createPluginFromTemplate(name, options.template);
312
+ }
313
+ const pluginPath = path_1.default.join(process.cwd(), name);
314
+ await this.generatePluginStructure(pluginPath, pluginConfig);
315
+ logger_1.logger.success(`Plugin ${name} created at ${pluginPath}`);
316
+ logger_1.logger.info('Next steps:');
317
+ logger_1.logger.info(` cd ${name}`);
318
+ logger_1.logger.info(' npm install');
319
+ logger_1.logger.info(' wundr plugin dev link .');
320
+ }
321
+ catch (error) {
322
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_CREATE_FAILED', 'Failed to create plugin', { name, options }, true);
323
+ }
324
+ }
325
+ /**
326
+ * Publish plugin to registry
327
+ */
328
+ async publishPlugin(options) {
329
+ try {
330
+ logger_1.logger.info('Publishing plugin...');
331
+ if (options.dryRun) {
332
+ logger_1.logger.info('Dry run - would publish:');
333
+ // Show what would be published
334
+ }
335
+ else {
336
+ await this.pluginManager.publishPlugin({
337
+ registry: options.registry,
338
+ });
339
+ logger_1.logger.success('Plugin published successfully');
340
+ }
341
+ }
342
+ catch (error) {
343
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_PUBLISH_FAILED', 'Failed to publish plugin', { options }, true);
344
+ }
345
+ }
346
+ /**
347
+ * Search for plugins
348
+ */
349
+ async searchPlugins(query, options) {
350
+ try {
351
+ logger_1.logger.info(`Searching for plugins: ${chalk_1.default.cyan(query)}`);
352
+ const results = await this.pluginManager.searchPlugins(query, {
353
+ registry: options.registry,
354
+ limit: parseInt(options.limit),
355
+ });
356
+ if (results.length === 0) {
357
+ logger_1.logger.info('No plugins found');
358
+ return;
359
+ }
360
+ console.log(`\nFound ${results.length} plugin(s):`);
361
+ console.table(results.map(plugin => ({
362
+ Name: plugin.name,
363
+ Version: plugin.version,
364
+ Description: plugin.description || 'No description',
365
+ Downloads: plugin.downloads || 0,
366
+ Updated: plugin.updated
367
+ ? new Date(plugin.updated).toLocaleDateString()
368
+ : 'Unknown',
369
+ })));
370
+ }
371
+ catch (error) {
372
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_SEARCH_FAILED', 'Failed to search plugins', { query, options }, true);
373
+ }
374
+ }
375
+ /**
376
+ * Link local plugin for development
377
+ */
378
+ async linkPlugin(pluginPath) {
379
+ try {
380
+ const absolutePath = path_1.default.resolve(pluginPath);
381
+ if (!(await fs_extra_1.default.pathExists(absolutePath))) {
382
+ throw new Error(`Plugin path does not exist: ${absolutePath}`);
383
+ }
384
+ await this.pluginManager.linkPlugin(absolutePath);
385
+ logger_1.logger.success(`Plugin linked: ${absolutePath}`);
386
+ }
387
+ catch (error) {
388
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_LINK_FAILED', 'Failed to link plugin', { pluginPath }, true);
389
+ }
390
+ }
391
+ /**
392
+ * Unlink development plugin
393
+ */
394
+ async unlinkPlugin(plugin) {
395
+ try {
396
+ await this.pluginManager.unlinkPlugin(plugin);
397
+ logger_1.logger.success(`Plugin unlinked: ${plugin}`);
398
+ }
399
+ catch (error) {
400
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_UNLINK_FAILED', 'Failed to unlink plugin', { plugin }, true);
401
+ }
402
+ }
403
+ /**
404
+ * Test a plugin
405
+ */
406
+ async testPlugin(plugin, options) {
407
+ try {
408
+ logger_1.logger.info(`Testing plugin: ${chalk_1.default.cyan(plugin)}`);
409
+ await this.pluginManager.testPlugin(plugin, {
410
+ coverage: options.coverage,
411
+ });
412
+ logger_1.logger.success(`Plugin ${plugin} tests passed`);
413
+ }
414
+ catch (error) {
415
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_TEST_FAILED', 'Failed to test plugin', { plugin, options }, true);
416
+ }
417
+ }
418
+ /**
419
+ * Set plugin configuration
420
+ */
421
+ async setPluginConfig(plugin, key, value) {
422
+ try {
423
+ await this.pluginManager.setPluginConfig(plugin, key, value);
424
+ logger_1.logger.success(`Plugin configuration updated: ${plugin}.${key} = ${value}`);
425
+ }
426
+ catch (error) {
427
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_CONFIG_SET_FAILED', 'Failed to set plugin configuration', { plugin, key, value }, true);
428
+ }
429
+ }
430
+ /**
431
+ * Get plugin configuration
432
+ */
433
+ async getPluginConfig(plugin, key) {
434
+ try {
435
+ if (key) {
436
+ const value = await this.pluginManager.getPluginConfig(plugin, key);
437
+ console.log(`${key}: ${value}`);
438
+ }
439
+ else {
440
+ const config = await this.pluginManager.getPluginConfig(plugin);
441
+ console.log(JSON.stringify(config, null, 2));
442
+ }
443
+ }
444
+ catch (error) {
445
+ throw error_handler_1.errorHandler.createError('WUNDR_PLUGIN_CONFIG_GET_FAILED', 'Failed to get plugin configuration', { plugin, key }, true);
446
+ }
447
+ }
448
+ /**
449
+ * Helper methods for plugin operations
450
+ */
451
+ async listInstalledPlugins(enabledOnly = false) {
452
+ const plugins = await this.pluginManager.getInstalledPlugins();
453
+ const filteredPlugins = enabledOnly
454
+ ? plugins.filter(p => p.enabled)
455
+ : plugins;
456
+ if (filteredPlugins.length === 0) {
457
+ logger_1.logger.info(enabledOnly ? 'No enabled plugins found' : 'No plugins installed');
458
+ return;
459
+ }
460
+ logger_1.logger.info(`${enabledOnly ? 'Enabled plugins' : 'Installed plugins'} (${filteredPlugins.length}):`);
461
+ const pluginData = filteredPlugins.map(plugin => ({
462
+ Name: plugin.name,
463
+ Version: plugin.version,
464
+ Status: plugin.enabled ? '✅ Enabled' : '❌ Disabled',
465
+ Commands: plugin.commands?.length || 0,
466
+ Description: plugin.description || 'No description',
467
+ }));
468
+ console.table(pluginData);
469
+ }
470
+ async listAvailablePlugins() {
471
+ const plugins = await this.pluginManager.getAvailablePlugins();
472
+ if (plugins.length === 0) {
473
+ logger_1.logger.info('No plugins available in registry');
474
+ return;
475
+ }
476
+ logger_1.logger.info(`Available plugins (${plugins.length}):`);
477
+ const pluginData = plugins.map(plugin => ({
478
+ Name: plugin.name,
479
+ Version: plugin.version,
480
+ Downloads: plugin.downloads || 0,
481
+ Updated: plugin.updated
482
+ ? new Date(plugin.updated).toLocaleDateString()
483
+ : 'Unknown',
484
+ Description: plugin.description || 'No description',
485
+ }));
486
+ console.table(pluginData);
487
+ }
488
+ async createInteractivePlugin(name) {
489
+ const inquirer = await Promise.resolve().then(() => tslib_1.__importStar(require('inquirer')));
490
+ return await inquirer.default.prompt([
491
+ {
492
+ type: 'input',
493
+ name: 'description',
494
+ message: 'Plugin description:',
495
+ },
496
+ {
497
+ type: 'input',
498
+ name: 'author',
499
+ message: 'Author name:',
500
+ },
501
+ {
502
+ type: 'input',
503
+ name: 'version',
504
+ message: 'Initial version:',
505
+ default: '1.0.0',
506
+ },
507
+ {
508
+ type: 'checkbox',
509
+ name: 'features',
510
+ message: 'Plugin features:',
511
+ choices: [
512
+ 'Commands',
513
+ 'Hooks',
514
+ 'Configuration',
515
+ 'Templates',
516
+ 'Middleware',
517
+ ],
518
+ },
519
+ ]);
520
+ }
521
+ async createPluginFromTemplate(name, template) {
522
+ const templates = {
523
+ basic: {
524
+ description: `A basic Wundr plugin: ${name}`,
525
+ features: ['Commands'],
526
+ },
527
+ advanced: {
528
+ description: `An advanced Wundr plugin: ${name}`,
529
+ features: ['Commands', 'Hooks', 'Configuration'],
530
+ },
531
+ template: {
532
+ description: `A template-based Wundr plugin: ${name}`,
533
+ features: ['Templates', 'Commands'],
534
+ },
535
+ };
536
+ return templates[template] || templates['basic'];
537
+ }
538
+ async generatePluginStructure(pluginPath, config) {
539
+ await fs_extra_1.default.ensureDir(pluginPath);
540
+ // Create package.json
541
+ const packageJson = {
542
+ name: path_1.default.basename(pluginPath),
543
+ version: config.version || '1.0.0',
544
+ description: config.description,
545
+ main: 'dist/index.js',
546
+ types: 'dist/index.d.ts',
547
+ files: ['dist'],
548
+ scripts: {
549
+ build: 'tsc',
550
+ dev: 'tsc --watch',
551
+ test: 'jest',
552
+ },
553
+ peerDependencies: {
554
+ '@wundr/cli': '^1.0.0',
555
+ },
556
+ devDependencies: {
557
+ typescript: '^5.0.0',
558
+ '@types/node': '^20.0.0',
559
+ jest: '^29.0.0',
560
+ },
561
+ wundr: {
562
+ plugin: true,
563
+ commands: config.features?.includes('Commands') || false,
564
+ hooks: config.features?.includes('Hooks') || false,
565
+ templates: config.features?.includes('Templates') || false,
566
+ },
567
+ };
568
+ await fs_extra_1.default.writeJson(path_1.default.join(pluginPath, 'package.json'), packageJson, {
569
+ spaces: 2,
570
+ });
571
+ // Create TypeScript config
572
+ const tsConfig = {
573
+ compilerOptions: {
574
+ target: 'ES2020',
575
+ module: 'CommonJS',
576
+ outDir: './dist',
577
+ rootDir: './src',
578
+ strict: true,
579
+ esModuleInterop: true,
580
+ skipLibCheck: true,
581
+ forceConsistentCasingInFileNames: true,
582
+ declaration: true,
583
+ declarationMap: true,
584
+ sourceMap: true,
585
+ },
586
+ include: ['src/**/*'],
587
+ exclude: ['node_modules', 'dist'],
588
+ };
589
+ await fs_extra_1.default.writeJson(path_1.default.join(pluginPath, 'tsconfig.json'), tsConfig, {
590
+ spaces: 2,
591
+ });
592
+ // Create source directory and files
593
+ const srcDir = path_1.default.join(pluginPath, 'src');
594
+ await fs_extra_1.default.ensureDir(srcDir);
595
+ // Create main plugin file
596
+ const pluginCode = this.generatePluginCode(path_1.default.basename(pluginPath), config);
597
+ await fs_extra_1.default.writeFile(path_1.default.join(srcDir, 'index.ts'), pluginCode);
598
+ // Create README
599
+ const readme = this.generatePluginReadme(path_1.default.basename(pluginPath), config);
600
+ await fs_extra_1.default.writeFile(path_1.default.join(pluginPath, 'README.md'), readme);
601
+ }
602
+ generatePluginCode(name, config) {
603
+ return `import { Plugin, PluginContext } from '@wundr/cli';
604
+
605
+ export default class ${this.toPascalCase(name)}Plugin implements Plugin {
606
+ name = '${name}';
607
+ version = '${config.version || '1.0.0'}';
608
+ description = '${config.description}';
609
+
610
+ async activate(context: PluginContext): Promise<void> {
611
+ // Plugin activation logic
612
+ context.logger.info('${name} plugin activated');
613
+
614
+ ${config.features?.includes('Commands') ? this.generateCommandCode(name) : ''}
615
+ ${config.features?.includes('Hooks') ? this.generateHookCode(name) : ''}
616
+ }
617
+
618
+ async deactivate(): Promise<void> {
619
+ // Plugin deactivation logic
620
+ }
621
+ }
622
+ `;
623
+ }
624
+ generateCommandCode(name) {
625
+ return `
626
+ // Register commands
627
+ context.registerCommand({
628
+ name: '${name}',
629
+ description: '${name} plugin command',
630
+ action: async (args, options, ctx) => {
631
+ ctx.logger.info('${name} command executed');
632
+ }
633
+ });
634
+ `;
635
+ }
636
+ generateHookCode(name) {
637
+ return `
638
+ // Register hooks
639
+ context.registerHook({
640
+ event: 'before-command',
641
+ handler: async (data, ctx) => {
642
+ ctx.logger.debug('${name} hook: before-command');
643
+ }
644
+ });
645
+ `;
646
+ }
647
+ generatePluginReadme(name, config) {
648
+ return `# ${name}
649
+
650
+ ${config.description}
651
+
652
+ ## Installation
653
+
654
+ \`\`\`bash
655
+ wundr plugin install ${name}
656
+ \`\`\`
657
+
658
+ ## Usage
659
+
660
+ \`\`\`bash
661
+ wundr ${name}
662
+ \`\`\`
663
+
664
+ ## Development
665
+
666
+ \`\`\`bash
667
+ npm install
668
+ npm run build
669
+ wundr plugin dev link .
670
+ \`\`\`
671
+
672
+ ## License
673
+
674
+ MIT
675
+ `;
676
+ }
677
+ toPascalCase(str) {
678
+ return str
679
+ .split(/[-_\s]/)
680
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
681
+ .join('');
682
+ }
683
+ }
684
+ exports.PluginCommands = PluginCommands;
685
+ //# sourceMappingURL=plugins.js.map