You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/copilot/how-tos/use-copilot-agents/use-copilot-cli.md
+57Lines changed: 57 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -74,6 +74,63 @@ Install {% data variables.copilot.copilot_cli_short %}. See [AUTOTITLE](/copilot
74
74
75
75
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`.
76
76
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"`|
|`--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`|
|`/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
+
77
134
## Permissions
78
135
79
136
{% 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