Skip to content

Commit 9acb109

Browse files
docs-botgithub-actions[bot]hubwriter
authored
docs: update copilot-cli content from source docs (#60096)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: hubwriter <hubwriter@github.com>
1 parent 79f17c3 commit 9acb109

5 files changed

Lines changed: 65 additions & 12 deletions

File tree

content/copilot/how-tos/copilot-cli/set-up-copilot-cli/configure-copilot-cli.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ If you choose to trust the directory for future sessions, the trusted directory
4040
You can edit the list of permanently trusted directories.
4141

4242
1. Open the CLI’s `config.json` file. By default, it’s stored in a `.copilot` folder under your home directory:
43+
4344
* **macOS/Linux**: `~/.copilot/config.json`
4445
* **Windows**: `$HOME\.copilot\config.json`
4546

46-
You can change the config location by setting the `XDG_CONFIG_HOME` environment variable (primarily on macOS/Linux).
47+
You can change the config location by setting the `COPILOT_HOME` environment variable.
48+
4749
1. Edit the contents of the `trusted_folders` array.
4850

4951
## Setting allowed tools

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Invoking custom agents
2+
title: Invoking custom agents
33
shortTitle: Invoke custom agents
44
intro: Use custom agents, skills, and MCP servers in {% data variables.copilot.copilot_cli_short %} to extend its capabilities.
55
product: '{% data reusables.gated-features.copilot-cli %}'
@@ -102,7 +102,7 @@ To extend the functionality available to you in {% data variables.copilot.copilo
102102
1. Fill in the details for the MCP server you want to add, using the <kbd>Tab</kbd> key to move between fields.
103103
1. Press <kbd>Ctrl</kbd>+<kbd>S</kbd> to save the details.
104104

105-
Details of your configured MCP servers are stored in the `mcp-config.json` file, which is located, by default, in the `~/.copilot` directory. This location can be changed by setting the `XDG_CONFIG_HOME` environment variable. For information about the JSON structure of a server definition, see [AUTOTITLE](/copilot/how-tos/use-copilot-agents/coding-agent/extend-coding-agent-with-mcp#writing-a-json-configuration-for-mcp-servers).
105+
Details of your configured MCP servers are stored in the `mcp-config.json` file, which is located, by default, in the `~/.copilot` directory. This location can be changed by setting the `COPILOT_HOME` environment variable. For information about the JSON structure of a server definition, see [AUTOTITLE](/copilot/how-tos/use-copilot-agents/coding-agent/extend-coding-agent-with-mcp#writing-a-json-configuration-for-mcp-servers).
106106

107107
For more detailed information on adding and managing MCP servers in {% data variables.copilot.copilot_cli_short %}, see [AUTOTITLE](/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers).
108108

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ To extend the functionality available to you in {% data variables.copilot.copilo
231231
1. Fill in the details for the MCP server you want to add, using the <kbd>Tab</kbd> key to move between fields.
232232
1. Press <kbd>Ctrl</kbd>+<kbd>S</kbd> to save the details.
233233
234-
Details of your configured MCP servers are stored in the `mcp-config.json` file, which is located, by default, in the `~/.copilot` directory. This location can be changed by setting the `XDG_CONFIG_HOME` environment variable. For information about the JSON structure of a server definition, see [AUTOTITLE](/copilot/how-tos/use-copilot-agents/coding-agent/extend-coding-agent-with-mcp#writing-a-json-configuration-for-mcp-servers).
234+
Details of your configured MCP servers are stored in the `mcp-config.json` file, which is located, by default, in the `~/.copilot` directory. This location can be changed by setting the `COPILOT_HOME` environment variable. For information about the JSON structure of a server definition, see [AUTOTITLE](/copilot/how-tos/use-copilot-agents/coding-agent/extend-coding-agent-with-mcp#writing-a-json-configuration-for-mcp-servers).
235235
236236
### Context management
237237
@@ -269,7 +269,7 @@ For additional information use one of the following commands in your terminal:
269269
270270
`copilot help config`
271271
272-
You can adjust the configuration settings by editing the `config.json` file, which is located, by default, in the `~/.copilot` directory. This location can be changed by setting the `XDG_CONFIG_HOME` environment variable.
272+
You can adjust the configuration settings by editing the `config.json` file, which is located, by default, in the `~/.copilot` directory. This location can be changed by setting the `COPILOT_HOME` environment variable.
273273
274274
* **Environment variables** that affect {% data variables.copilot.copilot_cli_short %}:
275275

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

Lines changed: 57 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ contentType: reference
5454
| <kbd>Ctrl</kbd>+<kbd>F</kbd> | Move to the next character. |
5555
| <kbd>Ctrl</kbd>+<kbd>G</kbd> | Edit the prompt in an external editor. |
5656
| <kbd>Ctrl</kbd>+<kbd>H</kbd> | Delete the previous character. |
57-
| <kbd>Ctrl</kbd>+<kbd>K</kbd> | Delete from cursor to end of the line. |
57+
| <kbd>Ctrl</kbd>+<kbd>K</kbd> | Delete from cursor to end of the line. If the cursor is at the end of the line, delete the line break. |
5858
| <kbd>Ctrl</kbd>+<kbd>U</kbd> | Delete from cursor to beginning of the line. |
5959
| <kbd>Ctrl</kbd>+<kbd>W</kbd> | Delete the previous word. |
6060
| <kbd>Home</kbd> | Move to the start of the current line. |
@@ -152,6 +152,7 @@ For a complete list of available slash commands enter `/help` in the CLI's inter
152152
| `--no-color` | Disable all color output. |
153153
| `--no-custom-instructions` | Disable loading of custom instructions from `AGENTS.md` and related files. |
154154
| `--no-experimental` | Disable experimental features. |
155+
| `--output-format FORMAT` | FORMAT can be `text` (default) or `json` (outputs JSONL: one JSON object per line). |
155156
| `-p PROMPT`, `--prompt PROMPT` | Execute a prompt programmatically (exits after completion). |
156157
| `--plain-diff` | Disable rich diff rendering (syntax highlighting via the diff tool specified by your git config). |
157158
| `--resume [SESSION-ID]` | Resume a previous interactive session by choosing from a list (optionally specify a session ID). |
@@ -204,18 +205,25 @@ copilot --allow-tool 'MyMCP'
204205
| `COPILOT_SKILLS_DIRS` | Comma-separated list of additional directories for skills. |
205206
| `COPILOT_EDITOR` | Editor command for interactive editing (checked after `$VISUAL` and `$EDITOR`). Defaults to `vi` if none are set. |
206207
| `COPILOT_GITHUB_TOKEN` | Authentication token. Takes precedence over `GH_TOKEN` and `GITHUB_TOKEN`. |
208+
| `COPILOT_HOME` | Override the configuration and state directory. Default: `$HOME/.copilot`. |
207209
| `GH_TOKEN` | Authentication token. Takes precedence over `GITHUB_TOKEN`. |
208210
| `GITHUB_TOKEN` | Authentication token. |
209-
| `XDG_CONFIG_HOME` | Override the configuration directory. Default: `$HOME/.copilot`. |
210-
| `XDG_STATE_HOME` | Override the state directory. Default: `$HOME/.copilot`. |
211211
| `USE_BUILTIN_RIPGREP` | Set to `false` to use the system ripgrep instead of the bundled version. |
212212
| `PLAIN_DIFF` | Set to `true` to disable rich diff rendering. |
213213
| `COLORFGBG` | Fallback for dark/light terminal background detection. |
214214
| `COPILOT_CLI_ENABLED_FEATURE_FLAGS` | Comma-separated list of feature flags to enable (for example, `"SOME_FEATURE,SOME_OTHER_FEATURE"`). |
215215

216216
## Configuration file settings
217217

218-
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+
Settings cascade from user to repository to local, with more specific scopes overriding more general ones. Command-line flags and environment variables always take the highest precedence.
219+
220+
| Scope | Location | Purpose |
221+
|-------|----------|---------|
222+
| User | `~/.copilot/config.json` | Global defaults for all repositories. Use the `COPILOT_HOME` environment variable to specify an alternative path. |
223+
| Repository | `.github/copilot/settings.json` | Shared repository configuration (committed to the repository). |
224+
| Local | `.github/copilot/settings.local.json` | Personal overrides (add this to `.gitignore`). |
225+
226+
### User settings (`~/.copilot/config.json`)
219227

220228
| Key | Type | Default | Description |
221229
|-----|------|---------|-------------|
@@ -230,7 +238,7 @@ User settings are stored in `~/.copilot/config.json`. Project-level settings can
230238
| `denied_urls` | `string[]` | `[]` | URLs or domains blocked (takes precedence over `allowed_urls`). |
231239
| `experimental` | `boolean` | `false` | Enable experimental features. |
232240
| `include_coauthor` | `boolean` | `true` | Add a `Co-authored-by` trailer to git commits made by the agent. |
233-
| `launch_messages` | `string[]` | `[]` | Custom messages shown randomly on startup. |
241+
| `companyAnnouncements` | `string[]` | `[]` | Custom messages shown randomly on startup. |
234242
| `log_level` | `"none"` \| `"error"` \| `"warning"` \| `"info"` \| `"debug"` \| `"all"` \| `"default"` | `"default"` | Logging verbosity. |
235243
| `model` | `string` | varies | AI model to use (see the `/model` command). |
236244
| `reasoning_effort` | `"low"` \| `"medium"` \| `"high"` \| `"xhigh"` | `"medium"` | Reasoning effort level for extended thinking. Higher levels use more compute. |
@@ -243,13 +251,33 @@ User settings are stored in `~/.copilot/config.json`. Project-level settings can
243251
| `trusted_folders` | `string[]` | `[]` | Folders with pre-granted file access. |
244252
| `update_terminal_title` | `boolean` | `true` | Show the current intent in the terminal title. |
245253

254+
### Repository settings (`.github/copilot/settings.json`)
255+
256+
Repository settings apply to everyone who works in the repository. Only a subset of settings is supported at the repository level. Unsupported keys are ignored.
257+
258+
| Key | Type | Merge behavior | Description |
259+
|-----|------|---------------|-------------|
260+
| `companyAnnouncements` | `string[]` | Replaced—repository takes precedence | Messages shown randomly on startup. |
261+
| `enabledPlugins` | `Record<string, boolean>` | Merged—repository overrides user for same key | Declarative plugin auto-install. |
262+
| `marketplaces` | `Record<string, {...}>` | Merged—repository overrides user for same key | Plugin marketplaces available in this repository. |
263+
264+
### Local settings (`.github/copilot/settings.local.json`)
265+
266+
Create `.github/copilot/settings.local.json` in the repository, for personal overrides that should not be committed. Add this file to `.gitignore`.
267+
268+
The local configuration file uses the same schema as the repository configuration file (`.github/copilot/settings.json`) and takes precedence over it.
269+
246270
## Hooks reference
247271

248272
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.
249273

250274
### Hook configuration format
251275

252-
Hook configuration files use JSON format with version `1`:
276+
Hook configuration files use JSON format with version `1`.
277+
278+
#### Command hooks
279+
280+
Command hooks run shell scripts and are supported on all hook types.
253281

254282
```json
255283
{
@@ -278,6 +306,29 @@ Hook configuration files use JSON format with version `1`:
278306
| `env` | object | No | Environment variables to set (supports variable expansion). |
279307
| `timeoutSec` | number | No | Timeout in seconds. Default: `30`. |
280308

309+
#### Prompt hooks
310+
311+
Prompt hooks auto-submit text as if the user typed it. They are only supported on `sessionStart` and run before any initial prompt passed via `--prompt`. The text can be a natural language prompt or a slash command.
312+
313+
```json
314+
{
315+
"version": 1,
316+
"hooks": {
317+
"sessionStart": [
318+
{
319+
"type": "prompt",
320+
"prompt": "Your prompt text or /slash-command"
321+
}
322+
]
323+
}
324+
}
325+
```
326+
327+
| Field | Type | Required | Description |
328+
|-------|------|----------|-------------|
329+
| `type` | `"prompt"` | Yes | Must be `"prompt"`. |
330+
| `prompt` | string | Yes | Text to submit—can be a natural language message or a slash command. |
331+
281332
### Hook events
282333

283334
| Event | Fires when | Output processed |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
048ce959ac72b3507545101544155fecbc89f353
1+
632be5c3f07cff2d1b3de6e9215997d2c7d97a08

0 commit comments

Comments
 (0)