@bytedance/doubao-cli 2.36.2 → 2.37.2

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
@@ -31,7 +31,8 @@ npm install -g @bytedance/doubao-cli
31
31
  npm view @bytedance/doubao-cli versions --json
32
32
  ```
33
33
 
34
- 更新前退出所有 CLI 实例,再执行 `doubao update`,或重复上面的安装命令。
34
+ 更新脚本会尝试停止 `--service-start` 服务任务;请先退出所有 TUI,再执行
35
+ `doubao update`,或重复上面的安装命令。
35
36
  有实例仍在运行时,更新会停止并提示退出,不会自动终止进程。
36
37
  已下载的安装包会在 SHA-256 校验通过后复用,退出实例后重试无需重复下载。
37
38
  `doubao update` 在版本相同时提示已是最新版本;本机版本较新时保留本机版本,不自动降级。
package/artifacts.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
- "version": "2.36.2",
2
+ "version": "2.37.2",
3
3
  "platforms": {
4
4
  "linux-x64": {
5
- "url": "https://lf-flow-web-cdn.doubao.com/obj/flow-doubao/doubao_cli/2.36.2/doubao-cli-2.36.2-linux-x64-signed.tar.gz",
6
- "sha256": "439e45db14ba9f4138772848e1fbdac6ee3477c9a60b92ea3ef91102eb85e6b7",
7
- "root": "doubao-cli-2.36.2-linux-x64"
5
+ "url": "https://lf-flow-web-cdn.doubao.com/obj/flow-doubao/doubao_cli/2.37.2/doubao-cli-2.37.2-linux-x64-signed.tar.gz",
6
+ "sha256": "f49aebaea880cb24e44ca4eaacd45efb789d32387b9d197cfd8c01a703715091",
7
+ "root": "doubao-cli-2.37.2-linux-x64"
8
8
  },
9
9
  "darwin-arm64": {
10
- "url": "https://lf-flow-web-cdn.doubao.com/obj/flow-doubao/doubao_cli/2.36.2/doubao-cli-2.36.2-darwin-arm64-signed-signed.tar.gz",
11
- "sha256": "bc111662e714b9e4666fb43783f3bc0993ab6aed7325533ec32421fece74094f",
12
- "root": "doubao-cli-2.36.2-darwin-arm64"
10
+ "url": "https://lf-flow-web-cdn.doubao.com/obj/flow-doubao/doubao_cli/2.37.2/doubao-cli-2.37.2-darwin-arm64-signed-signed.tar.gz",
11
+ "sha256": "2ed0261a484b8bc5319bb3da1a70b66d4362b084c1a3e848efd0e10f1e63243e",
12
+ "root": "doubao-cli-2.37.2-darwin-arm64"
13
13
  },
14
14
  "win32-x64": {
15
- "url": "https://lf-flow-web-cdn.doubao.com/obj/flow-doubao/doubao_cli/2.36.2/doubao-cli-2.36.2-win-x64-signed.zip",
16
- "sha256": "a60c7f4b18d56001cf8867e2d197814f09e049dbbb6d0585e0ad77d351b5e9cd",
17
- "root": "doubao-cli-2.36.2-win-x64"
15
+ "url": "https://lf-flow-web-cdn.doubao.com/obj/flow-doubao/doubao_cli/2.37.2/doubao-cli-2.37.2-win-x64-signed.zip",
16
+ "sha256": "76f4ee62241af2aead2625c5f30214f93b9f1102cc71964ea511ad1fbce7d2c1",
17
+ "root": "doubao-cli-2.37.2-win-x64"
18
18
  }
19
19
  }
20
20
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytedance/doubao-cli",
3
- "version": "2.36.2",
3
+ "version": "2.37.2",
4
4
  "description": "Doubao CLI for terminal and automation workflows",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "bin": {
@@ -9,6 +9,28 @@ const { setTimeout: delay } = require('node:timers/promises');
9
9
  const packageRoot = path.resolve(__dirname, '..');
10
10
  const platforms = ['win32-x64', 'darwin-arm64', 'linux-x64'];
11
11
 
12
+ function stopCurrentService(app, platform, execute = execFileSync) {
13
+ const binary = platform === 'win32-x64' ? 'doubao.exe' : 'doubao';
14
+ const executable = path.join(app, 'current', binary);
15
+ let info;
16
+ try {
17
+ info = fs.lstatSync(executable);
18
+ } catch (error) {
19
+ if (error.code === 'ENOENT') return false;
20
+ return false;
21
+ }
22
+ if (!info.isFile() || info.isSymbolicLink() || info.nlink !== 1) {
23
+ return false;
24
+ }
25
+ try {
26
+ execute(executable, ['--service-stop'],
27
+ { cwd: path.dirname(executable), stdio: 'ignore', windowsHide: true, timeout: 5000 });
28
+ return true;
29
+ } catch {
30
+ return false;
31
+ }
32
+ }
33
+
12
34
  function validateConfig(config, version) {
13
35
  if (config.version !== version) throw new Error('下载清单版本必须与 package.json 一致。');
14
36
  for (const platform of platforms) {
@@ -170,6 +192,7 @@ async function install(root = packageRoot, applicationRoot) {
170
192
  if (typeof manifest.version === 'string') fromVersion = manifest.version;
171
193
  } catch { /* First installation or damaged old manifest. */ }
172
194
  const operation = process.env.DOUBAO_CLI_INSTALL_OPERATION === 'update' ? 'update' : 'install';
195
+ stopCurrentService(app, platform);
173
196
  support.invokeUpdater(path.join(runner, support.updaterName), app,
174
197
  ['--staging=' + path.basename(temporary), '--from-version=' + fromVersion,
175
198
  '--to-version=' + version, '--operation=' + operation]);
@@ -198,7 +221,8 @@ async function install(root = packageRoot, applicationRoot) {
198
221
  }
199
222
  }
200
223
 
201
- module.exports = { validateConfig, validatePath, verifyChecksum, extract, validateRuntime, cachedArchive, renameStaged, install };
224
+ module.exports = { validateConfig, validatePath, verifyChecksum, extract, validateRuntime,
225
+ cachedArchive, renameStaged, stopCurrentService, install };
202
226
  if (require.main === module) install().catch(error => {
203
227
  if (!error.reported) console.error('豆包 CLI 安装失败:' + error.message);
204
228
  process.exitCode = 1;