cskit-cli 1.0.28 → 1.0.29

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/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "cskit-cli",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Content Suite Kit CLI - Download and manage CSK skills from private repository",
5
5
  "main": "src/index.js",
6
6
  "bin": {
7
7
  "cskit": "bin/csk.js"
8
8
  },
9
9
  "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1"
10
+ "test": "echo \"Error: no test specified\" && exit 1",
11
+ "postinstall": "node src/postinstall.js"
11
12
  },
12
13
  "keywords": [
13
14
  "claude",
@@ -45,6 +46,7 @@
45
46
  "files": [
46
47
  "bin",
47
48
  "src",
48
- "README.md"
49
+ "README.md",
50
+ "postinstall.js"
49
51
  ]
50
52
  }
@@ -4,6 +4,7 @@
4
4
  * Update Command
5
5
  *
6
6
  * Updates the CSK CLI tool itself to latest version.
7
+ * Shows clear version comparison before and after update.
7
8
  */
8
9
 
9
10
  const chalk = require('chalk');
@@ -11,15 +12,33 @@ const ora = require('ora');
11
12
  const { execSync } = require('child_process');
12
13
  const pkg = require('../../package.json');
13
14
 
15
+ /**
16
+ * Compare semantic versions
17
+ * @returns -1 if a < b, 0 if equal, 1 if a > b
18
+ */
19
+ function compareVersions(a, b) {
20
+ const partsA = a.replace(/^v/, '').split('.').map(Number);
21
+ const partsB = b.replace(/^v/, '').split('.').map(Number);
22
+ for (let i = 0; i < 3; i++) {
23
+ if (partsA[i] > partsB[i]) return 1;
24
+ if (partsA[i] < partsB[i]) return -1;
25
+ }
26
+ return 0;
27
+ }
28
+
14
29
  /**
15
30
  * Main update command handler
16
31
  */
17
32
  async function updateCommand() {
18
33
  console.log(chalk.cyan('\n CSK CLI - Update\n'));
19
34
 
20
- console.log(chalk.dim(` Current version: v${pkg.version}\n`));
35
+ const currentVersion = pkg.version;
36
+
37
+ // Show version info box
38
+ console.log(chalk.dim(' ┌─────────────────────────────────────┐'));
39
+ console.log(chalk.dim(' │') + ` Current version: ${chalk.yellow('v' + currentVersion)}`.padEnd(46) + chalk.dim('│'));
21
40
 
22
- const spinner = ora('Checking for updates...').start();
41
+ const spinner = ora({ text: 'Checking npm registry...', indent: 2 }).start();
23
42
 
24
43
  try {
25
44
  // Get latest version from npm
@@ -28,29 +47,53 @@ async function updateCommand() {
28
47
  stdio: ['pipe', 'pipe', 'pipe']
29
48
  }).trim();
30
49
 
31
- if (latestVersion === pkg.version) {
32
- spinner.succeed(chalk.green('Already on latest version'));
50
+ spinner.stop();
51
+ console.log(chalk.dim(' │') + ` Latest version: ${chalk.green('v' + latestVersion)}`.padEnd(46) + chalk.dim('│'));
52
+ console.log(chalk.dim(' └─────────────────────────────────────┘\n'));
53
+
54
+ const comparison = compareVersions(currentVersion, latestVersion);
55
+
56
+ if (comparison === 0) {
57
+ console.log(chalk.green(' ✓ Already on latest version\n'));
33
58
  return;
34
59
  }
35
60
 
36
- spinner.text = `Updating to v${latestVersion}...`;
61
+ if (comparison > 0) {
62
+ console.log(chalk.yellow(' ⚠ Local version is newer than npm (dev build?)\n'));
63
+ return;
64
+ }
65
+
66
+ // Need update
67
+ console.log(chalk.cyan(` Updating v${currentVersion} → v${latestVersion}...\n`));
68
+
69
+ const updateSpinner = ora({ text: 'Installing update...', indent: 2 }).start();
37
70
 
38
- // Run npm update
71
+ // Run npm update (hide npm output)
39
72
  execSync('npm install -g cskit-cli@latest', {
40
- stdio: ['pipe', 'pipe', 'pipe']
73
+ stdio: 'ignore' // Hide npm noise
41
74
  });
42
75
 
43
- spinner.succeed(chalk.green(`Updated to v${latestVersion}`));
76
+ updateSpinner.succeed(chalk.green('Update complete'));
77
+
78
+ // Show summary
79
+ console.log('');
80
+ console.log(chalk.dim(' ┌─────────────────────────────────────┐'));
81
+ console.log(chalk.dim(' │') + ` ${chalk.red('v' + currentVersion)} → ${chalk.green('v' + latestVersion)}`.padEnd(55) + chalk.dim('│'));
82
+ console.log(chalk.dim(' └─────────────────────────────────────┘'));
83
+ console.log(chalk.dim('\n Run `cskit init` to update project files.\n'));
44
84
 
45
- console.log(chalk.dim('\n Run `csk init` to update project files.\n'));
46
85
  } catch (error) {
47
- if (error.message.includes('npm view')) {
48
- spinner.fail(chalk.red('Could not check for updates'));
49
- console.log(chalk.dim('\n Package may not be published yet.\n'));
86
+ spinner.stop();
87
+ console.log(chalk.dim(' │') + ` Latest version: ${chalk.red('(unavailable)')}`.padEnd(46) + chalk.dim('│'));
88
+ console.log(chalk.dim(' └─────────────────────────────────────┘\n'));
89
+
90
+ if (error.message.includes('npm view') || error.message.includes('404')) {
91
+ console.log(chalk.red(' ✗ Could not check for updates'));
92
+ console.log(chalk.dim(' Package may not be published yet.\n'));
50
93
  } else {
51
- spinner.fail(chalk.red('Update failed'));
52
- console.log(chalk.dim(`\n ${error.message}`));
53
- console.log(chalk.dim('\n Try manually: npm install -g cskit-cli@latest\n'));
94
+ console.log(chalk.red('Update failed'));
95
+ console.log(chalk.dim(` ${error.message}`));
96
+ console.log(chalk.dim('\n Try manually: npm install -g cskit-cli@latest\n'));
54
97
  }
55
98
  }
56
99
  }
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * Postinstall script - shows welcome message after npm install
6
+ */
7
+
8
+ const pkg = require('../package.json');
9
+
10
+ // Simple colors without requiring chalk (postinstall runs before deps ready)
11
+ const cyan = (s) => `\x1b[36m${s}\x1b[0m`;
12
+ const green = (s) => `\x1b[32m${s}\x1b[0m`;
13
+ const dim = (s) => `\x1b[2m${s}\x1b[0m`;
14
+ const bold = (s) => `\x1b[1m${s}\x1b[0m`;
15
+
16
+ console.log('');
17
+ console.log(cyan(' ┌─────────────────────────────────────────────────┐'));
18
+ console.log(cyan(' │') + bold(' CSK CLI - Content Suite Kit ') + cyan('│'));
19
+ console.log(cyan(' └─────────────────────────────────────────────────┘'));
20
+ console.log('');
21
+ console.log(` ${green('✓')} Installed ${bold('cskit-cli')} v${pkg.version}`);
22
+ console.log('');
23
+ console.log(dim(' Quick Start:'));
24
+ console.log(` ${bold('cskit auth')} - Login with GitHub`);
25
+ console.log(` ${bold('cskit init')} - Initialize project with skills`);
26
+ console.log(` ${bold('cskit update')} - Update CLI to latest version`);
27
+ console.log('');
28
+ console.log(dim(` Docs: ${pkg.homepage}`));
29
+ console.log('');