@dongnanyang/deploy-cli 0.13.0 → 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/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
  ]),
@@ -715,6 +753,7 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
715
753
  },
716
754
  emits: [
717
755
  "deploy",
756
+ "scripts",
718
757
  "create",
719
758
  "refresh"
720
759
  ],
@@ -733,6 +772,7 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
733
772
  if (name === "j" || name === "down") sel.value = Math.min(sel.value + 1, props.rows.length - 1);
734
773
  else if (name === "k" || name === "up") sel.value = Math.max(sel.value - 1, 0);
735
774
  else if (name === "d") emit("deploy", props.rows[sel.value].name);
775
+ else if (name === "r") emit("scripts", props.rows[sel.value].name);
736
776
  else if (name === "f") emit("refresh");
737
777
  });
738
778
  const __returned__ = {
@@ -744,6 +784,9 @@ const _sfc_main$6 = /*@__PURE__*/ defineComponent({
744
784
  },
745
785
  get Text() {
746
786
  return Text;
787
+ },
788
+ get PANEL_KEY_HINTS() {
789
+ return PANEL_KEY_HINTS;
747
790
  }
748
791
  };
749
792
  Object.defineProperty(__returned__, "__isScriptSetup", {
@@ -871,7 +914,7 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
871
914
  }, 1024);
872
915
  }), 128)),
873
916
  createVNode($setup["Text"], { dimColor: "" }, {
874
- default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("j/k 选择 · n 新建(创建向导) · d 部署 · f 刷新", -1)])]),
917
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.PANEL_KEY_HINTS.projects), 1)]),
875
918
  _: 1
876
919
  })
877
920
  ]),
@@ -882,13 +925,19 @@ var ProjectsPanel_default = /*#__PURE__*/ export_helper_default(_sfc_main$6, [["
882
925
  //#endregion
883
926
  //#region src/tui/components/ScriptsPanel.vue
884
927
  /**
885
- * Scripts 面板(M2-T7 自 v0.1.0 DeployPanel 迁移):j/k/Enter/p 语义原样保留;
886
- * p 开参数弹窗(旧 InputModal 语义:输入参数、Enter 执行、Esc 取消)。
887
- * 只吃 ViewModel(rows/running);动作经 emit 交 App 接线(useScripts)。
928
+ * Scripts 脚本浮层(R20:spec §6.5 脚本执行并入项目动作——Projects 面板 r 打开,扫描选中项目 deploy/)。
929
+ * 能力迁移自 v0.1.0 DeployPanel:j/k/Enter/p(传参弹窗=旧 InputModal 语义)。
930
+ * R21 确认闸:脚本执行=任意 shell,Enter/传参执行一律经 ConfirmModal 确认后才 emit。
931
+ * 只吃 ViewModel(project/rows/running);动作经 emit 交 App 接线(useScripts)。
932
+ * 挂模态闸(R17 机制):浮层打开期间全局键 1-6/q/? 停用;Esc 返回(关闭浮层)。
888
933
  */
889
934
  const _sfc_main$5 = /*@__PURE__*/ defineComponent({
890
935
  __name: "ScriptsPanel",
891
936
  props: {
937
+ project: {
938
+ type: String,
939
+ required: true
940
+ },
892
941
  rows: {
893
942
  type: Array,
894
943
  required: true
@@ -898,25 +947,38 @@ const _sfc_main$5 = /*@__PURE__*/ defineComponent({
898
947
  required: true
899
948
  }
900
949
  },
901
- emits: ["run", "refresh"],
950
+ emits: [
951
+ "run",
952
+ "refresh",
953
+ "close"
954
+ ],
902
955
  setup(__props, { expose: __expose, emit: __emit }) {
903
956
  __expose();
904
957
  const props = __props;
905
958
  const emit = __emit;
959
+ useModalGate(() => true);
906
960
  const sel = ref(0);
907
961
  watch(() => props.rows.length, () => {
908
962
  sel.value = Math.min(sel.value, Math.max(0, props.rows.length - 1));
909
963
  });
910
- /** 传参弹窗(旧 App paramModal 归入面板):打开期间挂模态闸,列表键不触达 */
964
+ /** 传参弹窗(旧 InputModal 语义):输入参数、Enter 转确认弹窗、Esc 取消 */
911
965
  const paramsFor = ref(null);
912
966
  const paramsText = ref("");
913
967
  const paramsOpen = computed(() => paramsFor.value !== null);
914
- useModalGate(paramsOpen);
968
+ /** 执行确认挂起(R21:任意 shell);挂起期间列表键位全部停用 */
969
+ const pending = ref(null);
970
+ const confirmMessage = computed(() => {
971
+ if (pending.value === null) return "";
972
+ const { script, args } = pending.value;
973
+ const key = `${script.project}/${script.name}`;
974
+ return args.length > 0 ? `确认执行脚本 ${key}(参数: ${args.join(" ")})?` : `确认执行脚本 ${key}?`;
975
+ });
915
976
  function closeParams() {
916
977
  paramsFor.value = null;
917
978
  paramsText.value = "";
918
979
  }
919
980
  useInput((event) => {
981
+ if (pending.value !== null) return;
920
982
  const name = keyName(event);
921
983
  const char = event.type === "text" ? event.text : event.type === "key" ? event.key.character : void 0;
922
984
  if (paramsOpen.value) {
@@ -924,21 +986,36 @@ const _sfc_main$5 = /*@__PURE__*/ defineComponent({
924
986
  const script = paramsFor.value;
925
987
  const args = paramsText.value.trim().split(/\s+/).filter(Boolean);
926
988
  closeParams();
927
- emit("run", script, args);
989
+ pending.value = {
990
+ script,
991
+ args
992
+ };
928
993
  } else if (name === "escape") closeParams();
929
994
  else if (name === "backspace") paramsText.value = paramsText.value.slice(0, -1);
930
995
  else if (char) paramsText.value += char;
931
996
  return;
932
997
  }
998
+ if (name === "escape") {
999
+ emit("close");
1000
+ return;
1001
+ }
933
1002
  if (props.rows.length === 0) return;
934
1003
  if (name === "j" || name === "down") sel.value = Math.min(sel.value + 1, props.rows.length - 1);
935
1004
  else if (name === "k" || name === "up") sel.value = Math.max(sel.value - 1, 0);
936
- else if (name === "enter") emit("run", props.rows[sel.value], []);
1005
+ else if (name === "enter") pending.value = {
1006
+ script: props.rows[sel.value],
1007
+ args: []
1008
+ };
937
1009
  else if (name === "p") {
938
1010
  paramsFor.value = props.rows[sel.value];
939
1011
  paramsText.value = "";
940
1012
  } else if (name === "f") emit("refresh");
941
- });
1013
+ }, { isActive: () => pending.value === null });
1014
+ function onConfirm() {
1015
+ const p = pending.value;
1016
+ pending.value = null;
1017
+ if (p !== null) emit("run", p.script, p.args);
1018
+ }
942
1019
  function key(script) {
943
1020
  return `${script.project}/${script.name}`;
944
1021
  }
@@ -949,14 +1026,18 @@ const _sfc_main$5 = /*@__PURE__*/ defineComponent({
949
1026
  paramsFor,
950
1027
  paramsText,
951
1028
  paramsOpen,
1029
+ pending,
1030
+ confirmMessage,
952
1031
  closeParams,
1032
+ onConfirm,
953
1033
  key,
954
1034
  get Box() {
955
1035
  return Box;
956
1036
  },
957
1037
  get Text() {
958
1038
  return Text;
959
- }
1039
+ },
1040
+ ConfirmModal: ConfirmModal_default
960
1041
  };
961
1042
  Object.defineProperty(__returned__, "__isScriptSetup", {
962
1043
  enumerable: false,
@@ -978,7 +1059,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
978
1059
  bold: "",
979
1060
  color: "cyan"
980
1061
  }, {
981
- default: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("Scripts 脚本(deploy/ 目录)", -1)])]),
1062
+ default: withCtx(() => [createTextVNode("Scripts 脚本 — " + toDisplayString($setup.props.project) + "(deploy/ 目录)", 1)]),
982
1063
  _: 1
983
1064
  }),
984
1065
  $setup.props.rows.length === 0 ? (openBlock(), createBlock($setup["Text"], {
@@ -1050,7 +1131,7 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
1050
1131
  }, 1024);
1051
1132
  }), 128)),
1052
1133
  createVNode($setup["Text"], { dimColor: "" }, {
1053
- default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("j/k 选择 · Enter 执行 · p 传参执行 · f 重扫", -1)])]),
1134
+ default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("j/k 选择 · Enter 执行 · p 传参执行 · f 重扫 · Esc 返回", -1)])]),
1054
1135
  _: 1
1055
1136
  }),
1056
1137
  createCommentVNode(" 传参弹窗(旧 InputModal 文案) "),
@@ -1098,7 +1179,14 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
1098
1179
  })
1099
1180
  ]),
1100
1181
  _: 1
1101
- })) : createCommentVNode("v-if", true)
1182
+ })) : createCommentVNode("v-if", true),
1183
+ createCommentVNode(" 执行确认(R21:任意 shell,y 确认才执行) "),
1184
+ createVNode($setup["ConfirmModal"], {
1185
+ visible: $setup.pending !== null,
1186
+ message: $setup.confirmMessage,
1187
+ onConfirm: $setup.onConfirm,
1188
+ onCancel: _cache[0] || (_cache[0] = ($event) => $setup.pending = null)
1189
+ }, null, 8, ["visible", "message"])
1102
1190
  ]),
1103
1191
  _: 1
1104
1192
  });
@@ -1138,6 +1226,9 @@ const _sfc_main$4 = /*@__PURE__*/ defineComponent({
1138
1226
  },
1139
1227
  get Text() {
1140
1228
  return Text;
1229
+ },
1230
+ get PANEL_KEY_HINTS() {
1231
+ return PANEL_KEY_HINTS;
1141
1232
  }
1142
1233
  };
1143
1234
  Object.defineProperty(__returned__, "__isScriptSetup", {
@@ -1264,7 +1355,7 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
1264
1355
  ], 64);
1265
1356
  }), 128)),
1266
1357
  createVNode($setup["Text"], { dimColor: "" }, {
1267
- default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("f 刷新", -1)])]),
1358
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.PANEL_KEY_HINTS.status), 1)]),
1268
1359
  _: 1
1269
1360
  })
1270
1361
  ]),
@@ -1274,6 +1365,10 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
1274
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"]]);
1275
1366
  //#endregion
1276
1367
  //#region src/tui/components/StatusBar.vue
1368
+ /**
1369
+ * 底部状态栏(T8 完善):全局键常驻 + 当前上下文动作键(面板/浮层/向导 hint 同源 PANEL_KEY_HINTS/OVERLAY_KEY_HINTS)。
1370
+ * hint 缺省随 activePanel;浮层/向导打开时由 App 传入覆盖(防显示过期键位)。
1371
+ */
1277
1372
  const _sfc_main$3 = /*@__PURE__*/ defineComponent({
1278
1373
  __name: "StatusBar",
1279
1374
  props: {
@@ -1284,6 +1379,10 @@ const _sfc_main$3 = /*@__PURE__*/ defineComponent({
1284
1379
  helpVisible: {
1285
1380
  type: Boolean,
1286
1381
  required: false
1382
+ },
1383
+ hint: {
1384
+ type: String,
1385
+ required: false
1287
1386
  }
1288
1387
  },
1289
1388
  setup(__props, { expose: __expose }) {
@@ -1296,6 +1395,9 @@ const _sfc_main$3 = /*@__PURE__*/ defineComponent({
1296
1395
  get Text() {
1297
1396
  return Text;
1298
1397
  },
1398
+ get PANEL_KEY_HINTS() {
1399
+ return PANEL_KEY_HINTS;
1400
+ },
1299
1401
  get PANEL_TITLES() {
1300
1402
  return PANEL_TITLES;
1301
1403
  }
@@ -1310,18 +1412,26 @@ const _sfc_main$3 = /*@__PURE__*/ defineComponent({
1310
1412
  function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
1311
1413
  return openBlock(), createBlock($setup["Box"], {
1312
1414
  paddingX: 1,
1313
- flexDirection: "row",
1314
- justifyContent: "space-between",
1415
+ flexDirection: "column",
1315
1416
  flexShrink: 0
1316
1417
  }, {
1317
- default: withCtx(() => [createVNode($setup["Text"], {
1318
- bold: "",
1319
- color: "cyan"
1418
+ default: withCtx(() => [createVNode($setup["Box"], {
1419
+ flexDirection: "row",
1420
+ justifyContent: "space-between"
1320
1421
  }, {
1321
- 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
+ })]),
1322
1432
  _: 1
1323
1433
  }), createVNode($setup["Text"], { dimColor: "" }, {
1324
- 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)]),
1325
1435
  _: 1
1326
1436
  })]),
1327
1437
  _: 1
@@ -1331,7 +1441,8 @@ var StatusBar_default = /*#__PURE__*/ export_helper_default(_sfc_main$3, [["rend
1331
1441
  //#endregion
1332
1442
  //#region src/tui/components/TunnelsPanel.vue
1333
1443
  /**
1334
- * Tunnels 面板(spec 6.4 面板 5):旧 v0.1.0 TunnelPanel 迁移——j/k/s/x/a 语义原样保留。
1444
+ * Tunnels 面板(spec 6.4 面板 5):旧 v0.1.0 TunnelPanel 迁移——j/k/s/x/a 语义保留。
1445
+ * R21 确认闸分流:start 类(s/a)直接执行(非破坏);x 停止=中断在用连接,走 ConfirmModal。
1335
1446
  * 只吃 ViewModel(rows);动作经 emit 交 App 接线(useTunnels)。
1336
1447
  */
1337
1448
  const _sfc_main$2 = /*@__PURE__*/ defineComponent({
@@ -1350,22 +1461,32 @@ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
1350
1461
  const props = __props;
1351
1462
  const emit = __emit;
1352
1463
  const sel = ref(0);
1464
+ /** 确认挂起(R21:x 停止=中断在用连接);挂起期间面板键位全部停用 */
1465
+ const pendingStop = ref(null);
1353
1466
  watch(() => props.rows.length, () => {
1354
1467
  sel.value = Math.min(sel.value, Math.max(0, props.rows.length - 1));
1355
1468
  });
1356
1469
  useInput((event) => {
1470
+ if (pendingStop.value !== null) return;
1357
1471
  const name = keyName(event);
1358
1472
  if (name === "a") emit("startAll");
1359
1473
  if (props.rows.length === 0) return;
1360
1474
  if (name === "j" || name === "down") sel.value = Math.min(sel.value + 1, props.rows.length - 1);
1361
1475
  else if (name === "k" || name === "up") sel.value = Math.max(sel.value - 1, 0);
1362
1476
  else if (name === "s") emit("start", props.rows[sel.value].name);
1363
- else if (name === "x") emit("stop", props.rows[sel.value].name);
1364
- });
1477
+ else if (name === "x") pendingStop.value = props.rows[sel.value].name;
1478
+ }, { isActive: () => pendingStop.value === null });
1479
+ function onStopConfirm() {
1480
+ const name = pendingStop.value;
1481
+ pendingStop.value = null;
1482
+ if (name !== null) emit("stop", name);
1483
+ }
1365
1484
  const __returned__ = {
1366
1485
  props,
1367
1486
  emit,
1368
1487
  sel,
1488
+ pendingStop,
1489
+ onStopConfirm,
1369
1490
  STATUS_MARK: {
1370
1491
  running: "●",
1371
1492
  error: "✗",
@@ -1381,7 +1502,11 @@ const _sfc_main$2 = /*@__PURE__*/ defineComponent({
1381
1502
  },
1382
1503
  get Text() {
1383
1504
  return Text;
1384
- }
1505
+ },
1506
+ get PANEL_KEY_HINTS() {
1507
+ return PANEL_KEY_HINTS;
1508
+ },
1509
+ ConfirmModal: ConfirmModal_default
1385
1510
  };
1386
1511
  Object.defineProperty(__returned__, "__isScriptSetup", {
1387
1512
  enumerable: false,
@@ -1403,21 +1528,21 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
1403
1528
  bold: "",
1404
1529
  color: "cyan"
1405
1530
  }, {
1406
- default: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("5. Tunnels 隧道", -1)])]),
1531
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("5. Tunnels 隧道", -1)])]),
1407
1532
  _: 1
1408
1533
  }),
1409
1534
  $setup.props.rows.length === 0 ? (openBlock(), createBlock($setup["Text"], {
1410
1535
  key: 0,
1411
1536
  dimColor: ""
1412
1537
  }, {
1413
- default: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("(暂无隧道配置)", -1)])]),
1538
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("(暂无隧道配置)", -1)])]),
1414
1539
  _: 1
1415
1540
  })) : createCommentVNode("v-if", true),
1416
1541
  $setup.props.rows.length === 0 ? (openBlock(), createBlock($setup["Text"], {
1417
1542
  key: 1,
1418
1543
  dimColor: ""
1419
1544
  }, {
1420
- default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("编辑 ~/.deploy-cli/config.json 添加", -1)])]),
1545
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("编辑 ~/.deploy-cli/config.json 添加", -1)])]),
1421
1546
  _: 1
1422
1547
  })) : createCommentVNode("v-if", true),
1423
1548
  (openBlock(true), createElementBlock(Fragment, null, renderList($setup.props.rows, (t, i) => {
@@ -1464,7 +1589,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
1464
1589
  key: 0,
1465
1590
  dimColor: ""
1466
1591
  }, {
1467
- default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode(" (auto)", -1)])]),
1592
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode(" (auto)", -1)])]),
1468
1593
  _: 1
1469
1594
  })) : createCommentVNode("v-if", true)]),
1470
1595
  _: 2
@@ -1485,9 +1610,15 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
1485
1610
  }, 1024);
1486
1611
  }), 128)),
1487
1612
  createVNode($setup["Text"], { dimColor: "" }, {
1488
- default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("j/k 选择 · s 启动 · x 停止 · a 全部启动", -1)])]),
1613
+ default: withCtx(() => [createTextVNode(toDisplayString($setup.PANEL_KEY_HINTS.tunnels), 1)]),
1489
1614
  _: 1
1490
- })
1615
+ }),
1616
+ createVNode($setup["ConfirmModal"], {
1617
+ visible: $setup.pendingStop !== null,
1618
+ message: `确认停止隧道 ${$setup.pendingStop ?? ""}?将中断在用连接`,
1619
+ onConfirm: $setup.onStopConfirm,
1620
+ onCancel: _cache[0] || (_cache[0] = ($event) => $setup.pendingStop = null)
1621
+ }, null, 8, ["visible", "message"])
1491
1622
  ]),
1492
1623
  _: 1
1493
1624
  });
@@ -2492,11 +2623,12 @@ function useScripts(opts = {}) {
2492
2623
  const config = opts.load ? opts.load() : loadConfig();
2493
2624
  const rows = ref([]);
2494
2625
  const running = ref(null);
2495
- function scan() {
2626
+ function scan(name) {
2627
+ const projects = name === void 0 ? config.projects : config.projects.filter((p) => p.name === name);
2496
2628
  const all = [];
2497
- for (const project of config.projects) all.push(...discoverScripts(project));
2629
+ for (const project of projects) all.push(...discoverScripts(project));
2498
2630
  rows.value = all;
2499
- info(`扫描完成: ${config.projects.length} 个项目, ${all.length} 个脚本`);
2631
+ info(`扫描完成: ${projects.length} 个项目, ${all.length} 个脚本`);
2500
2632
  }
2501
2633
  function run(script, args = []) {
2502
2634
  const key = `${script.project}/${script.name}`;
@@ -2712,6 +2844,8 @@ function useTunnels(opts = {}) {
2712
2844
  const config = opts.load ? opts.load() : loadConfig();
2713
2845
  const manager = opts.manager ?? createTunnelManager(config);
2714
2846
  const tunnels = ref(manager.states());
2847
+ /** 连接建立中的隧道名(T7#3 安全增强:握手窗口内重复按 s 拦截,不建双连接——v0.1.0 继承竞态) */
2848
+ const starting = /* @__PURE__ */ new Set();
2715
2849
  manager.onEvent((event) => {
2716
2850
  if (event.type === "log") if (event.level === "info") info(event.message);
2717
2851
  else if (event.level === "success") success(event.message);
@@ -2730,13 +2864,20 @@ function useTunnels(opts = {}) {
2730
2864
  warn(`隧道 "${name}" 已在运行`);
2731
2865
  return;
2732
2866
  }
2867
+ if (starting.has(name)) {
2868
+ warn(`隧道 "${name}" 正在连接中`);
2869
+ return;
2870
+ }
2733
2871
  const row = tunnels.value.find((t) => t.name === name);
2734
2872
  if (row) row.status = "running";
2873
+ starting.add(name);
2735
2874
  try {
2736
2875
  await manager.start(name);
2737
2876
  } catch (error) {
2738
2877
  const message = error instanceof Error ? error.message : String(error);
2739
2878
  logError(`隧道 "${name}" 启动失败: ${message}`);
2879
+ } finally {
2880
+ starting.delete(name);
2740
2881
  }
2741
2882
  tunnels.value = manager.states();
2742
2883
  }
@@ -2784,6 +2925,13 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2784
2925
  const activePanel = ref("projects");
2785
2926
  const helpVisible = ref(false);
2786
2927
  const wizardOpen = ref(false);
2928
+ /** R20:脚本浮层目标项目名(null=浮层关) */
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
+ });
2787
2935
  useKeymap({
2788
2936
  onPanel: (panel) => {
2789
2937
  activePanel.value = panel;
@@ -2798,7 +2946,6 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2798
2946
  }
2799
2947
  });
2800
2948
  onMounted(() => {
2801
- scanScripts();
2802
2949
  autoStartTunnels();
2803
2950
  });
2804
2951
  onUnmounted(() => {
@@ -2837,6 +2984,19 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2837
2984
  activePanel.value = "deploy";
2838
2985
  startDeploy(name);
2839
2986
  }
2987
+ /** Projects r → 脚本浮层(R20 项目动作):打开即扫该项目 deploy/(输出进 useLogs→Output 面板) */
2988
+ function onScripts(name) {
2989
+ scriptsFor.value = name;
2990
+ scanScripts(name);
2991
+ }
2992
+ /** 浮层内 R21 确认后的脚本执行(useScripts.run 消费输出/结果) */
2993
+ function onScriptRun(script, args) {
2994
+ runScript(script, args);
2995
+ }
2996
+ /** 浮层内 f 重扫(同项目范围) */
2997
+ function onScriptRefresh() {
2998
+ if (scriptsFor.value !== null) scanScripts(scriptsFor.value);
2999
+ }
2840
3000
  /** 创建向导落盘成功(WizardPanel 经 ConfirmModal 确认后):日志 + 关闭时刷新列表 */
2841
3001
  function onWizardCreated(result) {
2842
3002
  success(`创建托管项目成功: ${result.config.name}(${result.dir})`);
@@ -2885,10 +3045,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2885
3045
  activePanel,
2886
3046
  helpVisible,
2887
3047
  wizardOpen,
3048
+ scriptsFor,
3049
+ statusHint,
2888
3050
  ACTION_LABEL,
2889
3051
  onContainerAction,
2890
3052
  onLogs,
2891
3053
  onDeploy,
3054
+ onScripts,
3055
+ onScriptRun,
3056
+ onScriptRefresh,
2892
3057
  onWizardCreated,
2893
3058
  onWizardClose,
2894
3059
  get Box() {
@@ -2906,9 +3071,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
2906
3071
  StatusBar: StatusBar_default,
2907
3072
  TunnelsPanel: TunnelsPanel_default,
2908
3073
  WizardPanel: WizardPanel_default,
3074
+ get OVERLAY_KEY_HINTS() {
3075
+ return OVERLAY_KEY_HINTS;
3076
+ },
2909
3077
  get PANEL_IDS() {
2910
3078
  return PANEL_IDS;
2911
3079
  },
3080
+ get PANEL_KEY_HINTS() {
3081
+ return PANEL_KEY_HINTS;
3082
+ },
2912
3083
  get PANEL_TITLES() {
2913
3084
  return PANEL_TITLES;
2914
3085
  }
@@ -2937,10 +3108,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2937
3108
  bold: "",
2938
3109
  color: "cyan"
2939
3110
  }, {
2940
- default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("Deploy CLI", -1)])]),
3111
+ default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("Deploy CLI", -1)])]),
2941
3112
  _: 1
2942
3113
  }), createVNode($setup["Text"], { dimColor: "" }, {
2943
- default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("1 Projects · 2 Containers · 3 Deploy · 4 Status · 5 Tunnels · 6 Output", -1)])]),
3114
+ default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("1 Projects · 2 Containers · 3 Deploy · 4 Status · 5 Tunnels · 6 Output", -1)])]),
2944
3115
  _: 1
2945
3116
  })]),
2946
3117
  _: 1
@@ -2955,65 +3126,92 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
2955
3126
  key: 0,
2956
3127
  onCreated: $setup.onWizardCreated,
2957
3128
  onClose: $setup.onWizardClose
2958
- })) : $setup.activePanel === "projects" ? (openBlock(), createBlock($setup["ProjectsPanel"], {
2959
- key: 1,
3129
+ })) : $setup.scriptsFor !== null ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" R20:脚本浮层(Projects r 项目动作)——挂模态闸,Esc 关闭 "), createVNode($setup["ScriptsPanel"], {
3130
+ project: $setup.scriptsFor,
3131
+ rows: $setup.scriptRows,
3132
+ running: $setup.scriptRunning,
3133
+ onRun: $setup.onScriptRun,
3134
+ onRefresh: $setup.onScriptRefresh,
3135
+ onClose: _cache[0] || (_cache[0] = ($event) => $setup.scriptsFor = null)
3136
+ }, null, 8, [
3137
+ "project",
3138
+ "rows",
3139
+ "running"
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,
2960
3174
  rows: $setup.projectRows,
2961
3175
  error: $setup.projectError,
2962
3176
  onDeploy: $setup.onDeploy,
2963
- onCreate: _cache[0] || (_cache[0] = ($event) => $setup.wizardOpen = true),
3177
+ onScripts: $setup.onScripts,
3178
+ onCreate: _cache[1] || (_cache[1] = ($event) => $setup.wizardOpen = true),
2964
3179
  onRefresh: $setup.refreshProjects
2965
3180
  }, null, 8, [
2966
3181
  "rows",
2967
3182
  "error",
2968
3183
  "onRefresh"
2969
3184
  ])) : $setup.activePanel === "containers" ? (openBlock(), createBlock($setup["ContainersPanel"], {
2970
- key: 2,
3185
+ key: 4,
2971
3186
  rows: $setup.containerRows,
2972
3187
  error: $setup.containerError,
2973
3188
  following: $setup.following,
2974
3189
  onLogs: $setup.onLogs,
2975
- onRestart: _cache[1] || (_cache[1] = (name) => $setup.onContainerAction("restart", name)),
2976
- onStop: _cache[2] || (_cache[2] = (name) => $setup.onContainerAction("stop", name)),
2977
- onRemove: _cache[3] || (_cache[3] = (name) => $setup.onContainerAction("remove", name)),
3190
+ onRestart: _cache[2] || (_cache[2] = (name) => $setup.onContainerAction("restart", name)),
3191
+ onStop: _cache[3] || (_cache[3] = (name) => $setup.onContainerAction("stop", name)),
3192
+ onRemove: _cache[4] || (_cache[4] = (name) => $setup.onContainerAction("remove", name)),
2978
3193
  onRefresh: $setup.refreshContainers
2979
3194
  }, null, 8, [
2980
3195
  "rows",
2981
3196
  "error",
2982
3197
  "following",
2983
3198
  "onRefresh"
2984
- ])) : $setup.activePanel === "deploy" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [createCommentVNode(" 面板 3 Deploy:流水线(T6)+ 脚本区(T7,v0.1.0 DeployPanel 语义)复合;\n gap=0 + 脚本区单行空态:80x24 终端部署进行时 21 行恰好放下(部署框 15 + 脚本框 6) "), createVNode($setup["Box"], {
2985
- flexDirection: "column",
2986
- flexGrow: 1,
2987
- gap: 0
2988
- }, {
2989
- default: withCtx(() => [createVNode($setup["DeployPanel"], {
2990
- "project-name": $setup.deployProject,
2991
- steps: $setup.deploySteps,
2992
- lines: $setup.deployLines,
2993
- running: $setup.deployRunning,
2994
- done: $setup.deployDone,
2995
- "failed-step": $setup.deployFailedStep
2996
- }, null, 8, [
2997
- "project-name",
2998
- "steps",
2999
- "lines",
3000
- "running",
3001
- "done",
3002
- "failed-step"
3003
- ]), createVNode($setup["ScriptsPanel"], {
3004
- rows: $setup.scriptRows,
3005
- running: $setup.scriptRunning,
3006
- onRun: $setup.runScript,
3007
- onRefresh: $setup.scanScripts
3008
- }, null, 8, [
3009
- "rows",
3010
- "running",
3011
- "onRun",
3012
- "onRefresh"
3013
- ])]),
3014
- _: 1
3015
- })], 2112)) : $setup.activePanel === "status" ? (openBlock(), createBlock($setup["StatusPanel"], {
3016
- key: 4,
3199
+ ])) : $setup.activePanel === "deploy" ? (openBlock(), createElementBlock(Fragment, { key: 5 }, [createCommentVNode(" 面板 3 Deploy:T6 流水线视图(R20:脚本=Projects 动作浮层,不在此复合) "), createVNode($setup["DeployPanel"], {
3200
+ "project-name": $setup.deployProject,
3201
+ steps: $setup.deploySteps,
3202
+ lines: $setup.deployLines,
3203
+ running: $setup.deployRunning,
3204
+ done: $setup.deployDone,
3205
+ "failed-step": $setup.deployFailedStep
3206
+ }, null, 8, [
3207
+ "project-name",
3208
+ "steps",
3209
+ "lines",
3210
+ "running",
3211
+ "done",
3212
+ "failed-step"
3213
+ ])], 2112)) : $setup.activePanel === "status" ? (openBlock(), createBlock($setup["StatusPanel"], {
3214
+ key: 6,
3017
3215
  rows: $setup.healthRows,
3018
3216
  error: $setup.healthError,
3019
3217
  onRefresh: $setup.refreshHealth
@@ -3022,7 +3220,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3022
3220
  "error",
3023
3221
  "onRefresh"
3024
3222
  ])) : $setup.activePanel === "tunnels" ? (openBlock(), createBlock($setup["TunnelsPanel"], {
3025
- key: 5,
3223
+ key: 7,
3026
3224
  rows: $setup.tunnelRows,
3027
3225
  onStart: $setup.startTunnel,
3028
3226
  onStop: $setup.stopTunnel,
@@ -3033,46 +3231,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3033
3231
  "onStop",
3034
3232
  "onStartAll"
3035
3233
  ])) : $setup.activePanel === "output" ? (openBlock(), createBlock($setup["OutputPanel"], {
3036
- key: 6,
3234
+ key: 8,
3037
3235
  logs: $setup.logs
3038
3236
  }, null, 8, ["logs"])) : createCommentVNode("v-if", true)]),
3039
3237
  _: 1
3040
3238
  }),
3041
- createCommentVNode(" 帮助浮层(? 开关) "),
3042
- $setup.helpVisible ? (openBlock(), createBlock($setup["Box"], {
3043
- key: 0,
3044
- flexDirection: "column",
3045
- borderStyle: "round",
3046
- borderColor: "yellow",
3047
- padding: 1,
3048
- marginX: 1
3049
- }, {
3050
- default: withCtx(() => [
3051
- createVNode($setup["Text"], {
3052
- bold: "",
3053
- color: "yellow"
3054
- }, {
3055
- default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("快捷键帮助", -1)])]),
3056
- _: 1
3057
- }),
3058
- (openBlock(true), createElementBlock(Fragment, null, renderList($setup.PANEL_IDS, (id, i) => {
3059
- return openBlock(), createBlock($setup["Text"], { key: id }, {
3060
- default: withCtx(() => [createTextVNode(toDisplayString(i + 1) + " " + toDisplayString($setup.PANEL_TITLES[id]), 1)]),
3061
- _: 2
3062
- }, 1024);
3063
- }), 128)),
3064
- createVNode($setup["Text"], null, {
3065
- default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("? 打开/关闭帮助 │ q 退出", -1)])]),
3066
- _: 1
3067
- })
3068
- ]),
3069
- _: 1
3070
- })) : createCommentVNode("v-if", true),
3071
3239
  createCommentVNode(" 底部状态栏 "),
3072
3240
  createVNode($setup["StatusBar"], {
3073
3241
  "active-panel": $setup.activePanel,
3074
- "help-visible": $setup.helpVisible
3075
- }, 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
+ ])
3076
3249
  ]),
3077
3250
  _: 1
3078
3251
  });