phewsh 0.12.1 → 0.12.2

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/README.md CHANGED
@@ -67,6 +67,7 @@ phewsh pull # Sync cloud to local
67
67
  phewsh mcp setup # Configure MCP server for agent connectivity
68
68
  phewsh mcp serve # Coordination bridge — route work to live agents
69
69
  phewsh receipts # Proof trail — what agents actually did, with evidence
70
+ phewsh update # Update phewsh to the latest version
70
71
  phewsh style # Build your style identity
71
72
  ```
72
73
 
package/bin/phewsh.js CHANGED
@@ -64,6 +64,7 @@ const COMMANDS = {
64
64
  watch: () => require('../commands/watch')(),
65
65
  mcp: () => require('../commands/mcp')(),
66
66
  receipts: () => require('../commands/receipts')(),
67
+ update: () => require('../commands/update')(),
67
68
  serve: () => require('../commands/serve')(),
68
69
  sequence: () => require('../commands/sequence')(),
69
70
  seq: () => require('../commands/sequence')(),
@@ -103,6 +104,7 @@ function showHelp() {
103
104
  console.log(` ${b(w('configure'))}`);
104
105
  console.log(` ${cyan('login')} ${g('Identity + API key + cloud sync')}`);
105
106
  console.log(` ${cyan('link')} ${g('Link local .intent/ to cloud project')}`);
107
+ console.log(` ${cyan('update')} ${g('Update phewsh to the latest version')}`);
106
108
  console.log('');
107
109
  console.log(` ${g('Works in: Claude Code · Cursor · ChatGPT · any MCP agent')}`);
108
110
  console.log(` ${g('No account needed. Account adds sync + sharing.')}`);
@@ -127,7 +129,7 @@ function checkForUpdates() {
127
129
  newer[2] > current[2];
128
130
  if (isNewer) {
129
131
  console.log(g(`\n Update available: ${pkg.version} → ${data.version}`));
130
- console.log(g(` Run: npm install -g phewsh\n`));
132
+ console.log(g(` Run: phewsh update\n`));
131
133
  }
132
134
  }
133
135
  })
@@ -0,0 +1,79 @@
1
+ // phewsh update — update the CLI to the latest published version.
2
+ //
3
+ // Usage:
4
+ // phewsh update Check npm and install the latest version
5
+ // phewsh update --check Just compare versions, don't install
6
+
7
+ const { spawn } = require('child_process');
8
+
9
+ const b = (s) => `\x1b[1m${s}\x1b[0m`;
10
+ const w = (s) => `\x1b[97m${s}\x1b[0m`;
11
+ const g = (s) => `\x1b[38;2;130;142;138m${s}\x1b[0m`;
12
+ const green = (s) => `\x1b[32m${s}\x1b[0m`;
13
+ const yellow = (s) => `\x1b[33m${s}\x1b[0m`;
14
+
15
+ function isNewer(latest, current) {
16
+ const l = latest.split('.').map(Number);
17
+ const c = current.split('.').map(Number);
18
+ return l[0] !== c[0] ? l[0] > c[0] : l[1] !== c[1] ? l[1] > c[1] : l[2] > c[2];
19
+ }
20
+
21
+ async function main() {
22
+ const checkOnly = process.argv.includes('--check');
23
+ const pkg = require('../package.json');
24
+
25
+ console.log('');
26
+ console.log(` ${b(w('phewsh update'))}`);
27
+ console.log('');
28
+ console.log(` ${g('current:')} v${pkg.version}`);
29
+
30
+ let latest;
31
+ try {
32
+ const res = await fetch(`https://registry.npmjs.org/${pkg.name}/latest`, {
33
+ signal: AbortSignal.timeout(5000),
34
+ });
35
+ latest = (await res.json()).version;
36
+ } catch {
37
+ console.log(` ${yellow('Could not reach the npm registry. Try again later.')}`);
38
+ console.log('');
39
+ return;
40
+ }
41
+ console.log(` ${g('latest: ')} v${latest}`);
42
+ console.log('');
43
+
44
+ if (!latest || !isNewer(latest, pkg.version)) {
45
+ console.log(` ${green('Already up to date.')}`);
46
+ console.log('');
47
+ return;
48
+ }
49
+
50
+ if (checkOnly) {
51
+ console.log(` ${w(`v${latest} available.`)} Run ${w('phewsh update')} to install.`);
52
+ console.log('');
53
+ return;
54
+ }
55
+
56
+ console.log(` ${g('Installing')} ${w(`phewsh@${latest}`)} ${g('via npm…')}`);
57
+ console.log('');
58
+
59
+ const child = spawn('npm', ['install', '-g', `${pkg.name}@latest`], { stdio: 'inherit' });
60
+ child.on('close', (code) => {
61
+ console.log('');
62
+ if (code === 0) {
63
+ console.log(` ${green('✓')} Updated to v${latest}. New shells pick it up immediately.`);
64
+ } else {
65
+ console.log(` ${yellow('Update failed')} (npm exited ${code}).`);
66
+ console.log(` ${g('If it was a permissions error, fix your npm prefix or run:')}`);
67
+ console.log(` ${w(`sudo npm install -g ${pkg.name}@latest`)}`);
68
+ }
69
+ console.log('');
70
+ process.exit(code ?? 0);
71
+ });
72
+ child.on('error', (err) => {
73
+ console.log(` ${yellow('Could not run npm:')} ${err.message}`);
74
+ console.log('');
75
+ process.exit(1);
76
+ });
77
+ }
78
+
79
+ module.exports = main;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phewsh",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "description": "Turn intent into action. Structure your thinking, execute your next step.",
5
5
  "bin": {
6
6
  "phewsh": "bin/phewsh.js"