Skip to content

Polish the reasoning panel, switch drives when adding folders, repeat CLI --path - #205

Merged
luoshuai990529 merged 8 commits into
mainfrom
feat/drive-switching-cli-paths
Nov 28, 2026
Merged

luoshuai990529 merged 8 commits into
mainfrom
feat/drive-switching-cli-paths

Conversation

@luoshuai990529

@luoshuai990529 luoshuai990529 commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Change and validation

User-visible changes

  • Reasoning effort panel. The top-right button restores the default effort. It looked like a refresh control and did nothing when the effort was already Default. It now appears only after another level is chosen or when the saved level is unsupported, and it spins once while the thumb glides back to Default. The slider is redrawn: the knob is inset 3px in the track, the fill reaches the knob's outer edge so its end stays concentric, Default shows no fill, and the panel radius is concentric with the track. This removes the blue crescent that showed at Default.
  • Switching drives when adding folders. A new folder_locations command lists Home, Desktop, Documents and Downloads plus mounted volumes: drive letters with labels and types on Windows, /Volumes on macOS, and mount points under /media, /run/media and /mnt on Linux. The Home button becomes a location menu that names the current drive. Going up from a drive or filesystem root lists all drives. The path field accepts quoted paths from Copy as path, and a bare D: opens that drive's root. On Windows, network drives are not probed for labels, and critical-error dialogs are suppressed while probing empty removable drives.
  • Repeated --path in sag (closes 功能建議:SAG CLI 支援重複指定 --path,與 HTTP API 的多目錄搜尋一致 #196). Several directories are searched as one request with a single ranking. -m limits the whole search. Repeated directories and ones inside another selected directory are searched once. --exclude applies relative to each directory, matching paths in the HTTP API. This works for semantic search and -E / -F. If any directory is missing, unindexed or not ready, the command fails and names it.

Compatibility

  • paths on Command::Search and MatchRequest is omitted when empty, so single-directory requests are unchanged on the wire and older CLIs keep working. sag_client::ensure already makes sure the running service is at least as new as the CLI, so paths never reaches a service that would ignore it.
  • Search and match JSON gain scopes; scope stays and holds the first directory.
  • The folder picker falls back to a Home-only menu if folder_locations is unavailable.

Tests

  • Frontend: full vitest suite (1087 tests), with new cases for reset visibility and fill state, the location menu, the all-drives view, quoted paths and the fallback menu. svelte-check reports 0 errors, and npm run build succeeds.
  • Rust: core (including 4 new multi-directory CLI service tests), src-tauri (27 tests, including new location tests), cli (all test binaries, including a new repeated --path integration test) and client. The Windows drive code was type-checked with cargo check --target x86_64-pc-windows-msvc.
  • UI: headless Chrome screenshots of real components with a mocked backend, covering the reasoning panel in light and dark mode, frames of the reset animation, a Windows-style picker (menu, drive D:, all-drives view) and the macOS menu. The real folder_locations output was checked on macOS.
  • Docs: updated the zh/en CLI, folders and chat pages, the CLI Skill reference and the add-folder screenshots. Regenerated the updates pages for ## 0.4.7. The docs site builds, and the affected pages, images and search results were checked. automatic-release.mjs check-notes passes.

Platform and synchronization

  • Target branch: main
  • Affected desktop platforms: both; the CLI change applies to all platforms
  • Source PR / commit (if ported from another repository): none
  • Related cross-repository change, if needed: none
  • Device / installer verification performed, and untested boundaries: macOS was verified locally. Drive listing on a real Windows device (labels, removable, optical and network drives) has not been run yet and should be checked before merging. No installer was built.

Release

This PR is merged last and without release:skip, so it prepares the 0.4.7 release. #204 is labeled release:skip and merges first. The ## 0.4.7 section here consolidates the release notes for #204 and this PR, so after #204 merges, main is merged into this branch and the changelog conflict is resolved in favor of this section.

Review follow-ups in this PR: a rejected --path now reports its reason (the service passes only the top-level error message to the CLI), focus stays on the slider after a reset, the drives view shows a loading state, and the docs note that a --path inside another one is merged into it (as in the HTTP API).

The top-right button in the reasoning panel restores the default effort, but
it looked like a refresh control and did nothing when the effort was already
Default. Show it only when another level is selected or the saved level is
unsupported, and spin it once while the thumb glides back to Default.

At Default the fill was half a thumb wide, so its corners were squeezed and
showed as a blue crescent outside the thumb and the track. The knob is now
inset 3px in the track, the fill extends to the thumb's outer edge so its end
stays concentric, Default shows no fill, and the panel corner radius matches
the track inset.
On Windows the folder picker lost "Back" at a drive root, so the only way to
reach another drive was typing D:\ into a path field that did not look
editable.

Add a folder_locations command that lists Home, Desktop, Documents and
Downloads plus mounted volumes: drive letters with labels and types on
Windows (network drives are not probed, and critical-error dialogs are
suppressed for empty removable drives), /Volumes on macOS, and mount points
under /media, /run/media and /mnt on Linux.

The "Home" button becomes a location menu that names the current drive. Going
up from a drive or filesystem root lists all drives. The path field accepts
quoted paths from "Copy as path", and a bare drive letter opens its root.
`sag --path A --path B` now searches the union of the directories as one
request, ranked together, with -m as the limit for the whole search. Repeated
directories and ones inside another selected directory are searched once.
--exclude applies relative to each directory, as `paths` does in the HTTP
API. Semantic search and -E/-F both support it.

If any directory is missing, has no indexed content or is not ready, the whole
command fails and names it instead of skipping it or widening the scope.
Single-directory requests keep their wire format; `paths` is only sent when
there is more than one directory. Search and match output gain `scopes` next
to the existing `scope`.

Closes #196
The service reports only the top-level error message to the CLI, so wrapping
the cause in a context hid it: a rejected directory printed just "cannot
search directory" without saying it was missing or unindexed. Build one
message that names the directory and its reason, and assert the reason in the
CLI integration test.
- Keep focus on the slider after resetting the reasoning effort for mouse
  users too; the reset button unmounts after its spin.
- Stop the reset glide as soon as the user moves the slider, so a drag right
  after a reset is not animated.
- Show the loading state when opening a drive from the all-drives view, so a
  slow network drive gives feedback instead of a list that looks unchanged.
- Document that when one --path contains another, the inner directory is
  merged into the outer one and --exclude is relative to the outer one, as in
  the HTTP API.
…cli-paths

# Conflicts:
#	CHANGELOG.md
#	docs-site/content/docs/updates.en.mdx
#	docs-site/content/docs/updates.mdx
@luoshuai990529
luoshuai990529 marked this pull request as ready for review November 28, 2026 03:30
@luoshuai990529
luoshuai990529 merged commit 863cf57 into main Nov 28, 2026
6 checks passed
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.

功能建議:SAG CLI 支援重複指定 --path,與 HTTP API 的多目錄搜尋一致

1 participant