@skunkceo/cli 2.1.0 → 2.2.0
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.
- package/bin/skunk.js +66 -0
- package/package.json +1 -1
package/bin/skunk.js
CHANGED
|
@@ -69,6 +69,12 @@ switch (command) {
|
|
|
69
69
|
case 'status':
|
|
70
70
|
checkStatus();
|
|
71
71
|
break;
|
|
72
|
+
case 'versions':
|
|
73
|
+
showVersions(null);
|
|
74
|
+
break;
|
|
75
|
+
case 'version':
|
|
76
|
+
showVersions(args[1]);
|
|
77
|
+
break;
|
|
72
78
|
case 'update':
|
|
73
79
|
handleUpdate();
|
|
74
80
|
break;
|
|
@@ -466,6 +472,64 @@ async function checkStatus() {
|
|
|
466
472
|
}
|
|
467
473
|
}
|
|
468
474
|
|
|
475
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
476
|
+
// Versions - Simple version lookup
|
|
477
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
478
|
+
|
|
479
|
+
async function showVersions(plugin) {
|
|
480
|
+
const versionsUrl = 'https://skunkglobal.com/api/plugins/versions';
|
|
481
|
+
|
|
482
|
+
try {
|
|
483
|
+
const data = await new Promise((resolve, reject) => {
|
|
484
|
+
https.get(versionsUrl, { headers: { 'User-Agent': 'skunk-cli' } }, (res) => {
|
|
485
|
+
let body = '';
|
|
486
|
+
res.on('data', chunk => body += chunk);
|
|
487
|
+
res.on('end', () => {
|
|
488
|
+
try {
|
|
489
|
+
resolve(JSON.parse(body));
|
|
490
|
+
} catch (e) {
|
|
491
|
+
reject(new Error('Invalid response'));
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
}).on('error', reject);
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
if (!data.plugins) {
|
|
498
|
+
error('Failed to fetch versions');
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// Single plugin lookup
|
|
503
|
+
if (plugin) {
|
|
504
|
+
// Normalize: skunkcrm, crm, skunk-crm all -> skunkcrm
|
|
505
|
+
const slug = plugin.replace(/^skunk-?/, '').toLowerCase();
|
|
506
|
+
const fullSlug = `skunk${slug}`;
|
|
507
|
+
|
|
508
|
+
const info = data.plugins[fullSlug] || data.plugins[slug];
|
|
509
|
+
|
|
510
|
+
if (info) {
|
|
511
|
+
console.log(info.version);
|
|
512
|
+
} else {
|
|
513
|
+
error(`Unknown plugin: ${plugin}`);
|
|
514
|
+
console.log(`\n${colors.dim}Available: skunkcrm, skunkforms, skunkpages${colors.reset}`);
|
|
515
|
+
}
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// All plugins
|
|
520
|
+
console.log('');
|
|
521
|
+
for (const [slug, info] of Object.entries(data.plugins)) {
|
|
522
|
+
if (info.type === 'free') {
|
|
523
|
+
console.log(`${info.name}: ${colors.cyan}${info.version}${colors.reset}`);
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
console.log('');
|
|
527
|
+
|
|
528
|
+
} catch (e) {
|
|
529
|
+
error('Failed to fetch versions: ' + e.message);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
|
|
469
533
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
470
534
|
// Update
|
|
471
535
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
@@ -528,6 +592,8 @@ ${colors.bright}Usage:${colors.reset}
|
|
|
528
592
|
skunk available List available skills
|
|
529
593
|
skunk plugins List available plugins
|
|
530
594
|
skunk status Check plugin versions (+ compare if in WP site)
|
|
595
|
+
skunk versions Show latest versions of all plugins
|
|
596
|
+
skunk version <plugin> Show latest version of a specific plugin
|
|
531
597
|
skunk update Update CLI and refresh skills
|
|
532
598
|
skunk help Show this help
|
|
533
599
|
|