@flowe-ai/cli 0.1.3 → 0.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowe-ai/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Neural resets for engineers using AI coding assistants.",
5
5
  "license": "MIT",
6
6
  "author": "flowe.ai",
@@ -34,6 +34,7 @@
34
34
  "dist/",
35
35
  "audio/",
36
36
  "scripts/preinstall.js",
37
+ "scripts/postinstall.js",
37
38
  "protocols.json",
38
39
  "README.md",
39
40
  "LICENSE"
@@ -45,6 +46,7 @@
45
46
  },
46
47
  "scripts": {
47
48
  "preinstall": "node scripts/preinstall.js",
49
+ "postinstall": "node scripts/postinstall.js",
48
50
  "build": "tsup",
49
51
  "dev": "tsx src/cli.ts",
50
52
  "flowe": "tsx src/cli.ts",
@@ -0,0 +1,52 @@
1
+ // flowe-cli postinstall.
2
+ // Runs after the install completes. Prints next steps so the user
3
+ // isn't dropped at a blinking prompt with no idea what to do next.
4
+ // Skipped during dev installs in the source tree (same heuristic as
5
+ // preinstall) so contributors don't see the welcome banner on every
6
+ // `pnpm install`.
7
+
8
+ import { existsSync } from 'node:fs';
9
+ import { join } from 'node:path';
10
+
11
+ function isDevTreeInstall(cwd) {
12
+ const segments = cwd.split(/[\\/]/);
13
+ if (segments.includes('node_modules')) return false;
14
+ return (
15
+ existsSync(join(cwd, 'pnpm-lock.yaml')) ||
16
+ existsSync(join(cwd, 'package-lock.json')) ||
17
+ existsSync(join(cwd, 'yarn.lock'))
18
+ );
19
+ }
20
+
21
+ export function buildGreeting() {
22
+ return [
23
+ '',
24
+ 'flowe-cli installed.',
25
+ '',
26
+ 'Try it:',
27
+ ' flowe reset interactive picker (pick duration + protocol)',
28
+ ' flowe reset 60 quick 60-second reset, random protocol',
29
+ ' flowe protocols list all 12 protocols',
30
+ '',
31
+ 'Docs: https://cli.flowe.ai/docs/',
32
+ '',
33
+ ].join('\n');
34
+ }
35
+
36
+ import { pathToFileURL } from 'node:url';
37
+
38
+ const invokedDirectly =
39
+ typeof process.argv[1] === 'string' &&
40
+ process.argv[1].length > 0 &&
41
+ import.meta.url === pathToFileURL(process.argv[1]).href;
42
+
43
+ if (invokedDirectly) {
44
+ try {
45
+ if (isDevTreeInstall(process.cwd())) {
46
+ process.exit(0);
47
+ }
48
+ process.stdout.write(buildGreeting());
49
+ } catch {
50
+ // Never let the welcome message break a real install.
51
+ }
52
+ }