Skip to content

feat: add SSH ops panel, Git graph swimlane, LAN remote preview & IM push - #341

Closed
Jason880902 wants to merge 5 commits into
Devin-AXIS:mainfrom
Jason880902:feat/ssh-ops-panel
Closed

feat: add SSH ops panel, Git graph swimlane, LAN remote preview & IM push#341
Jason880902 wants to merge 5 commits into
Devin-AXIS:mainfrom
Jason880902:feat/ssh-ops-panel

Conversation

@Jason880902

Copy link
Copy Markdown

概述

为 iPolloWork 客户端左侧功能菜单新增三个工具入口,并完成一轮规范性整改。所有改动已在真实运行的 Electron 应用中端到端验证。

新功能

1. SSH 运维面板

  • 侧边栏新增「运维」入口,复用现有 node-pty/xterm 基建
  • 主进程 terminal:create 支持 command 直接 spawn(如 ssh user@host),新增 ~/.ssh/config 主机解析(ipollowork:ssh:list-hosts
  • 渲染层 domains/session/ops/:主机列表 + 快速连接 + 多会话 tab + xterm 终端
  • 凭据走系统 ssh-agent/Keychain,不落应用

2. Git 图谱泳道

  • 侧边栏新增「Git」入口
  • 主进程 git-graph.mjsrev-list --parents 精确 DAG + for-each-ref 分支映射,含截断检测
  • 渲染层 domains/session/git/:泳道布局(父继承 + merge 分叉)+ SVG 渲染 + 分支徽章 + 提交详情
  • 截断边界:显示「已截断」横幅,越界父提交以虚线 stub 呈现

3. LAN 远程只读预览(移动端)

  • 独立 lan-preview-server.mjs:0.0.0.0 可选端口(默认 39485)
  • 配对流程:8 位大写字母配对码(~39.6 bits,10 分钟单次)换内存 session token(12h),challenge 防 CSRF,按 IP 限速 + 全局指数退避锁定
  • /api/snapshot/api/actions 只读,/api/execute 硬拒 403
  • 单文件移动页:配对 UI + 3s 轮询 + visibility 暂停
  • 设置页「远程预览」tab:开关、LAN 地址、配对码倒计时、已配对设备、断开全部

4. IM 推送(钉钉 MCP 方式)

  • preview-core.mjs:只读 renderer 桥 + 脱敏公开摘要(LAN 与 IM 共用)
  • im-bot.mjs:最小 MCP client,连接钉钉 Streamable HTTP 端点 → 发现 send 工具 → 推送脱敏摘要
  • 设置页「推送预览到 IM」:粘贴端点 + 推送按钮。不携带 lan-preview token

规范性整改

  • 目录按领域组织(ops/git 不再塞进 terminal/),各配纯逻辑模块便于单测
  • 主进程模块化:抽出 ssh-ops.mjsgit-graph.mjslan-preview-server.mjspreview-core.mjsim-bot.mjs
  • 补测试:desktop 22 个新 node:test(ssh config 解析、git DAG、泳道布局、preview-core 脱敏、im-bot 工具发现/参数映射),app bun:test(泳道布局、SSH 目标归一化)

验证

  • pnpm --filter @ipollowork/app typecheck
  • pnpm --filter @ipollowork/desktop test — 132 pass / 0 fail
  • pnpm --filter @ipollowork/app test — 757 pass(4 个既有失败与本 PR 无关)
  • pnpm --filter @ipollowork/app build
  • 真实 Electron 端到端:SSH pty 输出、Git 图谱 1372 提交 0 孤儿边、LAN 配对→快照→execute 403

说明

分支基于 fork 的旧 main(ahead 5 / behind 44)。如需要可与上游 main 对齐后再合并。

Jovan-zjy added 5 commits August 16, 2026 11:11
Extend the in-session terminal bridge to spawn commands directly
(e.g. ssh user@host), parse ~/.ssh/config for a host list, and add a
sidebar entry ('运维') that opens a multi-session SSH ops panel with
quick-connect input and xterm rendering.
Add a sidebar entry ('Git') that opens a swimlane git graph panel. The
Electron main process gains an ipollowork:git:graph IPC that builds a
commit DAG from rev-list --parents plus ref -> commit mapping from
for-each-ref; the renderer draws an SVG lane layout with branch badges,
commit selection, and a detail pane.
Add a default-off LAN read-only preview server so phones and tablets on
the local network can view the workbench via a pairing flow. The main
process gains a lan-preview-server with 6-digit single-use pair codes,
challenge-based anti-CSRF, in-memory session tokens, per-IP fail lockout
and rate limiting, and a hard 403 on /api/execute (read-only). A new
settings tab (Remote Preview) toggles the server, shows the LAN address
and pair code with countdown, and lists paired devices.
SSH ops + Git graph + LAN preview remediation pass:
- Git graph: detect and surface truncation (rev-list total-count probe,
  truncated banner, dashed stub edges for parents outside the window);
  fix lane layout so sibling branches fork to distinct lanes instead of
  collapsing onto the parent lane.
- LAN preview: raise pair-code entropy (8-char uppercase alphabet,
  ~39.6 bits) and add a global fail lockout with exponential backoff on
  top of per-IP limits.
- Module layout: move ops-panel/git-panel out of domains/session/terminal
  into domain-owned dirs with pure-logic modules (graph-layout.ts,
  ops-utils.ts) instead of dodging the single-file-directory audit rule.
- Main process: extract ssh-ops.mjs and git-graph.mjs factories from
  main.mjs; add preview-core.mjs shared read-only renderer bridge with
  sanitized public summary for LAN/IM channels.
- Tests: node:test suites for ssh config parsing, git DAG building, and
  preview-core redaction; bun:test suites for swimlane layout and SSH
  target normalization.
Add an IM notification section to the Remote Preview settings tab: paste
a DingTalk/Feishu MCP Streamable-HTTP endpoint and push a redacted
workbench summary to the group. The main process gains im-bot.mjs, a
minimal MCP client that discovers a send tool by name (send_message /
sendMessage / send_text / messages_send) and calls it with the sanitized
snapshot from preview-core. No lan-preview session tokens are ever sent.
Includes node:test coverage for tool discovery, argument mapping, and
summary redaction.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant