feat(office): word/excel live preview via officecli watch + auto-preview on file generation#1869
feat(office): word/excel live preview via officecli watch + auto-preview on file generation#1869
Conversation
- Add wordPreview/excelPreview IPC bridge entries - Add officeWatchBridge.ts (mirrors pptPreviewBridge, handles word+excel) - Refactor proxy routes into shared registerOfficecliWatchProxy helper - Replace static Word/Excel viewers with officecli watch mode - Add useAutoPreviewOfficeFiles hook: auto-opens preview on tool completion - Handles tool_group (Claude/Gemini/ACP) and codex_tool_call (Claude Code) - Deduped by toolCallId, conversation-scoped - Update readme wx group image to wx-5.png (all language variants) - 20 unit tests for officeWatchBridge, 7 for useAutoPreviewOfficeFiles
…k for auto-preview
…n conversation switch
…e last filename match
…event historical openings Only fire auto-preview for tool calls observed in Executing/Pending/Confirming state during the current component mount. Tool calls already in Success state at mount time (historical messages) are never added to seenInProgress and therefore never trigger. Navigating away remounts the component and resets seenInProgress, so returning to an old conversation does not re-open tabs.
Replace message-state tracking (seenInProgress) with a filesystem watcher. The main process watches the workspace directory via fs.watch and emits workspaceOfficeWatch.fileAdded for any new .pptx/.docx/.xlsx that appears while the conversation is active. The renderer hook starts the watcher on mount and stops it on unmount, so switching conversations resets the watch session. Pre-existing files are never emitted. This approach works regardless of how the file was created (WriteFile tool, Bash/officecli, or any other method).
…omments Consolidate the three near-identical watch viewers (PptViewer, OfficeDocViewer, ExcelViewer) into a single OfficeWatchViewer component parameterised by docType. Each viewer is now a one-line wrapper. No behaviour changes. Also add comments clarifying the settle()-without-resolve pattern in startWatch and the fs.watch recursive Linux limitation.
…parsing stdout When spawned as a child process stdout is fully-buffered (non-TTY), so the "Watch:" readiness line never flushes within the 15s timeout window. Replace stdout parsing with direct TCP port polling: once the port is reachable the server is ready, regardless of output buffering. Also extend waitForPort max retries from 20 to 150 (matches 15s outer timeout) and update tests to control port-connect success/failure per scenario.
Code Review:feat(office): word/excel live preview via officecli watch + auto-preview on file generation (#1869)变更概述本 PR 为 Word 和 Excel 文件引入了基于 方案评估结论:✅ 方案合理 整体方案架构清晰,主进程(officeWatchBridge)负责进程生命周期管理,渲染侧通过 IPC 驱动,符合项目的进程分层规范。端口校验( 问题清单🔵 LOW — 未使用的 catch 参数
|
| # | 严重级别 | 文件 | 问题 |
|---|---|---|---|
| 1 | 🔵 LOW | src/process/services/database/index.ts:649 |
未使用的 catch 参数 e |
结论
✅ 批准合并 — 无阻塞性问题
代码质量良好,架构设计合理,测试覆盖全面(officeWatchBridge 500+ 行测试)。唯一问题是一个 LOW 级别的未使用 catch 参数,不影响功能。
本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。
|
✅ 已自动 review,无阻塞性问题,正在触发自动合并。 |
Summary
Changes
Main process
Renderer
Tests
Related Issue
Closes #1876
Test Plan