@chenmk/superflow 0.5.2 → 0.5.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/INSTALL.en.md CHANGED
@@ -8,7 +8,7 @@ aliases, scripts, rules, and handoff state for Claude Code and Codex.
8
8
  ## 1. Install
9
9
 
10
10
  ```bash
11
- npm install -g @chenmk/superflow
11
+ npx --yes --package=@chenmk/superflow@latest superflow-install
12
12
  ```
13
13
 
14
14
  > **Node.js requirement:** Node.js 20 or later is required. If `node -v` is older,
package/INSTALL.md CHANGED
@@ -43,7 +43,7 @@ docs -> design -> implement -> verify -> archive
43
43
  ### 2.1 npm 全局安装(推荐给普通用户)
44
44
 
45
45
  ```bash
46
- npm install -g @chenmk/superflow
46
+ npx --yes --package=@chenmk/superflow@latest superflow-install
47
47
  superflow --version
48
48
  ```
49
49
 
@@ -51,7 +51,7 @@ superflow --version
51
51
 
52
52
  ```bash
53
53
  npm config set registry https://registry.npmmirror.com
54
- npm install -g @chenmk/superflow
54
+ npx --yes --package=@chenmk/superflow@latest superflow-install
55
55
  ```
56
56
 
57
57
  ### 2.2 从源码安装(贡献者或本地调试)
@@ -669,7 +669,7 @@ superflow pipeline --agent codex
669
669
 
670
670
  | 场景 | 命令 |
671
671
  |------|------|
672
- | 安装 CLI | `npm install -g @chenmk/superflow` |
672
+ | 安装 CLI | `npx --yes --package=@chenmk/superflow@latest superflow-install` |
673
673
  | 初始化并选择工具 | `superflow init` |
674
674
  | 非交互初始化两侧 | `superflow init --yes` |
675
675
  | 检查健康 | `superflow doctor` |
package/README.md CHANGED
@@ -151,7 +151,7 @@ Each phase has a clear owner and an exit gate:
151
151
  ## Install
152
152
 
153
153
  ```bash
154
- npm install -g @chenmk/superflow
154
+ npx --yes --package=@chenmk/superflow@latest superflow-install
155
155
  ```
156
156
 
157
157
  > **Node.js requirement:** Node.js 20 or later is required. On an older runtime,
package/README.zh-CN.md CHANGED
@@ -100,7 +100,7 @@ docs -> design -> implement -> verify -> archive
100
100
  ## 安装
101
101
 
102
102
  ```bash
103
- npm install -g @chenmk/superflow
103
+ npx --yes --package=@chenmk/superflow@latest superflow-install
104
104
  # 或本地源码:
105
105
  # git clone https://github.com/.../superflow-cli && cd superflow-cli && bash install.sh
106
106
  ```
@@ -112,7 +112,7 @@ npm install -g @chenmk/superflow
112
112
  从源码执行 `bash install.sh` 时,会检测本机已有的 Codex、Claude,并一次完成
113
113
  CLI、Skills/Hooks 与对应托管 MCP 注册;安装后重启检测到的 Agent 即可。
114
114
 
115
- > **💡 装完即全局生效,无需逐项目 init**:`npm install -g @chenmk/superflow`(或 `bash install.sh`)会自动把 superflow hooks 注册到 `~/.claude/settings.json`(全局),**本机上所有项目仓库**都获得 superflow 守门。钩子内部靠 `.sdd-enforced` 标记懒激活(没跑 `superflow clarify` 之前所有钩子静默放行,零干扰)。
115
+ > **💡 装完即全局生效,无需逐项目 init**:`npx --yes --package=@chenmk/superflow@latest superflow-install`(或 `bash install.sh`)会自动把 superflow hooks 注册到 `~/.claude/settings.json`(全局),**本机上所有项目仓库**都获得 superflow 守门。钩子内部靠 `.sdd-enforced` 标记懒激活(没跑 `superflow clarify` 之前所有钩子静默放行,零干扰)。
116
116
  >
117
117
  > 只有需要项目级产物(OpenSpec change 目录 / `.sdd/` 任务文件 / 团队约定)时,才在项目根目录跑 `superflow init`。**绝大多数项目不需要这一步**——hooks 已经在全局生效了。
118
118
 
@@ -0,0 +1,68 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const { spawnSync } = require('child_process');
5
+ const { existsSync } = require('fs');
6
+ const { join } = require('path');
7
+
8
+ const NODE_MIN = 20;
9
+ const MAIN = '@chenmk/superflow@latest';
10
+ const NVM_URL = 'https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.7/install.sh';
11
+
12
+ function run(command, args, options) {
13
+ const result = spawnSync(command, args, { stdio: 'inherit', ...options });
14
+ if (result.error) throw result.error;
15
+ if (result.status !== 0) throw new Error(`${command} failed with ${result.status}`);
16
+ }
17
+
18
+ function major(version) {
19
+ const match = String(version || '').match(/^v?(\d+)/);
20
+ return match ? Number(match[1]) : 0;
21
+ }
22
+
23
+ function main() {
24
+ console.log('[Superflow] Starting one-command installation...');
25
+ if (major(process.version) >= NODE_MIN) {
26
+ run(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['install', '-g', MAIN,
27
+ '--registry', 'https://registry.npmjs.org']);
28
+ return;
29
+ }
30
+ if (process.platform === 'win32') {
31
+ run('winget', ['install', '--id', 'OpenJS.NodeJS', '--exact', '--source', 'winget',
32
+ '--accept-package-agreements', '--accept-source-agreements']);
33
+ const npm = join(process.env.ProgramFiles || 'C:\\Program Files', 'nodejs', 'npm.cmd');
34
+ if (!existsSync(npm)) throw new Error('Node installed; reopen terminal and rerun this command.');
35
+ run(npm, ['install', '-g', MAIN, '--registry', 'https://registry.npmjs.org']);
36
+ return;
37
+ }
38
+ const home = process.env.HOME;
39
+ if (!home) throw new Error('HOME is required to install Node.js.');
40
+ const nvm = process.env.NVM_DIR || join(home, '.nvm');
41
+ const script = [
42
+ 'set -e',
43
+ 'export NVM_DIR="$SUPERFLOW_NVM_DIR"',
44
+ 'if [ ! -s "$NVM_DIR/nvm.sh" ]; then',
45
+ ` curl -fsSL "${NVM_URL}" | bash`,
46
+ 'fi',
47
+ '. "$NVM_DIR/nvm.sh"',
48
+ `nvm use --delete-prefix 20 --silent || true`,
49
+ `nvm install `,
50
+ `nvm use --delete-prefix ${NODE_MIN}`,
51
+ `nvm alias default ${NODE_MIN}`,
52
+ `npm install -g "${MAIN}" --registry https://registry.npmjs.org`,
53
+ 'superflow --version',
54
+ ].join('\n');
55
+ run('bash', ['-lc', script], { env: { ...process.env, SUPERFLOW_NVM_DIR: nvm } });
56
+ }
57
+
58
+ if (require.main === module) {
59
+ try {
60
+ main();
61
+ console.log('[Superflow] Installation complete. Restart your terminal before using Superflow.');
62
+ } catch (error) {
63
+ console.error(`[Superflow] Installation failed: ${error.message}`);
64
+ process.exitCode = 1;
65
+ }
66
+
67
+ }
68
+ module.exports = { major };
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@chenmk/superflow-installer",
3
+ "version": "0.1.0",
4
+ "description": "One-command Node and Superflow installer",
5
+ "license": "MIT",
6
+ "main": "bin/superflow-installer.js",
7
+ "bin": {
8
+ "superflow-installer": "bin/superflow-installer.js"
9
+ },
10
+ "files": ["bin", "README.md"],
11
+ "engines": { "node": ">=14" },
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "registry": "https://registry.npmjs.org"
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chenmk/superflow",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "SuperBridge Flow workflow CLI for Claude Code and Codex",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -23,10 +23,12 @@
23
23
  },
24
24
  "bin": {
25
25
  "superflow": "dist/app/cli.js",
26
- "superflow-mcp": "dist/mcp/server.js"
26
+ "superflow-mcp": "dist/mcp/server.js",
27
+ "superflow-install": "installer/bin/superflow-installer.cjs"
27
28
  },
28
29
  "files": [
29
30
  "dist",
31
+ "installer",
30
32
  "scripts",
31
33
  "assets",
32
34
  "README.md",
@@ -40,7 +42,6 @@
40
42
  "prebuild": "npm run check:design-principles && npm run check:managed-design",
41
43
  "build": "node scripts/clean-dist.js && tsc && node scripts/ensure-bin-modes.js",
42
44
  "dev": "tsx watch src/cli/index.ts",
43
- "preinstall": "node scripts/preinstall.js",
44
45
  "postinstall": "node scripts/postinstall.js",
45
46
  "prepack": "npm run build",
46
47
  "prepublishOnly": "npm run release:check && npm test && npm run build",
@@ -23,12 +23,12 @@ export function buildNodeVersionMessage(version, language) {
23
23
  return [
24
24
  `[Superflow] 需要 Node.js ${MIN_NODE_MAJOR} 或更高版本,当前检测到 ${version}。`,
25
25
  '',
26
- '请先升级到 Node.js 20;Superflow 不会自动修改你的系统 Node。',
26
+ '请先升级到 Node.js 20;请改用一键安装器;它会自动安装并设定 Node.js 20。',
27
27
  '若已安装 nvm,请运行:',
28
28
  commands,
29
29
  '',
30
30
  '完成后重新打开终端,再运行:',
31
- ' npm install -g @chenmk/superflow',
31
+ ' npx --yes --package=@chenmk/superflow@latest superflow-install',
32
32
  '未安装 nvm 时,请用系统包管理器或 https://nodejs.org 安装 Node.js 20。',
33
33
  ].join('\n');
34
34
  }
@@ -36,12 +36,12 @@ export function buildNodeVersionMessage(version, language) {
36
36
  return [
37
37
  `[Superflow] Node.js ${MIN_NODE_MAJOR} or later is required; detected ${version}.`,
38
38
  '',
39
- 'Install Node.js 20 first. Superflow never changes your system Node automatically.',
39
+ 'Install Node.js 20 first. Use the one-command installer to install and set Node.js 20 automatically.',
40
40
  'If nvm is already installed, run:',
41
41
  commands,
42
42
  '',
43
43
  'Open a new terminal, then rerun:',
44
- ' npm install -g @chenmk/superflow',
44
+ ' npx --yes --package=@chenmk/superflow@latest superflow-install',
45
45
  'Without nvm, use your system package manager or https://nodejs.org to install Node.js 20.',
46
46
  ].join('\n');
47
47
  }