diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md deleted file mode 100644 index 7d16501..0000000 --- a/docs/ROADMAP.md +++ /dev/null @@ -1,82 +0,0 @@ -# JRedisDesktop v2 路线图 - -> 基于 Legacy (AnotherRedisDesktopManager) 的对比分析,当前 v2 已覆盖约 40% 功能。 - ---- - -## P0 — 阻塞级(连接功能不完整) - -- [x] **SSH 隧道** — 类型已定义,NewConnectionDialog 需添加 host/port/user/password/privateKey/passphrase 表单 -- [x] **SSL/TLS 证书路径** — CA / Cert / Key 文件路径 + SNI servername,当前仅 TLS 复选框 -- [x] **Sentinel 模式** — masterName + nodePassword 表单 -- [x] **Cluster 开关** — UI 暴露 cluster 模式切换 + FAQ 说明 - -## P1 — 核心功能缺失 - -- [x] **内存分析** — `MEMORY USAGE` 扫描所有 key,虚拟化列表,按大小排序,暂停/恢复,大小过滤 -- [x] **命令日志** — 记录每次命令的耗时/连接/时间,最多 5000 条,只写模式过滤 -- [x] **自动更新** — electron-updater 集成,启动检查,下载进度,发行说明 -- [x] **多标签页** — 单连接支持同时打开 Status/Keys/CLI/SlowLog/内存分析/批量删除 多个标签 -- [x] **多连接并行** — 同时打开多个连接,各自独立标签页 -- [x] **Monaco 编辑器** — 替换 StringEditor 的 textarea,支持 JSON 折叠/展开/语法高亮 -- [x] **Redis 命令自动补全** — CLI 输入时智能提示(基于 commands.js 命令数据库) -- [x] **CLI SUBSCRIBE/MONITOR** — 实时消息流 + MONITOR 命令流 + 停止按钮 -- [x] **CLI MULTI/EXEC** — 事务模式支持 -- [x] **Stream 消费者组** — XINFO GROUPS / XINFO CONSUMERS 展开表格 - -## P2 — 重要功能增强 - -- [x] **多格式查看器** — Text / Hex / Json / Binary / Msgpack / PHP Serialize / Java Serialize / Pickle / Brotli / Gzip / Deflate / DeflateRaw / Protobuf(13 种格式) -- [x] **自动格式检测** — 检查内容 magic bytes 自动选择查看器 -- [x] **自定义格式化器** — 外部可执行文件 + 模板参数 {KEY} {VALUE} {HEX} {HEX_FILE} -- [x] **ReJson / TairJson 支持** — JSON.GET / JSON.SET / JSON.DEL 编辑 -- [x] **二进制 key 支持** — [Hex] 前缀输入,hex ↔ buffer 双向转换 -- [x] **虚拟化滚动** — 大 key 集合(200k+)的性能优化,KeyList 树形视图虚拟化 -- [x] **批量删除预览** — 先扫描预览,再确认删除,显示 key 数量和总大小 -- [x] **Key 导出** — DUMP + PTTL → CSV 下载 -- [x] **Key 导入** — CSV (hex_key, hex_value, ttl) → RESTORE -- [x] **命令导入** — 文本文件逐行执行 Redis 命令 -- [x] **FlushDB** — 清空当前数据库,双重确认 -- [x] **Key 搜索历史** — 最近 200 条搜索模式自动补全 -- [x] **取消扫描** — 中断正在进行的 SCAN - -## P3 — 体验优化 - -- [x] **右键菜单** — key 列表右键:复制/删除/多选/导出/内存分析/加载文件夹/删除文件夹 -- [x] **多选增强** — Shift+Click 范围选择,全选复选框 -- [x] **快捷键增强** — Ctrl+,(设置) / Ctrl+G(命令日志) / Ctrl+W(关闭标签) / Ctrl+S(保存) / Ctrl+L(清CLI) / Ctrl+/(帮助) -- [x] **连接颜色标记** — 每个连接可选颜色(预定义色板) -- [x] **连接拖拽排序** — Sortable.js 拖拽重排连接列表 -- [x] **复制连接** — 右键复制现有连接配置 -- [x] **侧边栏可拖拽** — 调整宽度 200–1500px,持久化 -- [x] **DB 自定义名称** — 用户可重命名 DB0 → 生产库,下拉显示 -- [x] **DB key 数量显示** — 下拉框显示每个 DB 的 key 数量 -- [x] **DB 数量自动检测** — CONFIG GET databases + INFO keyspace -- [x] **DB 记忆** — 每个连接记住最后选择的数据库 -- [x] **更多语言** — de/es/fr/it/ko/pt/ru/tr/ua/vi/tw(当前仅 en/zh-CN) -- [x] **SlowLog 配置显示** — slowlog-log-slower-than / slowlog-max-len -- [x] **Cluster SlowLog** — 每个 master 节点分别查询 -- [x] **Cluster Keyspace 表** — 集群模式显示各节点 key 数量 -- [x] **Status 自动刷新开关** — 可暂停/恢复的刷新(当前固定 1s) -- [x] **Status 搜索过滤** — INFO 表格搜索 -- [x] **Key 统计表** — 每个 DB 的 Keys/Expires/Avg TTL 排序表 -- [x] **大值保护** — >20MB 显示占位符而非崩溃 -- [x] **Hash 字段 TTL** — Redis 7.4+ HEXPIRE 支持 -- [x] **Editor 行内过滤** — 每个编辑器的表头搜索 -- [x] **Zset 排序切换** — ASC/DESC 单选按钮 -- [x] **CLI 自动同步** — CLI 执行 SELECT 后自动同步 UI -- [x] **CLI 执行后刷新 key 列表** — set/hset/del 等命令后自动刷新 -- [x] **标签页滚轮切换** — 鼠标滚轮切换标签 -- [x] **标签页右键菜单** — 关闭/关闭其他/关闭左侧/关闭右侧 -- [x] **Element Plus 深色适配** — 所有组件无白底 -- [x] **窗口状态持久化** — 大小/位置/最大化状态记忆 - ---- - -## 技术债务 - -- [x] AGENTS.md 路径更新 — 文档写 `src/renderer/src/components/`,实际是 `src/components/` -- [x] `electron/shared/types.ts` 残留字段(文件已在层级重构中移除) — SSH/Sentinel/Cluster/TLS 路径在类型中存在但从未在 UI 中实现 -- [ ] 单元测试 — 当前无任何测试 -- [ ] E2E 测试 — 无端到端测试 -- [x] 构建产物清理 — `dist-electron/` 与 `release/` 已加入 .gitignore diff --git a/docs/superpowers/specs/2026-07-04-jredisdesktop-v2-design.md b/docs/superpowers/specs/2026-07-04-jredisdesktop-v2-design.md deleted file mode 100644 index 1340522..0000000 --- a/docs/superpowers/specs/2026-07-04-jredisdesktop-v2-design.md +++ /dev/null @@ -1,233 +0,0 @@ -# JRedisDesktop v2 — Design Spec - -**Date:** 2026-07-04 -**Status:** Approved - -## 1. Project Identity - -Fork of [AnotherRedisDesktopManager](https://github.com/qishibo/AnotherRedisDesktopManager). Full rewrite of the legacy Vue 2 + Webpack 4 + Electron 12 codebase (archived in `legacy/`) to Electron 33 + Vue 3 + Vite 6 + TypeScript 5. - -## 2. Scope & Phasing - -### Phase 1: Architecture Skeleton (Week 1-2) -- Electron main process with contextIsolation + preload + contextBridge -- Vue 3 SPA with Vue Router + Element Plus + Pinia -- electron-vite three-target build pipeline (main/preload/renderer) -- Dark/light dual theme system via CSS variables -- Window management (min/max/close, win-state persistence) - -### Phase 2: Connection Management MVP (Week 2-3) -- Standalone Redis connections (host:port + password/ACL) -- TLS support (CA/cert/key file reading via main process) -- Connection list CRUD with drag-to-reorder -- Secure credential storage (electron-store + safeStorage encryption) -- SSH tunnel support (single node) - -### Phase 3: Key Browser MVP (Week 3-4) -- Key list with SCAN-based pagination + tree view (key separator) -- String viewer/editor (plain text, JSON formatting) -- Hash viewer/editor (field table, pagination, add/edit/delete) -- Server INFO status dashboard -- Database switching - -### Phase 4: Advanced Features (Iterative) -- List/Set/Zset/Stream editors -- Format viewers (Msgpack, Protobuf, Pickle, Brotli, Gzip, etc.) -- Redis CLI terminal -- Cluster/Sentinel connections -- Slow log, memory analysis, batch delete -- i18n (13 languages from legacy) -- Monaco JSON editor -- Custom shell formatters - -## 3. Architecture - -### Process Model -``` -┌─────────────────────────────────────────────┐ -│ Main Process │ -│ ├── Window management │ -│ ├── RedisService (ioredis + SSH + TLS) │ -│ ├── electron-store (persistence) │ -│ ├── safeStorage (credential encryption) │ -│ └── IPC handlers (typed channels) │ -├─────────────────────────────────────────────┤ -│ Preload (contextBridge) │ -│ └── window.electronAPI (typed IPC methods) │ -├─────────────────────────────────────────────┤ -│ Renderer (Vue 3 SPA) │ -│ ├── Pinia stores (connection, key, app) │ -│ ├── Vue Router │ -│ ├── Element Plus │ -│ └── Composition API components │ -└─────────────────────────────────────────────┘ -``` - -### Key Architectural Decision: RedisService in Main Process -ioredis depends on Node `net`/`tls` modules and cannot run in a contextIsolation renderer. All Redis operations go through typed IPC: - -``` -Renderer (Pinia action) → IPC invoke → Main (RedisService) → ioredis → Redis -``` - -IPC latency (~1ms) is negligible vs Redis network latency (1-100ms). High-frequency operations (SCAN) use batch IPC to minimize round trips. - -### Renderer Component Tree (MVP) -``` -App.vue -├── TitleBar.vue (window controls, connection badge) -├── Sidebar.vue -│ ├── ConnectionSearch.vue (filter connections) -│ ├── ConnectionList.vue (card list, drag sort) -│ │ └── ConnectionCard.vue -│ └── NewConnectionBtn.vue -├── MainArea.vue (tab host) -│ ├── StatusView.vue (INFO dashboard with stat cards) -│ ├── KeyBrowser.vue (key list + tree + detail) -│ │ ├── KeyList.vue (SCAN pagination, tree toggle) -│ │ └── KeyDetail.vue (type dispatcher) -│ │ ├── StringEditor.vue -│ │ └── HashEditor.vue -│ └── CliView.vue (Phase 4) -└── StatusBar.vue (connection status, latency) -``` - -### Pinia Stores -| Store | Responsibility | -|---|---| -| `useConnectionStore` | Connections CRUD, active connection, RedisService proxy | -| `useKeyStore` | Key list, tree view, selected key, key data cache | -| `useAppStore` | Theme (dark/light), settings, i18n locale, UI state | - -### IPC Channel Design -| Channel | Type | Direction | Purpose | -|---|---|---|---| -| `redis:connect` | invoke | renderer→main | Create Redis connection, return client ID | -| `redis:disconnect` | invoke | renderer→main | Close connection by ID | -| `redis:execute` | invoke | renderer→main | Execute Redis command, return result | -| `redis:event` | on | main→renderer | Connection events (ready, error, close) | -| `storage:get` | invoke | renderer→main | Read from electron-store | -| `storage:set` | invoke | renderer→main | Write to electron-store | -| `credential:encrypt` | invoke | renderer→main | Encrypt via safeStorage | -| `credential:decrypt` | invoke | renderer→main | Decrypt via safeStorage | -| `dialog:openFile` | invoke | renderer→main | Open file picker, return file content | -| `window:minimize` | send | renderer→main | Minimize window | -| `window:maximize` | send | renderer→main | Toggle maximize | -| `window:close` | send | renderer→main | Close window | -| `theme:set` | send | renderer→main | Set nativeTheme source | -| `theme:os-updated` | on | main→renderer | OS theme change notification | - -## 4. UI Design - -### Visual Style -- **Dark theme:** Deep blue-black gradient background, perspective cards with rotateY/X micro-angles, ambient light overlays, glow dot status indicators, multi-tier shadows for depth hierarchy -- **Light theme:** Clean white background, soft shadows, purple-blue accent, light frosted glass effects -- **Dual theme:** CSS custom properties (`--bg`, `--text`, `--border`, `--accent`, `--shadow`) switch at root level. Follows OS preference by default, manual toggle persisted. - -### Layout -- Left sidebar (~260px): connection cards with search + new connection button -- Right main area: stat cards row + tab bar + content panel -- Bottom status bar: connection status + latency + app version -- Resizable sidebar (drag handle) - -## 5. Data Persistence - -### Strategy: Mixed -- **electron-store** (main process): Non-sensitive data — connection list, settings, UI preferences -- **safeStorage** (main process): Sensitive data — passwords, SSH private keys, TLS certs - -### Data Shape -```typescript -// electron-store schema -interface AppStorage { - connections: Connection[]; - settings: AppSettings; - windowState: { x: number; y: number; width: number; height: number; maximized: boolean }; -} - -interface Connection { - id: string; - name: string; - host: string; - port: number; - auth: string; // encrypted via safeStorage - username: string; // ACL username - tls: boolean; - tlsCaPath: string; - tlsCertPath: string; - tlsKeyPath: string; - sshEnabled: boolean; - sshHost: string; - sshPort: number; - sshUsername: string; - sshPassword: string; // encrypted via safeStorage - sshPrivateKeyPath: string; - cluster: boolean; - sentinelMasterName: string; - separator: string; // key tree separator, default ":" - order: number; - createdAt: number; -} - -interface AppSettings { - theme: 'system' | 'dark' | 'light'; - locale: string; - fontSize: number; - scanCount: number; // keys per SCAN page - // ... more settings as needed -} -``` - -## 6. Security Model - -- **contextIsolation: true** — renderer has zero Node.js/Electron API access -- **nodeIntegration: false** — no Node globals in renderer -- **contextBridge** — only typed API surface exposed via `window.electronAPI` -- **safeStorage** — OS-level encryption for credentials (DPAPI on Windows, Keychain on macOS, libsecret on Linux) -- **IPC validation** — all IPC handlers validate input before executing -- **No remote module** — all main-process features accessed via IPC - -## 7. Compatibility Mitigations - -| Legacy Pattern | v2 Approach | -|---|---| -| `redisClient.js` in renderer | RedisService in main, typed IPC proxy | -| `fs.readFileSync` for TLS | `dialog:openFile` IPC → main reads file | -| `remote.app` sandbox bookmarks | Main process handles file access | -| `vue.$bus` / `vue.$message` | mitt EventEmitter + ElMessage composable | -| `Vue.prototype.$storage` | `useConnectionStore()` composable | -| `Vue.prototype.$util` | Pure functions in `utils/` | -| Node `zlib` for decompression | Web `DecompressionStream` + WASM fallback | -| `child_process.exec` formatters | IPC → main process spawn (Phase 4) | -| `window.localStorage` | electron-store IPC | -| Monaco + webpack plugin | ESM Monaco + vite plugin (Phase 4) | - -## 8. Build & Dev - -```bash -npm run dev # electron-vite dev (HMR, renderer on :5173) -npm run build # production build → out/ -npm start # preview built app -npm run build:unpack # build + electron-builder --dir -npm run build:win # build + electron-builder --win -npm run build:mac # build + electron-builder --mac -npm run build:linux # build + electron-builder --linux -``` - -## 9. Dependencies - -### Runtime -- `ioredis` ^5.7.0 — Redis client (main process) -- `tunnel-ssh` ^5.x — SSH tunneling (main process) -- `electron-store` ^10.x — persistence (main process) - -### Dev / Renderer -- `electron` ^33.4.0 -- `electron-vite` ^3.0.0 -- `vue` ^3.5.0 -- `vue-router` ^4.5.0 -- `pinia` ^2.x -- `element-plus` ^2.9.0 -- `typescript` ^5.7.0 -- `vite` ^6.0.0 -- `electron-builder` ^25.1.0