821cf12ade
Append CR when executing quick commands (fixes trim stripping saved \r) and allow optional dedicated Telegram bot for server offline alerts only. Co-authored-by: Cursor <cursoragent@cursor.com>
1.3 KiB
1.3 KiB
终端快捷命令回车修复 — 验证报告
日期: 2026-06-13
变更: formatQuickCmdForSend + execQuickCmd 发送时追加 \r
验证结果
| 项 | 命令/方式 | 结果 |
|---|---|---|
| 前端构建 | cd frontend && npm run build |
PASS(5.37s,含 TerminalPage-*.js) |
| 本地门控 | bash scripts/local_verify.sh |
PASS(26/26 API smoke + ruff) |
| 发送逻辑单测 | Node/Python 镜像 formatQuickCmdForSend |
PASS(含 trim() 剥 \r 后仍能补回) |
| API 集成 | pytest tests/test_terminal_quick_commands.py |
PASS |
| 浏览器 E2E(WebSSH 点击执行) | 未执行 | SKIP — 需已登录 + 可 SSH 子机 |
根因复现(已确认)
'ls\r'.trim() // => 'ls' (\r 被当作空白剥掉)
修复后:formatQuickCmdForSend('ls') => 'ls\r',与命令栏 sendCmd 行为一致。
手动终验(部署后)
- 设置 → 终端快捷命令 → 添加
echo hello,保存。 - 终端页连接子机 → 点击该快捷命令。
- 预期:输出
hello并回到新提示符(非悬停在输入行)。
备注
- 内置命令 DB 中可能仍带
\r;formatQuickCmdForSend先去尾再追加,幂等安全。 - 仅前端变更;部署
web/app/即可,无需重启后端。