cnagent 2.0.3 → 2.0.4

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/cn +15 -1
  2. package/package.json +1 -1
package/bin/cn CHANGED
@@ -11,7 +11,7 @@ const { execSync, spawn } = require('child_process');
11
11
  const path = require('path');
12
12
  const fs = require('fs');
13
13
 
14
- const VERSION = '2.0.3';
14
+ const VERSION = '2.0.4';
15
15
 
16
16
  // Colors (respects NO_COLOR)
17
17
  const noColor = process.env.NO_COLOR !== undefined;
@@ -44,6 +44,7 @@ Commands:
44
44
  flush Execute decisions
45
45
  peer Manage peers
46
46
  doctor Check system health
47
+ update Update cn to latest version
47
48
 
48
49
  Aliases:
49
50
  i = inbox, s = status, d = doctor
@@ -241,6 +242,19 @@ if (command === 'init') {
241
242
  process.exit(1);
242
243
  }
243
244
 
245
+ if (command === 'update') {
246
+ info('Updating cnagent...');
247
+ try {
248
+ execSync('npm install -g cnagent@latest', { stdio: 'inherit' });
249
+ ok('Updated to latest version.');
250
+ execSync('cn --version', { stdio: 'inherit' });
251
+ } catch (e) {
252
+ fail('Update failed. Try: npm install -g cnagent@latest');
253
+ process.exit(1);
254
+ }
255
+ process.exit(0);
256
+ }
257
+
244
258
  // Find hub
245
259
  const hubPath = findHubPath();
246
260
  if (!hubPath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnagent",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "Coherent Network agent CLI — everything runs through cn",
5
5
  "keywords": [
6
6
  "cn-agent",