Feature Request: Persist /add-dir allowed directories across sessions
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 6
描述
## Feature Request
### Summary
The `/add-dir` command adds directories to the allowed list for file access, but these permissions are **session-scoped only** and are lost when the session ends. There is no built-in way to persist allowed directories across sessions.
### Current Behavior
- `/add-dir ` adds a directory to the allowed list for the current session
- `/list-dirs` shows the allowed directories for the current session
- After restarting Copilot CLI (even with `/restart`), all added directories are gone
### Expected Behavior
Users should be able to mark directories as **permanently trusted**, so they appear automatically in `/list-dirs` on every new session without needing to re-add them each time.
### Proposed Solution
- Add a `/add-dir --permanent` (or `/add-dir --global`) flag to persist directories in `~/.copilot/config.json`
- Add a corresponding `/remove-dir ` command to revoke persistent access
- `/list-dirs` should show both session-scoped and persistent directories (with a label distinguishing them)
### Use Case
When working with directories on a Windows host via WSL (e.g. `/mnt/c/Users/paolo/git/myproject`), users need to re-add the same directories at the start of every Copilot session, which is repetitive and breaks workflow.
### Workaround
Currently none — `trusted_folders` in `config.json` serves a different purpose (workspace trust for MCP server loading) and does not affect `/list-dirs`.
贡献指南
调研方向
Start by tracing the `/add-dir` and `/list-dirs` command entry points and the handling of `~/.copilot/config.json`. Check how `trusted_folders` is currently used without treating it as the same permission system. Done means persistent directories can be added, removed, and distinguished from session-scoped entries across restarts.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- shell
- 领域
- cli
- Issue 类型
- 功能
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100