Skip to content

feat: add remove-dir workspace management - #2784

Closed
Coiggahou2002 wants to merge 1 commit into
MoonshotAI:mainfrom
Coiggahou2002:feat/remove-dir
Closed

feat: add remove-dir workspace management#2784
Coiggahou2002 wants to merge 1 commit into
MoonshotAI:mainfrom
Coiggahou2002:feat/remove-dir

Conversation

@Coiggahou2002

Copy link
Copy Markdown

Related Issue

Follow-up to #396 and #812.

Problem

/add-dir can add session-only or remembered workspace roots, but there is no symmetric way to remove one. Users must edit .kimi-code/local.toml or restart the process, while live file-tool permissions and file-mention completion continue to include the old root.

What Changed

  • added /remove-dir [<path>] to the TUI
    • bare invocation opens a selector of configured roots
    • distinguishes removing a session-only root from removing and forgetting a project root
    • refreshes app state and slash/file completion after success
  • added /remove-dir [--forget] <path> to the VS Code host commands
  • added the public Session.removeAdditionalDir() SDK operation and v1/v2 RPC plumbing
  • updated both engine implementations
    • removes roots from live file/process access immediately
    • updates session resume metadata for session-only roots
    • updates .kimi-code/local.toml for remembered roots while preserving unrelated TOML fields
    • permits cleanup when the removed directory no longer exists on disk
    • rejects the primary workspace root, unknown roots, and accidental session-only removal of remembered roots
  • updated English and Chinese docs and added a patch changeset

Verification

  • TUI command/registry/availability suites: 38 tests
  • agent-core project-local config removal tests
  • agent-core-v2 workspace directory integration suite: 9 tests
  • public SDK session removal test
  • focused v1/v2 parity test
  • focused VS Code integration test
  • typecheck: agent-core, agent-core-v2, node-sdk, kimi-code app, and VS Code app
  • package build, kimi-code production build, VS Code extension/webview build, and docs build
  • agent-core-v2 import-boundary check
  • full repository lint: 0 errors (existing warnings only)
  • git diff --check

Checklist

  • Existing open PRs searched; no duplicate remove-dir contribution found
  • Public API, both engines, TUI, and VS Code updated
  • Tests cover persistence, live-session refresh, invalid roots, and deleted directories
  • English and Chinese docs updated
  • Changeset added

@changeset-bot

changeset-bot Bot commented Aug 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bdbd38f

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

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/kimi-code Patch
@moonshot-ai/kimi-code-sdk 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

@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: bdbd38f6ee

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

'The primary workspace directory cannot be removed',
);
}
if (!this.additionalDirs.includes(target)) {

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 Compare remove-dir roots with canonical path keys

When the v2 engine runs on Windows and the user removes a directory with a different drive-letter/case or slash spelling than the stored entry (for example the root is stored as C:/Repo/Extra but /remove-dir c:/repo/extra is used), this exact includes check rejects the valid additional root before the forget path can update local.toml. The workspace code already has to treat those spellings as the same physical directory, so the remove path should use the same canonical comparison for additionalDirs, fileDirs, and the config-file filter; otherwise users can only remove a root if they reproduce the exact stored spelling.

Useful? React with 👍 / 👎.

@liruifengv liruifengv closed this Aug 11, 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.

2 participants