feat(desktop): 添加项目与任务快速切换 - #3650
Conversation
支持按项目名称和任务标题搜索、键盘切换及侧栏定位,包含已归档历史任务和已连接设备来源。 补齐分页元数据目录、交互与边界测试,以及浅色和深色实机截图。 Signed-off-by: lizzjin <lizzjin37@gmail.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
| Filename | Overview |
|---|---|
| apps/desktop/src/renderer/features/cc-agent/QuickSwitcher.tsx | 实现目录聚合、异步失效保护、来源复核、导航与完整的弹窗键盘交互。 |
| apps/desktop/src/renderer/features/cc-agent/lib/quickSwitcher.ts | 实现项目构建及模糊排序,但会把 exists=false 的近期目录暴露为无法打开的项目结果。 |
| apps/desktop/src/main/localDb/quickSwitcher.ts | 以稳定游标分页读取可见任务元数据,并排除已删除任务和 worker。 |
| apps/desktop/src/main/localDb/ipc/search.ts | 新目录 IPC 对本地发送方、device-link 调用、游标和错误信息进行了边界处理。 |
| apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx | 增加快速切换目标的临时过滤覆盖、历史任务注入、项目展开和侧栏定位。 |
| packages/device-link/src/allowlist.ts | 将只读分页目录通道加入默认拒绝的远程调用白名单。 |
Sequence Diagram
sequenceDiagram
participant U as 用户
participant R as QuickSwitcher
participant P as Preload
participant M as Desktop Main
participant D as 本地或远程数据库
U->>R: Ctrl/Cmd+K 并输入查询
R->>P: 请求分页任务目录
P->>M: local-db:conversations:catalog
M->>M: 校验发送方、来源和游标
M->>D: 读取任务元数据
D-->>M: 分页目录
M-->>R: 项目与任务候选
U->>R: 选择结果
R->>D: 按明确来源重新读取目标
R->>R: 切换路由并临时展开侧栏
Prompt To Fix All With AI
### Issue 1
apps/desktop/src/renderer/features/cc-agent/lib/quickSwitcher.ts:62-64
**失效目录仍可被选择**
当 `recentWorkdirs.list` 返回目录已删除、迁移、无权访问或网络盘断开而 `exists=false` 的条目时,这里仍将其加入可搜索的空项目列表;选择逻辑随后必然拒绝该目录,导致用户点击正常展示的结果后只能收到“任务或目录已不存在”。
```suggestion
for (const dir of recent) {
if (!dir.exists) continue;
const workingDir = normalizeWorkingDir(dir.path);
if (!workingDir) continue;
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Reviews (1): Last reviewed commit: "feat(desktop): 添加项目与任务快速切换" | Re-trigger Greptile
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 533084c696
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
过滤失效的近期空目录,保留真实任务与远端项目。 通过现有受限通道转发 WebView 快速切换快捷键,沿用有效绑定、交互锁和焦点恢复规则。 补充目录、跨平台按键、preload 过滤与弹窗回归测试。 隔离 exec E2E 的插件运行时,避免后台下载子进程占用临时目录导致清理超时。 Signed-off-by: lizzjin <lizzjin37@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b00646b55
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Main 使用与 Renderer 相同的语音键位转换和外部让位组合。 实时读取当前语音快捷键,改绑或清除后立即更新,避免按键路径复制词典和历史。 补充三平台冲突、改绑、清空和原生快捷键回归测试。 Signed-off-by: lizzjin <lizzjin37@gmail.com>
|
这条 PR 需要维护者确认后才能合并:新产品交互(项目/任务快速切换),并触及 preload/webview 安全边界和核心路径。 请维护者在 PR 上 Approve;若要改,请 Request Changes。讨论 issue:#3654 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2baddf65dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@lizzjin 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/renderer/features/cc-agent/CCAgentSidebarUpper.tsx),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
快速切换只投影目标项目的展开状态,不再调用持久化 expand。 普通与置顶项目共用临时状态,手动折叠及全部展开/折叠仍保留显式偏好。 补充导航恢复、重新挂载、账号隔离与手动操作回归,并同步折叠提醒接线测试。 Signed-off-by: lizzjin <lizzjin37@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bee3f02ca5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@lizzjin 👋 这个 PR 还有 1 条 review conversation 没 resolve(apps/desktop/src/main/localDb/quickSwitcher.ts),auto-review 因此暂时跳过、没法继续审查 / 合并。 如果你已经按评论改完或回应了,请到对应 thread 上点 Resolve conversation;全部 resolve 后,下一轮 auto-review 会自动重新审查这个 PR。 |
目录消息存在性判断包含 rewind 记录,保持物理消息分组口径。 补充旧任务和导入任务的项目搜索回归,并分别验证三平台语音快捷键策略。 Signed-off-by: lizzjin <lizzjin37@gmail.com>
这次改了什么
摘要
新增项目与任务快速切换入口,减少在侧栏中查找和展开项目的操作。使用 Ctrl+K / Cmd+K 打开后,可按项目名称或任务标题搜索,通过方向键、Enter 或鼠标直接切换,并定位到侧栏中的目标。
Closes #3458
变更类型
feat新功能fix缺陷修复范围
UI 变化
引用的设计规范:
docs/design-rules/DESIGN.md§3 Typography Rules、§4 Inputs & Forms / Dialog & Modal、§10 Theme System、§14.2 Focus Management、§15.11 Input Caret。弹窗使用规定的字号、间距和圆角,颜色与焦点样式使用主题语义 token;输入框继承全局光标颜色,圆角由外层容器承载,保证光标完整显示。以下为真实 Desktop 运行截图:Windows x64,Electron 41.10.3,2026-08-30;分别使用 Cindy Light 与 Cindy Dark。截图对应本 PR 提交
533084c696ebad92bf1bda2fe8ff370e29218f5c中的界面代码。怎么验证的
原功能提交的自动验证
pnpm test:unit:related:通过,覆盖 Desktop、Mobile 和 device-link 的相关单测门禁。pnpm --filter desktop run --if-present typecheck:通过。pnpm --filter @cindy/device-link build:通过。pnpm --filter desktop exec vitest run src/renderer/__tests__/quickSwitcherDialog.test.tsx:20 项通过。pnpm check:i18n、pnpm check:i18n-glossary:通过。pnpm check:dco:通过。前两条评审修复验证
pnpm test:unit:related:通过,Desktop 374.8s、Mobile 26.8s、device-link 1.2s;未跳过或放宽原断言、未提高测试超时。pnpm --filter desktop run --if-present typecheck与pnpm --filter @cindy/device-link build:通过。device-link 的--if-present typecheck没有对应脚本,不计为类型检查证据,类型验证来自 build 中的 tsc。P2:语音快捷键冲突修复验证
pnpm test:unit:related通过:Desktop 371.3s、Mobile 27.6s、device-link 1.1s。pnpm --filter desktop run --if-present typecheck、pnpm --filter @cindy/device-link run build通过;device-link 无 typecheck script,其--if-present typecheck为无操作,实际类型验证来自 build 中的 tsc。P1:快速切换临时展开修复验证
collapse.expand(),仅在quickFocus有效期间投影目标项目为展开;结束临时定位后读取原折叠记录,手动操作仍按用户意图保存。普通项目、置顶项目及折叠提醒使用同一显示状态。pnpm test:unit:related:通过,Desktop 368.6s、Mobile 28.1s、device-link 1.2s;未跳过或放宽原测试。pnpm --filter desktop run --if-present typecheck、pnpm --filter @cindy/device-link run build通过;device-link 无 typecheck script,--if-present typecheck为无操作,实际类型验证来自 build 中的 tsc。提交前再次预检通过,并核对最终快照的验证凭据一致。docs/design-rules/DESIGN.md§10 Theme System / Light-Dark Dual-Mode Delivery Gate、§14.2 Focus Management。未改布局、样式、颜色、文案、存储格式或 IPC/权限边界;未重新进行实机、macOS/Linux 或 Light/Dark 目检,原截图不代表本轮已目检。最新 P2 与 Linux CI 修复验证
rewind_at,与sessions:list/get的物理消息口径一致;userSendAt为空且全部消息已 rewind 的旧任务或导入任务仍归入项目,可按项目名搜索。保持索引存在性查询,不读取消息正文、不统计完整历史。pnpm test:unit:related通过:Desktop 396.9s、Mobile 35.7s、device-link 1.2s。pnpm --filter desktop run --if-present typecheck与pnpm --filter @cindy/device-link run build通过;device-link 无 typecheck script,其--if-present typecheck为无操作,类型证据来自 build 中的 tsc。发布前预检和同快照测试凭据再次核对通过。手工验证
在 Windows 的隔离 Desktop 实例中,以本地模式完成快捷键打开、搜索匹配、键盘与鼠标选择、项目与归档任务跳转、关闭后焦点与草稿保留、侧栏展开定位及快捷键修改验收。
在 Cindy Light / Cindy Dark 两种主题下检查了真实弹窗、自动聚焦和完整输入光标,截图见上方。
风险
风险分类
影响与回滚
提交前检查
Signed-off-by签名