github / github/copilot-cli

Add /remove-dir command to revoke directory access

未关闭
#4,830 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

triage
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

Describe the feature or problem you'd like to solve

Copilot CLI provides /add-dir and /list-dirs, but no corresponding command to remove a previously allowed directory. Users cannot reduce directory access during a session without restarting or otherwise resetting session state.

Proposed solution

Add /remove-dir <path> as the counterpart to /add-dir. It should:

  • Revoke file access to the specified previously allowed directory for the current session.
  • Remove the directory from /list-dirs immediately.
  • Unload trusted skills, agents, and instructions loaded from that directory when safe.
  • Clearly report active references or running work that prevent immediate removal.
  • Return a clear error when the path is not currently allowed.

This improves least-privilege workflows by allowing users to grant temporary access and revoke it as soon as it is no longer needed, without restarting the session.

Example prompts or workflows
  1. /add-dir C:\work\shared-library, work with files there, then run /remove-dir C:\work\shared-library when finished.

  2. Run /list-dirs, identify an accidentally added directory, and remove it with /remove-dir <path>.

  3. Temporarily allow access to generated artifacts, inspect them, then revoke access while keeping the current conversation.

  4. Attempt to remove a directory used by a running task and receive a clear message explaining what must finish or stop first.

Additional context

A dedicated removal command would make /add-dir reversible and provide a clearer least-privilege permission model. /reset-allowed-tools does not address directory access, and restarting a session is unnecessarily disruptive.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先检查现有的 /add-dir 和 /list-dirs 命令入口,以及当前会话的目录权限是如何被跟踪的。根据所要求的行为定义完成标准:从 /list-dirs 中移除、安全卸载已加载的资源、明确报告活动引用或正在运行的工作,以及对不允许的路径返回错误。

由索引模型根据 Issue 内容生成。

评估

技术栈
shell
领域
cli, security
Issue 类型
功能
难度
5/5
预计耗时
一周以上
活跃度
活跃
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。