Skip to content

Commit d534c54

Browse files
github-actions[bot]hubwritersarahs
authored
docs: update copilot-cli content from source docs (#59833)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: hubwriter <hubwriter@github.com> Co-authored-by: Sarah Schneider <sarahs@users.noreply.github.com> Co-authored-by: Sarah Schneider <sarahs@github.com>
1 parent 5a58e4f commit d534c54

File tree

3 files changed

+326
-3
lines changed

3 files changed

+326
-3
lines changed

content/copilot/reference/cli-command-reference.md

Lines changed: 321 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ contentType: reference
1919
| `copilot init` | Initialize {% data variables.product.prodname_copilot_short %} custom instructions for this repository. |
2020
| `copilot update` | Download and install the latest version. |
2121
| `copilot version` | Display version information and check for updates. |
22+
| `copilot login` | Authenticate with {% data variables.product.prodname_copilot_short %} via the OAuth device flow. Accepts `--host HOST` to specify the {% data variables.product.github %} host URL (default: `https://github.com`). |
23+
| `copilot logout` | Sign out of {% data variables.product.github %} and remove stored credentials. |
2224
| `copilot plugin` | Manage plugins and plugin marketplaces. |
2325

2426
## Global shortcuts in the interactive interface
@@ -32,24 +34,32 @@ contentType: reference
3234
| <kbd>Ctrl</kbd>+<kbd>C</kbd> | Cancel operation / clear input. Press twice to exit. |
3335
| <kbd>Ctrl</kbd>+<kbd>D</kbd> | Shutdown. |
3436
| <kbd>Ctrl</kbd>+<kbd>L</kbd> | Clear the screen. |
37+
| <kbd>Shift</kbd>+<kbd>Tab</kbd> | Cycle between standard, plan, and autopilot mode. |
3538

3639
## Timeline shortcuts in the interactive interface
3740

3841
| Shortcut | Purpose |
3942
|-------------------------------------|---------------------------------------|
4043
| ctrl+o | While there is nothing in the prompt input, this expands recent items in {% data variables.product.prodname_copilot_short %}'s response timeline to show more details. |
4144
| ctrl+e | While there is nothing in the prompt input, this expands all items in {% data variables.product.prodname_copilot_short %}'s response timeline. |
45+
| ctrl+t | Expand/collapse display of reasoning in responses. |
4246

4347
## Navigation shortcuts in the interactive interface
4448

4549
| Shortcut | Purpose |
4650
|-------------------------------------|----------------------------------------------|
4751
| <kbd>Ctrl</kbd>+<kbd>A</kbd> | Move to beginning of the line (when typing). |
52+
| <kbd>Ctrl</kbd>+<kbd>B</kbd> | Move to the previous character. |
4853
| <kbd>Ctrl</kbd>+<kbd>E</kbd> | Move to end of the line (when typing). |
54+
| <kbd>Ctrl</kbd>+<kbd>F</kbd> | Move to the next character. |
4955
| <kbd>Ctrl</kbd>+<kbd>H</kbd> | Delete the previous character. |
50-
| <kbd>Ctrl</kbd>+<kbd>W</kbd> | Delete the previous word. |
51-
| <kbd>Ctrl</kbd>+<kbd>U</kbd> | Delete from cursor to beginning of the line. |
5256
| <kbd>Ctrl</kbd>+<kbd>K</kbd> | Delete from cursor to end of the line. |
57+
| <kbd>Ctrl</kbd>+<kbd>U</kbd> | Delete from cursor to beginning of the line. |
58+
| <kbd>Ctrl</kbd>+<kbd>W</kbd> | Delete the previous word. |
59+
| <kbd>Home</kbd> | Move to the start of the current line. |
60+
| <kbd>End</kbd> | Move to the end of the current line. |
61+
| <kbd>Ctrl</kbd>+<kbd>Home</kbd> | Move to the start of the text. |
62+
| <kbd>Ctrl</kbd>+<kbd>End</kbd> | Move to the end of the text. |
5363
| <kbd>Meta</kbd>+<kbd>←</kbd>/<kbd>→</kbd> | Move the cursor by a word. |
5464
| <kbd>↑</kbd>/<kbd>↓</kbd> | Navigate the command history. |
5565

@@ -153,3 +163,312 @@ For a complete list of available slash commands enter `/help` in the CLI's inter
153163
| `--yolo` | Enable all permissions (equivalent to `--allow-all`). |
154164

155165
For a complete list of commands and options, run `copilot help`.
166+
167+
## Tool permission patterns
168+
169+
The `--allow-tool` and `--deny-tool` options accept permission patterns in the format `Kind(argument)`. The argument is optional—omitting it matches all tools of that kind.
170+
171+
| Kind | Description | Example patterns |
172+
|------|-------------|-----------------|
173+
| `shell` | Shell command execution | `shell(git push)`, `shell(git:*)`, `shell` |
174+
| `write` | File creation or modification | `write`, `write(src/*.ts)` |
175+
| `read` | File or directory reads | `read`, `read(.env)` |
176+
| SERVER-NAME | MCP server tool invocation | `MyMCP(create_issue)`, `MyMCP` |
177+
| `url` | URL access via web-fetch or shell | `url(github.com)`, `url(https://*.api.com)` |
178+
| `memory` | Storing facts to agent memory | `memory` |
179+
180+
For `shell` rules, the `:*` suffix matches the command stem followed by a space, preventing partial matches. For example, `shell(git:*)` matches `git push` and `git pull` but does not match `gitea`.
181+
182+
Deny rules always take precedence over allow rules, even when `--allow-all` is set.
183+
184+
```shell
185+
# Allow all git commands except git push
186+
copilot --allow-tool 'shell(git:*)' --deny-tool 'shell(git push)'
187+
188+
# Allow a specific MCP server tool
189+
copilot --allow-tool 'MyMCP(create_issue)'
190+
191+
# Allow all tools from a server
192+
copilot --allow-tool 'MyMCP'
193+
```
194+
195+
## Environment variables
196+
197+
| Variable | Description |
198+
|----------|-------------|
199+
| `COPILOT_MODEL` | Set the AI model. |
200+
| `COPILOT_ALLOW_ALL` | Set to `true` to allow all permissions automatically (equivalent to `--allow-all`). |
201+
| `COPILOT_AUTO_UPDATE` | Set to `false` to disable automatic updates. |
202+
| `COPILOT_CUSTOM_INSTRUCTIONS_DIRS` | Comma-separated list of additional directories for custom instructions. |
203+
| `COPILOT_SKILLS_DIRS` | Comma-separated list of additional directories for skills. |
204+
| `COPILOT_EDITOR` | Editor command for interactive editing (checked after `$VISUAL` and `$EDITOR`). Defaults to `vi` if none are set. |
205+
| `COPILOT_GITHUB_TOKEN` | Authentication token. Takes precedence over `GH_TOKEN` and `GITHUB_TOKEN`. |
206+
| `GH_TOKEN` | Authentication token. Takes precedence over `GITHUB_TOKEN`. |
207+
| `GITHUB_TOKEN` | Authentication token. |
208+
| `XDG_CONFIG_HOME` | Override the configuration directory. Default: `$HOME/.copilot`. |
209+
| `XDG_STATE_HOME` | Override the state directory. Default: `$HOME/.copilot`. |
210+
| `USE_BUILTIN_RIPGREP` | Set to `false` to use the system ripgrep instead of the bundled version. |
211+
| `PLAIN_DIFF` | Set to `true` to disable rich diff rendering. |
212+
| `COLORFGBG` | Fallback for dark/light terminal background detection. |
213+
| `COPILOT_CLI_ENABLED_FEATURE_FLAGS` | Comma-separated list of feature flags to enable (for example, `"SOME_FEATURE,SOME_OTHER_FEATURE"`). |
214+
215+
## Configuration file settings
216+
217+
User settings are stored in `~/.copilot/config.json`. Project-level settings can be placed in `.copilot/settings.json` (committed to the repository) or `.copilot/settings.local.json` (personal overrides—add to `.gitignore`). Settings cascade from user to project to local, with more specific scopes overriding more general ones. Command-line flags and environment variables always take the highest precedence.
218+
219+
| Key | Type | Default | Description |
220+
|-----|------|---------|-------------|
221+
| `allowed_urls` | `string[]` | `[]` | URLs or domains allowed without prompting. |
222+
| `alt_screen` | `boolean` | `false` | Use the terminal alternate screen buffer. |
223+
| `auto_update` | `boolean` | `true` | Automatically download CLI updates. |
224+
| `banner` | `"always"` \| `"once"` \| `"never"` | `"once"` | Animated banner display frequency. |
225+
| `bash_env` | `boolean` | `false` | Enable `BASH_ENV` support for bash shells. |
226+
| `beep` | `boolean` | `true` | Play an audible beep when attention is required. |
227+
| `compact_paste` | `boolean` | `true` | Collapse large pastes into compact tokens. |
228+
| `custom_agents.default_local_only` | `boolean` | `false` | Only use local custom agents. |
229+
| `denied_urls` | `string[]` | `[]` | URLs or domains blocked (takes precedence over `allowed_urls`). |
230+
| `experimental` | `boolean` | `false` | Enable experimental features. |
231+
| `include_coauthor` | `boolean` | `true` | Add a `Co-authored-by` trailer to git commits made by the agent. |
232+
| `launch_messages` | `string[]` | `[]` | Custom messages shown randomly on startup. |
233+
| `log_level` | `"none"` \| `"error"` \| `"warning"` \| `"info"` \| `"debug"` \| `"all"` \| `"default"` | `"default"` | Logging verbosity. |
234+
| `model` | `string` | varies | AI model to use (see the `/model` command). |
235+
| `reasoning_effort` | `"low"` \| `"medium"` \| `"high"` \| `"xhigh"` | `"medium"` | Reasoning effort level for extended thinking. Higher levels use more compute. |
236+
| `render_markdown` | `boolean` | `true` | Render Markdown in terminal output. |
237+
| `screen_reader` | `boolean` | `false` | Enable screen reader optimizations. |
238+
| `stream` | `boolean` | `true` | Enable streaming responses. |
239+
| `store_token_plaintext` | `boolean` | `false` | Store authentication tokens in plaintext in the config file when no system keychain is available. |
240+
| `streamer_mode` | `boolean` | `false` | Hide preview model names and quota details (useful when recording). |
241+
| `theme` | `"auto"` \| `"dark"` \| `"light"` | `"auto"` | Terminal color theme. |
242+
| `trusted_folders` | `string[]` | `[]` | Folders with pre-granted file access. |
243+
| `update_terminal_title` | `boolean` | `true` | Show the current intent in the terminal title. |
244+
245+
## Hooks reference
246+
247+
Hooks are external commands that execute at specific lifecycle points during a session, enabling custom automation, security controls, and integrations. Hook configuration files are loaded automatically from `.github/hooks/*.json` in your repository.
248+
249+
### Hook configuration format
250+
251+
Hook configuration files use JSON format with version `1`:
252+
253+
```json
254+
{
255+
"version": 1,
256+
"hooks": {
257+
"preToolUse": [
258+
{
259+
"type": "command",
260+
"bash": "your-bash-command",
261+
"powershell": "your-powershell-command",
262+
"cwd": "optional/working/directory",
263+
"env": { "VAR": "value" },
264+
"timeoutSec": 30
265+
}
266+
]
267+
}
268+
}
269+
```
270+
271+
| Field | Type | Required | Description |
272+
|-------|------|----------|-------------|
273+
| `type` | `"command"` | Yes | Must be `"command"`. |
274+
| `bash` | string | One of `bash`/`powershell` | Shell command for Unix. |
275+
| `powershell` | string | One of `bash`/`powershell` | Shell command for Windows. |
276+
| `cwd` | string | No | Working directory for the command (relative to repository root or absolute). |
277+
| `env` | object | No | Environment variables to set (supports variable expansion). |
278+
| `timeoutSec` | number | No | Timeout in seconds. Default: `30`. |
279+
280+
### Hook events
281+
282+
| Event | Fires when | Output processed |
283+
|-------|-----------|-----------------|
284+
| `sessionStart` | A new or resumed session begins. | No |
285+
| `sessionEnd` | The session terminates. | No |
286+
| `userPromptSubmitted` | The user submits a prompt. | No |
287+
| `preToolUse` | Before each tool executes. | Yes — can allow, deny, or modify. |
288+
| `postToolUse` | After each tool completes. | No |
289+
| `agentStop` | The main agent finishes a turn. | Yes — can block and force continuation. |
290+
| `subagentStop` | A subagent completes. | Yes — can block and force continuation. |
291+
| `errorOccurred` | An error occurs during execution. | No |
292+
293+
### `preToolUse` decision control
294+
295+
The `preToolUse` hook can control tool execution by writing a JSON object to stdout.
296+
297+
| Field | Values | Description |
298+
|-------|--------|-------------|
299+
| `permissionDecision` | `"allow"`, `"deny"`, `"ask"` | Whether the tool executes. Empty output uses default behavior. |
300+
| `permissionDecisionReason` | string | Reason shown to the agent. Required when decision is `"deny"`. |
301+
| `modifiedArgs` | object | Substitute tool arguments to use instead of the originals. |
302+
303+
### `agentStop` / `subagentStop` decision control
304+
305+
| Field | Values | Description |
306+
|-------|--------|-------------|
307+
| `decision` | `"block"`, `"allow"` | `"block"` forces another agent turn using `reason` as the prompt. |
308+
| `reason` | string | Prompt for the next turn when `decision` is `"block"`. |
309+
310+
### Tool names for hook matching
311+
312+
| Tool name | Description |
313+
|-----------|-------------|
314+
| `bash` | Execute shell commands (Unix). |
315+
| `powershell` | Execute shell commands (Windows). |
316+
| `view` | Read file contents. |
317+
| `edit` | Modify file contents. |
318+
| `create` | Create new files. |
319+
| `glob` | Find files by pattern. |
320+
| `grep` | Search file contents. |
321+
| `web_fetch` | Fetch web pages. |
322+
| `task` | Run subagent tasks. |
323+
324+
If multiple hooks of the same type are configured, they execute in order. For `preToolUse`, if any hook returns `"deny"`, the tool is blocked. Hook failures (non-zero exit codes or timeouts) are logged and skipped—they never block agent execution.
325+
326+
## MCP server configuration
327+
328+
MCP servers provide additional tools to the CLI agent. Configure persistent servers in `~/.copilot/mcp-config.json`. Use `--additional-mcp-config` to add servers for a single session.
329+
330+
### Transport types
331+
332+
| Type | Description | Required fields |
333+
|------|-------------|----------------|
334+
| `local` / `stdio` | Local process communicating via stdin/stdout. | `command`, `args` |
335+
| `http` | Remote server using streamable HTTP transport. | `url` |
336+
| `sse` | Remote server using Server-Sent Events transport. | `url` |
337+
338+
### Local server configuration fields
339+
340+
| Field | Required | Description |
341+
|-------|----------|-------------|
342+
| `command` | Yes | Command to start the server. |
343+
| `args` | Yes | Command arguments (array). |
344+
| `tools` | Yes | Tools to enable: `["*"]` for all, or a list of specific tool names. |
345+
| `env` | No | Environment variables. Supports `$VAR`, `${VAR}`, and `${VAR:-default}` expansion. |
346+
| `cwd` | No | Working directory for the server. |
347+
| `timeout` | No | Tool call timeout in milliseconds. |
348+
| `type` | No | `"local"` or `"stdio"`. Default: `"local"`. |
349+
350+
### Remote server configuration fields
351+
352+
| Field | Required | Description |
353+
|-------|----------|-------------|
354+
| `type` | Yes | `"http"` or `"sse"`. |
355+
| `url` | Yes | Server URL. |
356+
| `tools` | Yes | Tools to enable. |
357+
| `headers` | No | HTTP headers. Supports variable expansion. |
358+
| `oauthClientId` | No | Static OAuth client ID (skips dynamic registration). |
359+
| `oauthPublicClient` | No | Whether the OAuth client is public. Default: `true`. |
360+
| `timeout` | No | Tool call timeout in milliseconds. |
361+
362+
### Filter mapping
363+
364+
Control how MCP tool output is processed using the `filterMapping` field in a server's configuration.
365+
366+
| Mode | Description |
367+
|------|-------------|
368+
| `none` | No filtering. |
369+
| `markdown` | Format output as Markdown. |
370+
| `hidden_characters` | Remove hidden or control characters. Default. |
371+
372+
### Built-in MCP servers
373+
374+
The CLI includes built-in MCP servers that are available without additional setup.
375+
376+
| Server | Description |
377+
|--------|-------------|
378+
| `github-mcp-server` | {% data variables.product.github %} API integration: issues, pull requests, commits, code search, and {% data variables.product.prodname_actions %}. |
379+
| `playwright` | Browser automation: navigate, click, type, screenshot, and form handling. |
380+
| `fetch` | HTTP requests via the `fetch` tool. |
381+
| `time` | Time utilities: `get_current_time` and `convert_time`. |
382+
383+
Use `--disable-builtin-mcps` to disable all built-in servers, or `--disable-mcp-server SERVER-NAME` to disable a specific one.
384+
385+
## Skills reference
386+
387+
Skills are Markdown files that extend what the CLI can do. Each skill lives in its own directory containing a `SKILL.md` file. When invoked (via `/SKILL-NAME` or automatically by the agent), the skill's content is injected into the conversation.
388+
389+
### Skill frontmatter fields
390+
391+
| Field | Type | Required | Description |
392+
|-------|------|----------|-------------|
393+
| `name` | string | Yes | Unique identifier for the skill. Letters, numbers, and hyphens only. Max 64 characters. |
394+
| `description` | string | Yes | What the skill does and when to use it. Max 1024 characters. |
395+
| `allowed-tools` | string or string[] | No | Comma-separated list or YAML array of tools that are automatically allowed when the skill is active. Use `"*"` for all tools. |
396+
| `user-invocable` | boolean | No | Whether users can invoke the skill with `/SKILL-NAME`. Default: `true`. |
397+
| `disable-model-invocation` | boolean | No | Prevent the agent from automatically invoking this skill. Default: `false`. |
398+
399+
### Skill locations
400+
401+
Skills are loaded from these locations in priority order (first found wins for duplicate names).
402+
403+
| Location | Scope | Description |
404+
|----------|-------|-------------|
405+
| `.github/skills/` | Project | Project-specific skills. |
406+
| `.agents/skills/` | Project | Alternative project location. |
407+
| `.claude/skills/` | Project | Claude-compatible location. |
408+
| Parent `.github/skills/` | Inherited | Monorepo parent directory support. |
409+
| `~/.copilot/skills/` | Personal | Personal skills for all projects. |
410+
| `~/.claude/skills/` | Personal | Claude-compatible personal location. |
411+
| Plugin directories | Plugin | Skills from installed plugins. |
412+
| `COPILOT_SKILLS_DIRS` | Custom | Additional directories (comma-separated). |
413+
414+
### Commands (alternative skill format)
415+
416+
Commands are an alternative to skills stored as individual `.md` files in `.claude/commands/`. The command name is derived from the filename. Command files use a simplified format (no `name` field required) and support `description`, `allowed-tools`, and `disable-model-invocation`. Commands have lower priority than skills with the same name.
417+
418+
## Custom agents reference
419+
420+
Custom agents are specialized AI agents defined in Markdown files. The filename (minus extension) becomes the agent ID. Use `.agent.md` or `.md` as the file extension.
421+
422+
### Built-in agents
423+
424+
| Agent | Default model | Description |
425+
|-------|--------------|-------------|
426+
| `explore` | claude-haiku-4.5 | Fast codebase exploration. Searches files, reads code, and answers questions. Returns focused answers under 300 words. Safe to run in parallel. |
427+
| `task` | claude-haiku-4.5 | Command execution (tests, builds, lints). Returns brief summary on success, full output on failure. |
428+
| `code-review` | claude-sonnet-4.5 | High signal-to-noise code review. Analyzes diffs for bugs, security issues, and logic errors. |
429+
| `general-purpose` | claude-sonnet-4.5 | Full-capability agent for complex multi-step tasks. Runs in a separate context window. |
430+
431+
### Custom agent frontmatter fields
432+
433+
| Field | Type | Required | Description |
434+
|-------|------|----------|-------------|
435+
| `name` | string | No | Display name. Defaults to the filename. |
436+
| `description` | string | Yes | Description shown in the agent list and `task` tool. |
437+
| `model` | string | No | AI model for this agent. When unset, inherits the outer agent's model. |
438+
| `tools` | string[] | No | Tools available to the agent. Default: `["*"]` (all tools). |
439+
| `mcp-servers` | object | No | MCP servers to connect. Uses the same schema as `~/.copilot/mcp-config.json`. |
440+
| `infer` | boolean | No | Allow auto-delegation by the main agent. Default: `true`. |
441+
442+
### Custom agent locations
443+
444+
| Scope | Location |
445+
|-------|----------|
446+
| Project | `.github/agents/` or `.claude/agents/` |
447+
| User | `~/.copilot/agents/` or `~/.claude/agents/` |
448+
| Plugin | `<plugin>/agents/` |
449+
450+
Project-level agents take precedence over user-level agents. Plugin agents have the lowest priority.
451+
452+
## Permission approval responses
453+
454+
When the CLI prompts for permission to execute an operation, you can respond with the following keys.
455+
456+
| Key | Effect |
457+
|-----|--------|
458+
| `y` | Allow this specific request once. |
459+
| `n` | Deny this specific request once. |
460+
| `!` | Allow all similar requests for the rest of the session. |
461+
| `#` | Deny all similar requests for the rest of the session. |
462+
| `?` | Show detailed information about the request. |
463+
464+
Session approvals reset when you run `/clear` or start a new session.
465+
466+
| Flag | Tier | Description |
467+
|------|------|-------------|
468+
| `AUTOPILOT_MODE` | `experimental` | Autonomous operation mode. |
469+
| `BACKGROUND_AGENTS` | `staff` | Run agents in the background. |
470+
| `QUEUED_COMMANDS` | `staff` | Queue commands while the agent is running. |
471+
| `LSP_TOOLS` | `on` | Language Server Protocol tools. |
472+
| `PLAN_COMMAND` | `on` | Interactive planning mode. |
473+
| `AGENTIC_MEMORY` | `on` | Persistent memory across sessions. |
474+
| `CUSTOM_AGENTS` | `on` | Custom agent definitions. |

0 commit comments

Comments
 (0)