Skip to content

fix(desktop): simplify multi-select folder picker actions - #5174

Merged
7Sageer merged 1 commit into
release/2026-11-20from
feat/folder-picker-ux
Nov 20, 2026
Merged

7Sageer merged 1 commit into
release/2026-11-20from
feat/folder-picker-ux

Conversation

@7Sageer

@7Sageer 7Sageer commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Requirement or Bug

在桌面端 SSH 新建项目(以及 Web 端多选目录回退路径)打开多选文件夹选择器时,底部同时出现「选择此文件夹」与「添加所选(n)」两个确认类按钮;点击「选择此文件夹」只是静默将当前路径 toggle 进隐藏的已选数组,既没有选中态反馈,又与主按钮语义重叠。本 PR 移除了独立的「选择此文件夹」按钮,将多选模式的底部操作收敛为一个自适应主按钮,并将多选文案改为更明确的「添加文件夹(n)」。

Bug Reproduction Steps

N/A

Root Cause

N/A

Code Changes

核心思路是把多选模式下的「选择当前目录」和「提交已勾选目录」合并到单一主按钮:有勾选项时提交已勾选列表,未勾选时直接提交当前所在目录,从而在不丢失“进入空目录 / 新建文件夹后直接添加当前目录 / 添加根目录”路径的前提下,去掉冗余的次按钮和静默 toggle 状态。

底部操作区结构变化:

 <div class="actions">
   <Button variant="ghost">取消</Button>
-  <Tooltip v-if="showBrowser" :text="currentPath">
-    <Button :variant="multiple ? 'secondary' : 'primary'" :disabled="!canOpen">
-      {{ multiple ? '选择此文件夹' : '打开此文件夹' }}
-    </Button>
-  </Tooltip>
-  <Button v-if="multiple" variant="primary" :disabled="selected.length === 0 || creatingFolder">
-    添加所选({n})
-  </Button>
+  <Tooltip v-if="showPrimaryAction" :text="primaryTooltip">
+    <Button variant="primary" :disabled="primaryDisabled" @click="submitPrimary">
+      {{ primaryLabel }}
+    </Button>
+  </Tooltip>
 </div>

主按钮状态与提交分支:

 submitPrimary()
-  openThisFolder(): multiple ? toggleSelect(currentPath) : emit('add', currentPath)
-  addSelected():    emit('addMany', selected)
+  if multiple
+    if selected.length > 0 -> emit('addMany', selected)      // 文案:添加文件夹(n) / Add folder(s) (n)
+    else if canOpen        -> emit('addMany', [currentPath]) // 文案:添加当前文件夹 / Add current folder,tooltip 为 currentPath
+  else if canOpen          -> emit('add', currentPath)       // 单选模式不变:打开此文件夹 / Open this folder

因为 canOpen 在 loading、creatingFolder、pathEditing && !isSearching 或 browseFailed 时为 false,未勾选状态下主按钮会自动禁用,避免在加载中或编辑路径中途误提交旧路径;当已有勾选项时,即使发生后续浏览失败,showPrimaryAction 仍为 true,用户仍可提交已勾选的目录。

关键决策:

决策 选择 没选 理由
移除「选择此文件夹」后的空选态行为 未勾选时主按钮直接显示「添加当前文件夹」并可提交 currentPath 保留禁用态的「添加文件夹(0)」 新建文件夹后会自动进入新建的空目录,直接点击主按钮即可完成添加,同时也覆盖“点进目录确认内容后直接添加”和根目录无父级可勾选的场景,与系统原生文件夹选择器习惯一致
英文复数文案 使用 vue-i18n 复数格式 Add folder ({n}) | Add folders ({n}) 固定 Add folders ({n}) 勾选 1 个与多个文件夹时语法自然一致

Behavior Changes and Affected Users

Behavior Before After Who relies on the old behavior Escape hatch
多选模式底部「选择此文件夹」按钮 存在独立次按钮,点击后将 currentPath toggle 进 selected 集合 移除该次按钮;未勾选任何子项时直接通过主按钮「添加当前文件夹」一步添加当前目录 desktop 与 web 用户(SSH 远程新建项目及多选目录回退弹窗)中在同一次弹窗里同时选择「当前目录 + 其子目录」的用法 无(分两次添加或退回上一级勾选,该组合在项目目录场景下实际很少需要;合入前需维护者确认)
多选模式未勾选(selected.length === 0)时的主按钮 显示「添加所选(0)」且禁用 显示「添加当前文件夹」/「Add current folder」(tooltip 展示当前路径),在当前目录可打开时启用,点击直接提交 [currentPath] desktop 与 web 用户(SSH 远程新建项目及多选目录回退弹窗) 勾选任意子文件夹即可切换为仅提交已勾选目录;编辑路径时按钮仍保持禁用
多选模式已勾选(selected.length > 0)时的主按钮文案 显示「添加所选(n)」/「Add selected (n)」 显示「添加文件夹(n)」/「Add folder (1)」或「Add folders (n)」 desktop 与 web 用户(SSH 远程新建项目及多选目录回退弹窗) 无(纯文案更名)
单选模式(multiple: false) 底部显示「取消」和「打开此文件夹」,点击触发 add 行为与文案保持不变 desktop 与 web 用户(单选目录入口) N/A

受影响模块与验证覆盖:

  • packages/app-components(AddWorkspaceDialog.vue)与 packages/app-i18n(en/zh workspace.ts):单元测试已覆盖多选模式无次按钮、中英文文案(含英文单复数)、勾选/取消勾选回退添加当前文件夹、空目录与新建文件夹后直接添加、路径编辑时主按钮禁用、单选模式不变。
  • 平台核对:已在 macOS 本地运行单元测试、桌面端类型检查与全仓 lint;未做实机桌面 UI 截图(draft PR)。
验证命令与结果
  • pnpm exec vitest run --reporter=agent packages/app-components/test/addWorkspaceDialog.test.ts packages/app-i18n/test/i18n.test.ts:2 个测试文件 / 34 个用例全部通过
  • pnpm --filter kimi-code-app run typecheck(tsc --noEmit + vue-tsc --noEmit -p tsconfig.renderer.json):通过
  • pnpm lint(check-comments、oxlint --type-aware --deny-warnings、check-import-boundaries、guards、ratchet、instructions):全部通过

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue (external PRs: issue must have a maintainer's /approve).
  • I have added tests that prove my feature works.
  • The behavior-change table above is complete, and every removed behavior or flipped default is named in the changeset and either has an escape hatch or was explicitly approved by a maintainer in this PR.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Nov 20, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 30175eb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
kimi-code-app Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@7Sageer
7Sageer marked this pull request as ready for review November 20, 2026 05:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T05:43:50.416105Z 30175eb Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Nov 20, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@30175eb
npx https://pkg.pr.new/@moonshot-ai/kimi-code@30175eb

commit: 30175eb

@7Sageer
7Sageer merged commit 3ad2547 into release/2026-11-20 Nov 20, 2026
30 of 31 checks passed
@7Sageer
7Sageer deleted the feat/folder-picker-ux branch November 20, 2026 05:43
@github-actions github-actions Bot mentioned this pull request Nov 20, 2026
Grapedge added a commit that referenced this pull request Nov 23, 2026
* fix(core): add Claude 5 output token ceilings (#5096)

* fix(core): add Claude 5 output token ceilings

* chore: add Claude 5 output ceiling changeset

* fix(markdown): keep table actions inside clipped containers (#5098)

* fix(markdown): keep table actions inside clipped containers

* fix(markdown): observe table action clipping ancestors

---------

Co-authored-by: kimi-agent-bot <[email protected]>

* fix(hosts): keep project lists usable with SSH hosts (#5102)

* ci: release packages (#5094)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix: preserve first prompt through project creation (#5161)

Co-authored-by: kimi-agent-bot <[email protected]>

* fix(agent-core-v2): align fork slicing with restored turn ids (#5165)

* fix(agent-core-v2): align fork slicing with restored turn ids

* chore: add restored fork fix changeset

* fix(core): prevent AJV diagnostics from polluting TUI input (#5168)

* refactor(core): route AJV logs through utils logger

* chore(core): add AJV logger changeset

* chore(core): clarify AJV logger changeset

* fix: support UUID generation in insecure browser contexts (#5173)

* fix: support UUID generation in insecure browser contexts

* chore: update pnpm deps hash

* fix: resolve crypto bindings in UUID lint rule

---------

Co-authored-by: kimi-agent-bot <[email protected]>

* fix(client): keep draft thinking effort after sending (#5170)

* fix(client): keep draft thinking effort after sending

* chore: add cli changeset for draft thinking fix

* test(client): use function stub for websocket in thinking test

* fix(client): preserve thinking effort during model normalization

* fix(client): reconcile profile updates and model fallbacks

* fix(client): scope draft thinking preservation

* fix(tui): defer queued prompts until the loop drains (#5166)

* fix(tui): defer queued prompts until the loop drains

- add core and v2 drained/idle lifecycle events
- consume reminder-only queues without starting a model turn
- gate TUI queue dispatch and completion notifications on lifecycle state
- document notification-handoff queue behavior and add a CLI patch changeset

* fix(tui): close loop lifecycle races

- emit idle only after the current macro is revalidated
- keep queued input pending through compaction and delayed dispatch
- reject stale idle after new work starts

* fix(loop): correlate lifecycle events by generation

- track macro generations in the core and v2 loop state
- replace TUI macro inference with event-generation correlation
- preserve compaction guards for queued dispatch

* fix(desktop): simplify multi-select folder picker actions (#5174)

* fix(kap-server): report :wait settled only after the session is on disk (#5176)

:wait settled as soon as the turn left the in-memory activity view, but
the engine writes wire records through a batched log that flushes in a
later task. A server killed right after :wait reported idle could lose
the end of the finished turn.

Before it replies with a settled session, :wait now flushes the wire of
every agent in the session and drains pending metadata writes. A failed
write surfaces as an error instead of a settled reply. The KAP guide
states the guarantee. A new test in sessions.test.ts slows down the disk
write of the turn end and checks that the record is on disk when :wait
returns.

(cherry picked from commit fc33c6d)

Co-authored-by: kai <[email protected]>

* ci: release packages (#5163)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(client): keep config-derived draft thinking effort after sending (#5191)

Co-authored-by: liruifengv <[email protected]>

* ci: release packages (#5192)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(kap-server): resume sessions with unavailable models (#5212)

* fix(kap-server): resume sessions with unavailable models

* fix: let users replace unavailable session models

* fix: scope unavailable model recovery state

---------

Co-authored-by: kimi-agent-bot <[email protected]>

* fix(plugins): detect MCP OAuth with targeted probes (#5197)

* fix(plugins): detect MCP OAuth with targeted probes

* fix(plugins): use the MCP inspect route

* fix(plugins): preserve OAuth requirements across inspection and disconnect

* fix(chat): show pending MCP browser authorization (#5246)

* fix(chat): show pending MCP browser authorization

* fix(chat): resolve MCP authorization lint findings

* fix(chat): preserve MCP authorization failure details

* fix(mcp): preserve cancellation during OAuth reconnect

* fix(desktop): cache feedback form per host and let reply reasons wrap (#5303)

* ci: release packages (#5232)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* test: port removed-model recovery coverage to testkit

* test: dedupe anthropic output ceiling cases

---------

Co-authored-by: Haozhe <[email protected]>
Co-authored-by: kimi-agent-bot <[email protected]>
Co-authored-by: 7Sageer <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: kimi-agent-bot <[email protected]>
Co-authored-by: liruifengv <[email protected]>
Co-authored-by: qer <[email protected]>
Co-authored-by: kai <[email protected]>
Co-authored-by: Luyu Cheng <[email protected]>
Co-authored-by: grapedge <[email protected]>
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.

1 participant