@devilsdev/rag-pipeline-utils 2.1.12 → 2.2.1

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 (113) hide show
  1. package/.ragrc.schema.json +218 -0
  2. package/README.md +178 -550
  3. package/bin/cli.js +8 -14
  4. package/contracts/reranker-contract.json +69 -0
  5. package/dist/index.d.ts +237 -0
  6. package/dist/index.mjs +22 -7
  7. package/package.json +18 -13
  8. package/src/ai/adaptive-retrieval.js +191 -0
  9. package/src/ai/federated-learning.js +214 -0
  10. package/src/ai/federation/federated-learning-coordinator.js +345 -0
  11. package/src/ai/federation.js +76 -0
  12. package/src/ai/index-fixed.js +509 -0
  13. package/src/ai/index.js +33 -0
  14. package/src/ai/model-trainer.js +217 -0
  15. package/src/ai/model-training.js +205 -0
  16. package/src/ai/module-template.js +37 -0
  17. package/src/ai/multimodal/multi-modal-processor.js +345 -0
  18. package/src/ai/multimodal-processing.js +268 -0
  19. package/src/ai/multimodal.js +71 -0
  20. package/src/ai/orchestrator.js +70 -0
  21. package/src/ai/retrieval/adaptive-retrieval-engine.js +398 -0
  22. package/src/ai/retrieval-engine.js +69 -0
  23. package/src/ai/training/model-training-orchestrator.js +228 -0
  24. package/src/ci/workflow-analyzer.js +71 -0
  25. package/src/cli/commands/ai-ml.js +967 -0
  26. package/src/cli/commands/docs.js +228 -0
  27. package/src/cli/commands/dx.js +538 -0
  28. package/src/cli/commands/plugin-hub.js +875 -0
  29. package/src/cli/doctor-command.js +639 -0
  30. package/src/cli/enhanced-cli-commands.js +945 -0
  31. package/src/cli/interactive-wizard.js +997 -0
  32. package/src/cli/plugin-marketplace-commands.js +869 -0
  33. package/src/cli.js +17 -0
  34. package/src/config/enhanced-ragrc-schema.js +632 -0
  35. package/src/config/load-config.js +54 -0
  36. package/src/config/load-plugin-config.js +69 -0
  37. package/src/config/normalize-config.js +105 -0
  38. package/src/config/schema-validator.js +315 -0
  39. package/src/config/validate-plugin-schema.js +35 -0
  40. package/src/config/validate-schema.js +113 -0
  41. package/src/contracts/plugin-contracts.js +33 -0
  42. package/src/core/create-pipeline.js +99 -0
  43. package/src/core/dependency-injection.js +242 -0
  44. package/src/core/observability/event-logger.js +241 -0
  45. package/src/core/observability/instrumented-pipeline.js +609 -0
  46. package/src/core/observability/metrics.js +497 -0
  47. package/src/core/observability/tracing.js +781 -0
  48. package/src/core/performance/benchmark.js +516 -0
  49. package/src/core/performance/parallel-processor.js +240 -0
  50. package/src/core/performance/streaming-safeguards.js +620 -0
  51. package/src/core/pipeline-factory.js +60 -0
  52. package/src/core/plugin-contracts.js +89 -0
  53. package/src/core/plugin-marketplace/plugin-metadata.js +485 -0
  54. package/src/core/plugin-marketplace/plugin-publisher.js +574 -0
  55. package/src/core/plugin-marketplace/plugin-registry-format.js +419 -0
  56. package/src/core/plugin-marketplace/version-resolver.js +61 -0
  57. package/src/core/plugin-registry.js +294 -0
  58. package/src/dag/dag-engine.js +954 -0
  59. package/src/dag/dag-node.js +76 -0
  60. package/src/dag/enhanced-dag-engine.js +822 -0
  61. package/src/dx/index.js +40 -0
  62. package/src/dx/integration-templates.js +665 -0
  63. package/src/dx/performance-profiler.js +968 -0
  64. package/src/dx/realtime-debugger.js +755 -0
  65. package/src/dx/visual-pipeline-builder.js +578 -0
  66. package/src/ecosystem/plugin-analytics-dashboard.js +778 -0
  67. package/src/ecosystem/plugin-certification.js +580 -0
  68. package/src/ecosystem/plugin-hub.js +821 -0
  69. package/src/enterprise/audit-logging.js +967 -0
  70. package/src/enterprise/data-governance.js +408 -0
  71. package/src/enterprise/multi-tenancy.js +496 -0
  72. package/src/enterprise/sso-integration.js +1030 -0
  73. package/src/evaluate/evaluator.js +52 -0
  74. package/src/evaluate/scoring.js +91 -0
  75. package/src/index.js +67 -0
  76. package/src/ingest.js +59 -0
  77. package/src/loader/csv-loader.js +38 -0
  78. package/src/loader/directory-loader.js +48 -0
  79. package/src/loader/html-loader.js +62 -0
  80. package/src/loader/markdown-loader.js +67 -0
  81. package/src/mocks/openai-embedder.js +119 -0
  82. package/src/mocks/openai-llm.js +77 -0
  83. package/src/mocks/pdf-loader.js +21 -0
  84. package/src/mocks/pinecone-retriever.js +106 -0
  85. package/src/observability/audit-logger.js +758 -0
  86. package/src/observability/dashboard-config.json +675 -0
  87. package/src/observability/event-logger.js +310 -0
  88. package/src/observability/metrics.js +691 -0
  89. package/src/observability/security-monitor.js +830 -0
  90. package/src/observability/slo-monitor.js +319 -0
  91. package/src/observability/telemetry.js +686 -0
  92. package/src/pipeline/pipeline.js +18 -0
  93. package/src/plugins/sample-embedder.js +53 -0
  94. package/src/plugins/sample-llm.js +30 -0
  95. package/src/plugins/sample-loader.js +24 -0
  96. package/src/plugins/sample-retriever.js +84 -0
  97. package/src/query.js +117 -0
  98. package/src/reranker/llm-reranker.js +111 -0
  99. package/src/scripts/script-utilities.js +36 -0
  100. package/src/security/plugin-sandbox.js +586 -0
  101. package/src/security/plugin-signature-verifier.js +414 -0
  102. package/src/security/validator.js +36 -0
  103. package/src/utils/ci/diagnostic-reporter.js +57 -0
  104. package/src/utils/logger.js +211 -0
  105. package/src/utils/performance-monitor.js +561 -0
  106. package/src/utils/plugin-scaffolder.js +447 -0
  107. package/src/utils/rate-limiter.js +244 -0
  108. package/src/utils/retry-policy.js +443 -0
  109. package/src/utils/retry.js +107 -0
  110. package/src/utils/safe-expression-evaluator.js +579 -0
  111. package/src/utils/secure-logging.js +338 -0
  112. package/src/utils/structured-logger.js +388 -0
  113. package/src/utils/validate-plugin-contract.js +42 -0
@@ -0,0 +1,875 @@
1
+ /**
2
+ const path = require('path');
3
+ * Plugin Hub CLI Commands
4
+ * Command-line interface for community plugin hub operations
5
+ */
6
+
7
+ const { Command } = require('commander');
8
+ // eslint-disable-line global-require
9
+ const chalk = require('chalk');
10
+ // eslint-disable-line global-require
11
+ const ora = require('ora');
12
+ // eslint-disable-line global-require
13
+ const inquirer = require('inquirer');
14
+ // eslint-disable-line global-require
15
+ const Table = require('cli-table3');
16
+ // eslint-disable-line global-require
17
+ const { PluginHub } = require('../../ecosystem/plugin-hub');
18
+ // eslint-disable-line global-require
19
+ const { PluginCertification } = require('../../ecosystem/plugin-certification');
20
+ // eslint-disable-line global-require
21
+
22
+ class PluginHubCLI {
23
+ constructor() {
24
+ this.hub = new PluginHub();
25
+ this.certification = new PluginCertification();
26
+ this.setupEventListeners();
27
+ }
28
+
29
+ setupEventListeners() {
30
+ // Hub events
31
+ this.hub.on('install_start', (data) => {
32
+ console.log(
33
+ chalk.blue(
34
+ `šŸš€ Starting installation of ${data.pluginId}@${data.version}`,
35
+ ),
36
+ ); // eslint-disable-line no-console
37
+ });
38
+
39
+ this.hub.on('install_progress', (data) => {
40
+ const stages = {
41
+ security_scan: 'šŸ” Running security scan...',
42
+ downloading: 'ā¬‡ļø Downloading plugin...',
43
+ verifying: 'āœ… Verifying integrity...',
44
+ sandbox_install: 'šŸ—ļø Installing in sandbox...',
45
+ installing: 'šŸ“¦ Installing to system...',
46
+ };
47
+ console.log(
48
+ chalk.yellow(stages[data.stage] || `Processing ${data.stage}...`),
49
+ ); // eslint-disable-line no-console
50
+ }); // eslint-disable-line no-console
51
+
52
+ this.hub.on('install_complete', (data) => {
53
+ console.log(
54
+ chalk.green(
55
+ `āœ… Successfully installed ${data.pluginId}@${data.version}`,
56
+ ),
57
+ ); // eslint-disable-line no-console
58
+ });
59
+
60
+ // eslint-disable-line no-console
61
+ this.hub.on('install_error', (data) => {
62
+ console.error(chalk.red(`āŒ Installation failed: ${data.error.message}`)); // eslint-disable-line no-console
63
+ });
64
+
65
+ // Certification events
66
+ // eslint-disable-line no-console
67
+ this.certification.on('certification_start', (data) => {
68
+ console.log(
69
+ chalk.blue(
70
+ `šŸ† Starting ${data.level} certification for ${data.pluginId}`,
71
+ ),
72
+ ); // eslint-disable-line no-console
73
+ });
74
+
75
+ this.certification.on('certification_progress', (data) => {
76
+ const stages = {
77
+ // eslint-disable-line no-console
78
+ automated_checks: 'šŸ¤– Running automated checks...',
79
+ manual_review: 'šŸ‘„ Submitting for manual review...',
80
+ security_audit: 'šŸ”’ Performing security audit...',
81
+ };
82
+ console.log(
83
+ chalk.yellow(stages[data.stage] || `Processing ${data.stage}...`),
84
+ ); // eslint-disable-line no-console
85
+ });
86
+ }
87
+
88
+ createCommands() {
89
+ const program = new Command('hub'); // eslint-disable-line no-console
90
+ program.description('Community plugin hub operations');
91
+
92
+ // Search command
93
+ program
94
+ .command('search <query>')
95
+ .description('Search plugins in the community hub')
96
+ .option('-c, --category <category>', 'Filter by category')
97
+ .option('-t, --tags <tags>', 'Filter by tags (comma-separated)')
98
+ .option('-a, --author <author>', 'Filter by author')
99
+ .option('-r, --min-rating <rating>', 'Minimum rating (1-5)', parseFloat)
100
+ .option('--verified', 'Show only verified plugins')
101
+ .option('-l, --limit <limit>', 'Number of results', parseInt, 20)
102
+ .option(
103
+ '--sort <sort>',
104
+ 'Sort by: relevance, downloads, rating, updated',
105
+ 'relevance',
106
+ )
107
+ .action(async (query, _options) => {
108
+ await this.searchPlugins(query, _options);
109
+ });
110
+
111
+ // Install command
112
+ program
113
+ .command('install <plugin>')
114
+ .description('Install a plugin from the hub')
115
+ .option('-v, --version <version>', 'Plugin version', 'latest')
116
+ .option('--no-security-scan', 'Skip security scan')
117
+ .option('--require-certified', 'Only install certified plugins')
118
+ .option(
119
+ '--sandbox-timeout <timeout>',
120
+ 'Sandbox timeout in ms',
121
+ parseInt,
122
+ 30000,
123
+ )
124
+ .action(async (plugin, _options) => {
125
+ await this.installPlugin(plugin, _options);
126
+ });
127
+
128
+ // Info command
129
+ program
130
+ .command('info <plugin>')
131
+ .description('Get detailed information about a plugin')
132
+ .action(async (plugin) => {
133
+ await this.getPluginInfo(plugin);
134
+ });
135
+
136
+ // List installed command
137
+ program
138
+ .command('list')
139
+ .alias('ls')
140
+ .description('List installed plugins')
141
+ .option('--format <format>', 'Output format: table, json', 'table')
142
+ .action(async (_options) => {
143
+ await this.listInstalledPlugins(_options);
144
+ });
145
+
146
+ // Publish command
147
+ program
148
+ .command('publish [path]')
149
+ .description('Publish a plugin to the hub')
150
+ .option('--dry-run', 'Validate without publishing')
151
+ .option('--tag <tag>', 'Release tag')
152
+ .action(async (pluginPath, _options) => {
153
+ await this.publishPlugin(pluginPath || process.cwd(), _options);
154
+ });
155
+
156
+ // Rate command
157
+ program
158
+ .command('rate <plugin> <rating>')
159
+ .description('Rate a plugin (1-5 stars)')
160
+ .option('-r, --review <review>', 'Written review')
161
+ .action(async (plugin, rating, _options) => {
162
+ await this.ratePlugin(plugin, parseInt(rating), _options);
163
+ });
164
+
165
+ // Reviews command
166
+ program
167
+ .command('reviews <plugin>')
168
+ .description('View plugin reviews')
169
+ .option('-l, --limit <limit>', 'Number of reviews', parseInt, 10)
170
+ .option('--sort <sort>', 'Sort by: helpful, recent, rating', 'helpful')
171
+ .action(async (plugin, _options) => {
172
+ await this.getPluginReviews(plugin, _options);
173
+ });
174
+
175
+ // Trending command
176
+ program
177
+ .command('trending')
178
+ .description('Show trending plugins')
179
+ .option('-p, --period <period>', 'Time period: day, week, month', 'week')
180
+ .option('-c, --category <category>', 'Filter by category')
181
+ .option('-l, --limit <limit>', 'Number of results', parseInt, 20)
182
+ .action(async (_options) => {
183
+ await this.getTrendingPlugins(_options);
184
+ });
185
+
186
+ // Certification commands
187
+ const certifyCmd = program
188
+ .command('certify')
189
+ .description('Plugin certification operations');
190
+
191
+ certifyCmd
192
+ .command('submit <plugin>')
193
+ .description('Submit plugin for certification')
194
+ .option(
195
+ '-l, --level <level>',
196
+ 'Certification level: BASIC, VERIFIED, ENTERPRISE',
197
+ 'BASIC',
198
+ )
199
+ .action(async (plugin, _options) => {
200
+ await this.submitForCertification(plugin, _options);
201
+ });
202
+
203
+ certifyCmd
204
+ .command('verify <plugin> <certificationId>')
205
+ .description('Verify plugin certification')
206
+ .action(async (plugin, certificationId) => {
207
+ await this.verifyCertification(plugin, certificationId);
208
+ });
209
+
210
+ certifyCmd
211
+ .command('requirements [level]')
212
+ .description('Show certification requirements')
213
+ .action(async (level) => {
214
+ await this.showCertificationRequirements(level);
215
+ });
216
+
217
+ // Publisher commands
218
+ const publisherCmd = program
219
+ .command('publisher')
220
+ .description('Publisher verification operations');
221
+
222
+ publisherCmd
223
+ .command('status [publisherId]')
224
+ .description('Check publisher verification status')
225
+ .action(async (publisherId) => {
226
+ await this.getPublisherStatus(publisherId);
227
+ });
228
+
229
+ publisherCmd
230
+ .command('apply')
231
+ .description('Apply for publisher verification')
232
+ .action(async () => {
233
+ await this.applyForPublisherVerification();
234
+ });
235
+
236
+ return program;
237
+ }
238
+
239
+ async searchPlugins(query, _options) {
240
+ const spinner = ora('Searching plugins...').start();
241
+
242
+ try {
243
+ const searchOptions = {
244
+ category: _options.category,
245
+ tags: _options.tags ? _options.tags.split(',') : undefined,
246
+ author: _options.author,
247
+ minRating: _options.minRating,
248
+ verified: _options.verified,
249
+ limit: _options.limit,
250
+ sortBy: _options.sort,
251
+ };
252
+
253
+ const results = await this.hub.searchPlugins(query, searchOptions);
254
+ spinner.stop();
255
+
256
+ if (results.results.length === 0) {
257
+ console.log(chalk.yellow('No plugins found matching your criteria.')); // eslint-disable-line no-console
258
+ return;
259
+ }
260
+
261
+ console.log(chalk.green(`Found ${results.total} plugins:\n`)); // eslint-disable-line no-console
262
+
263
+ const table = new Table({
264
+ // eslint-disable-line no-console
265
+ head: [
266
+ 'Name',
267
+ 'Version',
268
+ 'Author',
269
+ 'Rating',
270
+ 'Downloads',
271
+ 'Description',
272
+ ],
273
+ colWidths: [20, 10, 15, 8, 10, 40],
274
+ });
275
+
276
+ for (const plugin of results.results) {
277
+ // eslint-disable-line no-console
278
+ const rating =
279
+ 'ā˜…'.repeat(Math.floor(plugin.rating)) +
280
+ 'ā˜†'.repeat(5 - Math.floor(plugin.rating));
281
+ const certified = plugin.certified ? chalk.green('āœ“') : '';
282
+
283
+ table.push([
284
+ `${plugin.name} ${certified}`,
285
+ plugin.version,
286
+ plugin.author,
287
+ `${rating} (${plugin.reviewCount})`,
288
+ plugin.downloadCount.toLocaleString(),
289
+ plugin.description.substring(0, 35) +
290
+ (plugin.description.length > 35 ? '...' : ''),
291
+ ]);
292
+ }
293
+
294
+ console.log(table.toString()); // eslint-disable-line no-console
295
+
296
+ if (results.hasMore) {
297
+ console.log(
298
+ chalk.blue(
299
+ `\nShowing ${results.results.length} of ${results.total} results. Use --limit to see more.`,
300
+ ),
301
+ ); // eslint-disable-line no-console
302
+ }
303
+ } catch (error) {
304
+ spinner.stop();
305
+ console.error(chalk.red(`Search failed: ${error.message}`)); // eslint-disable-line no-console
306
+ process.exit(1);
307
+ }
308
+ }
309
+
310
+ // eslint-disable-line no-console
311
+ async installPlugin(plugin, _options) {
312
+ try {
313
+ const installOptions = {
314
+ securityScan: _options.securityScan,
315
+ requireCertified: _options.requireCertified,
316
+ sandboxTimeout: _options.sandboxTimeout, // eslint-disable-line no-console
317
+ };
318
+
319
+ const result = await this.hub.installPlugin(
320
+ plugin,
321
+ _options.version,
322
+ installOptions,
323
+ );
324
+
325
+ console.log(chalk.green('\nāœ… Installation completed successfully!')); // eslint-disable-line no-console
326
+ console.log(chalk.blue(`Plugin: ${result.pluginInfo.name}`)); // eslint-disable-line no-console
327
+ console.log(chalk.blue(`Version: ${result.version}`)); // eslint-disable-line no-console
328
+ console.log(chalk.blue(`Install Path: ${result.installPath}`)); // eslint-disable-line no-console
329
+
330
+ if (result.pluginInfo.certified) {
331
+ console.log(chalk.green('šŸ† This plugin is certified!')); // eslint-disable-line no-console
332
+ }
333
+ } catch (error) {
334
+ console.error(chalk.red(`Installation failed: ${error.message}`)); // eslint-disable-line no-console
335
+ process.exit(1); // eslint-disable-line no-console
336
+ }
337
+ }
338
+ // eslint-disable-line no-console
339
+
340
+ async getPluginInfo(plugin) {
341
+ // eslint-disable-line no-console
342
+ const spinner = ora('Fetching plugin information...').start();
343
+
344
+ // eslint-disable-line no-console
345
+ try {
346
+ const info = await this.hub.getPluginInfo(plugin);
347
+ spinner.stop();
348
+
349
+ // eslint-disable-line no-console
350
+ console.log(chalk.blue.bold(`\n${info.name} v${info.version}\n`)); // eslint-disable-line no-console
351
+ console.log(chalk.gray(info.description)); // eslint-disable-line no-console
352
+ console.log(); // eslint-disable-line no-console
353
+
354
+ const details = new Table({
355
+ // eslint-disable-line no-console
356
+ chars: {
357
+ top: '',
358
+ 'top-mid': '',
359
+ 'top-left': '',
360
+ 'top-right': '',
361
+ bottom: '',
362
+ 'bottom-mid': '',
363
+ 'bottom-left': '',
364
+ 'bottom-right': '',
365
+ left: '',
366
+ 'left-mid': '',
367
+ mid: '',
368
+ 'mid-mid': '',
369
+ right: '',
370
+ 'right-mid': '',
371
+ middle: ' ',
372
+ },
373
+ style: { 'padding-left': 0, 'padding-right': 0 },
374
+ });
375
+
376
+ const rating =
377
+ 'ā˜…'.repeat(Math.floor(info.rating)) +
378
+ 'ā˜†'.repeat(5 - Math.floor(info.rating));
379
+
380
+ details.push(
381
+ ['Author:', info.author],
382
+ ['Category:', info.category],
383
+ ['Rating:', `${rating} (${info.reviewCount} reviews)`],
384
+ // eslint-disable-line no-console
385
+ ['Downloads:', info.downloadCount.toLocaleString()],
386
+ ['License:', info.license],
387
+ // eslint-disable-line no-console
388
+ ['Last Updated:', new Date(info.lastUpdated).toLocaleDateString()],
389
+ [
390
+ 'Certified:',
391
+ info.certified ? chalk.green('Yes āœ“') : chalk.gray('No'),
392
+ ],
393
+ // eslint-disable-line no-console
394
+ [
395
+ 'Verified Publisher:',
396
+ info.verifiedPublisher ? chalk.green('Yes āœ“') : chalk.gray('No'),
397
+ ],
398
+ );
399
+
400
+ console.log(details.toString()); // eslint-disable-line no-console
401
+
402
+ if (info.tags && info.tags.length > 0) {
403
+ console.log(
404
+ chalk.blue('\nTags:'),
405
+ info.tags.map((tag) => chalk.cyan(`#${tag}`)).join(' '),
406
+ ); // eslint-disable-line no-console
407
+ }
408
+
409
+ if (info.homepage) {
410
+ console.log(chalk.blue('\nHomepage:'), chalk.underline(info.homepage)); // eslint-disable-line no-console
411
+ }
412
+
413
+ if (info.repository) {
414
+ console.log(
415
+ chalk.blue('Repository:'),
416
+ chalk.underline(info.repository),
417
+ ); // eslint-disable-line no-console
418
+ }
419
+ } catch (error) {
420
+ spinner.stop();
421
+ console.error(chalk.red(`Failed to get plugin info: ${error.message}`)); // eslint-disable-line no-console
422
+ process.exit(1);
423
+ }
424
+ }
425
+
426
+ // eslint-disable-line no-console
427
+ async listInstalledPlugins(_options) {
428
+ const spinner = ora('Loading installed plugins...').start();
429
+
430
+ try {
431
+ // eslint-disable-line no-console
432
+ const installed = await this.hub.getInstalledPlugins();
433
+ spinner.stop();
434
+
435
+ if (installed.length === 0) {
436
+ console.log(chalk.yellow('No plugins installed.')); // eslint-disable-line no-console
437
+ return;
438
+ }
439
+
440
+ if (_options.format === 'json') {
441
+ console.log(JSON.stringify(installed, null, 2)); // eslint-disable-line no-console
442
+ return;
443
+ }
444
+
445
+ console.log(chalk.green(`${installed.length} plugins installed:\n`)); // eslint-disable-line no-console
446
+
447
+ const table = new Table({
448
+ // eslint-disable-line no-console
449
+ head: ['Name', 'Version', 'Type', 'Last Used', 'Status'],
450
+ colWidths: [25, 12, 15, 15, 10],
451
+ });
452
+
453
+ for (const plugin of installed) {
454
+ const lastUsed = plugin.lastUsed
455
+ ? new Date(plugin.lastUsed).toLocaleDateString()
456
+ : chalk.gray('Never');
457
+
458
+ const status = plugin.certified
459
+ ? chalk.green('Certified')
460
+ : chalk.gray('Standard');
461
+
462
+ table.push([
463
+ // eslint-disable-line no-console
464
+ plugin.name,
465
+ plugin.version,
466
+ plugin._type,
467
+ lastUsed,
468
+ status,
469
+ ]); // eslint-disable-line no-console
470
+ }
471
+
472
+ console.log(table.toString()); // eslint-disable-line no-console
473
+ } catch (error) {
474
+ // eslint-disable-line no-console
475
+ spinner.stop();
476
+ console.error(chalk.red(`Failed to list plugins: ${error.message}`)); // eslint-disable-line no-console
477
+ process.exit(1);
478
+ }
479
+ }
480
+
481
+ async publishPlugin(pluginPath, _options) {
482
+ if (_options.dryRun) {
483
+ console.log(
484
+ chalk.blue('šŸ” Dry run mode - validating plugin without publishing\n'),
485
+ ); // eslint-disable-line no-console
486
+ }
487
+
488
+ try {
489
+ if (!_options.dryRun) {
490
+ const result = await this.hub.publishPlugin(pluginPath, _options);
491
+
492
+ console.log(chalk.green('\nšŸŽ‰ Plugin published successfully!')); // eslint-disable-line no-console
493
+ console.log(chalk.blue(`Plugin ID: ${result.pluginId}`)); // eslint-disable-line no-console
494
+ console.log(chalk.blue(`Version: ${result.version}`)); // eslint-disable-line no-console
495
+ console.log(chalk.blue(`URL: ${result.url}`)); // eslint-disable-line no-console
496
+ } else {
497
+ console.log(
498
+ chalk.green('āœ… Plugin validation passed - ready for publishing!'),
499
+ ); // eslint-disable-line no-console
500
+ }
501
+ } catch (error) {
502
+ console.error(chalk.red(`Publishing failed: ${error.message}`)); // eslint-disable-line no-console
503
+ process.exit(1); // eslint-disable-line no-console
504
+ }
505
+ }
506
+
507
+ async ratePlugin(plugin, rating, _options) {
508
+ if (rating < 1 || rating > 5) {
509
+ // eslint-disable-line no-console
510
+ console.error(chalk.red('Rating must be between 1 and 5')); // eslint-disable-line no-console
511
+ process.exit(1);
512
+ }
513
+
514
+ try {
515
+ await this.hub.ratePlugin(plugin, rating, _options.review);
516
+
517
+ const stars = 'ā˜…'.repeat(rating) + 'ā˜†'.repeat(5 - rating); // eslint-disable-line no-console
518
+ console.log(chalk.green(`āœ… Rated ${plugin}: ${stars}`)); // eslint-disable-line no-console
519
+
520
+ if (_options.review) {
521
+ console.log(chalk.blue('Review submitted successfully!')); // eslint-disable-line no-console
522
+ }
523
+ } catch (error) {
524
+ console.error(chalk.red(`Rating failed: ${error.message}`)); // eslint-disable-line no-console
525
+ process.exit(1);
526
+ }
527
+ // eslint-disable-line no-console
528
+ }
529
+
530
+ // eslint-disable-line no-console
531
+ async getPluginReviews(plugin, _options) {
532
+ const spinner = ora('Loading reviews...').start(); // eslint-disable-line no-console
533
+
534
+ try {
535
+ const reviews = await this.hub.getPluginReviews(plugin, _options); // eslint-disable-line no-console
536
+ spinner.stop();
537
+
538
+ if (reviews.reviews.length === 0) {
539
+ console.log(chalk.yellow('No reviews found for this plugin.')); // eslint-disable-line no-console
540
+ return; // eslint-disable-line no-console
541
+ }
542
+
543
+ console.log(chalk.green(`Reviews for ${plugin}:\n`)); // eslint-disable-line no-console
544
+
545
+ for (const review of reviews.reviews) {
546
+ const stars = 'ā˜…'.repeat(review.rating) + 'ā˜†'.repeat(5 - review.rating);
547
+ const date = new Date(review.createdAt).toLocaleDateString();
548
+
549
+ // eslint-disable-line no-console
550
+ console.log(chalk.blue(`${stars} by ${review.author} on ${date}`)); // eslint-disable-line no-console
551
+
552
+ if (review.review) {
553
+ console.log(chalk.gray(`"${review.review}"`)); // eslint-disable-line no-console
554
+ }
555
+
556
+ if (review.helpful > 0) {
557
+ console.log(chalk.green(`šŸ‘ ${review.helpful} found this helpful`)); // eslint-disable-line no-console
558
+ }
559
+ // eslint-disable-line no-console
560
+
561
+ console.log(); // eslint-disable-line no-console
562
+ }
563
+
564
+ // eslint-disable-line no-console
565
+ if (reviews.hasMore) {
566
+ console.log(
567
+ chalk.blue(
568
+ `Showing ${reviews.reviews.length} of ${reviews.total} reviews.`,
569
+ ),
570
+ ); // eslint-disable-line no-console
571
+ }
572
+ } catch (error) {
573
+ // eslint-disable-line no-console
574
+ spinner.stop();
575
+ console.error(chalk.red(`Failed to load reviews: ${error.message}`)); // eslint-disable-line no-console
576
+ process.exit(1);
577
+ }
578
+ }
579
+
580
+ async getTrendingPlugins(_options) {
581
+ const spinner = ora('Loading trending plugins...').start();
582
+
583
+ try {
584
+ const trending = await this.hub.getTrendingPlugins(_options);
585
+ spinner.stop();
586
+
587
+ console.log(chalk.green(`šŸ”„ Trending plugins (${_options.period}):\n`)); // eslint-disable-line no-console
588
+
589
+ const table = new Table({
590
+ head: ['Rank', 'Name', 'Author', 'Category', 'Growth', 'Rating'],
591
+ colWidths: [6, 20, 15, 15, 10, 10],
592
+ }); // eslint-disable-line no-console
593
+
594
+ trending.forEach((plugin, index) => {
595
+ const rating =
596
+ 'ā˜…'.repeat(Math.floor(plugin.rating)) +
597
+ 'ā˜†'.repeat(5 - Math.floor(plugin.rating));
598
+ const certified = plugin.certified ? chalk.green('āœ“') : '';
599
+
600
+ table.push([
601
+ `#${index + 1}`,
602
+ // eslint-disable-line no-console
603
+ `${plugin.name} ${certified}`,
604
+ plugin.author,
605
+ plugin.category,
606
+ chalk.green(`+${plugin.growth || 0}%`),
607
+ // eslint-disable-line no-console
608
+ rating,
609
+ ]);
610
+ });
611
+
612
+ console.log(table.toString()); // eslint-disable-line no-console
613
+ } catch (error) {
614
+ spinner.stop();
615
+ console.error(
616
+ chalk.red(`Failed to load trending plugins: ${error.message}`),
617
+ ); // eslint-disable-line no-console
618
+ process.exit(1);
619
+ }
620
+ }
621
+
622
+ async submitForCertification(plugin, options) {
623
+ // eslint-disable-line no-console
624
+ try {
625
+ const result = await this.certification.submitForCertification(
626
+ plugin,
627
+ options.level,
628
+ );
629
+
630
+ console.log(chalk.green('\nšŸ† Certification submitted successfully!')); // eslint-disable-line no-console
631
+ console.log(chalk.blue(`Certification ID: ${result.id}`)); // eslint-disable-line no-console
632
+ console.log(chalk.blue(`Level: ${result.level}`)); // eslint-disable-line no-console
633
+ console.log(chalk.blue(`Score: ${result.score}/100`)); // eslint-disable-line no-console
634
+ console.log(chalk.blue(`Status: ${result.status || 'Pending'}`)); // eslint-disable-line no-console
635
+
636
+ if (result.estimatedCompletion) {
637
+ console.log(
638
+ chalk.blue(`Estimated completion: ${result.estimatedCompletion}`),
639
+ ); // eslint-disable-line no-console
640
+ }
641
+ } catch (error) {
642
+ console.error(
643
+ chalk.red(`Certification submission failed: ${error.message}`),
644
+ ); // eslint-disable-line no-console
645
+ process.exit(1);
646
+ }
647
+ }
648
+
649
+ // eslint-disable-line no-console
650
+ async verifyCertification(plugin, certificationId) {
651
+ const spinner = ora('Verifying certification...').start();
652
+
653
+ try {
654
+ const verification = await this.certification.verifyCertification(
655
+ plugin,
656
+ certificationId,
657
+ );
658
+ spinner.stop();
659
+
660
+ if (verification.valid) {
661
+ console.log(chalk.green('āœ… Certification is valid!')); // eslint-disable-line no-console
662
+ console.log(chalk.blue(`Plugin: ${plugin}`)); // eslint-disable-line no-console
663
+ console.log(chalk.blue(`Level: ${verification.certification.level}`)); // eslint-disable-line no-console
664
+ console.log(
665
+ chalk.blue(
666
+ `Expires: ${new Date(verification.expiresAt).toLocaleDateString()}`,
667
+ ),
668
+ ); // eslint-disable-line no-console
669
+ } else {
670
+ console.log(chalk.red('āŒ Certification is invalid or expired')); // eslint-disable-line no-console
671
+ }
672
+ } catch (error) {
673
+ spinner.stop();
674
+ console.error(chalk.red(`Verification failed: ${error.message}`)); // eslint-disable-line no-console
675
+ process.exit(1);
676
+ }
677
+ }
678
+ // eslint-disable-line no-console
679
+
680
+ async showCertificationRequirements(level) {
681
+ const levels = level ? [level] : ['BASIC', 'VERIFIED', 'ENTERPRISE'];
682
+
683
+ for (const certLevel of levels) {
684
+ // eslint-disable-line no-console
685
+ const requirements =
686
+ this.certification.getCertificationRequirements(certLevel);
687
+
688
+ if (!requirements) {
689
+ console.log(chalk.red(`Unknown certification level: ${certLevel}`)); // eslint-disable-line no-console
690
+ continue;
691
+ }
692
+
693
+ console.log(
694
+ chalk.blue.bold(`\n${certLevel} Certification Requirements:\n`),
695
+ ); // eslint-disable-line no-console
696
+
697
+ console.log(chalk.green('Automated Checks:')); // eslint-disable-line no-console
698
+ requirements.automated.forEach((check) => {
699
+ console.log(chalk.gray(` • ${check}`)); // eslint-disable-line no-console
700
+ });
701
+
702
+ // eslint-disable-line no-console
703
+ if (requirements.manual.length > 0) {
704
+ console.log(chalk.yellow('\nManual Review:')); // eslint-disable-line no-console
705
+ requirements.manual.forEach((review) => {
706
+ console.log(chalk.gray(` • ${review}`)); // eslint-disable-line no-console
707
+ });
708
+ }
709
+
710
+ if (requirements.audit.length > 0) {
711
+ // eslint-disable-line no-console
712
+ console.log(chalk.red('\nSecurity Audit:')); // eslint-disable-line no-console
713
+ requirements.audit.forEach((audit) => {
714
+ console.log(chalk.gray(` • ${audit}`)); // eslint-disable-line no-console
715
+ });
716
+ }
717
+ // eslint-disable-line no-console
718
+
719
+ console.log(chalk.blue(`\nMinimum Score: ${requirements.minScore}/100`)); // eslint-disable-line no-console
720
+ console.log(
721
+ chalk.blue(`Validity Period: ${requirements.validityPeriod}`),
722
+ ); // eslint-disable-line no-console
723
+ }
724
+ }
725
+
726
+ async getPublisherStatus(publisherId) {
727
+ const spinner = ora('Checking publisher status...').start();
728
+
729
+ try {
730
+ const status = await this.certification.getPublisherStatus(
731
+ publisherId || 'me',
732
+ );
733
+ spinner.stop();
734
+
735
+ console.log(chalk.blue.bold('\nPublisher Status:\n')); // eslint-disable-line no-console
736
+
737
+ const table = new Table({
738
+ // eslint-disable-line no-console
739
+ chars: {
740
+ top: '',
741
+ 'top-mid': '',
742
+ 'top-left': '',
743
+ 'top-right': '',
744
+ bottom: '',
745
+ 'bottom-mid': '',
746
+ 'bottom-left': '',
747
+ 'bottom-right': '',
748
+ // eslint-disable-line no-console
749
+ left: '',
750
+ 'left-mid': '',
751
+ mid: '',
752
+ 'mid-mid': '',
753
+ right: '',
754
+ 'right-mid': '',
755
+ middle: ' ',
756
+ },
757
+ // eslint-disable-line no-console
758
+ style: { 'padding-left': 0, 'padding-right': 0 },
759
+ });
760
+
761
+ // eslint-disable-line no-console
762
+ table.push(
763
+ [
764
+ 'Verified:',
765
+ status.verified ? chalk.green('Yes āœ“') : chalk.gray('No'),
766
+ ],
767
+ ['Level:', status.level || chalk.gray('None')],
768
+ ['Certified Plugins:', status.certifiedPlugins.toString()],
769
+ ['Reputation:', status.reputation.toString()],
770
+ ['Member Since:', new Date(status.joinedAt).toLocaleDateString()],
771
+ // eslint-disable-line no-console
772
+ ['Last Activity:', new Date(status.lastActivity).toLocaleDateString()],
773
+ );
774
+
775
+ console.log(table.toString()); // eslint-disable-line no-console
776
+
777
+ if (status.badges && status.badges.length > 0) {
778
+ console.log(chalk.blue('\nBadges:'), status.badges.join(', ')); // eslint-disable-line no-console
779
+ }
780
+ } catch (error) {
781
+ spinner.stop();
782
+ console.error(
783
+ chalk.red(`Failed to get publisher status: ${error.message}`),
784
+ ); // eslint-disable-line no-console
785
+ process.exit(1); // eslint-disable-line no-console
786
+ }
787
+ }
788
+
789
+ async applyForPublisherVerification() {
790
+ console.log(chalk.blue('šŸ“ Publisher Verification Application\n')); // eslint-disable-line no-console
791
+
792
+ const answers = await inquirer.prompt([
793
+ {
794
+ // eslint-disable-line no-console
795
+ _type: 'input',
796
+ name: 'name',
797
+ message: 'Full name:',
798
+ // eslint-disable-line no-console
799
+ validate: (input) => input.length > 0,
800
+ },
801
+ {
802
+ _type: 'input',
803
+ name: 'email',
804
+ // eslint-disable-line no-console
805
+ message: 'Email address:',
806
+ validate: (input) => /\S+@\S+\.\S+/.test(input),
807
+ },
808
+ // eslint-disable-line no-console
809
+ {
810
+ _type: 'input',
811
+ name: 'organization',
812
+ message: 'Organization (optional):',
813
+ },
814
+ {
815
+ // eslint-disable-line no-console
816
+ _type: 'input',
817
+ name: 'website',
818
+ message: 'Website/Portfolio:',
819
+ // eslint-disable-line no-console
820
+ },
821
+ {
822
+ _type: 'input',
823
+ name: 'github',
824
+ message: 'GitHub profile:',
825
+ // eslint-disable-line no-console
826
+ },
827
+ {
828
+ // eslint-disable-line no-console
829
+ _type: 'editor',
830
+ name: 'motivation',
831
+ message: 'Why do you want to become a verified publisher?',
832
+ },
833
+ ]);
834
+
835
+ const spinner = ora('Submitting application...').start();
836
+
837
+ try {
838
+ const result =
839
+ await this.certification.applyForPublisherVerification(answers);
840
+ spinner.stop();
841
+
842
+ // eslint-disable-line no-console
843
+ console.log(chalk.green('\nāœ… Application submitted successfully!')); // eslint-disable-line no-console
844
+ console.log(chalk.blue(`Application ID: ${result.applicationId}`)); // eslint-disable-line no-console
845
+ console.log(chalk.blue(`Status: ${result.status}`)); // eslint-disable-line no-console
846
+ console.log(
847
+ chalk.blue(`Estimated review time: ${result.estimatedReviewTime}`),
848
+ ); // eslint-disable-line no-console
849
+ } catch (error) {
850
+ spinner.stop();
851
+ console.error(chalk.red(`Application failed: ${error.message}`)); // eslint-disable-line no-console
852
+ process.exit(1);
853
+ }
854
+ }
855
+ }
856
+
857
+ module.exports = { PluginHubCLI };
858
+
859
+ undefined; // eslint-disable-line no-console
860
+
861
+ undefined; // eslint-disable-line no-console
862
+
863
+ undefined; // eslint-disable-line no-console
864
+
865
+ undefined; // eslint-disable-line no-console
866
+
867
+ undefined; // eslint-disable-line no-console
868
+
869
+ undefined; // eslint-disable-line no-console
870
+
871
+ undefined; // eslint-disable-line no-console
872
+
873
+ undefined; // eslint-disable-line no-console
874
+
875
+ undefined; // eslint-disable-line no-console