mihomo-cli 4.1.0 → 4.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.2.0] - 2026-09-05
4
+
5
+ 修两个「报告成功但其实没做到」的高危缺陷,均实测复现并回归验证。
6
+
7
+ ### 修复
8
+
9
+ - **`start` 会把崩溃循环报成「已启动」**。内核因配置问题(端口占用、订阅里有内核不接受的字段)启动后立即退出时,`start` 打印「已启动 (PID xxx)」并退出 0,而 `KeepAlive` 正每隔约 10 秒把它反复拉起——用户以为代理开着,实际完全没有代理,日志被崩溃信息刷爆。更别扭的是几秒后 `status` 会显示「不在运行」,同一个状态两条命令给出相反答案。
10
+
11
+ 根因是 `launchctl bootstrap` 成功只代表**任务被装载**,不代表进程活着,而此前的实现固定 `sleep 500ms` 后取一次 pid 就认定成功。现在 `start` 会观察一个窗口确认内核稳定运行,失败则报错、退出码非 0,并直接附上日志尾部(TUN 路径本就 `tail -25`,服务路径此前什么都不给)。
12
+
13
+ 判据用 `last exit code` 而非 `runs`:`KeepAlive` 有约 10 秒重启节流,崩溃后 2 秒内 `runs` 仍是 1。实测还发现全新 `bootstrap` 后存在一段**假健康窗口**(`state = running` 且 pid 拿得到,进程其实马上要退出),长度不固定——同一台机器上量到过 180ms 与 540ms,故健康判定不能一看到 running 就收口。
14
+
15
+ - **服务模式下日志永不轮转**。`rotateAndCleanupLogs()` 只在 TUN 启动路径被调用,而 Mixed(默认模式)走 launchd,于是 `mihomo.log` 无限增长、`logs` 的归档列表恒为空——README 承诺的「自动轮转,保留 7 天」对默认模式根本不成立。唯一的兜底是日志超 10MB 时借重启做 copy-truncate。
16
+
17
+ 现在 `startService` 在 `bootout` 与 `bootstrap` 之间轮转日志。必须卡在这个窗口:运行中 rename 是无效的,launchd 的 `StandardOutPath` fd 指向旧 inode,改名后内核会继续往归档文件里写。
18
+
19
+ - **`status` 无法区分「用户主动停止」与「崩溃循环」**:两者都显示「不在运行」。现在检出内核上次非 0 退出时会额外提示,并给出排查与止损命令。
20
+
21
+ ### 改进
22
+
23
+ - `help` 的说明列改为按最长命令签名自动对齐。此前靠手写空格,实测三段错位(控制组落在第 34 列、其余组第 30 列,`subscription add <url> [name]` 直接溢出)。对齐宽度按显示宽度计算,含中文占位符(`[编号]`、`[镜像]`、`[目标...]`)的签名不再少缩进
24
+ - 删除无消费者的死代码:`registerCleanup`/`runCleanup` 退出清理注册表(v4.1.0 移除 detached spawn 后已恒空转,留着会让人误以为信号安全网仍在生效)、`hasRootResidue`、`sleepSync`、`ProcessStatus` 的 `allProcesses`/`hasStaleProcesses`、`StartResult.alreadyRunning`、`downloadSubscription` 的 `persist` 参数
25
+ - 文档整理:`CLAUDE.md` 新增「报告成功前必须确认事情真的成立」一节收敛这类缺陷的共性,launchd 实测事实补录本轮四条新结论;`CODE_REVIEW.md` 从两轮历史修复清单(含已删除功能的条目)重写为当前基线的未处理项与已验证结论
26
+
3
27
  ## [4.1.0] - 2026-09-05
4
28
 
5
29
  `daemon` 保活重构为 install/start/stop 服务模型,日常操作全程免密。
package/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
  - 🛡️ **服务托管** - 基于 launchd,崩溃/登录自动拉起,代理后台常驻;日常 `start`/`stop` **全程免密**
16
16
  - 🔄 **双模式支持** - Mixed 模式和 TUN 透明代理模式
17
17
  - 📊 **状态监控** - 查看运行状态、内存占用、订阅流量与到期时间
18
- - 📝 **日志管理** - 实时日志 + 历史日志归档(自动轮转,保留7天)
18
+ - 📝 **日志管理** - 每次启动归档上一次日志,保留 7 天,支持列表/跟随/编号查看
19
19
  - 🎨 **Web UI** - 一键打开 Web 控制面板 (zash/metacubexd/yacd)
20
20
  - 🔄 **内核更新** - 自动检查更新,支持 GitHub 镜像加速
21
21
  - 💡 **容错提示** - 命令/子命令拼错时给出 did-you-mean 纠错建议
@@ -209,6 +209,7 @@ mihomo status # 查看状态
209
209
  - **`RunAtLoad`** — 登录后自动启动
210
210
  - 常驻的是系统 launchd 进程本身,**不额外占用资源、无轮询**
211
211
  - 切换订阅、开关覆写后的重启**优先走内核热重载**,免密且不中断连接
212
+ - `start` 会确认内核**真的跑起来了**才报「已启动」:坏配置下内核启动即退出时报错并附日志尾部,而不是报成功后让 `KeepAlive` 静默地反复重试
212
213
  - 「系统设置 → 通用 → 登录项与扩展」中显示为 **`mihomo-cli-service`**(plist 指向一个同名符号链,否则那里只会显示一个没有上下文的 `mihomo`)
213
214
 
214
215
  ### 关于 macOS 本地网络授权
@@ -245,7 +246,13 @@ mihomo start # 恢复服务
245
246
 
246
247
  ### 日志
247
248
 
248
- 服务模式下日志持续追加到 `mihomo.log`;超过 10MB 时,下次配置变更触发的重启会顺便轮转归档,不会无限增长。
249
+ 每次 `mihomo start` 会把上一次的 `mihomo.log` 归档为 `mihomo.<时间戳>.log`,归档保留 7 天。运行期间日志持续追加到 `mihomo.log`;若单次运行就写超 10MB,配置变更触发的重启会顺便轮转,不会无限增长。
250
+
251
+ ```bash
252
+ mihomo logs # 列出当前日志与归档
253
+ mihomo logs 0 -f # 实时跟随当前日志
254
+ mihomo logs 1 # 查看最新的归档
255
+ ```
249
256
 
250
257
  ## 内核更新镜像
251
258
 
@@ -418,6 +425,17 @@ match:
418
425
 
419
426
  ## 故障排除
420
427
 
428
+ ### 启动失败
429
+
430
+ `mihomo start` 会确认内核真的跑起来了才报「已启动」——内核因配置问题启动后立即退出时,命令会报错并直接附上日志尾部,退出码非 0。常见原因是端口被占用或订阅里有内核不接受的字段。
431
+
432
+ ```bash
433
+ mihomo logs 0 # 看完整原因
434
+ mihomo stop # 止住 launchd 的反复重试
435
+ ```
436
+
437
+ 若 `status` 显示「不在运行」但带「内核上次异常退出」的提示,说明内核正在崩溃循环中被反复拉起,同样按上面两步处理。
438
+
421
439
  ### 进程无法停止
422
440
 
423
441
  ```bash
package/dist/index.js CHANGED
@@ -3740,7 +3740,6 @@ function listOverwriteFile() {
3740
3740
  }
3741
3741
 
3742
3742
  // src/utils.ts
3743
- var sleepBuf = new Int32Array(new SharedArrayBuffer(4));
3744
3743
  function sleep(ms) {
3745
3744
  return new Promise((resolve) => setTimeout(resolve, ms));
3746
3745
  }
@@ -3750,6 +3749,25 @@ function escapeRegExp(s) {
3750
3749
  function shellQuote(s) {
3751
3750
  return `'${s.replace(/'/g, "'\\''")}'`;
3752
3751
  }
3752
+ function displayWidth(s) {
3753
+ let width = 0;
3754
+ for (const ch of s) {
3755
+ const code = ch.codePointAt(0) ?? 0;
3756
+ const isWide = code >= 4352 && code <= 4447 || // 韩文字母
3757
+ code >= 11904 && code <= 42191 || // CJK 部首 … 注音、统一表意文字
3758
+ code >= 44032 && code <= 55203 || // 韩文音节
3759
+ code >= 63744 && code <= 64255 || // CJK 兼容表意文字
3760
+ code >= 65072 && code <= 65135 || // CJK 兼容形式
3761
+ code >= 65280 && code <= 65376 || // 全角字母数字与标点
3762
+ code >= 65504 && code <= 65510;
3763
+ width += isWide ? 2 : 1;
3764
+ }
3765
+ return width;
3766
+ }
3767
+ function padEndDisplay(s, width) {
3768
+ const pad = width - displayWidth(s);
3769
+ return pad > 0 ? s + " ".repeat(pad) : s;
3770
+ }
3753
3771
  function formatBytes(bytes) {
3754
3772
  if (bytes === void 0 || bytes === null) return "\u672A\u77E5";
3755
3773
  const num = Number(bytes);
@@ -4316,18 +4334,19 @@ var GROUP_TITLES = [
4316
4334
  function printHelp(commands) {
4317
4335
  const lines = [`
4318
4336
  ${colors.cyan(colors.bold(`mihomo-cli v${VERSION}`))}`, "", "\u547D\u4EE4\u522B\u540D: mihomo, mhm, mh", "", "\u7528\u6CD5:", " mihomo <\u547D\u4EE4> [\u9009\u9879]"];
4337
+ const allUsage = commands.flatMap((c) => c.usage);
4338
+ const signatureWidth = Math.max(...allUsage.map((u) => displayWidth(u.signature)));
4339
+ const formatUsage = (u) => ` ${colors.bold(padEndDisplay(u.signature, signatureWidth))} ${u.description}`;
4319
4340
  for (const [group, title] of GROUP_TITLES) {
4320
4341
  const usageLines = commands.filter((c) => c.group === group).flatMap((c) => c.usage);
4321
4342
  if (usageLines.length === 0) continue;
4322
4343
  lines.push("", colors.cyan(title));
4323
- for (const u of usageLines) {
4324
- lines.push(u.startsWith(" ") ? ` ${u}` : ` ${boldFirstToken(u)}`);
4325
- }
4344
+ for (const u of usageLines) lines.push(formatUsage(u));
4326
4345
  }
4327
4346
  const meta = commands.filter((c) => c.group === "meta").flatMap((c) => c.usage);
4328
4347
  if (meta.length > 0) {
4329
4348
  lines.push("", colors.cyan("\u5143:"));
4330
- for (const u of meta) lines.push(` ${boldFirstToken(u)}`);
4349
+ for (const u of meta) lines.push(formatUsage(u));
4331
4350
  }
4332
4351
  lines.push(
4333
4352
  "",
@@ -4353,11 +4372,6 @@ ${colors.cyan(colors.bold(`mihomo-cli v${VERSION}`))}`, "", "\u547D\u4EE4\u522B\
4353
4372
  );
4354
4373
  console.log(lines.join("\n"));
4355
4374
  }
4356
- function boldFirstToken(usage) {
4357
- const spaceIdx = usage.indexOf(" ");
4358
- if (spaceIdx < 0) return colors.bold(usage);
4359
- return `${colors.bold(usage.slice(0, spaceIdx))}${usage.slice(spaceIdx)}`;
4360
- }
4361
4375
  function printVersion() {
4362
4376
  const kv = getKernelVersion() || "\u672A\u5B89\u88C5";
4363
4377
  console.log(colors.cyan(colors.bold(`mihomo-cli v${VERSION}`)));
@@ -4369,7 +4383,6 @@ function printVersion() {
4369
4383
  import { spawn } from "child_process";
4370
4384
 
4371
4385
  // src/lifecycle.ts
4372
- var cleanupFns = /* @__PURE__ */ new Set();
4373
4386
  var silentSigint = false;
4374
4387
  function setSilentSigint(value) {
4375
4388
  silentSigint = value;
@@ -4377,15 +4390,6 @@ function setSilentSigint(value) {
4377
4390
  function isSilentSigint() {
4378
4391
  return silentSigint;
4379
4392
  }
4380
- function runCleanup() {
4381
- for (const fn of cleanupFns) {
4382
- try {
4383
- fn();
4384
- } catch {
4385
- }
4386
- }
4387
- cleanupFns.clear();
4388
- }
4389
4393
 
4390
4394
  // src/open.ts
4391
4395
  function openUrl(url) {
@@ -4433,9 +4437,111 @@ function viewLogWithTail(logPath, options) {
4433
4437
  // src/commands/shared.ts
4434
4438
  import readline from "readline";
4435
4439
 
4440
+ // src/log-files.ts
4441
+ import fs5 from "fs";
4442
+ import path4 from "path";
4443
+ var DEFAULT_LOG_RETENTION_DAYS = 7;
4444
+ function rotateAndCleanupLogs() {
4445
+ rotateLog();
4446
+ cleanupOldLogs(DEFAULT_LOG_RETENTION_DAYS);
4447
+ }
4448
+ function getLogPath() {
4449
+ return PATHS.logFile;
4450
+ }
4451
+ function readLogTail(maxLines = 15) {
4452
+ const TAIL_BYTES = 64 * 1024;
4453
+ let fd = null;
4454
+ try {
4455
+ const size = fs5.statSync(PATHS.logFile).size;
4456
+ if (size === 0) return [];
4457
+ const start = Math.max(0, size - TAIL_BYTES);
4458
+ const length = size - start;
4459
+ const buf = Buffer.alloc(length);
4460
+ fd = fs5.openSync(PATHS.logFile, "r");
4461
+ fs5.readSync(fd, buf, 0, length, start);
4462
+ return buf.toString("utf8").split("\n").map((l) => l.trimEnd()).filter((l) => l.length > 0).slice(-maxLines);
4463
+ } catch {
4464
+ return [];
4465
+ } finally {
4466
+ if (fd !== null) {
4467
+ try {
4468
+ fs5.closeSync(fd);
4469
+ } catch {
4470
+ }
4471
+ }
4472
+ }
4473
+ }
4474
+ function rotateLog() {
4475
+ const logFile = PATHS.logFile;
4476
+ if (!fs5.existsSync(logFile)) return null;
4477
+ const stat = fs5.statSync(logFile);
4478
+ if (stat.size === 0) return null;
4479
+ const rotatedName = `mihomo.${formatLocalTimestamp()}.log`;
4480
+ const rotatedPath = path4.join(DIRS.logs, rotatedName);
4481
+ fs5.renameSync(logFile, rotatedPath);
4482
+ return rotatedPath;
4483
+ }
4484
+ function cleanupOldLogs(maxAgeDays = DEFAULT_LOG_RETENTION_DAYS) {
4485
+ const logsDir = DIRS.logs;
4486
+ if (!fs5.existsSync(logsDir)) return { deleted: 0, errors: 0 };
4487
+ const files = fs5.readdirSync(logsDir);
4488
+ const now = Date.now();
4489
+ const maxAgeMs = maxAgeDays * 24 * 60 * 60 * 1e3;
4490
+ let deleted = 0;
4491
+ let errors = 0;
4492
+ for (const file of files) {
4493
+ if (!file.match(/^mihomo\.\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}\.log$/)) continue;
4494
+ try {
4495
+ const filePath = path4.join(logsDir, file);
4496
+ const stat = fs5.statSync(filePath);
4497
+ if (now - stat.mtimeMs > maxAgeMs) {
4498
+ fs5.unlinkSync(filePath);
4499
+ deleted++;
4500
+ }
4501
+ } catch {
4502
+ errors++;
4503
+ }
4504
+ }
4505
+ return { deleted, errors };
4506
+ }
4507
+ function listLogs() {
4508
+ const logsDir = DIRS.logs;
4509
+ const result = { current: null, archives: [] };
4510
+ if (fs5.existsSync(PATHS.logFile)) {
4511
+ const stat = fs5.statSync(PATHS.logFile);
4512
+ result.current = {
4513
+ name: "mihomo.log (\u5F53\u524D)",
4514
+ path: PATHS.logFile,
4515
+ size: stat.size,
4516
+ mtime: stat.mtime,
4517
+ isCurrent: true
4518
+ };
4519
+ }
4520
+ if (!fs5.existsSync(logsDir)) return result;
4521
+ const files = fs5.readdirSync(logsDir);
4522
+ for (const file of files) {
4523
+ const match = file.match(/^mihomo\.(\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2})\.log$/);
4524
+ if (!match) continue;
4525
+ try {
4526
+ const filePath = path4.join(logsDir, file);
4527
+ const stat = fs5.statSync(filePath);
4528
+ result.archives.push({
4529
+ name: file,
4530
+ path: filePath,
4531
+ size: stat.size,
4532
+ mtime: stat.mtime,
4533
+ isCurrent: false
4534
+ });
4535
+ } catch {
4536
+ }
4537
+ }
4538
+ result.archives.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
4539
+ return result;
4540
+ }
4541
+
4436
4542
  // src/process-probe.ts
4437
4543
  import { spawnSync as spawnSync2 } from "child_process";
4438
- import fs5 from "fs";
4544
+ import fs6 from "fs";
4439
4545
  var PS_TIMEOUT_MS = 5e3;
4440
4546
  function isProcessRunning(pid) {
4441
4547
  if (!pid) return false;
@@ -4467,9 +4573,9 @@ function isProcessRoot(pid) {
4467
4573
  var BINARY_ALTERNATION = `(?:${escapeRegExp(PATHS.serviceBinary)}|${escapeRegExp(PATHS.mihomoBinary)})`;
4468
4574
  var MAIN_INSTANCE_PATTERN = `${BINARY_ALTERNATION}.*${escapeRegExp(PATHS.configFile)}`;
4469
4575
  function getPid() {
4470
- if (!fs5.existsSync(PATHS.pidFile)) return null;
4576
+ if (!fs6.existsSync(PATHS.pidFile)) return null;
4471
4577
  try {
4472
- const pid = parseInt(fs5.readFileSync(PATHS.pidFile, "utf8").trim(), 10);
4578
+ const pid = parseInt(fs6.readFileSync(PATHS.pidFile, "utf8").trim(), 10);
4473
4579
  return pid > 0 ? pid : null;
4474
4580
  } catch {
4475
4581
  return null;
@@ -4491,9 +4597,9 @@ function getMihomoPids() {
4491
4597
  }
4492
4598
  }
4493
4599
  function isPidFileOwnedByRoot() {
4494
- if (!fs5.existsSync(PATHS.pidFile)) return false;
4600
+ if (!fs6.existsSync(PATHS.pidFile)) return false;
4495
4601
  try {
4496
- const stat = fs5.statSync(PATHS.pidFile);
4602
+ const stat = fs6.statSync(PATHS.pidFile);
4497
4603
  return stat.uid === 0;
4498
4604
  } catch {
4499
4605
  return false;
@@ -4529,101 +4635,19 @@ function getProcessInfo(pid) {
4529
4635
  function getStatus() {
4530
4636
  const running = isRunning();
4531
4637
  const pid = getPid();
4532
- const allPids = getMihomoPids();
4533
4638
  return {
4534
4639
  running,
4535
4640
  pid: running ? pid : null,
4536
4641
  processInfo: running && pid ? getProcessInfo(pid) : null,
4537
4642
  hasConfig: hasConfig(),
4538
4643
  hasKernel: hasKernel(),
4539
- kernelVersion: getKernelVersion(),
4540
- allProcesses: allPids,
4541
- hasStaleProcesses: allPids.length > (running ? 1 : 0)
4644
+ kernelVersion: getKernelVersion()
4542
4645
  };
4543
4646
  }
4544
4647
 
4545
4648
  // src/process-start.ts
4546
4649
  import fs8 from "fs";
4547
4650
 
4548
- // src/log-files.ts
4549
- import fs6 from "fs";
4550
- import path4 from "path";
4551
- var DEFAULT_LOG_RETENTION_DAYS = 7;
4552
- function rotateAndCleanupLogs() {
4553
- rotateLog();
4554
- cleanupOldLogs(DEFAULT_LOG_RETENTION_DAYS);
4555
- }
4556
- function getLogPath() {
4557
- return PATHS.logFile;
4558
- }
4559
- function rotateLog() {
4560
- const logFile = PATHS.logFile;
4561
- if (!fs6.existsSync(logFile)) return null;
4562
- const stat = fs6.statSync(logFile);
4563
- if (stat.size === 0) return null;
4564
- const rotatedName = `mihomo.${formatLocalTimestamp()}.log`;
4565
- const rotatedPath = path4.join(DIRS.logs, rotatedName);
4566
- fs6.renameSync(logFile, rotatedPath);
4567
- return rotatedPath;
4568
- }
4569
- function cleanupOldLogs(maxAgeDays = DEFAULT_LOG_RETENTION_DAYS) {
4570
- const logsDir = DIRS.logs;
4571
- if (!fs6.existsSync(logsDir)) return { deleted: 0, errors: 0 };
4572
- const files = fs6.readdirSync(logsDir);
4573
- const now = Date.now();
4574
- const maxAgeMs = maxAgeDays * 24 * 60 * 60 * 1e3;
4575
- let deleted = 0;
4576
- let errors = 0;
4577
- for (const file of files) {
4578
- if (!file.match(/^mihomo\.\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2}\.log$/)) continue;
4579
- try {
4580
- const filePath = path4.join(logsDir, file);
4581
- const stat = fs6.statSync(filePath);
4582
- if (now - stat.mtimeMs > maxAgeMs) {
4583
- fs6.unlinkSync(filePath);
4584
- deleted++;
4585
- }
4586
- } catch {
4587
- errors++;
4588
- }
4589
- }
4590
- return { deleted, errors };
4591
- }
4592
- function listLogs() {
4593
- const logsDir = DIRS.logs;
4594
- const result = { current: null, archives: [] };
4595
- if (fs6.existsSync(PATHS.logFile)) {
4596
- const stat = fs6.statSync(PATHS.logFile);
4597
- result.current = {
4598
- name: "mihomo.log (\u5F53\u524D)",
4599
- path: PATHS.logFile,
4600
- size: stat.size,
4601
- mtime: stat.mtime,
4602
- isCurrent: true
4603
- };
4604
- }
4605
- if (!fs6.existsSync(logsDir)) return result;
4606
- const files = fs6.readdirSync(logsDir);
4607
- for (const file of files) {
4608
- const match = file.match(/^mihomo\.(\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2})\.log$/);
4609
- if (!match) continue;
4610
- try {
4611
- const filePath = path4.join(logsDir, file);
4612
- const stat = fs6.statSync(filePath);
4613
- result.archives.push({
4614
- name: file,
4615
- path: filePath,
4616
- size: stat.size,
4617
- mtime: stat.mtime,
4618
- isCurrent: false
4619
- });
4620
- } catch {
4621
- }
4622
- }
4623
- result.archives.sort((a, b) => b.mtime.getTime() - a.mtime.getTime());
4624
- return result;
4625
- }
4626
-
4627
4651
  // src/sudo.ts
4628
4652
  import { spawnSync as spawnSync3 } from "child_process";
4629
4653
  import fs7 from "fs";
@@ -4757,7 +4781,9 @@ function assertServiceLabelSafe() {
4757
4781
  }
4758
4782
  }
4759
4783
  var HOT_RELOAD_TIMEOUT_MS = 5e3;
4760
- var SERVICE_BOOT_WAIT_MS = 500;
4784
+ var SERVICE_HEALTH_INTERVAL_MS = 100;
4785
+ var SERVICE_OBSERVE_MS = 1200;
4786
+ var SERVICE_HEALTH_GRACE_MS = 1800;
4761
4787
  var LOG_ROTATE_MAX_BYTES = 10 * 1024 * 1024;
4762
4788
  var LAUNCHCTL_TIMEOUT_MS = 5e3;
4763
4789
  function serviceTarget() {
@@ -4776,9 +4802,12 @@ function parseServicePrint(output) {
4776
4802
  const stateMatch = output.match(/^\tstate = (.+)$/m);
4777
4803
  const pidMatch = output.match(/^\tpid = (\d+)$/m);
4778
4804
  const pid = pidMatch ? Number.parseInt(pidMatch[1], 10) : null;
4805
+ const exitMatch = output.match(/^\tlast exit code = (\d+)$/m);
4806
+ const lastExitCode = exitMatch ? Number.parseInt(exitMatch[1], 10) : null;
4779
4807
  return {
4780
4808
  state: stateMatch ? stateMatch[1].trim() : null,
4781
- pid: pid !== null && Number.isInteger(pid) && pid > 0 ? pid : null
4809
+ pid: pid !== null && Number.isInteger(pid) && pid > 0 ? pid : null,
4810
+ lastExitCode: lastExitCode !== null && Number.isInteger(lastExitCode) ? lastExitCode : null
4782
4811
  };
4783
4812
  }
4784
4813
  function parseDisabledList(output, label) {
@@ -4801,12 +4830,41 @@ function getServiceStatus() {
4801
4830
  const print = runLaunchctl(["print", serviceTarget()]);
4802
4831
  const loaded = print.status === 0;
4803
4832
  if (!installed && !loaded) {
4804
- return { installed: false, loaded: false, running: false, pid: null, disabled: false };
4833
+ return { installed: false, loaded: false, running: false, pid: null, disabled: false, lastExitCode: null };
4805
4834
  }
4806
- const { state, pid } = loaded ? parseServicePrint(print.stdout) : { state: null, pid: null };
4835
+ const { state, pid, lastExitCode } = loaded ? parseServicePrint(print.stdout) : { state: null, pid: null, lastExitCode: null };
4807
4836
  const disabledOut = runLaunchctl(["print-disabled", bootstrapDomain()]);
4808
4837
  const disabled = disabledOut.status === 0 ? parseDisabledList(disabledOut.stdout, SERVICE_LABEL) : false;
4809
- return { installed, loaded, running: state === "running", pid, disabled };
4838
+ return { installed, loaded, running: state === "running", pid, disabled, lastExitCode };
4839
+ }
4840
+ async function waitServiceHealthy() {
4841
+ const deadline = Date.now() + SERVICE_OBSERVE_MS;
4842
+ const graceDeadline = deadline + SERVICE_HEALTH_GRACE_MS;
4843
+ let last = getServiceStatus();
4844
+ while (Date.now() < deadline) {
4845
+ await sleep(SERVICE_HEALTH_INTERVAL_MS);
4846
+ last = getServiceStatus();
4847
+ if (isCrashed(last)) {
4848
+ return { healthy: false, crashed: true, pid: null, exitCode: last.lastExitCode };
4849
+ }
4850
+ if (!last.loaded) {
4851
+ return { healthy: false, crashed: false, pid: null, exitCode: last.lastExitCode };
4852
+ }
4853
+ }
4854
+ if (last.running) return { healthy: true, crashed: false, pid: last.pid, exitCode: null };
4855
+ while (Date.now() < graceDeadline) {
4856
+ await sleep(SERVICE_HEALTH_INTERVAL_MS);
4857
+ last = getServiceStatus();
4858
+ if (isCrashed(last)) {
4859
+ return { healthy: false, crashed: true, pid: null, exitCode: last.lastExitCode };
4860
+ }
4861
+ if (!last.loaded) break;
4862
+ if (last.running) return { healthy: true, crashed: false, pid: last.pid, exitCode: null };
4863
+ }
4864
+ return { healthy: false, crashed: false, pid: last.pid, exitCode: last.lastExitCode };
4865
+ }
4866
+ function isCrashed(status) {
4867
+ return !status.running && status.lastExitCode !== null && status.lastExitCode !== 0;
4810
4868
  }
4811
4869
  function escapeXml(s) {
4812
4870
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
@@ -4954,18 +5012,12 @@ function startService() {
4954
5012
  cleanupRootResidue();
4955
5013
  const target = shellQuote(serviceTarget());
4956
5014
  const dest = shellQuote(PATHS.userAgentPlist);
4957
- runLaunchctlSteps(
4958
- [
4959
- `launchctl bootout ${target} 2>/dev/null || true`,
4960
- ...waitUnloadedSteps(),
4961
- `launchctl enable ${target} || exit 2`,
4962
- `launchctl bootstrap ${bootstrapDomain()} ${dest} || exit 3`
4963
- ],
4964
- {
4965
- action: "\u542F\u52A8\u670D\u52A1",
4966
- codeMessages: { 2: "\u542F\u7528\u670D\u52A1\u5931\u8D25\uFF08launchctl enable\uFF09", 3: "\u88C5\u8F7D\u670D\u52A1\u5931\u8D25\uFF08launchctl bootstrap\uFF09" }
4967
- }
4968
- );
5015
+ runLaunchctlSteps([`launchctl bootout ${target} 2>/dev/null || true`, ...waitUnloadedSteps()], { action: "\u5378\u8F7D\u65E7\u670D\u52A1\u5B9E\u4F8B" });
5016
+ rotateAndCleanupLogs();
5017
+ runLaunchctlSteps([`launchctl enable ${target} || exit 2`, `launchctl bootstrap ${bootstrapDomain()} ${dest} || exit 3`], {
5018
+ action: "\u542F\u52A8\u670D\u52A1",
5019
+ codeMessages: { 2: "\u542F\u7528\u670D\u52A1\u5931\u8D25\uFF08launchctl enable\uFF09", 3: "\u88C5\u8F7D\u670D\u52A1\u5931\u8D25\uFF08launchctl bootstrap\uFF09" }
5020
+ });
4969
5021
  }
4970
5022
  function stopService() {
4971
5023
  assertServiceLabelSafe();
@@ -5039,7 +5091,7 @@ async function restartService() {
5039
5091
  if (!isServiceInstalled()) {
5040
5092
  throw new CliError("\u670D\u52A1\u672A\u5B89\u88C5\uFF0C\u65E0\u6CD5\u91CD\u542F", { hint: "\u5B89\u88C5\u670D\u52A1: mihomo install" });
5041
5093
  }
5042
- if (!logOversized() && await tryHotReload()) return;
5094
+ if (!logOversized() && await tryHotReload()) return { hotReloaded: true };
5043
5095
  const target = shellQuote(serviceTarget());
5044
5096
  const dest = shellQuote(PATHS.userAgentPlist);
5045
5097
  const logFile = shellQuote(PATHS.logFile);
@@ -5056,6 +5108,7 @@ async function restartService() {
5056
5108
  { action: "\u91CD\u542F\u670D\u52A1", codeMessages: { 3: "\u91CD\u542F\u670D\u52A1\u5931\u8D25\uFF08launchctl bootstrap\uFF09" } }
5057
5109
  );
5058
5110
  cleanupOldLogs();
5111
+ return { hotReloaded: false };
5059
5112
  }
5060
5113
 
5061
5114
  // src/runtime.ts
@@ -5084,12 +5137,27 @@ async function launchOrRestart(mode) {
5084
5137
  }
5085
5138
  const status = getServiceStatus();
5086
5139
  if (status.running && !status.disabled) {
5087
- await restartService();
5140
+ const { hotReloaded } = await restartService();
5141
+ if (hotReloaded) return getServiceStatus().pid;
5088
5142
  } else {
5089
5143
  startService();
5090
5144
  }
5091
- await sleep(SERVICE_BOOT_WAIT_MS);
5092
- return getServiceStatus().pid;
5145
+ return assertServiceHealthy();
5146
+ }
5147
+ async function assertServiceHealthy() {
5148
+ const health = await waitServiceHealthy();
5149
+ if (health.healthy) return health.pid;
5150
+ const tail = readLogTail();
5151
+ const reason = health.crashed ? `\u5185\u6838\u542F\u52A8\u540E\u7ACB\u5373\u9000\u51FA\uFF08\u9000\u51FA\u7801 ${health.exitCode}\uFF09` : "\u5185\u6838\u672A\u80FD\u8FDB\u5165\u8FD0\u884C\u72B6\u6001";
5152
+ throw new CliError(reason, {
5153
+ label: "\u542F\u52A8\u5931\u8D25",
5154
+ hint: [
5155
+ ...health.crashed ? ["launchd \u4F1A\u6BCF\u9694\u7EA6 10 \u79D2\u53CD\u590D\u62C9\u8D77\u5B83\uFF0C\u8BF7\u5148\u4FEE\u6B63\u914D\u7F6E\u6216\u6267\u884C mihomo stop\u3002"] : [],
5156
+ ...tail.length > 0 ? ["", "--- \u65E5\u5FD7\u5C3E\u90E8 ---", ...tail] : ["", `\u65E5\u5FD7: ${PATHS.logFile}`],
5157
+ "",
5158
+ "\u5B8C\u6574\u65E5\u5FD7: mihomo logs 0"
5159
+ ]
5160
+ });
5093
5161
  }
5094
5162
 
5095
5163
  // src/http.ts
@@ -5297,7 +5365,7 @@ function assertLooksLikeSubscription(parsed, maskedUrl) {
5297
5365
  ]
5298
5366
  });
5299
5367
  }
5300
- async function downloadSubscription(url, subName = "default", signal, persist = true) {
5368
+ async function downloadSubscription(url, subName = "default", signal) {
5301
5369
  let response;
5302
5370
  try {
5303
5371
  response = await HTTP_CLIENT.get(url, { responseType: "text", signal });
@@ -5319,13 +5387,9 @@ async function downloadSubscription(url, subName = "default", signal, persist =
5319
5387
  const parsed = parseYamlOrJson(content, "\u8BA2\u9605\u5185\u5BB9");
5320
5388
  if (!parsed) throw new Error("\u8BA2\u9605\u5185\u5BB9\u4E3A\u7A7A");
5321
5389
  assertLooksLikeSubscription(parsed, maskUrl(url));
5322
- if (persist) {
5323
- saveSubscriptionRawConfig(subName, content);
5324
- }
5390
+ saveSubscriptionRawConfig(subName, content);
5325
5391
  const meta = extractSubscriptionMeta(response.headers);
5326
- if (persist) {
5327
- saveSubscriptionMeta(subName, meta);
5328
- }
5392
+ saveSubscriptionMeta(subName, meta);
5329
5393
  const proxies = parsed.proxies;
5330
5394
  const proxyGroups = parsed["proxy-groups"];
5331
5395
  return {
@@ -5449,6 +5513,10 @@ async function printStatus() {
5449
5513
  }
5450
5514
  const statusText = running ? colors.green("\u25CF \u8FD0\u884C\u4E2D") : colors.yellow("\u4E0D\u5728\u8FD0\u884C");
5451
5515
  console.log(`${colors.gray("\u72B6\u6001: ")}${statusText}${modeLabel}`);
5516
+ if (!running && service.installed && !service.disabled && service.lastExitCode !== null && service.lastExitCode !== 0) {
5517
+ console.log(colors.yellow(` \u5F02\u5E38: \u5185\u6838\u4E0A\u6B21\u5F02\u5E38\u9000\u51FA\uFF08\u9000\u51FA\u7801 ${service.lastExitCode}\uFF09\uFF0Claunchd \u6B63\u5728\u53CD\u590D\u62C9\u8D77`));
5518
+ console.log(colors.gray(" \u67E5\u770B\u539F\u56E0: mihomo logs 0 \u505C\u6B62\u91CD\u8BD5: mihomo stop"));
5519
+ }
5452
5520
  console.log(`${colors.gray("\u5185\u6838: ")}${getKernelVersion() || "\u672A\u5B89\u88C5"}`);
5453
5521
  if (pid) {
5454
5522
  console.log(`${colors.gray("PID: ")}${pid}`);
@@ -6914,14 +6982,14 @@ var COMMANDS = [
6914
6982
  aliases: [],
6915
6983
  handler: cmdInstall,
6916
6984
  group: "control",
6917
- usage: ["install \u5B89\u88C5\u670D\u52A1\uFF08Mixed \u6A21\u5F0F\u7684\u524D\u7F6E\uFF0C\u53EA\u9700\u4E00\u6B21\uFF09"]
6985
+ usage: [{ signature: "install", description: "\u5B89\u88C5\u670D\u52A1\uFF08Mixed \u6A21\u5F0F\u7684\u524D\u7F6E\uFF0C\u53EA\u9700\u4E00\u6B21\uFF09" }]
6918
6986
  },
6919
6987
  {
6920
6988
  name: "start",
6921
6989
  aliases: [],
6922
6990
  handler: cmdStart,
6923
6991
  group: "control",
6924
- usage: ["start [tun|mixed] [-s] [-u ms] \u542F\u52A8\u4EE3\u7406\u5E76\u5F00\u542F\u767B\u5F55\u81EA\u542F (\u9ED8\u8BA4 mixed)"]
6992
+ usage: [{ signature: "start [tun|mixed] [-s] [-u ms]", description: "\u542F\u52A8\u4EE3\u7406\u5E76\u5F00\u542F\u767B\u5F55\u81EA\u542F\uFF08\u9ED8\u8BA4 mixed\uFF09" }]
6925
6993
  },
6926
6994
  {
6927
6995
  name: "tun",
@@ -6936,21 +7004,21 @@ var COMMANDS = [
6936
7004
  aliases: [],
6937
7005
  handler: cmdStop,
6938
7006
  group: "control",
6939
- usage: ["stop \u505C\u6B62\u4EE3\u7406\u5E76\u5173\u95ED\u767B\u5F55\u81EA\u542F"]
7007
+ usage: [{ signature: "stop", description: "\u505C\u6B62\u4EE3\u7406\u5E76\u5173\u95ED\u767B\u5F55\u81EA\u542F" }]
6940
7008
  },
6941
7009
  {
6942
7010
  name: "uninstall",
6943
7011
  aliases: [],
6944
7012
  handler: cmdUninstall,
6945
7013
  group: "control",
6946
- usage: ["uninstall \u5378\u8F7D\u670D\u52A1"]
7014
+ usage: [{ signature: "uninstall", description: "\u5378\u8F7D\u670D\u52A1" }]
6947
7015
  },
6948
7016
  {
6949
7017
  name: "status",
6950
7018
  aliases: [],
6951
7019
  handler: printStatus,
6952
7020
  group: "control",
6953
- usage: ["status \u67E5\u770B\u72B6\u6001"]
7021
+ usage: [{ signature: "status", description: "\u67E5\u770B\u72B6\u6001" }]
6954
7022
  },
6955
7023
  // === 已移除(墓碑:显式报错指引迁移,不在帮助中列出) ===
6956
7024
  {
@@ -6987,7 +7055,7 @@ var COMMANDS = [
6987
7055
  aliases: [],
6988
7056
  handler: cmdUI,
6989
7057
  group: "interface",
6990
- usage: ["ui [zash|dash|yacd] \u6253\u5F00 Web UI (\u9ED8\u8BA4 zash)"]
7058
+ usage: [{ signature: "ui [zash|dash|yacd]", description: "\u6253\u5F00 Web UI\uFF08\u9ED8\u8BA4 zash\uFF09" }]
6991
7059
  },
6992
7060
  {
6993
7061
  // 已并入 `logs -f`;保留为隐藏别名过渡,不在帮助中列出(usage 留空)
@@ -7003,7 +7071,7 @@ var COMMANDS = [
7003
7071
  aliases: [],
7004
7072
  handler: cmdLogs,
7005
7073
  group: "interface",
7006
- usage: ["logs [-f] [-n N] [\u7F16\u53F7] [-o] \u65E5\u5FD7\u5217\u8868/\u67E5\u770B\uFF080=\u5F53\u524D\uFF0C1+=\u5F52\u6863\uFF0C-f \u8DDF\u968F\uFF1B\u7701\u7565\u7F16\u53F7\u5373\u5F53\u524D\uFF09"]
7074
+ usage: [{ signature: "logs [-f] [-n N] [\u7F16\u53F7] [-o]", description: "\u65E5\u5FD7\u5217\u8868/\u67E5\u770B\uFF080=\u5F53\u524D\uFF0C1+=\u5F52\u6863\uFF0C-f \u8DDF\u968F\uFF1B\u7701\u7565\u7F16\u53F7\u5373\u5F53\u524D\uFF09" }]
7007
7075
  },
7008
7076
  // === 订阅 ===
7009
7077
  {
@@ -7012,11 +7080,11 @@ var COMMANDS = [
7012
7080
  handler: cmdSubscription,
7013
7081
  group: "subscription",
7014
7082
  usage: [
7015
- "subscription \u5217\u51FA\u6240\u6709\u8BA2\u9605\uFF08\u522B\u540D sub/subs\uFF09",
7016
- "subscription use <name> \u5207\u6362\u5F53\u524D\u8BA2\u9605",
7017
- "subscription add <url> [name] \u6DFB\u52A0\u8BA2\u9605",
7018
- "subscription update [name] \u66F4\u65B0\u8BA2\u9605\uFF08\u65E0\u53C2\u66F4\u65B0\u6240\u6709\uFF09",
7019
- "subscription remove <name> \u5220\u9664\u8BA2\u9605\uFF08\u6A21\u7CCA\u5339\u914D\u9700\u786E\u8BA4\uFF0C-y \u8DF3\u8FC7\uFF09"
7083
+ { signature: "subscription", description: "\u5217\u51FA\u6240\u6709\u8BA2\u9605\uFF08\u522B\u540D sub/subs\uFF09" },
7084
+ { signature: "subscription use <name>", description: "\u5207\u6362\u5F53\u524D\u8BA2\u9605" },
7085
+ { signature: "subscription add <url> [name]", description: "\u6DFB\u52A0\u8BA2\u9605" },
7086
+ { signature: "subscription update [name]", description: "\u66F4\u65B0\u8BA2\u9605\uFF08\u65E0\u53C2\u66F4\u65B0\u6240\u6709\uFF09" },
7087
+ { signature: "subscription remove <name>", description: "\u5220\u9664\u8BA2\u9605\uFF08\u6A21\u7CCA\u5339\u914D\u9700\u786E\u8BA4\uFF0C-y \u8DF3\u8FC7\uFF09" }
7020
7088
  ]
7021
7089
  },
7022
7090
  // === 配置 ===
@@ -7025,14 +7093,20 @@ var COMMANDS = [
7025
7093
  aliases: ["ow"],
7026
7094
  handler: cmdOverwrite,
7027
7095
  group: "config",
7028
- usage: ["overwrite \u67E5\u770B\u8986\u5199\u72B6\u6001\uFF08\u522B\u540D ow\uFF09", "overwrite on|off \u542F\u7528/\u7981\u7528\u8986\u5199\u914D\u7F6E"]
7096
+ usage: [
7097
+ { signature: "overwrite", description: "\u67E5\u770B\u8986\u5199\u72B6\u6001\uFF08\u522B\u540D ow\uFF09" },
7098
+ { signature: "overwrite on|off", description: "\u542F\u7528/\u7981\u7528\u8986\u5199\u914D\u7F6E" }
7099
+ ]
7029
7100
  },
7030
7101
  {
7031
7102
  name: "directory",
7032
7103
  aliases: ["dir", "dirs", "directories"],
7033
7104
  handler: cmdDirectory,
7034
7105
  group: "config",
7035
- usage: ["directory \u663E\u793A\u6570\u636E\u76EE\u5F55\u4F4D\u7F6E\uFF08\u522B\u540D dir\uFF09", "directory open [target] \u6253\u5F00\u76EE\u5F55: root|subs|logs|data|runtime|kernel"]
7106
+ usage: [
7107
+ { signature: "directory", description: "\u663E\u793A\u6570\u636E\u76EE\u5F55\u4F4D\u7F6E\uFF08\u522B\u540D dir\uFF09" },
7108
+ { signature: "directory open [target]", description: "\u6253\u5F00\u76EE\u5F55: root|subs|logs|data|runtime|kernel" }
7109
+ ]
7036
7110
  },
7037
7111
  // === 系统 ===
7038
7112
  {
@@ -7040,21 +7114,21 @@ var COMMANDS = [
7040
7114
  aliases: [],
7041
7115
  handler: cmdKernel,
7042
7116
  group: "system",
7043
- usage: ["kernel [--mirror [\u955C\u50CF]] \u66F4\u65B0\u5185\u6838\uFF08\u9ED8\u8BA4\u76F4\u8FDE\uFF0C--mirror \u8D70\u955C\u50CF\u4E0B\u8F7D\uFF09"]
7117
+ usage: [{ signature: "kernel [--mirror [\u955C\u50CF]]", description: "\u66F4\u65B0\u5185\u6838\uFF08\u9ED8\u8BA4\u76F4\u8FDE\uFF0C--mirror \u8D70\u955C\u50CF\u4E0B\u8F7D\uFF09" }]
7044
7118
  },
7045
7119
  {
7046
7120
  name: "update",
7047
7121
  aliases: [],
7048
7122
  handler: cmdUpdate,
7049
7123
  group: "system",
7050
- usage: ["update \u66F4\u65B0 mihomo-cli (npm install -g)"]
7124
+ usage: [{ signature: "update", description: "\u66F4\u65B0 mihomo-cli\uFF08npm install -g\uFF09" }]
7051
7125
  },
7052
7126
  {
7053
7127
  name: "reset",
7054
7128
  aliases: [],
7055
7129
  handler: cmdReset,
7056
7130
  group: "system",
7057
- usage: ["reset [\u76EE\u6807...] [--full] [-y] \u91CD\u7F6E: \u7559\u7A7A\u4FDD\u7559\u8BBE\u7F6E/\u5185\u6838/\u8986\u5199, \u6307\u5B9A\u76EE\u6807\u5220\u5BF9\u5E94\u9879, --full \u5220\u5168\u90E8, -y \u8DF3\u8FC7\u786E\u8BA4"]
7131
+ usage: [{ signature: "reset [\u76EE\u6807...] [--full] [-y]", description: "\u91CD\u7F6E: \u7559\u7A7A\u4FDD\u7559\u8BBE\u7F6E/\u5185\u6838/\u8986\u5199\uFF0C\u6307\u5B9A\u76EE\u6807\u5220\u5BF9\u5E94\u9879\uFF0C--full \u5220\u5168\u90E8\uFF0C-y \u8DF3\u8FC7\u786E\u8BA4" }]
7058
7132
  },
7059
7133
  // === meta(不在分组清单展示,help 末尾单列) ===
7060
7134
  {
@@ -7062,14 +7136,14 @@ var COMMANDS = [
7062
7136
  aliases: ["-h", "--help"],
7063
7137
  handler: () => printHelp(COMMANDS),
7064
7138
  group: "meta",
7065
- usage: ["help, -h \u663E\u793A\u5E2E\u52A9"]
7139
+ usage: [{ signature: "help, -h", description: "\u663E\u793A\u5E2E\u52A9" }]
7066
7140
  },
7067
7141
  {
7068
7142
  name: "version",
7069
7143
  aliases: ["-v", "--version"],
7070
7144
  handler: printVersion,
7071
7145
  group: "meta",
7072
- usage: ["version, -v \u663E\u793A\u7248\u672C"]
7146
+ usage: [{ signature: "version, -v", description: "\u663E\u793A\u7248\u672C" }]
7073
7147
  }
7074
7148
  ];
7075
7149
  var COMMAND_INDEX = (() => {
@@ -7096,11 +7170,9 @@ process.on("SIGINT", () => {
7096
7170
  if (!isSilentSigint()) {
7097
7171
  console.log("\n\u6B63\u5728\u9000\u51FA...");
7098
7172
  }
7099
- runCleanup();
7100
7173
  process.exit(130);
7101
7174
  });
7102
7175
  process.on("SIGTERM", () => {
7103
- runCleanup();
7104
7176
  process.exit(143);
7105
7177
  });
7106
7178
  process.on("uncaughtException", (e) => {
@@ -7109,14 +7181,12 @@ process.on("uncaughtException", (e) => {
7109
7181
  if (e.stack) {
7110
7182
  console.error(e.stack.split("\n").slice(1).join("\n"));
7111
7183
  }
7112
- runCleanup();
7113
7184
  process.exit(1);
7114
7185
  });
7115
7186
  process.on("unhandledRejection", (reason) => {
7116
7187
  const msg = reason instanceof Error ? reason.message : String(reason);
7117
7188
  console.error(`
7118
7189
  \u672A\u5904\u7406\u7684 Promise \u62D2\u7EDD: ${msg}`);
7119
- runCleanup();
7120
7190
  process.exit(1);
7121
7191
  });
7122
7192
  function clearProxyEnv() {
@@ -7167,13 +7237,11 @@ main().catch((e) => {
7167
7237
  if (e instanceof CliError) {
7168
7238
  console.error(`${colors.red(`${e.label}:`)} ${e.message}`);
7169
7239
  for (const line of e.hint) console.error(line);
7170
- runCleanup();
7171
7240
  process.exit(e.exitCode);
7172
7241
  }
7173
7242
  const err = e;
7174
7243
  console.error(`${colors.red("\u9519\u8BEF:")} ${err.message}`);
7175
7244
  if (err.stack) console.error(err.stack.split("\n").slice(1).join("\n"));
7176
- runCleanup();
7177
7245
  process.exit(1);
7178
7246
  });
7179
7247
  /*! Bundled license information:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mihomo-cli",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "type": "module",
5
5
  "description": "A terminal-based mihomo (Clash.Meta) client for macOS",
6
6
  "bin": {