@skunkceo/cli 2.0.2 → 2.1.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.
Files changed (2) hide show
  1. package/bin/skunk.js +108 -0
  2. package/package.json +1 -1
package/bin/skunk.js CHANGED
@@ -66,6 +66,9 @@ switch (command) {
66
66
  case 'plugins':
67
67
  listPlugins();
68
68
  break;
69
+ case 'status':
70
+ checkStatus();
71
+ break;
69
72
  case 'update':
70
73
  handleUpdate();
71
74
  break;
@@ -359,6 +362,110 @@ Pro versions: skunk install plugin <name>-pro --license=XXXX${colors.reset}
359
362
  `);
360
363
  }
361
364
 
365
+ // ═══════════════════════════════════════════════════════════════════════════
366
+ // Status - Check plugin versions
367
+ // ═══════════════════════════════════════════════════════════════════════════
368
+
369
+ async function checkStatus() {
370
+ console.log('Checking plugin versions...\n');
371
+
372
+ // Fetch latest versions from API
373
+ const versionsUrl = 'https://skunkglobal.com/api/plugins/versions';
374
+
375
+ try {
376
+ const latestVersions = await new Promise((resolve, reject) => {
377
+ https.get(versionsUrl, { headers: { 'User-Agent': 'skunk-cli' } }, (res) => {
378
+ let data = '';
379
+ res.on('data', chunk => data += chunk);
380
+ res.on('end', () => {
381
+ try {
382
+ resolve(JSON.parse(data));
383
+ } catch (e) {
384
+ reject(new Error('Invalid response'));
385
+ }
386
+ });
387
+ }).on('error', reject);
388
+ });
389
+
390
+ if (!latestVersions.plugins) {
391
+ error('Failed to fetch version info');
392
+ return;
393
+ }
394
+
395
+ // Check if we're in a WordPress context (wp or studio available)
396
+ const hasWpCli = commandExists('wp');
397
+ const hasStudio = commandExists('studio');
398
+ const inWordPress = hasWpCli || hasStudio;
399
+
400
+ // Get installed versions if in WordPress context
401
+ let installedVersions = {};
402
+ if (inWordPress) {
403
+ try {
404
+ const cmd = hasStudio ? 'studio wp plugin list --format=json' : 'wp plugin list --format=json';
405
+ const output = execSync(cmd, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'ignore'] });
406
+ const plugins = JSON.parse(output);
407
+
408
+ for (const p of plugins) {
409
+ // Map WP plugin slugs to our slugs
410
+ if (p.name === 'skunk-crm' || p.name === 'skunkcrm') {
411
+ installedVersions['skunkcrm'] = p.version;
412
+ } else if (p.name === 'skunk-forms' || p.name === 'skunkforms') {
413
+ installedVersions['skunkforms'] = p.version;
414
+ } else if (p.name === 'skunk-pages' || p.name === 'skunkpages') {
415
+ installedVersions['skunkpages'] = p.version;
416
+ }
417
+ }
418
+ } catch (e) {
419
+ // Couldn't get installed versions, that's ok
420
+ }
421
+ }
422
+
423
+ console.log(`${colors.bright}Plugin${colors.reset} ${colors.bright}Latest${colors.reset} ${inWordPress ? `${colors.bright}Installed${colors.reset}` : ''}`);
424
+ console.log('─'.repeat(inWordPress ? 50 : 30));
425
+
426
+ // Show free plugins
427
+ for (const [slug, info] of Object.entries(latestVersions.plugins)) {
428
+ if (info.type === 'free') {
429
+ const installed = installedVersions[slug];
430
+ const latestV = info.version;
431
+
432
+ let status = '';
433
+ if (installed) {
434
+ if (installed === latestV) {
435
+ status = `${colors.green}${installed}${colors.reset} ✓`;
436
+ } else {
437
+ status = `${colors.yellow}${installed}${colors.reset} → ${latestV}`;
438
+ }
439
+ } else if (inWordPress) {
440
+ status = `${colors.dim}not installed${colors.reset}`;
441
+ }
442
+
443
+ const padding = ' '.repeat(Math.max(0, 16 - slug.length));
444
+ const vPadding = ' '.repeat(Math.max(0, 10 - latestV.length));
445
+ console.log(`${slug}${padding}${latestV}${vPadding}${status}`);
446
+ }
447
+ }
448
+
449
+ console.log('');
450
+
451
+ // Show if updates available
452
+ const hasUpdates = Object.entries(installedVersions).some(([slug, v]) => {
453
+ const latest = latestVersions.plugins[slug];
454
+ return latest && latest.version !== v;
455
+ });
456
+
457
+ if (hasUpdates) {
458
+ console.log(`${colors.yellow}Updates available!${colors.reset} Run:`);
459
+ console.log(` skunk install plugin <name>\n`);
460
+ } else if (Object.keys(installedVersions).length > 0) {
461
+ console.log(`${colors.green}All plugins up to date!${colors.reset}\n`);
462
+ }
463
+
464
+ } catch (e) {
465
+ error('Failed to check versions: ' + e.message);
466
+ }
467
+ }
468
+
362
469
  // ═══════════════════════════════════════════════════════════════════════════
363
470
  // Update
364
471
  // ═══════════════════════════════════════════════════════════════════════════
@@ -420,6 +527,7 @@ ${colors.bright}Usage:${colors.reset}
420
527
  skunk list List installed skills
421
528
  skunk available List available skills
422
529
  skunk plugins List available plugins
530
+ skunk status Check plugin versions (+ compare if in WP site)
423
531
  skunk update Update CLI and refresh skills
424
532
  skunk help Show this help
425
533
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skunkceo/cli",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "Install and manage Skunk Global skills and WordPress plugins",
5
5
  "bin": {
6
6
  "skunk": "./bin/skunk.js"