@dongnanyang/deploy-cli 0.13.1 → 0.14.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/README.md CHANGED
@@ -14,6 +14,13 @@
14
14
  - [ssh2](https://github.com/mscdex/ssh2) - SSH 客户端
15
15
  - Vite HMR 开发 + tsdown 生产构建
16
16
 
17
+ ## 安装
18
+
19
+ ```bash
20
+ npm i -g @dongnanyang/deploy-cli
21
+ deploy-cli # 启动交互式 TUI
22
+ ```
23
+
17
24
  ## 快速开始
18
25
 
19
26
  ```bash
@@ -59,15 +66,32 @@ npm start # 运行生产构建
59
66
  }
60
67
  ```
61
68
 
62
- ## 按键
69
+ ## TUI 快捷键
70
+
71
+ | 面板 | 键 | 作用 |
72
+ |---|---|---|
73
+ | 全局 | `1`-`6` | 切换面板(Projects/Containers/Deploy/Status/Tunnels/Output) |
74
+ | 全局 | `?` | 打开/关闭快捷键帮助 |
75
+ | 全局 | `q` | 退出(停全部隧道) |
76
+ | Projects | `j`/`k` | 上下选择 |
77
+ | Projects | `n` | 新建项目(创建向导) |
78
+ | Projects | `d` | 部署选中项目 |
79
+ | Projects | `r` | 打开脚本浮层(该项目 `deploy/` 目录) |
80
+ | Projects | `f` | 刷新 |
81
+ | Containers | `j`/`k` | 上下选择 |
82
+ | Containers | `l` | 查看容器日志(跟随) |
83
+ | Containers | `r`/`s`/`x` | 重启/停止/删除(确认后执行,删除带 force) |
84
+ | Containers | `f` | 刷新 |
85
+ | Deploy | — | 只读步骤流(Projects 按 `d` 发起) |
86
+ | Status | `f` | 刷新 |
87
+ | Tunnels | `j`/`k` | 上下选择 |
88
+ | Tunnels | `s`/`a` | 启动选中/全部隧道 |
89
+ | Tunnels | `x` | 停止隧道(确认) |
90
+ | Output | `g`/`G` | 到顶/底 |
91
+ | Output | `↑`/`↓` | 逐行滚动 |
92
+ | 脚本浮层 | `Enter`/`p` | 执行(空参/传参,均需 `y` 确认) |
93
+ | 脚本浮层 | `f`/`Esc` | 重扫/返回 |
94
+ | 创建向导 | `Enter`/`c`/`Esc` | 前进/重检 compose/返回 |
95
+ | 确认弹窗 | `y`/`Enter`、`n`/`Esc` | 确认、取消(期间全局键停用) |
63
96
 
64
- | 键 | 作用 |
65
- |---|---|
66
- | `j`/`k` | 上下选择 |
67
- | `s` | 启动隧道 |
68
- | `x` | 停止隧道 |
69
- | `a` | 启动全部隧道 |
70
- | `Enter` | 执行部署脚本 |
71
- | `Tab` | 切换面板焦点 |
72
- | `1`/`2`/`3` | 跳转到 Tunnels/Deploy/Output |
73
- | `q` | 退出 |
97
+ > 快捷键表与实现同源(`src/tui/composables/useKeymap.ts`),完整表见 TUI 内 `?` 帮助。
package/dist/api.js CHANGED
@@ -1,2 +1,2 @@
1
- import { a as generateCompose, c as loadProject, d as managedRoot, f as removeProject, h as PROJECT_LABEL, i as createManagedProject, m as COMPOSE_SERVICE_LABEL, n as ProjectConfigError, o as hasComposeMarker, p as saveProject, r as addProject, s as listProjects, t as COMPOSE_MARKER, u as managedDir } from "./project-BL00JHAo.js";
1
+ import { a as generateCompose, c as loadProject, d as managedRoot, f as removeProject, h as PROJECT_LABEL, i as createManagedProject, m as COMPOSE_SERVICE_LABEL, n as ProjectConfigError, o as hasComposeMarker, p as saveProject, r as addProject, s as listProjects, t as COMPOSE_MARKER, u as managedDir } from "./project-BHmvb9Mf.js";
2
2
  export { COMPOSE_MARKER, COMPOSE_SERVICE_LABEL, PROJECT_LABEL, ProjectConfigError, addProject, createManagedProject, generateCompose, hasComposeMarker, listProjects, loadProject, managedDir, managedRoot, removeProject, saveProject };
package/dist/bin.js CHANGED
@@ -5,21 +5,17 @@ function resolveEntry(argv) {
5
5
  case void 0:
6
6
  case "tui":
7
7
  case "--tui-next": return "tui";
8
- case "--legacy-tui": return "legacy-tui";
9
8
  default: return "cli";
10
9
  }
11
10
  }
12
- /** 执行入口分发:TUI 变体各自挂载;cli 子命令返回退出码写入 process.exitCode */
11
+ /** 执行入口分发:TUI 挂载;cli 子命令返回退出码写入 process.exitCode */
13
12
  async function runEntry(argv = process.argv.slice(2)) {
14
13
  switch (resolveEntry(argv)) {
15
14
  case "tui":
16
15
  await import("./tui/main.js");
17
16
  break;
18
- case "legacy-tui":
19
- await import("./main.js");
20
- break;
21
17
  case "cli": {
22
- const cli = await import("./cli-DuwAYtpm.js");
18
+ const cli = await import("./cli-ku0VmJk4.js");
23
19
  process.exitCode = await cli.main(argv);
24
20
  break;
25
21
  }
@@ -1,6 +1,5 @@
1
- import { C as run, S as execFailureMessage, _ as acmeProbeCommand, c as loadProject, f as removeProject, g as ACME_BIN, r as addProject, s as listProjects, v as certbotProbeCommand, x as resolveNginxPaths, y as createNginx } from "./project-BL00JHAo.js";
2
- import { n as loadConfig, r as saveConfig, t as expandPath } from "./config-xUl8Oa3T.js";
3
- import { c as createDocker, l as logsArgs, o as checkProjectHealth, r as runDeploy, s as findProjectContainers, t as buildSpec } from "./deploy-DuQKdGV9.js";
1
+ import { E as run, S as createNginx, T as execFailureMessage, _ as loadConfig, b as acmeProbeCommand, c as loadProject, f as removeProject, g as expandPath, r as addProject, s as listProjects, v as saveConfig, w as resolveNginxPaths, x as certbotProbeCommand, y as ACME_BIN } from "./project-BHmvb9Mf.js";
2
+ import { c as createDocker, l as logsArgs, o as checkProjectHealth, r as runDeploy, s as findProjectContainers, t as buildSpec } from "./deploy-DV42j6GT.js";
4
3
  import { accessSync, constants, existsSync, readFileSync } from "node:fs";
5
4
  import { dirname, join } from "node:path";
6
5
  import { fileURLToPath } from "node:url";
@@ -596,6 +595,7 @@ async function status(args, options = {}) {
596
595
  const USAGE = `用法:
597
596
  deploy-cli 启动交互式 TUI
598
597
  deploy-cli tui 启动交互式 TUI
598
+ deploy-cli --tui-next 启动交互式 TUI(预览开关别名,与缺省同义)
599
599
  deploy-cli doctor 环境自检
600
600
  deploy-cli ps 列出容器(--help 看示例)
601
601
  deploy-cli logs 查看容器日志(--help 看示例)
@@ -1,5 +1,4 @@
1
- import { C as run, S as execFailureMessage, a as generateCompose, h as PROJECT_LABEL, m as COMPOSE_SERVICE_LABEL, o as hasComposeMarker, t as COMPOSE_MARKER, y as createNginx } from "./project-BL00JHAo.js";
2
- import { t as expandPath } from "./config-xUl8Oa3T.js";
1
+ import { E as run, S as createNginx, T as execFailureMessage, a as generateCompose, g as expandPath, h as PROJECT_LABEL, m as COMPOSE_SERVICE_LABEL, o as hasComposeMarker, t as COMPOSE_MARKER } from "./project-BHmvb9Mf.js";
3
2
  import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
4
3
  import { dirname, join, resolve } from "node:path";
5
4
  import { spawn } from "node:child_process";
@@ -1,10 +1,9 @@
1
- import { n as loadConfig, r as saveConfig } from "./config-xUl8Oa3T.js";
2
1
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
3
2
  import { homedir } from "os";
4
3
  import { resolve } from "path";
5
4
  import { parse, stringify } from "yaml";
6
- import { existsSync as existsSync$1, lstatSync, readdirSync as readdirSync$1, renameSync, symlinkSync, unlinkSync, writeFileSync as writeFileSync$1 } from "node:fs";
7
- import { join as join$1 } from "node:path";
5
+ import { existsSync as existsSync$1, lstatSync, readdirSync, renameSync, symlinkSync, unlinkSync, writeFileSync as writeFileSync$1 } from "node:fs";
6
+ import { join } from "node:path";
8
7
  import { execFileSync, spawn } from "node:child_process";
9
8
  //#region src/core/exec.ts
10
9
  /**
@@ -319,10 +318,10 @@ function createNginx(runner = run, paths) {
319
318
  * 写盘段(写 .new/改名/软链)与 nginx -t 同一回滚口径(M2-T2 #8):段内任一 fs 操作失败即整体恢复再抛出。
320
319
  */
321
320
  async function writeSite(slug, content) {
322
- const conf = join$1(sitesAvailable, confName(slug));
323
- const tmp = join$1(sitesAvailable, tmpName(slug));
324
- const bak = join$1(sitesAvailable, bakName(slug));
325
- const link = sitesEnabled ? join$1(sitesEnabled, confName(slug)) : void 0;
321
+ const conf = join(sitesAvailable, confName(slug));
322
+ const tmp = join(sitesAvailable, tmpName(slug));
323
+ const bak = join(sitesAvailable, bakName(slug));
324
+ const link = sitesEnabled ? join(sitesEnabled, confName(slug)) : void 0;
326
325
  const existed = pathExists(conf);
327
326
  const linkCreated = link ? !pathExists(link) : false;
328
327
  /** 统一回滚:恢复/清除 conf、软链、.new 临时文件(R13:逐项守护,单项失败记 stderr 继续,回滚不抛) */
@@ -448,10 +447,10 @@ function createNginx(runner = run, paths) {
448
447
  },
449
448
  async removeSite(slug) {
450
449
  validateSlug(slug);
451
- const conf = join$1(sitesAvailable, confName(slug));
450
+ const conf = join(sitesAvailable, confName(slug));
452
451
  if (!pathExists(conf)) throw new Error(`未找到站点配置: ${conf}`);
453
- const bak = join$1(sitesAvailable, bakName(slug));
454
- const link = sitesEnabled ? join$1(sitesEnabled, confName(slug)) : void 0;
452
+ const bak = join(sitesAvailable, bakName(slug));
453
+ const link = sitesEnabled ? join(sitesEnabled, confName(slug)) : void 0;
455
454
  const hadLink = link ? pathExists(link) : false;
456
455
  /**
457
456
  * 与 applySite 同等回滚对等(R2)+ 写盘段同款收口(R13):逐项守护(单项失败记 stderr 继续恢复其余项),
@@ -497,12 +496,74 @@ function createNginx(runner = run, paths) {
497
496
  unlinkSync(bak);
498
497
  },
499
498
  async listSites() {
500
- return readdirSync$1(sitesAvailable).filter((name) => name.startsWith(CONF_PREFIX) && name.endsWith(CONF_SUFFIX)).map((name) => name.slice(11, -5)).filter((slug) => SLUG_RE.test(slug)).sort();
499
+ return readdirSync(sitesAvailable).filter((name) => name.startsWith(CONF_PREFIX) && name.endsWith(CONF_SUFFIX)).map((name) => name.slice(11, -5)).filter((slug) => SLUG_RE.test(slug)).sort();
501
500
  },
502
501
  requestCert
503
502
  };
504
503
  }
505
504
  //#endregion
505
+ //#region src/core/config.ts
506
+ const CONFIG_DIR = resolve(homedir(), ".deploy-cli");
507
+ const CONFIG_PATH = resolve(CONFIG_DIR, "config.json");
508
+ const DEFAULT_CONFIG = {
509
+ servers: [],
510
+ tunnels: [],
511
+ projects: []
512
+ };
513
+ /** 读取配置,不存在则创建默认配置;projects 缺 deployDir 时补默认值 'deploy'。
514
+ * 首建提示走可注入 log sink(M2-T2 #4),缺省仍打 console.log。 */
515
+ function loadConfig(log = (line) => console.log(line)) {
516
+ if (!existsSync(CONFIG_PATH)) {
517
+ mkdirSync(CONFIG_DIR, { recursive: true });
518
+ saveConfig(DEFAULT_CONFIG);
519
+ log(`[config] 已创建默认配置: ${CONFIG_PATH}`);
520
+ return {
521
+ servers: [],
522
+ tunnels: [],
523
+ projects: []
524
+ };
525
+ }
526
+ const raw = readFileSync(CONFIG_PATH, "utf-8");
527
+ let parsed;
528
+ try {
529
+ parsed = JSON.parse(raw);
530
+ } catch (error) {
531
+ const reason = error instanceof Error ? error.message : String(error);
532
+ throw new Error(`配置文件损坏(JSON 解析失败): ${CONFIG_PATH}: ${reason}`);
533
+ }
534
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) throw new Error(`配置文件损坏(应为 JSON 对象): ${CONFIG_PATH}`);
535
+ const config = parsed;
536
+ return {
537
+ servers: asArray(config.servers, "servers"),
538
+ tunnels: asArray(config.tunnels, "tunnels"),
539
+ projects: asArray(config.projects, "projects").map((project) => normalizeProject(project))
540
+ };
541
+ }
542
+ /** 字段缺省视为空数组;非数组抛配置错误(含路径),避免 TypeError 崩溃 */
543
+ function asArray(value, key) {
544
+ if (value === void 0 || value === null) return [];
545
+ if (!Array.isArray(value)) throw new Error(`配置文件损坏(${key} 应为数组): ${CONFIG_PATH}`);
546
+ return value;
547
+ }
548
+ /** 写入配置 */
549
+ function saveConfig(config) {
550
+ mkdirSync(CONFIG_DIR, { recursive: true });
551
+ writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + "\n", "utf-8");
552
+ }
553
+ /** 展开 ~ 路径 */
554
+ function expandPath(p) {
555
+ if (p.startsWith("~/")) return resolve(homedir(), p.slice(2));
556
+ if (p === "~") return homedir();
557
+ return resolve(p);
558
+ }
559
+ /** 读入的项目元素缺 deployDir 时补默认值(配置文件可省略该字段) */
560
+ function normalizeProject(project) {
561
+ return {
562
+ ...project,
563
+ deployDir: project.deployDir ?? "deploy"
564
+ };
565
+ }
566
+ //#endregion
506
567
  //#region src/core/types.ts
507
568
  /** 容器归属 label 键(M2-T3):generateCompose 写入 compose 服务级 labels,归属判定优先匹配,无 label 回退精确名后过滤 */
508
569
  const PROJECT_LABEL = "deploy-cli.project";
@@ -719,4 +780,4 @@ function createManagedProject(input) {
719
780
  };
720
781
  }
721
782
  //#endregion
722
- export { run as C, execFailureMessage as S, acmeProbeCommand as _, generateCompose as a, isValidSlug as b, loadProject as c, managedRoot as d, removeProject as f, ACME_BIN as g, PROJECT_LABEL as h, createManagedProject as i, managedComposeExists as l, COMPOSE_SERVICE_LABEL as m, ProjectConfigError as n, hasComposeMarker as o, saveProject as p, addProject as r, listProjects as s, COMPOSE_MARKER as t, managedDir as u, certbotProbeCommand as v, resolveNginxPaths as x, createNginx as y };
783
+ export { isValidSlug as C, run as E, createNginx as S, execFailureMessage as T, loadConfig as _, generateCompose as a, acmeProbeCommand as b, loadProject as c, managedRoot as d, removeProject as f, expandPath as g, PROJECT_LABEL as h, createManagedProject as i, managedComposeExists as l, COMPOSE_SERVICE_LABEL as m, ProjectConfigError as n, hasComposeMarker as o, saveProject as p, addProject as r, listProjects as s, COMPOSE_MARKER as t, managedDir as u, saveConfig as v, resolveNginxPaths as w, certbotProbeCommand as x, ACME_BIN as y };
package/dist/tui/main.js CHANGED
@@ -1,7 +1,5 @@
1
- import { a as generateCompose, b as isValidSlug, i as createManagedProject, l as managedComposeExists, s as listProjects, u as managedDir } from "../project-BL00JHAo.js";
2
- import { n as loadConfig, t as expandPath } from "../config-xUl8Oa3T.js";
3
- import { t as export_helper_default } from "../export-helper-CIEcxb5I.js";
4
- import { a as saveScriptResult, c as createDocker, i as runDeployScript, n as discoverScripts, o as checkProjectHealth, r as runDeploy } from "../deploy-DuQKdGV9.js";
1
+ import { C as isValidSlug, _ as loadConfig, a as generateCompose, g as expandPath, i as createManagedProject, l as managedComposeExists, s as listProjects, u as managedDir } from "../project-BHmvb9Mf.js";
2
+ import { a as saveScriptResult, c as createDocker, i as runDeployScript, n as discoverScripts, o as checkProjectHealth, r as runDeploy } from "../deploy-DV42j6GT.js";
5
3
  import { readFileSync } from "fs";
6
4
  import { stringify } from "yaml";
7
5
  import { Box, Text, createApp, useApp, useInput } from "@vue-tui/runtime";
@@ -29,6 +27,33 @@ const PANEL_TITLES = {
29
27
  output: "Output 输出"
30
28
  };
31
29
  /**
30
+ * 面板动作键提示(帮助/状态栏/面板 footer 同源——T8 快捷键表与实际键位逐一核对后收拢单一真相)。
31
+ * 改键必须同步对应面板 useInput handler;tests/tui/help.test.ts 锚定表文完整性与表-实一致核对。
32
+ */
33
+ const PANEL_KEY_HINTS = {
34
+ projects: "j/k 选择 · n 新建(创建向导) · d 部署 · r 脚本 · f 刷新",
35
+ containers: "j/k 选择 · l 日志 · r 重启 · s 停止 · x 删除 · f 刷新",
36
+ deploy: "(只读步骤流,无动作键)",
37
+ status: "f 刷新",
38
+ tunnels: "j/k 选择 · s 启动 · x 停止(确认) · a 全部启动",
39
+ output: "g/G 到顶/底 · ↑/↓ 逐行滚动"
40
+ };
41
+ /** 浮层/弹窗键位(帮助表第三段;keys 另供状态栏在浮层/向导打开时复用——80 列可容,行内提示见各自 footer) */
42
+ const OVERLAY_KEY_HINTS = {
43
+ scripts: {
44
+ label: "脚本浮层(Projects r)",
45
+ keys: "j/k 选择 · Enter/p 执行(均需 y 确认) · f 重扫 · Esc 返回"
46
+ },
47
+ wizard: {
48
+ label: "创建向导(Projects n)",
49
+ keys: "j/k/tab 移动 · 输入即编辑 · enter 前进 · c 重检 compose · esc 返回"
50
+ },
51
+ confirm: {
52
+ label: "确认弹窗",
53
+ keys: "y/enter 确认 · n/escape 取消(期间 1-6/q/? 停用)"
54
+ }
55
+ };
56
+ /**
32
57
  * 键名归一(R16 事件模型,面板/弹窗共用):text 事件取 text、key 事件取 character ?? name。
33
58
  * 多字符文本(粘贴/连打)与 paste 不归一,防误触;命名键(enter/escape/up…)原样返回 name。
34
59
  */
@@ -82,6 +107,13 @@ function useKeymap(handlers) {
82
107
  });
83
108
  }
84
109
  //#endregion
110
+ //#region \0/plugin-vue/export-helper
111
+ var export_helper_default = (sfc, props) => {
112
+ const target = sfc.__vccOpts || sfc;
113
+ for (const [key, val] of props) target[key] = val;
114
+ return target;
115
+ };
116
+ //#endregion
85
117
  //#region src/tui/components/ConfirmModal.vue
86
118
  /**
87
119
  * 破坏性动作二次确认弹窗(spec §6.3:down/rm/restart 等 TUI 需确认)。
@@ -244,6 +276,9 @@ const _sfc_main$9 = /*@__PURE__*/ defineComponent({
244
276
  get Text() {
245
277
  return Text;
246
278
  },
279
+ get PANEL_KEY_HINTS() {
280
+ return PANEL_KEY_HINTS;
281
+ },
247
282
  ConfirmModal: ConfirmModal_default
248
283
  };
249
284
  Object.defineProperty(__returned__, "__isScriptSetup", {
@@ -381,7 +416,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
381
416
  _: 1
382
417
  })) : createCommentVNode("v-if", true),
383
418
  createVNode($setup["Text"], { dimColor: "" }, {
384
- default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("j/k 选择 · l 日志 · r 重启 · s 停止 · x 删除 · f 刷新", -1)])]),
419
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.PANEL_KEY_HINTS.containers), 1)]),
385
420
  _: 1
386
421
  }),
387
422
  createVNode($setup["ConfirmModal"], {
@@ -635,6 +670,9 @@ const _sfc_main$7 = /*@__PURE__*/ defineComponent({
635
670
  },
636
671
  get ScrollBox() {
637
672
  return ScrollBox;
673
+ },
674
+ get PANEL_KEY_HINTS() {
675
+ return PANEL_KEY_HINTS;
638
676
  }
639
677
  };
640
678
  Object.defineProperty(__returned__, "__isScriptSetup", {
@@ -687,7 +725,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
687
725
  _: 1
688
726
  }, 512)),
689
727
  createVNode($setup["Text"], { dimColor: "" }, {
690
- default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("g/G 到顶/底 · ↑/↓ 逐行滚动", -1)])]),
728
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.PANEL_KEY_HINTS.output), 1)]),
691
729
  _: 1
692
730
  })
693
731
  ]),
@@ -746,6 +784,9 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
746
784
  },
747
785
  get Text() {
748
786
  return Text;
787
+ },
788
+ get PANEL_KEY_HINTS() {
789
+ return PANEL_KEY_HINTS;
749
790
  }
750
791
  };
751
792
  Object.defineProperty(__returned__, "__isScriptSetup", {
@@ -873,7 +914,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
873
914
  }, 1024);
874
915
  }), 128)),
875
916
  createVNode($setup["Text"], { dimColor: "" }, {
876
- default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("j/k 选择 · n 新建(创建向导) · d 部署 · r 脚本 · f 刷新", -1)])]),
917
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.PANEL_KEY_HINTS.projects), 1)]),
877
918
  _: 1
878
919
  })
879
920
  ]),
@@ -1185,6 +1226,9 @@ const _sfc_main$4 = /*@__PURE__*/ defineComponent({
1185
1226
  },
1186
1227
  get Text() {
1187
1228
  return Text;
1229
+ },
1230
+ get PANEL_KEY_HINTS() {
1231
+ return PANEL_KEY_HINTS;
1188
1232
  }
1189
1233
  };
1190
1234
  Object.defineProperty(__returned__, "__isScriptSetup", {
@@ -1311,7 +1355,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
1311
1355
  ], 64);
1312
1356
  }), 128)),
1313
1357
  createVNode($setup["Text"], { dimColor: "" }, {
1314
- default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("f 刷新", -1)])]),
1358
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.PANEL_KEY_HINTS.status), 1)]),
1315
1359
  _: 1
1316
1360
  })
1317
1361
  ]),
@@ -1321,6 +1365,10 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
1321
1365
  var StatusPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$4, [["render", _sfc_render$4], ["__file", "/Users/yangdongnan/work/deploy-cli/src/tui/components/StatusPanel.vue"]]);
1322
1366
  //#endregion
1323
1367
  //#region src/tui/components/StatusBar.vue
1368
+ /**
1369
+ * 底部状态栏(T8 完善):全局键常驻 + 当前上下文动作键(面板/浮层/向导 hint 同源 PANEL_KEY_HINTS/OVERLAY_KEY_HINTS)。
1370
+ * hint 缺省随 activePanel;浮层/向导打开时由 App 传入覆盖(防显示过期键位)。
1371
+ */
1324
1372
  const _sfc_main$3 = /*@__PURE__*/ defineComponent({
1325
1373
  __name: "StatusBar",
1326
1374
  props: {
@@ -1331,6 +1379,10 @@ const _sfc_main$3 = /*@__PURE__*/ defineComponent({
1331
1379
  helpVisible: {
1332
1380
  type: Boolean,
1333
1381
  required: false
1382
+ },
1383
+ hint: {
1384
+ type: String,
1385
+ required: false
1334
1386
  }
1335
1387
  },
1336
1388
  setup(__props, { expose: __expose }) {
@@ -1343,6 +1395,9 @@ const _sfc_main$3 = /*@__PURE__*/ defineComponent({
1343
1395
  get Text() {
1344
1396
  return Text;
1345
1397
  },
1398
+ get PANEL_KEY_HINTS() {
1399
+ return PANEL_KEY_HINTS;
1400
+ },
1346
1401
  get PANEL_TITLES() {
1347
1402
  return PANEL_TITLES;
1348
1403
  }
@@ -1357,18 +1412,26 @@ const _sfc_main$3 = /*@__PURE__*/ defineComponent({
1357
1412
  function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
1358
1413
  return openBlock(), createBlock($setup["Box"], {
1359
1414
  paddingX: 1,
1360
- flexDirection: "row",
1361
- justifyContent: "space-between",
1415
+ flexDirection: "column",
1362
1416
  flexShrink: 0
1363
1417
  }, {
1364
- default: withCtx(() => [createVNode($setup["Text"], {
1365
- bold: "",
1366
- color: "cyan"
1418
+ default: withCtx(() => [createVNode($setup["Box"], {
1419
+ flexDirection: "row",
1420
+ justifyContent: "space-between"
1367
1421
  }, {
1368
- default: withCtx(() => [createTextVNode(toDisplayString($setup.PANEL_TITLES[$setup.props.activePanel]), 1)]),
1422
+ default: withCtx(() => [createVNode($setup["Text"], {
1423
+ bold: "",
1424
+ color: "cyan"
1425
+ }, {
1426
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.PANEL_TITLES[$setup.props.activePanel]), 1)]),
1427
+ _: 1
1428
+ }), createVNode($setup["Text"], { dimColor: "" }, {
1429
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.props.helpVisible ? "[?] 关闭帮助" : "[?] 帮助") + " │ 1-6 切换面板 · q 退出", 1)]),
1430
+ _: 1
1431
+ })]),
1369
1432
  _: 1
1370
1433
  }), createVNode($setup["Text"], { dimColor: "" }, {
1371
- default: withCtx(() => [createTextVNode(toDisplayString($setup.props.helpVisible ? "[?] 关闭帮助" : "[?] 帮助") + " │ 1-6 切换面板 · q 退出", 1)]),
1434
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.props.hint ?? $setup.PANEL_KEY_HINTS[$setup.props.activePanel]), 1)]),
1372
1435
  _: 1
1373
1436
  })]),
1374
1437
  _: 1
@@ -1440,6 +1503,9 @@ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
1440
1503
  get Text() {
1441
1504
  return Text;
1442
1505
  },
1506
+ get PANEL_KEY_HINTS() {
1507
+ return PANEL_KEY_HINTS;
1508
+ },
1443
1509
  ConfirmModal: ConfirmModal_default
1444
1510
  };
1445
1511
  Object.defineProperty(__returned__, "__isScriptSetup", {
@@ -1544,7 +1610,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
1544
1610
  }, 1024);
1545
1611
  }), 128)),
1546
1612
  createVNode($setup["Text"], { dimColor: "" }, {
1547
- default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("j/k 选择 · s 启动 · x 停止(确认) · a 全部启动", -1)])]),
1613
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.PANEL_KEY_HINTS.tunnels), 1)]),
1548
1614
  _: 1
1549
1615
  }),
1550
1616
  createVNode($setup["ConfirmModal"], {
@@ -2778,6 +2844,8 @@ function useTunnels(opts = {}) {
2778
2844
  const config = opts.load ? opts.load() : loadConfig();
2779
2845
  const manager = opts.manager ?? createTunnelManager(config);
2780
2846
  const tunnels = ref(manager.states());
2847
+ /** 连接建立中的隧道名(T7#3 安全增强:握手窗口内重复按 s 拦截,不建双连接——v0.1.0 继承竞态) */
2848
+ const starting = /* @__PURE__ */ new Set();
2781
2849
  manager.onEvent((event) => {
2782
2850
  if (event.type === "log") if (event.level === "info") info(event.message);
2783
2851
  else if (event.level === "success") success(event.message);
@@ -2796,13 +2864,20 @@ function useTunnels(opts = {}) {
2796
2864
  warn(`隧道 "${name}" 已在运行`);
2797
2865
  return;
2798
2866
  }
2867
+ if (starting.has(name)) {
2868
+ warn(`隧道 "${name}" 正在连接中`);
2869
+ return;
2870
+ }
2799
2871
  const row = tunnels.value.find((t) => t.name === name);
2800
2872
  if (row) row.status = "running";
2873
+ starting.add(name);
2801
2874
  try {
2802
2875
  await manager.start(name);
2803
2876
  } catch (error) {
2804
2877
  const message = error instanceof Error ? error.message : String(error);
2805
2878
  logError(`隧道 "${name}" 启动失败: ${message}`);
2879
+ } finally {
2880
+ starting.delete(name);
2806
2881
  }
2807
2882
  tunnels.value = manager.states();
2808
2883
  }
@@ -2852,6 +2927,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2852
2927
  const wizardOpen = ref(false);
2853
2928
  /** R20:脚本浮层目标项目名(null=浮层关) */
2854
2929
  const scriptsFor = ref(null);
2930
+ /** 状态栏上下文键位(T8):浮层/向导打开时覆盖面板 hint,防显示过期键位 */
2931
+ const statusHint = computed(() => {
2932
+ if (wizardOpen.value) return OVERLAY_KEY_HINTS.wizard.keys;
2933
+ if (scriptsFor.value !== null) return OVERLAY_KEY_HINTS.scripts.keys;
2934
+ });
2855
2935
  useKeymap({
2856
2936
  onPanel: (panel) => {
2857
2937
  activePanel.value = panel;
@@ -2966,6 +3046,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2966
3046
  helpVisible,
2967
3047
  wizardOpen,
2968
3048
  scriptsFor,
3049
+ statusHint,
2969
3050
  ACTION_LABEL,
2970
3051
  onContainerAction,
2971
3052
  onLogs,
@@ -2990,9 +3071,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2990
3071
  StatusBar: StatusBar_default,
2991
3072
  TunnelsPanel: TunnelsPanel_default,
2992
3073
  WizardPanel: WizardPanel_default,
3074
+ get OVERLAY_KEY_HINTS() {
3075
+ return OVERLAY_KEY_HINTS;
3076
+ },
2993
3077
  get PANEL_IDS() {
2994
3078
  return PANEL_IDS;
2995
3079
  },
3080
+ get PANEL_KEY_HINTS() {
3081
+ return PANEL_KEY_HINTS;
3082
+ },
2996
3083
  get PANEL_TITLES() {
2997
3084
  return PANEL_TITLES;
2998
3085
  }
@@ -3050,8 +3137,40 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3050
3137
  "project",
3051
3138
  "rows",
3052
3139
  "running"
3053
- ])], 2112)) : $setup.activePanel === "projects" ? (openBlock(), createBlock($setup["ProjectsPanel"], {
3054
- key: 2,
3140
+ ])], 2112)) : $setup.helpVisible ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" 帮助浮层(? 开关):快捷键表=全局 + 六面板 + 浮层/弹窗三段(T8 与实际键位逐一核对,同源 useKeymap 常量);独占主区防 80x24 溢出 "), createVNode($setup["Box"], {
3141
+ flexDirection: "column",
3142
+ borderStyle: "round",
3143
+ borderColor: "yellow",
3144
+ padding: 1
3145
+ }, {
3146
+ default: withCtx(() => [
3147
+ createVNode($setup["Text"], {
3148
+ bold: "",
3149
+ color: "yellow"
3150
+ }, {
3151
+ default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("快捷键帮助", -1)])]),
3152
+ _: 1
3153
+ }),
3154
+ createVNode($setup["Text"], null, {
3155
+ default: withCtx(() => [..._cache[8] || (_cache[8] = [createTextVNode("全局: 1-6 切换面板 · q 退出(停全部隧道) · ? 打开/关闭帮助", -1)])]),
3156
+ _: 1
3157
+ }),
3158
+ (openBlock(true), createElementBlock(Fragment, null, renderList($setup.PANEL_IDS, (id, i) => {
3159
+ return openBlock(), createBlock($setup["Text"], { key: id }, {
3160
+ default: withCtx(() => [createTextVNode(toDisplayString(i + 1) + " " + toDisplayString($setup.PANEL_TITLES[id]) + ": " + toDisplayString($setup.PANEL_KEY_HINTS[id]), 1)]),
3161
+ _: 2
3162
+ }, 1024);
3163
+ }), 128)),
3164
+ (openBlock(true), createElementBlock(Fragment, null, renderList(Object.values($setup.OVERLAY_KEY_HINTS), (item) => {
3165
+ return openBlock(), createBlock($setup["Text"], { key: item.label }, {
3166
+ default: withCtx(() => [createTextVNode(toDisplayString(item.label) + ": " + toDisplayString(item.keys), 1)]),
3167
+ _: 2
3168
+ }, 1024);
3169
+ }), 128))
3170
+ ]),
3171
+ _: 1
3172
+ })], 2112)) : $setup.activePanel === "projects" ? (openBlock(), createBlock($setup["ProjectsPanel"], {
3173
+ key: 3,
3055
3174
  rows: $setup.projectRows,
3056
3175
  error: $setup.projectError,
3057
3176
  onDeploy: $setup.onDeploy,
@@ -3063,7 +3182,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3063
3182
  "error",
3064
3183
  "onRefresh"
3065
3184
  ])) : $setup.activePanel === "containers" ? (openBlock(), createBlock($setup["ContainersPanel"], {
3066
- key: 3,
3185
+ key: 4,
3067
3186
  rows: $setup.containerRows,
3068
3187
  error: $setup.containerError,
3069
3188
  following: $setup.following,
@@ -3077,7 +3196,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3077
3196
  "error",
3078
3197
  "following",
3079
3198
  "onRefresh"
3080
- ])) : $setup.activePanel === "deploy" ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [createCommentVNode(" 面板 3 Deploy:T6 流水线视图(R20:脚本=Projects 动作浮层,不在此复合) "), createVNode($setup["DeployPanel"], {
3199
+ ])) : $setup.activePanel === "deploy" ? (openBlock(), createElementBlock(Fragment, { key: 5 }, [createCommentVNode(" 面板 3 Deploy:T6 流水线视图(R20:脚本=Projects 动作浮层,不在此复合) "), createVNode($setup["DeployPanel"], {
3081
3200
  "project-name": $setup.deployProject,
3082
3201
  steps: $setup.deploySteps,
3083
3202
  lines: $setup.deployLines,
@@ -3092,7 +3211,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3092
3211
  "done",
3093
3212
  "failed-step"
3094
3213
  ])], 2112)) : $setup.activePanel === "status" ? (openBlock(), createBlock($setup["StatusPanel"], {
3095
- key: 5,
3214
+ key: 6,
3096
3215
  rows: $setup.healthRows,
3097
3216
  error: $setup.healthError,
3098
3217
  onRefresh: $setup.refreshHealth
@@ -3101,7 +3220,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3101
3220
  "error",
3102
3221
  "onRefresh"
3103
3222
  ])) : $setup.activePanel === "tunnels" ? (openBlock(), createBlock($setup["TunnelsPanel"], {
3104
- key: 6,
3223
+ key: 7,
3105
3224
  rows: $setup.tunnelRows,
3106
3225
  onStart: $setup.startTunnel,
3107
3226
  onStop: $setup.stopTunnel,
@@ -3112,46 +3231,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3112
3231
  "onStop",
3113
3232
  "onStartAll"
3114
3233
  ])) : $setup.activePanel === "output" ? (openBlock(), createBlock($setup["OutputPanel"], {
3115
- key: 7,
3234
+ key: 8,
3116
3235
  logs: $setup.logs
3117
3236
  }, null, 8, ["logs"])) : createCommentVNode("v-if", true)]),
3118
3237
  _: 1
3119
3238
  }),
3120
- createCommentVNode(" 帮助浮层(? 开关) "),
3121
- $setup.helpVisible ? (openBlock(), createBlock($setup["Box"], {
3122
- key: 0,
3123
- flexDirection: "column",
3124
- borderStyle: "round",
3125
- borderColor: "yellow",
3126
- padding: 1,
3127
- marginX: 1
3128
- }, {
3129
- default: withCtx(() => [
3130
- createVNode($setup["Text"], {
3131
- bold: "",
3132
- color: "yellow"
3133
- }, {
3134
- default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("快捷键帮助", -1)])]),
3135
- _: 1
3136
- }),
3137
- (openBlock(true), createElementBlock(Fragment, null, renderList($setup.PANEL_IDS, (id, i) => {
3138
- return openBlock(), createBlock($setup["Text"], { key: id }, {
3139
- default: withCtx(() => [createTextVNode(toDisplayString(i + 1) + " " + toDisplayString($setup.PANEL_TITLES[id]), 1)]),
3140
- _: 2
3141
- }, 1024);
3142
- }), 128)),
3143
- createVNode($setup["Text"], null, {
3144
- default: withCtx(() => [..._cache[8] || (_cache[8] = [createTextVNode("? 打开/关闭帮助 │ q 退出", -1)])]),
3145
- _: 1
3146
- })
3147
- ]),
3148
- _: 1
3149
- })) : createCommentVNode("v-if", true),
3150
3239
  createCommentVNode(" 底部状态栏 "),
3151
3240
  createVNode($setup["StatusBar"], {
3152
3241
  "active-panel": $setup.activePanel,
3153
- "help-visible": $setup.helpVisible
3154
- }, null, 8, ["active-panel", "help-visible"])
3242
+ "help-visible": $setup.helpVisible,
3243
+ hint: $setup.statusHint
3244
+ }, null, 8, [
3245
+ "active-panel",
3246
+ "help-visible",
3247
+ "hint"
3248
+ ])
3155
3249
  ]),
3156
3250
  _: 1
3157
3251
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dongnanyang/deploy-cli",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "description": "Local CLI TUI for SSH tunnels & deploy scripts",
5
5
  "type": "module",
6
6
  "main": "./dist/api.js",