tmuxclihook 0.3.1 → 0.3.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
@@ -12,6 +12,10 @@ tmuxclihook
12
12
  # 检查 npm registry 并将全局安装更新到最新版
13
13
  tmuxclihook update
14
14
 
15
+ # 查看版本 / 帮助(version、--version、-v 与 help、--help、-h 等价)
16
+ tmuxclihook --version
17
+ tmuxclihook --help
18
+
15
19
  # 插件已经载入 tmux 后
16
20
  prefix + I
17
21
 
package/bin/cli.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  } from '../src/adapters-meta.js';
28
28
  import { setSource, clearSource, getPersistedSource, originLabel } from '../src/source.js';
29
29
  import { note, padDisplay } from '../src/tui.js';
30
- import { updatePackage } from '../src/update.js';
30
+ import { updatePackage, CURRENT_VERSION } from '../src/update.js';
31
31
 
32
32
  const OK = '✓';
33
33
  const NO = '✗';
@@ -365,13 +365,26 @@ async function main() {
365
365
  p.outro('完成');
366
366
  }
367
367
 
368
- if (process.argv[2] === 'update') {
368
+ const arg = process.argv[2];
369
+ if (arg === 'update') {
369
370
  updatePackage().then((ok) => {
370
371
  if (!ok) process.exitCode = 1;
371
372
  }).catch((err) => {
372
373
  console.error(err);
373
374
  process.exitCode = 1;
374
375
  });
376
+ } else if (arg === '--version' || arg === '-v' || arg === 'version') {
377
+ console.log(`tmuxclihook v${CURRENT_VERSION}`);
378
+ } else if (arg === '--help' || arg === '-h' || arg === 'help') {
379
+ console.log(
380
+ 'tmuxclihook — tmux-ai-status 交互式安装器\n' +
381
+ '\n' +
382
+ '用法:\n' +
383
+ ' tmuxclihook 打开交互式 TUI 安装器\n' +
384
+ ' tmuxclihook update 检查并更新到 npm 最新版本\n' +
385
+ ' tmuxclihook version 显示版本(--version / -v 等价)\n' +
386
+ ' tmuxclihook help 显示本帮助(--help / -h 等价)',
387
+ );
375
388
  } else {
376
389
  main().catch((err) => {
377
390
  console.error(err);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tmuxclihook",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "交互式 TUI 安装器:环境侦测、AI CLI 侦测、tmux-ai-status hooks 装/卸/修、TPM 软链校验",
5
5
  "type": "module",
6
6
  "bin": {
@@ -73,10 +73,10 @@ fi
73
73
  # client-session-changed: attach 与 switch-client 的共同汇聚点 = 「进入」→ 记
74
74
  # @ai_entered_time(排序用:刚进入的 session 排最后;handler 内以 per-client
75
75
  # 上次 session 对比过滤自指 switch)+ 刷新聚合
76
+ tmux set-hook -g client-session-changed "run-shell '${CURRENT_DIR}/scripts/tmux-ai-status claude _session-switched #{hook_client_name}'" 2>/dev/null || true
76
77
  # 注:_refresh 与 TOOL_ID 无关(仅重建聚合 + 自修复 claude hooks),统一传 claude。
77
78
  tmux set-hook -g session-closed "run-shell '${CURRENT_DIR}/scripts/tmux-ai-status claude _refresh'"
78
79
  tmux set-hook -g client-detached "run-shell '${CURRENT_DIR}/scripts/tmux-ai-status claude _refresh'"
79
- tmux set-hook -g client-session-changed "run-shell '${CURRENT_DIR}/scripts/tmux-ai-status claude _session-switched #{hook_client_name}'" 2>/dev/null || true
80
80
  # (client-attached 不再注册:attach 场景由 client-session-changed 覆盖)
81
81
  # pane-exited: 程序自然退出 → 触发孤儿清理(#{pane_id} 在此 hook 中不可靠)
82
82
  tmux set-hook -g pane-exited "run-shell '${CURRENT_DIR}/scripts/tmux-ai-status claude _refresh'"