Skip to content

feat: 主要围绕“工作区”补齐了分支管理、阻塞守卫和差异查看能力,并把相关状态逐步收敛到统一的 WorkspaceModel#2

Open
liangriyu wants to merge 23 commits intoLeibnizhu:mainfrom
liangriyu:feat/codex-branch-p1
Open

feat: 主要围绕“工作区”补齐了分支管理、阻塞守卫和差异查看能力,并把相关状态逐步收敛到统一的 WorkspaceModel#2
liangriyu wants to merge 23 commits intoLeibnizhu:mainfrom
liangriyu:feat/codex-branch-p1

Conversation

@liangriyu
Copy link
Copy Markdown

概要

这个 PR 主要增强了工作区维度的分支管理和差异查看体验。

本次改动包括:

  • 支持受限版工作区分支切换与创建
  • 增加审批未闭合记录持久化与单条忽略能力
  • 工作区差异面板升级为多模式视图
  • Git Status 升级为右侧面板的一等视图
  • 支持按工作区配置基线分支
  • 增强 baseBranch 的本地自动推导策略
  • 引入统一的 WorkspaceModel 收敛工作区状态

主要改动

  • 分支切换不再只是前端按钮交互,而是围绕工作区状态进行受限控制。
  • 工作区脏状态改为结构化建模,阻塞原因和可见证据更一致。
  • 审批未闭合记录在刷新后仍可继续阻塞分支操作,并支持逐条忽略本地阻塞记录。
  • 右侧工作区面板现已支持以下视角:
    • 未暂存
    • 已暂存
    • 全部分支更改
    • 最近一次提交
    • Git 状态
  • baseBranch 支持按工作区保存,并在未显式配置时基于本地 Git 信息自动推导。

验证

  • npm run build

Copilot AI review requested due to automatic review settings April 1, 2026 15:08
@liangriyu
Copy link
Copy Markdown
Author

@codex

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

该 PR 以“工作区(cwd)”为核心,补齐了分支管理、阻塞守卫、差异面板多模式与 Git Status 一等视图等能力,并将相关状态逐步收敛到统一的 WorkspaceModel,让页面与组件更多只消费单一工作区模型而不是拼装多份真相。

Changes:

  • 新增/扩展 bridge 接口:分支查询与切换/创建、模式化 workspace diff、结构化 Git status、persisted approvals 账本与 dismiss 能力。
  • 前端引入并推广 WorkspaceModel:统一聚合分支、guard、gitStatus、diff、approvals 与 UI 状态;支持 baseBranch 按 cwd 持久化。
  • UI 升级:分支 chip 变为可交互菜单(含阻塞原因与 persisted 记录忽略),差异面板升级为多模式(含 Git Status tab + baseBranch 选择器)。

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/types/codex.ts 新增 persisted approvals、workspace diff modes/snapshot、WorkspaceModel 等统一类型定义
src/server/codexAppServerBridge.ts 增加 persisted approvals 账本、git status/branches/branch ops、workspace-diff-mode(含 baseBranch 推导)等能力
src/i18n/uiText.ts 新增分支菜单、diff panel 多模式、Git status/baseBranch 等 UI 文案
src/composables/useDesktopState.ts 引入 workspaceByCwd/WorkspaceModel 聚合逻辑,新增分支/guard/diff/persisted approvals/baseBranch 等状态与动作
src/composables/desktop-state/storage.ts 增加 baseBranch 的 cwd -> branch 本地持久化读写
src/components/content/ThreadComposer.vue 分支 chip 升级为菜单:显示阻塞原因、dirty 摘要、persisted records 并支持单条忽略
src/components/content/CodePreviewPanel.vue workspace 面板升级:多模式 tabs、Git Status 视图、branch 模式 baseBranch 选择与 ref/warning/empty state
src/App.vue 页面编排改为消费 workspace store:打开/切换面板模式、baseBranch 更新、分支操作联动刷新
src/api/codexRpcClient.ts 新增 persisted requests 读取、dismiss、workspace-diff-mode 请求等 HTTP 调用封装
src/api/codexGateway.ts 新增/归一化 workspace git status/branches、branch ops、persisted approvals、workspace diff snapshot 等高层 API
docs/plans/2026-04-01-workspace-model-unification-plan.md 工作区模型收敛实施计划与结果记录
docs/plans/2026-04-01-workspace-model-unification-design.md 工作区模型收敛设计文档
docs/plans/2026-04-01-workspace-guard-phase2-persisted-approvals-plan.md 守卫 phase2(persisted approvals)计划与结果
docs/plans/2026-04-01-workspace-guard-phase1-plan.md 守卫 phase1(结构化 git status)计划与结果
docs/plans/2026-04-01-workspace-guard-consistency-design.md 守卫一致性设计文档
docs/plans/2026-04-01-persisted-approval-dismiss-plan.md persisted approvals dismiss 计划与结果
docs/plans/2026-04-01-persisted-approval-dismiss-design.md persisted approvals dismiss 设计文档
docs/plans/2026-04-01-git-status-base-branch-plan.md Git Status + baseBranch 配置计划与结果
docs/plans/2026-04-01-git-status-base-branch-design.md Git Status + baseBranch 配置设计文档
docs/plans/2026-04-01-diff-panel-implementation-plan.md diff panel modes 计划与结果
docs/plans/2026-04-01-diff-panel-design.md diff panel 设计文档
docs/plans/2026-04-01-base-branch-auto-detection-plan.md baseBranch 自动推导计划
docs/plans/2026-04-01-base-branch-auto-detection-design.md baseBranch 自动推导设计文档
docs/plans/2026-03-31-branch-management-design.md 分支能力设计文档
docs/plans/2026-03-31-branch-capability-phase1-plan.md 分支能力 phase1 计划与结果

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/server/codexAppServerBridge.ts Outdated
Comment thread src/server/codexAppServerBridge.ts Outdated
Comment thread src/server/codexAppServerBridge.ts Outdated
Comment thread src/components/content/CodePreviewPanel.vue
Comment thread src/components/content/ThreadComposer.vue Outdated
Comment thread docs/plans/2026-04-01-workspace-model-unification-design.md Outdated
Comment thread docs/plans/2026-04-01-git-status-base-branch-design.md
Comment thread docs/plans/2026-04-01-base-branch-auto-detection-plan.md
Comment thread docs/plans/2026-04-01-base-branch-auto-detection-design.md Outdated
Comment thread docs/plans/2026-04-01-git-status-base-branch-plan.md Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 992d11ddba

ℹ️ 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".

Comment thread src/App.vue
Comment thread src/composables/useDesktopState.ts
liangriyu and others added 10 commits April 2, 2026 00:40
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@liangriyu
Copy link
Copy Markdown
Author

@codex

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38103c6ed2

ℹ️ 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".

Comment thread src/server/codexAppServerBridge.ts Outdated
Comment thread src/composables/useDesktopState.ts Outdated
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.

2 participants