@chenmk/superflow 0.5.0 → 0.5.1

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/INSTALL.en.md CHANGED
@@ -11,6 +11,10 @@ aliases, scripts, rules, and handoff state for Claude Code and Codex.
11
11
  npm install -g @chenmk/superflow
12
12
  ```
13
13
 
14
+ > **Node.js requirement:** Node.js 20 or later is required. If `node -v` is older,
15
+ > installation stops before command aliases are created. With nvm, run
16
+ > `nvm install 22 && nvm use 22 && nvm alias default 22`, open a new terminal, and reinstall.
17
+
14
18
  The repository `install.sh` and `install.ps1` scripts detect the Codex/Claude
15
19
  Hosts actually installed and register their managed MCP entries together with
16
20
  CLI, Skills, and Hooks. Single and non-default Host combinations are not forced
package/INSTALL.md CHANGED
@@ -28,6 +28,9 @@ docs -> design -> implement -> verify -> archive
28
28
  | Shell | macOS/Linux 原生 shell;Windows 使用 Git Bash 或兼容 shell | `bash --version` |
29
29
  | Python | hook 中的 Python 脚本需要 | `python3 --version` |
30
30
 
31
+ > **Node 版本不足:** 安装会在创建命令前停止。若已安装 nvm,运行
32
+ > `nvm install 22 && nvm use 22 && nvm alias default 22`,重新打开终端后再安装。
33
+
31
34
  支持系统:
32
35
 
33
36
  - macOS 10.15+
package/README.md CHANGED
@@ -154,6 +154,9 @@ Each phase has a clear owner and an exit gate:
154
154
  npm install -g @chenmk/superflow
155
155
  ```
156
156
 
157
+ > **Node.js requirement:** Node.js 20 or later is required. On an older runtime,
158
+ > installation stops before command aliases are created and prints Node 22 upgrade instructions.
159
+
157
160
  For a source checkout, `bash install.sh` detects installed Codex, Claude, and
158
161
  Codex and Claude Hosts and installs CLI, Skills/Hooks, and their managed MCP registrations
159
162
  in one pass. Restart the detected Hosts afterwards.
package/README.zh-CN.md CHANGED
@@ -105,6 +105,8 @@ npm install -g @chenmk/superflow
105
105
  # git clone https://github.com/.../superflow-cli && cd superflow-cli && bash install.sh
106
106
  ```
107
107
 
108
+ > **Node.js 要求:** 需要 Node.js 20+。版本不足时,安装会在创建命令前停止,并打印 Node 22 的升级和重装指引。
109
+
108
110
  完整安装、初始化和日常使用教程见 [INSTALL.md](./INSTALL.md)。
109
111
 
110
112
  从源码执行 `bash install.sh` 时,会检测本机已有的 Codex、Claude,并一次完成
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chenmk/superflow",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "SuperBridge Flow workflow CLI for Claude Code and Codex",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -40,6 +40,7 @@
40
40
  "prebuild": "npm run check:design-principles && npm run check:managed-design",
41
41
  "build": "node scripts/clean-dist.js && tsc && node scripts/ensure-bin-modes.js",
42
42
  "dev": "tsx watch src/cli/index.ts",
43
+ "preinstall": "node scripts/preinstall.js",
43
44
  "postinstall": "node scripts/postinstall.js",
44
45
  "prepack": "npm run build",
45
46
  "prepublishOnly": "npm run release:check && npm test && npm run build",
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ import { resolveInstallLanguage } from './postinstall.js';
3
+
4
+ const MIN_NODE_MAJOR = 20;
5
+
6
+ export function nodeMajor(version) {
7
+ const match = String(version).match(/^v?(\d+)/);
8
+ return match ? Number.parseInt(match[1], 10) : 0;
9
+ }
10
+
11
+ export function isSupportedNode(version) {
12
+ return nodeMajor(version) >= MIN_NODE_MAJOR;
13
+ }
14
+
15
+ export function buildNodeVersionMessage(version, language) {
16
+ const commands = [
17
+ ' nvm install 22',
18
+ ' nvm use 22',
19
+ ' nvm alias default 22',
20
+ ].join('\n');
21
+
22
+ if (language === 'zh') {
23
+ return [
24
+ `[Superflow] 需要 Node.js ${MIN_NODE_MAJOR} 或更高版本,当前检测到 ${version}。`,
25
+ '',
26
+ '请先升级到 Node.js 22 LTS;Superflow 不会自动修改你的系统 Node。',
27
+ '若已安装 nvm,请运行:',
28
+ commands,
29
+ '',
30
+ '完成后重新打开终端,再运行:',
31
+ ' npm install -g @chenmk/superflow',
32
+ '未安装 nvm 时,请用系统包管理器或 https://nodejs.org 安装 Node.js 22 LTS。',
33
+ ].join('\n');
34
+ }
35
+
36
+ return [
37
+ `[Superflow] Node.js ${MIN_NODE_MAJOR} or later is required; detected ${version}.`,
38
+ '',
39
+ 'Install Node.js 22 LTS first. Superflow never changes your system Node automatically.',
40
+ 'If nvm is already installed, run:',
41
+ commands,
42
+ '',
43
+ 'Open a new terminal, then rerun:',
44
+ ' npm install -g @chenmk/superflow',
45
+ 'Without nvm, use your system package manager or https://nodejs.org to install Node.js 22 LTS.',
46
+ ].join('\n');
47
+ }
48
+
49
+ export function runPreinstall(version = process.versions.node, env = process.env) {
50
+ if (isSupportedNode(version)) return 0;
51
+ const language = resolveInstallLanguage(env);
52
+ console.error(buildNodeVersionMessage(version, language));
53
+ return 1;
54
+ }
55
+
56
+ const exitCode = runPreinstall();
57
+ if (exitCode !== 0) process.exitCode = exitCode;