Skip to content

Commit 53d316e

Browse files
committed
Fix #42356: consolidate Copilot CLI parameters and in-session commands
1 parent 57afdb4 commit 53d316e

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

content/copilot/how-tos/use-copilot-agents/use-copilot-cli.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,63 @@ Install {% data variables.copilot.copilot_cli_short %}. See [AUTOTITLE](/copilot
7474

7575
For example, if you ask {% data variables.product.prodname_copilot_short %} to create a bash script but you do not want to use the script {% data variables.product.prodname_copilot_short %} suggests, you can stop the current operation and enter a new prompt, such as: `Continue the previous task but include usage instructions in the script`.
7676

77+
## CLI parameters
78+
79+
You can pass options and flags to the `copilot` command. The following table lists the most commonly used parameters and examples.
80+
81+
82+
| Parameter | Description | Example |
83+
| --- | --- | --- |
84+
| `--agent=<name>` | Use a named custom agent for this run. | `copilot --agent=refactor-agent --prompt "Refactor this code block"` |
85+
| `-p "<text>"` or `--prompt "<text>"` | Provide a prompt non-interactively (non-interactive mode exits after completion). | `copilot -p "Run tests and fix failures"` |
86+
| `-i "<text>"` or `--interactive "<text>"` | Start interactive mode and automatically execute a prompt. | `copilot -i "Fix the bug in main.js"` |
87+
| `--resume` | Resume a previously saved interactive session (session picker). | `copilot --resume` |
88+
| `--continue` | Quickly resume the most recently closed session. | `copilot --continue` |
89+
| `--model <model>` | Start with a specific model. | `copilot --model gpt-5` |
90+
| `--add-dir <path>` (repeatable) | Allow access to one or more directories by repeating the flag. | `copilot --add-dir /home/user/projects --add-dir ~/workspace` |
91+
| `--allow-all-paths` | Disable path verification for this run (trust all filesystem paths). | `copilot --allow-all-paths` |
92+
| `--allow-tool '<tool>'` | Allow a specific tool or tool pattern. | `copilot --allow-tool 'write'` |
93+
| `--deny-tool '<tool>'` | Deny a specific tool (can be used alongside `--allow-tool`). | `copilot --deny-tool 'MyMCP(denied_tool)' --allow-tool 'MyMCP'` |
94+
| `--allow-all-tools` | Allow all tools without per-command approval for this run. | `copilot --allow-all-tools --resume` |
95+
| `--allow-url <domain>` (repeatable) | Pre-approve one or more domains for network access by repeating the flag. | `copilot --allow-url github.com --allow-url api.github.com` |
96+
| `--deny-url <url>` | Deny network access to a specific URL/domain. | `copilot --deny-url malicious-site.com` |
97+
| `--allow-all-urls` | Allow all URLs without confirmation. | `copilot --allow-all-urls` |
98+
| `--help` or `help` | Show CLI help and available commands. | `copilot help` |
99+
100+
101+
## In-session commands
102+
103+
While in an interactive `copilot` session you can use slash commands and special prefixes to control behavior. Use the `?` command to list available in-session help.
104+
105+
| Command | Description | Example |
106+
| --- | --- | --- |
107+
| `/add-dir <directory>` | Add a directory to the allowed list for file access | `/add-dir /path/to/directory` |
108+
| `/agent` | Browse and select from available agents (if any) | `/agent` |
109+
| `/clear` | Clear the conversation history | `/clear` |
110+
| `/compact` | Summarize conversation history to reduce context window usage | `/compact` |
111+
| `/context` | Show context window token usage and visualization | `/context` |
112+
| `/cwd [directory]` | Change working directory or show current directory | `/cwd /path/to/dir` |
113+
| `/delegate <prompt>` | Delegate changes to remote repository with an AI-generated PR | `/delegate complete the API integration tests` |
114+
| `/exit` or `/quit` | Exit the CLI | `/exit` |
115+
| `/share [file or gist] [path]` | Share session to a markdown file or GitHub Gist | `/share file session.md` |
116+
| `/feedback` | Provide feedback about the CLI | `/feedback` |
117+
| `/help` | Show help for interactive commands | `/help` |
118+
| `/list-dirs` | Display all allowed directories for file access | `/list-dirs` |
119+
| `/login` | Log in to Copilot | `/login` |
120+
| `/logout` | Log out of Copilot | `/logout` |
121+
| `/mcp [show, add, edit, delete, disable, enable] [server-name]` | Manage MCP servers and configurations | `/mcp add` |
122+
| `/model [model]` | Select AI model to use | `/model gpt-5-mini` |
123+
| `/reset-allowed-tools` | Reset the list of allowed tools during the session | `/reset-allowed-tools` |
124+
| `/session` | Show information about the current CLI session | `/session` |
125+
| `/skills [list, info, add, remove, reload] [args...]` | Manage skills for enhanced capabilities | `/skills list` |
126+
| `/terminal-setup` | Configure terminal for multiline input support | `/terminal-setup` |
127+
| `/theme [show, set, list] [auto, dark, light]` | View or configure terminal theme | `/theme set dark` |
128+
| `/usage` | Display session usage metrics and statistics | `/usage` |
129+
| `/user [show, list, switch]` | Manage GitHub user list | `/user list` |
130+
| `?` | Display interactive help and available commands | `?` |
131+
| `!<shell command>` | Run a shell command directly from the prompt without calling the model | `!git clone https://github.com/github/copilot-cli` |
132+
133+
77134
## Permissions
78135

79136
{% data variables.copilot.copilot_cli_short %} uses a permissions system to control access to paths and URLs. At times, path and URL permission checks utilize heuristic-based detection, which has limitations to be aware of.

0 commit comments

Comments
 (0)