@tedbrain/vlink 0.1.159 → 0.1.160

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
@@ -9,20 +9,25 @@ npx --registry=https://registry.npmmirror.com -y @tedbrain/vlink@latest install
9
9
 
10
10
  npm 包只注册 `vlink-install` 命令;`vlink` 命令由安装后的原生程序提供。
11
11
  `npx` 会自动选择包中唯一的命令入口,因此上面的安装命令保持不变。
12
- 全局安装 npm 包只会注册 `vlink-install`;Windows 下 npm 会生成
12
+ 全局安装 npm 包会注册 `vlink-install`;Windows 下 npm 会生成
13
13
  `vlink-install`、`vlink-install.cmd`、`vlink-install.ps1` 三个入口。
14
- 通过全局 npm 包安装原生程序时,执行:
14
+ 升级到原生程序只需一条命令:
15
15
 
16
16
  ```bash
17
17
  npm install -g @tedbrain/vlink@latest --registry=https://registry.npmmirror.com
18
- vlink-install install
19
18
  ```
20
19
 
21
- 该命令会识别平台和架构,始终安装与当前 npm 包版本一致的 vlink,配置用户
22
- PATH,并启动 `vlink setup tedbrain`。如果 PATH 中已有原生 vlink,会优先更新该位置;
23
- 旧文件或目录不可写时,自动回退到用户安装目录(Unix 为 `~/.local/bin`,Windows 为
24
- `%LOCALAPPDATA%\TedBrain\bin`),保留原来的共享安装。显式设置 `VLINK_INSTALL_DIR`
25
- 时始终使用该目录,写入失败会报错,不会再改装到其他位置。
20
+ `npm_config_global=true` 时,包内 `postinstall` 除下载二进制外,会像
21
+ `vlink-install install` 一样把它原子安装到用户安装目录、停掉旧 daemon 并
22
+ 配置用户 PATH;它不会启动交互式的 `vlink setup tedbrain`。如果 PATH 中已有
23
+ 原生 vlink,会优先更新该位置;旧文件或目录不可写时,自动回退到用户安装目录
24
+ (Unix 为 `~/.local/bin`,Windows 为 `%LOCALAPPDATA%\TedBrain\bin`),保留原来
25
+ 的共享安装。显式设置 `VLINK_INSTALL_DIR` 时始终使用该目录,写入失败会报错,
26
+ 不会再改装到其他位置。
27
+
28
+ 需要交互式 setup 或 `--no-setup` / `--web` / `--verbose` 选项时,仍可执行
29
+ `vlink-install install`。在 CI 或不允许 postinstall 触碰用户目录/daemon 的
30
+ 环境里,设置 `VLINK_NPM_GLOBAL_INSTALL=0` 让全局 `postinstall` 只下载二进制。
26
31
 
27
32
  安装目录会优先加入当前安装进程的 PATH,补全和 setup 均使用新二进制的绝对路径。
28
33
  默认目录还会写入 shell 配置或 Windows 用户 PATH;自定义 Unix 目录需要自行配置
package/binaries.json CHANGED
@@ -1,40 +1,40 @@
1
1
  {
2
- "version": "0.1.159",
2
+ "version": "0.1.160",
3
3
  "binaries": {
4
4
  "linux-x86_64": {
5
- "url": "https://cloud.tsinghua.edu.cn/f/16e5a8f3c8b74048b537/?dl=1",
6
- "sha256": "c3e32724ce1af7dedf93f9290043ebcd9d3a18903c7e402bd6f7e607c3cd6208",
7
- "size": 24807805
5
+ "url": "https://cloud.tsinghua.edu.cn/f/e0fa60e0b68f4d2f88e3/?dl=1",
6
+ "sha256": "e1f5cb23e28da74a9f9a7962d2e880fd7f57d3171b5cb7c9edef9e5cbbe91eb8",
7
+ "size": 24803709
8
8
  },
9
9
  "linux-x86_64-glibc2.17": {
10
- "url": "https://cloud.tsinghua.edu.cn/f/ac7c1329616746eba8fd/?dl=1",
11
- "sha256": "dc654f8ca507bcc9b96a59bfb7d88973b98d980d1c920a911483933152c65d3d",
12
- "size": 25530233
10
+ "url": "https://cloud.tsinghua.edu.cn/f/729d55a84fb54d239f2f/?dl=1",
11
+ "sha256": "02d68d969eadd3757e771974c974b533ae571230e10addfcd0409b9a26c3a539",
12
+ "size": 25526985
13
13
  },
14
14
  "linux-aarch64": {
15
- "url": "https://cloud.tsinghua.edu.cn/f/3c23abe92a4f47b29655/?dl=1",
16
- "sha256": "51eca4ee6eeb6523ed3faa2368c0ecb4deb75120967429048716ffef510d2d71",
15
+ "url": "https://cloud.tsinghua.edu.cn/f/f913297b974f475b8535/?dl=1",
16
+ "sha256": "edfb9470a416046b352cc95f062daf40915d0263f18b46767d6eefd85d950ef3",
17
17
  "size": 21113765
18
18
  },
19
19
  "macos-x86_64": {
20
- "url": "https://cloud.tsinghua.edu.cn/f/c16b789421bb43158c31/?dl=1",
21
- "sha256": "5ace58e9ece6fcfa516b707f42148dadf374aeab2c91895163039fd55f98df31",
22
- "size": 22185681
20
+ "url": "https://cloud.tsinghua.edu.cn/f/1bf74767cf074d24a149/?dl=1",
21
+ "sha256": "2789f0e2f9fdc3884aef92fff9824490e52f75029c7acd04ae0f3cd7be0a7549",
22
+ "size": 22181593
23
23
  },
24
24
  "macos-aarch64": {
25
- "url": "https://cloud.tsinghua.edu.cn/f/19684ff1be334669b9d2/?dl=1",
26
- "sha256": "6edc731e483665bdbfc5ba37895602545438ce091377e8889c90cbcdeae1d532",
27
- "size": 17972805
25
+ "url": "https://cloud.tsinghua.edu.cn/f/824b1cf060ff4d548054/?dl=1",
26
+ "sha256": "127e180ba53d4033a7543d97e1e5df81b6c7c2dac6ad123d8f6b777e28fbdd48",
27
+ "size": 17956309
28
28
  },
29
29
  "windows-x86_64.exe": {
30
- "url": "https://cloud.tsinghua.edu.cn/f/d96c4e4c15274312ab31/?dl=1",
31
- "sha256": "757af31917c2759262cc3b8ff9ce9024c0ecf1dc33092fed7eb888499d76166d",
32
- "size": 9745701
30
+ "url": "https://cloud.tsinghua.edu.cn/f/2ee4076c15ee4af4a1c3/?dl=1",
31
+ "sha256": "529795cb23428b70de94f2256b6c2a620c2d662e8f6e1edcaad043346d699ea9",
32
+ "size": 9742629
33
33
  },
34
34
  "windows-aarch64.exe": {
35
- "url": "https://cloud.tsinghua.edu.cn/f/29c9276c37e149349044/?dl=1",
36
- "sha256": "7b2504ef6e7e699e03f085f57977398e0637682be13633bf5a72564d7ef8cc69",
37
- "size": 11226409
35
+ "url": "https://cloud.tsinghua.edu.cn/f/78af63aa46ad4fd69395/?dl=1",
36
+ "sha256": "2915213f17f874cde721f288c8875c2e78b2bd05310c974088ef07e50d72d049",
37
+ "size": 11224361
38
38
  }
39
39
  }
40
40
  }
package/install.js CHANGED
@@ -611,6 +611,48 @@ async function ensureBinary(options = {}) {
611
611
  throw new VlinkInstallError(`all download sources failed: ${lastError.message}`);
612
612
  }
613
613
 
614
+ // `npm i -g @tedbrain/vlink` must be the only step a user needs. npm runs this
615
+ // file as the global postinstall, but the package's own `vlink-install` bin is
616
+ // not on PATH, so download-only would leave no `vlink` command behind. When
617
+ // npm reports a global install, hand over to the installer: it atomically
618
+ // places the binary in the user install directory, stops the previous daemon
619
+ // and updates PATH, exactly like `vlink-install install` does.
620
+ function globalInstallRequested(env = process.env) {
621
+ return ['1', 'true', 'yes', 'on'].includes(
622
+ String(env.npm_config_global || '').toLowerCase()
623
+ );
624
+ }
625
+
626
+ function globalInstallDisabled(env = process.env) {
627
+ return ['0', 'false', 'no', 'off'].includes(
628
+ String(env.VLINK_NPM_GLOBAL_INSTALL || '').toLowerCase()
629
+ );
630
+ }
631
+
632
+ async function runPostinstall(options = {}) {
633
+ const env = options.env || process.env;
634
+ const output = options.output || process.stderr;
635
+ const globalInstall =
636
+ options.globalInstall === undefined
637
+ ? globalInstallRequested(env) && !globalInstallDisabled(env)
638
+ : options.globalInstall === true;
639
+ if (globalInstall) {
640
+ // Installer setup is interactive; npm postinstall has no terminal. The
641
+ // explicit `vlink-install install` / `vlink setup tedbrain` path still
642
+ // offers the wizard and its --no-setup/--web flags.
643
+ const runInstaller =
644
+ options.runInstaller || require('./installer').runInstaller;
645
+ const result = await runInstaller({ env, output, skipSetup: true });
646
+ output.write(`[vlink] installed ${result.vlinkPath}\n`);
647
+ return { global: true, ...result };
648
+ }
649
+ const ensure = options.ensureBinary || ensureBinary;
650
+ const binaryPath = await ensure();
651
+ cleanupLegacyNpmShims();
652
+ output.write(`[vlink] installed ${binaryPath}\n`);
653
+ return { global: false, binaryPath };
654
+ }
655
+
614
656
  module.exports = {
615
657
  VlinkInstallError,
616
658
  VERSION,
@@ -631,17 +673,15 @@ module.exports = {
631
673
  downloadFile,
632
674
  resolveBinaryPath,
633
675
  ensureBinary,
634
- verifyBinary
676
+ verifyBinary,
677
+ globalInstallRequested,
678
+ globalInstallDisabled,
679
+ runPostinstall
635
680
  };
636
681
 
637
682
  if (require.main === module) {
638
- ensureBinary()
639
- .then((binaryPath) => {
640
- cleanupLegacyNpmShims();
641
- console.error(`[vlink] installed ${binaryPath}`);
642
- })
643
- .catch((err) => {
644
- console.error(`[vlink] install failed: ${err.message}`);
645
- process.exitCode = 1;
646
- });
683
+ runPostinstall().catch((err) => {
684
+ console.error(`[vlink] install failed: ${err.message}`);
685
+ process.exitCode = 1;
686
+ });
647
687
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tedbrain/vlink",
3
- "version": "0.1.159",
3
+ "version": "0.1.160",
4
4
  "description": "vlink Virtuoso bridge CLI installer. Installs the matching platform binary at npm install time, like Claude Code / Codex.",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {