Session ID: 221b5571-3998-47e1-b57a-552cf9078947 Started: 11/24/2025, 11:18:54 AM Last Modified: 11/24/2025, 11:18:54 AM Duration: 50s Working Directory: /Users/jacklynlee31 Usage: Total usage est: 0 Premium requests Total duration (API): 0s Total duration (wall): 50s Total code changes: 0 lines added, 0 lines removed
目录与文件访问命令
/add-dir:允许 Copilot 访问指定目录
通过限制 Copilot 只能访问你选择的文件,可以确保结果更相关,同时提升安全性。
适用场景:
将 Copilot 限定在某个仓库或子目录
在包含敏感文件的大型代码库中工作
/add-dir <directory>
例如,这里我将 Documents 目录添加到了允许进行文件访问的列表中:
/add-dir /Users/jacklynlee31/Documents
Copilot 会返回:
Added directory to allowed list: /Users/jacklynlee31/Documents
Choose the AI model to use for Copilot CLI. The selected model will be persisted and used for future sessions. ❯ 1. Claude Sonnet 4.5 (1x) (default) (current) 2. Claude Opus 4.5 (Preview) (1x) 3. Claude Haiku 4.5 (0.33x) 4. Claude Sonnet 4 (1x) 5. GPT-5.1 (1x) 6. GPT-5.1-Codex-Mini (0.33x) 7. GPT-5.1-Codex (1x) 8. GPT-5 (1x) 9. GPT-5-Mini (0x) 10. GPT-4.1 (0x) 11. Gemini 3 Pro (Preview) (1x) 12. Cancel (Esc)
你可以使用数字键或方向键从列表中选择一个模型,然后按 Enter 确认;也可以通过 /model [model] 直接切换所使用的 AI 模型。
/theme [show|set|list] [auto|dark|light]:配置终端主题
show:显示当前的主题偏好设置
set:将终端主题设置为 auto、dark 或 light
list:显示可用主题列表
适用场景:
提高可读性
与团队或运行环境的标准保持一致
/theme set dark
设置完成后,Copilot 会确认你的偏好设置,并提示你重启 CLI 以应用新的主题:
● Theme preference set to: dark The new theme will be applied on the next restart of the CLI.
/terminal-setup:启用多行输入
此命令在处理复杂指令或多步骤代码修改时尤为有用,可确保你的终端已为高级任务和协作式工作流做好准备。
适用场景:
编写较长的提示词
执行大规模重构或代码审查
在大段代码修改过程中改进提示词格式
/terminal-setup
/reset-allowed-tools:重置工具权限
此命令可将已允许的工具列表快速回滚到初始状态,移除过期或存在风险的工具。
适用场景:
团队成员或角色发生变化后
演示或实验结束后的清理工作
/reset-allowed-tools
使用该命令后,Copilot 会显示确认信息:
The list of allowed tools has been reset.
外部服务相关命令
/agent:选择自定义智能体
自定义智能体可用于聚焦特定任务或集成场景。
适用场景:
按仓库 / 组织 / 项目切换智能体配置
测试专用智能体或第三方智能体
/delegate :创建 AI 生成的 Pull Request
此命令可在不离开终端的情况下,自动化生成修改并创建 Pull Request。
适用场景:
在多个仓库中应用修改
快速发起可供审查的工作
例如,下面的命令会在我的仓库中生成一个用于添加深色模式支持的 Pull Request:
/delegate Add dark mode support
/share [file|gist] [path]:导出并分享会话内容
文档记录非常重要,此命令可捕获整个会话历史,用于分享或归档。
适用场景:
异步交接工作
记录决策或实验过程
为 Issue 或 Pull Request 附加上下文信息
/share file /Users/jacklynlee31/Desktop
分享完成后,Copilot 会确认会话已成功导出到你指定的位置:
● Session shared successfully to: /Users/jacklynlee31/Desktop/copilot-session-221b5571-3998-47e1-b57a-552cf9078947.md