Repository navigation
feat(desktop): Git 控制台按类别省略内部查询并调整显示方式,初始状态与 IntelliJ IDEA 一致 - #2029
Merged
Merged
Conversation
设置 → 版本控制新增两张卡片,共 13 个开关,每个都带 ⓘ 说明: - “Git 控制台:省略的查询”(9 个,初始全部打开):后台分支读取、操作后的 自动重新加载、保存后的差异刷新、差异读取、日志浏览、日志路径筛选、注解与 行历史、列表与面板、操作前检查。省略的类别在 Core 记录前就丢弃,不占控制台 的 200 条记录。用户执行的命令、失败的 Git 请求、意外的退出码和未确认的命令 不受开关影响。 - “Git 控制台:显示”(4 个):查询只显示命令行(初始关)、省略“执行成功, 没有输出”提示(初始开)、完全隐藏临时 -c 配置(初始关)、省略仓库名(初始关)。 实现: - core:GitConsolePreferences 保存 13 个开关,零值就是 IDEA 的初始状态; ConsoleQueries 和 Display 换算成 Core 的 gitExecution.consoleQueries 与 git.consolePresentation 的 display;WithQueryCategory 为场景不同的同名请求 标注类别;删除 reportQueries。 - workbench:后台分支与引用读取、操作后的重新加载、保存后的差异刷新、日志路径 筛选分别标注 references、reload、diffRefresh、logPathFilter;控制台按显示 选项重新请求呈现,标题行按选项省略仓库名,复制全部内容仍保留完整命令和仓库名。 - 控制台工具栏的“隐藏读取命令”开关改为打开“设置 → 版本控制”的按钮。 - settingswindow:两张卡片接入设置保存,“恢复默认设置”回到 IDEA 的初始状态。 - i18n:新增 desktop.git.settings.console.* 词条,desktop.git.console.hideQueries 改为 desktop.git.console.settings。 - Core 固定到包含 consoleQueries、queryCategory 与 display 的提交。 - 功能矩阵 git-history 与 Agent Note 记录新的分类、记录前过滤和取舍。
6 tasks done
xiaoyumuxi
marked this pull request as ready for review
November 16, 2026 09:03
- “查询只显示命令行”改为“折叠 10 行以内的查询输出”(foldShortQueries):成功查询的输出超过 10 行才折叠,打开后短输出也折叠;删除类命令的配置、进度和输出从不折叠(规则在 Core)。 - 省略一个类别时移除已记录的该类成功查询(Core 在 started 事件里带 queryCategory); 查询类别改为 core.GitQueryCategory 类型,并与 Core fixture 的 queryCategories 对照测试。 - Git 操作后重新读取状态统一走 reloadGit,归入“操作后的自动重新加载”类别。 - 显示参数切换后,搜索命中和计数只用当前参数下的展示结果。 - 控制台只保存要记录的类别,显示参数从设置读取;类别用原子指针缓存,不再每个请求加锁。 - 日志路径筛选的类别标注提到循环外;单行输出用“共 1 行”词条;文案去掉“200 条记录”。 - PINNED_CORE_REVISION 升到 Core#64 分支的 5aae479。
7 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
关联 Issue / Linked issue
PR 类型 / Type
改动说明 / What changes
背景 / Why
Git 控制台显示的内容太多:打开一个仓库就有大量
rev-parse查询,切 diff、翻日志、看注解时,读取命令把用户自己执行的命令挤了出去,还会占掉控制台的 200 条记录。原来工具栏上只有一个“隐藏读取命令”开关,只能全显示或全隐藏。这次在“设置 → 版本控制”里加了 13 个开关,按类别省略内部查询,也能调整显示方式。所有开关都可以单独改,初始状态与 IntelliJ IDEA 的控制台一致:IDEA 只显示用户执行的命令,不显示内部读取。
改动 / Changes
设置页(
settingswindow/git_console_view.go,新文件)referencesreloaddiffRefreshdiffloglogPathFilterannotatepanelschecks-c配置(初始关)、省略仓库名(初始关)。window_view.go)。controller.go、version_control_view.go:两张卡片接入设置的保存和回显。过滤方式(
core/gitconsole.go、core/client.go)GitConsolePreferences保存 13 个开关,零值就是 IDEA 的初始状态,旧设置文件不需要迁移。QueryCategories()换算出 Core 的gitExecution.consoleQueries,Display()换算出git.consolePresentation的display。RecordQueries,依据 Core 在 started 事件里带的queryCategory),释放记录和输出预算;失败的查询、可见命令和仍在运行的请求里的查询保留。core.GitQueryCategory类型常量,TestGitQueryCategoriesAreTheOnesCoreLists拿它和 Core fixture 的queryCategories逐项对照。WithQueryCategory(ctx, category)给命令本身分不出场景的读取标注类别:reload:branch.go、gitsync.go操作后的重新加载,difftab.go的reloadDiffs,以及新的reloadGit:提交、暂存、贮藏、搁置、变基、历史改写、排除、行号区操作、PR 创建与评审、工作树、嵌套仓库之后和刷新更改列表时读取的状态(commit.go、stash.go、shelf.go、git_rebase.go、git_history.go、git_exclude.go、git_gutter.go、github_create.go、gitreview.go、gitworktree.go、nested_repos.go);diffRefresh:difftab_edit.go保存后的reloadDiffsOfPath;logPathFilter:gitlog.go按路径过滤时的GitCommitFiles(标注提到逐提交循环外);references:nested_refs.go后台读取分支和引用。reportQueries,Core 也已删除该字段(deny_unknown_fields),所以本 PR 必须和 Core#64 一起升级。控制台(
workbench/gitconsole.go、gitconsole_view.go、gitconsole_settings.go)openGitConsoleSettings)。-c配置、进度和输出从不折叠(“完全隐藏临时-c配置”对它仍然生效)。删除类命令(只看--之前的选项):rm、clean(含试运行clean -n);带-d/-D/--delete的branch、tag、update-ref、symbolic-ref;带-d/--delete/--prune或空源 refspec(:refs/heads/topic)的push;带-p/--prune/-P/--prune-tags的fetch、pull;remote remove/rm/prune和remote update --prune;带--unset、--unset-all、--remove-section、unset、remove-section的config;stash drop/clear/pop;worktree remove/prune。reset、checkout --这类回退不算删除。desktop.git.console.queryOutputOne)。settings.go、app.go:设置保存后调用gitConsole.SetPreferences,已经打开的控制台立即生效。其他
desktop.git.settings.console.*中英词条(卡片标题、13 个开关及 ⓘ 说明),desktop.git.console.hideQueries改为desktop.git.console.settings,新增desktop.git.console.queryOutputOne;说明文字不再写死“200 条记录”;生成文件已重新生成。scripts/desktop/build-desktop-core.sh:PINNED_CORE_REVISION暂时固定到 Core#64 分支的5aae479(分支已合入 Core main ad148ec)。git-history:补充证据路径和验证说明。2026-09-12-git-execution-and-project-console.md:新增“记录哪些查询由用户设置决定,在记录前过滤”一节,记录分类、记录前过滤的理由、类别与 fixture 对照、省略时移除已记录查询、失败查询的报告、10 行折叠阈值和删除类不折叠,以及被否方案。core/gitconsole_test.go:TestGitConsolePreferencesMapToCategoriesAndDisplay(零值对应 IDEA 的初始状态,每个开关对应的类别和显示字段);TestGitExecutionOfAsksForTheCategoriesTheConsoleShows;TestGitConsoleRecordsTheQueriesOfTheCategoriesItShows(真实仓库上只记录打开的类别,替换原来的…RecordsQueriesButNotAutomaticRefreshes);TestGitQueryCategoriesAreTheOnesCoreLists(类别名与 Core fixture 一致);TestGitConsoleDropsTheSuccessfulQueriesOfACategoryTurnedOff(省略类别时只移除已结束的成功查询,记录版本和输出预算随之更新,重复调用不变);started 事件解析出queryCategory。settingswindow/git_console_view_test.go:TestGitConsoleCardsStartAsIDEAAndHandOnTheirChanges(13 个开关的初始状态与切换后交给保存)。workbench/gitconsole_test.go:TestConsoleRedrawsWithTheDisplayChoices、TestConsoleFoldsAShortQueryCoreFolds、TestConsoleLeavesTheRepositoryOutWhenTheDisplayHidesIt、TestConsoleDropsANoticeTheDisplayNoLongerShows、TestConsoleDrawsAFailedQueryOpen(替换原来的TestConsoleHidesSuccessfulQueriesOnly)。settingswindow/visual_capture_test.go:新增26-settings-git-console截图场景(滚动到控制台卡片)。评审问题处理 / Review findings
上一轮
/code-review报的 12 条问题:reloadGit(提交、暂存、贮藏、搁置、变基、历史改写、排除、行号区操作、PR 创建与评审、工作树、嵌套仓库、刷新更改列表)WithQueryCategory接受任意字符串,写错会让整条请求被 Core 拒绝core.GitQueryCategory类型常量,测试与 Core fixture 的queryCategories逐项对照queryCategory,RecordQueries移除该类已结束的成功查询,失败的和仍在运行的请求保留PINNED_CORE_REVISION不在 Core main 上desktop.git.console.queryOutputOne词条ui.Scroll只有ScrollAt(offset),没有滚到某个子元素的接口;规则禁止在应用层绕过 Viva 的限制gitlog.go在逐提交的循环里调用WithQueryCategory不在本 PR 范围内 / Out of scope
PINNED_CORE_REVISION从分支 commit9fc6468改为 Core main 上的合入 commit,再标记 ready。类型专属:feat
多平台对齐
范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/git-history.json:补充gitconsole_settings.go、git_console_view.go、version_control_view.go证据路径和验证说明,两端的整机验收仍为pending./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh和./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD,均通过.artifacts/下生成的矩阵视图插件归属 / Plugin ownership
develop-lithe第三节的自查命令,结果为空shared/i18n/UI 验证 / UI evidence
LITHE_VISUAL_OUTPUT_DIR=… ../scripts/desktop/desktop-go.sh test -tags 'vivahead lithevisual' ./internal/settingswindow -run 'TestVisualSettings/26-settings-git' -count=1,场景26-settings-git、26-settings-git-console,中文,深色和浅色,900×700 窗口(2x)。设置 → 版本控制(改动前 → 改动后)
Git 控制台:打开仓库后
改动前全是
rev-parse等内部查询;改动后默认(IDEA 初始状态)只剩用户执行的worktree prune;把 9 个省略开关都关掉后,查询又全部出现,10 行以内的输出直接显示,不折叠。统一日志系统 / Structured logging
N/A:没有新增或改动日志事件、操作终态或失败路径。
界面文案 / i18n
shared/i18n/补齐中英词条,运行node scripts/i18n/generate-i18n.mjs并提交生成结果,Viva 代码通过desktop/internal/i18n/读取node scripts/i18n/verify-app-language-localization.mjs和node scripts/i18n/generate-i18n.mjs --check,没有放宽脚本或豁免名单逻辑归属 / Logic placement
-c、仓库名)都在 Rust Core(Core#64,带契约和 fixture);桌面端只保存开关、换算请求字段、给 Core 无法区分的读取标注类别性能与内存 / Performance and memory
设置 / Settings
插件契约 / Plugin contract
N/A:只改了宿主与 Core 之间的
rust-core-api(gitExecution、git.consolePresentation),没有改插件契约、能力版本或插件函数协议,没有新增宿主方法或通知。发行包与资源 / Bundle and resources
./scripts/desktop/verify/verify-runtime-bundle-immutability.sh,通过无用代码与重构 / Dead code and refactoring
reportQueries、工具栏“隐藏读取命令”开关及其词条desktop.git.console.hideQueries已删除验证 / Verification
本机为 Apple M4、macOS arm64,
LITHE_CORE_RUST_DIR指向 Core#64 分支(5aae479)。node scripts/i18n/verify-app-language-localization.mjsnode scripts/i18n/generate-i18n.mjs --check./scripts/platform-feature-matrix/verify-platform-feature-matrix.sh./scripts/platform-feature-matrix/verify-platform-feature-matrix-change.sh origin/main HEAD./scripts/agent-notes/verify-agent-notes.sh./scripts/desktop/verify/verify-runtime-bundle-immutability.shgofmt -l ./internal ./cmd../scripts/desktop/desktop-go.sh vet ./...../scripts/desktop/desktop-go.sh test ./internal/core ./internal/i18n ./internal/settingswindow ./internal/workbench -count=1cargo test -p lithe-git -p lithe-core未能执行的检查和原因:
PINNED_CORE_REVISION目前固定在 Core#64 分支的 commit 上,Core#64 合入 main 后要改为 main 上的合入 commit。提交前确认 / Final checks
main(e645e94d3)创建;目标分支main