Add /remove-dir command to revoke directory access
还没有人认领这个 Issue。
- 主要语言
- 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-dirsimmediately. - 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
-
/add-dir C:\work\shared-library, work with files there, then run/remove-dir C:\work\shared-librarywhen finished. -
Run
/list-dirs, identify an accidentally added directory, and remove it with/remove-dir <path>. -
Temporarily allow access to generated artifacts, inspect them, then revoke access while keeping the current conversation.
-
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先检查现有的 /add-dir 和 /list-dirs 命令入口,以及当前会话的目录权限是如何被跟踪的。根据所要求的行为定义完成标准:从 /list-dirs 中移除、安全卸载已加载的资源、明确报告活动引用或正在运行的工作,以及对不允许的路径返回错误。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- shell
- 领域
- cli, security
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100