Skip to content

feat(web): type absolute paths directly in the workspace picker - #1556

Merged
wbxl2000 merged 4 commits into
mainfrom
feat/web-workspace-path-entry
Jul 12, 2026
Merged

feat(web): type absolute paths directly in the workspace picker#1556
wbxl2000 merged 4 commits into
mainfrom
feat/web-workspace-path-entry

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue — problem explained below.

Problem

When starting a new session, the "Add workspace" dialog only accepted an absolute path through a small field collapsed behind a ghost button at the bottom of a 300px folder list. That field had no inline validation (bad paths only failed after a backend round-trip with a generic error), no completion, and an ambiguous "+" submit button. Users who already know the path (power users, remote/browse-less environments) had a poor, error-prone experience.

What changed

The dialog's existing fuzzy-search box now doubles as the absolute-path entry — no layout change beyond removing the collapsed paste section:

  • Typing input starting with / or ~ switches the box from fuzzy search to path mode (ambiguous-free: / can't appear in folder names, ~ only as ~/ or bare ~).
  • Live validation (debounced, one browseFs call on the parent dir): missing path / missing parent directory each get a specific message, and prefix-matched sibling folders are offered as clickable candidates in the list area.
  • A valid path live-follows the folder browser to it, so the existing "Open this folder" button submits it (no blind add) and Enter works too. Esc clears the box back to browsing.
  • The bottom paste-path section (toggle + dumb input + "+" button) is removed; the degraded mode (daemon can't browse) reuses the same box with format-only validation and Enter-to-add.
  • zh/en i18n strings updated; orphaned keys removed.

Includes a web: changeset (patch).

Note: an earlier iteration of this change (including a fly-out close animation that was later dropped) currently also lives in #1554. This PR is the final, animation-free version of just this feature; #1554 should drop this part when rebased. The changeset filename intentionally matches the one in #1554 so the duplicate is easy to spot.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works. — apps/kimi-web has no component test harness (pure logic tests only); verified with vue-tsc typecheck, vite build, vitest, oxlint, check:style, plus an interactive mock covering the keyboard/validation flows.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update. — no doc update needed; user-facing note ships via the changeset/changelog sync.

The add-workspace dialog's fuzzy-search box now doubles as an absolute
path entry: input starting with "/" or "~" is validated live (missing
path / missing parent get specific errors plus prefix-matched
candidates), and a valid path live-follows the folder browser so the
existing "Open this folder" button submits it. Enter accepts the first
candidate or opens a valid path; Esc clears the box. The collapsed
paste-path section at the bottom is removed, and the degraded
(no-browse) mode reuses the same box with format-only validation.
@changeset-bot

changeset-bot Bot commented Jul 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 17421b4

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

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code 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

@pkg-pr-new

pkg-pr-new Bot commented Jul 11, 2026

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

commit: 17421b4

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

Copy link
Copy Markdown

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: 6b17ea86fb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// switches from fuzzy search to path mode. A valid path live-follows (the
// browser jumps to it, so "Open this folder" submits it); an invalid one
// shows a specific error plus prefix-matched candidates in the list.
const PATH_LIKE = /^(?:\/|~(?:\/|$))/;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Support Windows absolute paths in path mode

On Windows, absolute workspace roots are usually drive-letter or UNC paths; the backend file browser uses the platform node:path.isAbsolute, and the removed paste fallback emitted any non-empty path. With this regex, C:\Users\me\repo is treated as fuzzy text instead of path entry, so in degraded mode Enter returns before emitting add and there is no remaining button to add it. Please recognize Windows absolute forms here or keep a generic paste fallback.

Useful? React with 👍 / 👎.

Comment on lines +193 to +195
pathState.value = 'valid';
pathCandidates.value = [];
currentPath.value = res.path;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Disable add after an invalid path follow

When a user pauses on a valid prefix and then finishes an invalid path, e.g. /tmp followed by /tmp/not-here, this live-follow assignment leaves currentPath set to the valid prefix while the UI shows a not-found error for the full input. The primary “Open this folder” button remains enabled and will add that stale prefix, so the dialog can register the wrong workspace; clear/separate the followed path on validation failure or disable the button unless path mode is valid.

Useful? React with 👍 / 👎.

…th mode

Two review fixes on the workspace picker's path entry:

- PATH_LIKE now also matches Windows drive (C:\x, C:/x) and UNC
  (\\srv\x) forms, matching node:path.isAbsolute on the daemon side.
  Without this, Windows users in degraded (no-browse) mode had no way to
  submit a path at all. Parent-dir splitting and trailing-separator
  trimming are now separator-aware (drive roots are preserved).
- "Open this folder" is disabled while path mode has no validated target.
  Previously, after typing a valid prefix and then an invalid path, the
  button still submitted the stale followed prefix.
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

1 similar comment
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

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

Copy link
Copy Markdown

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: 76e6a283ea

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

if (res.path) {
pathState.value = 'valid';
pathCandidates.value = [];
currentPath.value = res.path;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the typed path when adding path-mode workspaces

When path-mode validation succeeds, this stores res.path from fs:browse, and openThisFolder() later emits currentPath. The backend folder browser canonicalizes with fsp.realpath, while workspace/session IDs are based on the lexical root and the removed paste field used to submit the user's typed root. For a symlinked cwd such as /tmp/project on macOS resolving to /private/tmp/project, typing /tmp/project now registers the real target instead, so sessions under the typed cwd won't group under the workspace. Keep the typed normalized path for the add action while using the browse result only to populate the visible folder contents.

Useful? React with 👍 / 👎.

…th mode

fs:browse canonicalizes via realpath, but workspace/session ids are based
on the lexical root. For a symlinked cwd (/tmp/project -> /private/tmp/
project on macOS), live-follow stored the resolved target in currentPath
and "Open this folder" emitted it, so sessions under the typed cwd would
not group under the workspace. Keep the typed normalized path for the add
action and use the browse result only to populate the visible browser.
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

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

Copy link
Copy Markdown

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: 41233b37af

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

if (token !== pathToken) return;
// Split on whichever separator the path uses (Windows paths use "\").
const lastSep = Math.max(target.lastIndexOf('/'), target.lastIndexOf('\\'));
const parent = (lastSep > 0 ? target.slice(0, lastSep) : '') || '/';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the drive-root separator for completions

On Windows, typing a missing direct child of a drive root such as C:\Us or C:/Pro makes lastSep point at the root separator, but this slice produces parent === 'C:'. The server-side browse path must be absolute, so C: is rejected before entries are listed and the new completion UI reports a bad parent instead of suggesting C:\Users or C:\Program Files. Keep the separator when the parent is a drive root (C:\ / C:/).

Useful? React with 👍 / 👎.

@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 17421b44f0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@wbxl2000
wbxl2000 merged commit d2c2c33 into main Jul 12, 2026
10 checks passed
@wbxl2000
wbxl2000 deleted the feat/web-workspace-path-entry branch July 12, 2026 06:35
@github-actions github-actions Bot mentioned this pull request Jul 12, 2026
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