phewsh 0.15.20 → 0.15.22

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/phewsh.js CHANGED
@@ -74,6 +74,8 @@ const COMMANDS = {
74
74
  seq: () => require('../commands/sequence')(),
75
75
  ambient: () => require('../commands/ambient')(),
76
76
  hook: () => require('../commands/hook')(),
77
+ welcome: () => require('../commands/welcome')(),
78
+ intro: () => require('../commands/welcome')(),
77
79
  help: showHelp,
78
80
  version: showVersion,
79
81
  };
@@ -158,10 +160,23 @@ function exitAfterUpdate(code = 0) {
158
160
  setTimeout(() => process.exit(code), 2000);
159
161
  }
160
162
 
163
+ async function maybeFirstRunIntro() {
164
+ // First ever run → play the intro once, then never again. Marker, not config,
165
+ // so it's independent of login state. Never blocks the session on failure.
166
+ try {
167
+ const fs = require('fs'), path = require('path'), os = require('os');
168
+ const marker = path.join(os.homedir(), '.phewsh', '.welcomed');
169
+ if (fs.existsSync(marker)) return;
170
+ if (process.stdout.isTTY) await require('../lib/intro').playIntro();
171
+ fs.mkdirSync(path.dirname(marker), { recursive: true });
172
+ fs.writeFileSync(marker, new Date().toISOString());
173
+ } catch { /* the intro is a nicety — never let it block the session */ }
174
+ }
175
+
161
176
  if (!command) {
162
- // Bare `phewsh` — always drop into persistent session
177
+ // Bare `phewsh` — first run gets the intro, then drop into the session.
163
178
  // Session handles missing API key gracefully with /login and /key commands
164
- COMMANDS.session();
179
+ maybeFirstRunIntro().then(() => COMMANDS.session());
165
180
  } else if (command === 'help' || command === '--help' || command === '-h') {
166
181
  showHelp();
167
182
  exitAfterUpdate(0);
@@ -0,0 +1,4 @@
1
+ // phewsh welcome — the first-impression intro. Replayable any time.
2
+ const { playIntro } = require('../lib/intro');
3
+
4
+ module.exports = () => playIntro();
package/lib/intro.js ADDED
@@ -0,0 +1,83 @@
1
+ // The first impression. A staggered, terminal-safe reveal: the mark, the
2
+ // promise, then the magic moment — phewsh scans the machine and your installed
3
+ // AI tools light up one by one. That last beat IS the value prop: "it already
4
+ // works with everything you have."
5
+ //
6
+ // Safe by construction: line-by-line printing only, no cursor-up rewrites
7
+ // (Apple Terminal hazard). Non-TTY / piped → everything prints instantly.
8
+ // Timing + harness list + output are injectable so the sequence is testable.
9
+
10
+ const ui = require('./ui');
11
+
12
+ // The exhale mark (😮‍💨) — rasterized from assets/phew.svg to a 30×14 grid
13
+ // once, baked here so there's no runtime cost. It draws in row by row.
14
+ const FACE = [
15
+ ' ███ ██ ███',
16
+ ' █ █',
17
+ ' █ █',
18
+ ' █ █ █ █',
19
+ ' █ ██ ██ █',
20
+ '█ █ █ █',
21
+ '█ █████ █████ █',
22
+ '█ █',
23
+ '█ █',
24
+ ' █ ██ ██ █ █ █',
25
+ ' ██ █ █ █',
26
+ ' █ █ ██ █',
27
+ ' ███ ███ █',
28
+ ' ███ ███',
29
+ ];
30
+
31
+ const LOGO = ['█▀█ █░█ █▀▀ █░█ █▀ █░█', '█▀▀ █▀█ ██▄ ▀▄▀ ▄█ █▀█'];
32
+
33
+ function sleep(ms) { return new Promise((r) => setTimeout(r, ms)); }
34
+
35
+ async function playIntro(opts = {}) {
36
+ const {
37
+ animated = !!process.stdout.isTTY,
38
+ delay = sleep,
39
+ out = console.log,
40
+ listHarnesses = require('./harnesses').listHarnesses,
41
+ } = opts;
42
+
43
+ const { b, cream, sage, slate, teal, green } = ui;
44
+ const pause = async (ms) => { if (animated) await delay(ms); };
45
+
46
+ out('');
47
+ for (const line of FACE) { out(` ${cream(line)}`); await pause(55); }
48
+ await pause(160);
49
+ out('');
50
+ for (const line of LOGO) { out(` ${b(cream(line))}`); await pause(90); }
51
+ await pause(140);
52
+ out(` ${sage('Keep all your AI tools.')} ${cream('phewsh is the one memory they share.')}`);
53
+ out('');
54
+ await pause(260);
55
+
56
+ // The magic beat: discover the tools already on this machine.
57
+ out(` ${slate('scanning your machine for AI tools…')}`);
58
+ await pause(320);
59
+
60
+ let harnesses = [];
61
+ try { harnesses = listHarnesses().filter((h) => h.installed); } catch { /* none */ }
62
+
63
+ if (harnesses.length === 0) {
64
+ out(` ${slate('· none found yet — install Claude Code, Codex, or Gemini and phewsh picks it up.')}`);
65
+ } else {
66
+ for (const h of harnesses) {
67
+ out(` ${green('✓')} ${cream(h.label.padEnd(14))} ${sage(h.role || '')}`);
68
+ await pause(130);
69
+ }
70
+ await pause(160);
71
+ out('');
72
+ const n = harnesses.length;
73
+ out(` ${teal('●')} ${sage(`Found ${n} tool${n !== 1 ? 's' : ''} — they'll all share one memory now.`)}`);
74
+ }
75
+ out('');
76
+ await pause(160);
77
+ out(` ${sage('Next:')} ${cream('just type to start')} ${slate('·')} ${cream('phewsh setup')} ${slate('to pick a default route')}`);
78
+ out('');
79
+
80
+ return { toolsFound: harnesses.length };
81
+ }
82
+
83
+ module.exports = { playIntro, LOGO, FACE };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "phewsh",
3
- "version": "0.15.20",
3
+ "version": "0.15.22",
4
4
  "description": "Turn intent into action. Structure your thinking, execute your next step.",
5
5
  "bin": {
6
6
  "phewsh": "bin/phewsh.js"