Skip to content

Commit 1b990c9

Browse files
docs-botgithub-actions[bot]am-steadCopilot
authored
docs: update copilot-cli content from source docs (#61520)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Anne-Marie <102995847+am-stead@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent bbff48e commit 1b990c9

4 files changed

Lines changed: 58 additions & 4 deletions

File tree

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

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,31 @@ Sessions sort by the following modes:
144144

145145
Sessions already open in another window float to the top in all non-relevance sort modes. When no working-directory context is available, the `relevance` mode is skipped.
146146

147+
## Diff mode shortcuts
148+
149+
When diff mode is open (entered via `/diff`):
150+
151+
| Shortcut | Purpose |
152+
|----------|---------|
153+
| <kbd>↑</kbd> / `k` | Move selection up one line. |
154+
| <kbd>↓</kbd> / `j` | Move selection down one line. |
155+
| <kbd>←</kbd> / `h` | Jump to the previous file. |
156+
| <kbd>→</kbd> / `l` | Jump to the next file. |
157+
| <kbd>Home</kbd> | Jump to the first line. |
158+
| <kbd>End</kbd> | Jump to the last line. |
159+
| <kbd>Page Up</kbd> | Scroll up one page. |
160+
| <kbd>Page Down</kbd> | Scroll down one page. |
161+
| `Click` | Select the clicked diff line (requires mouse support). |
162+
| Mouse scroll | Scroll up or down. |
163+
| `c` | Add or edit a comment on the selected line. |
164+
| `s` | Show comments summary (when comments exist). |
165+
| `b` | Toggle between unstaged changes and branch diff. |
166+
| <kbd>Enter</kbd> | Submit all comments (when comments exist). |
167+
| `r` | Refresh the diff (remote sessions only). |
168+
| <kbd>Esc</kbd> / <kbd>Ctrl</kbd>+<kbd>C</kbd> | Exit diff mode. |
169+
170+
Holding <kbd>↑</kbd> or <kbd>↓</kbd> accelerates scrolling after the first 10 rapid presses. Mouse support requires `--mouse` (enabled by default in alt-screen mode). Disable with `--no-mouse`.
171+
147172
## Navigation shortcuts in the interactive interface
148173

149174
| Shortcut | Purpose |
@@ -183,7 +208,7 @@ Sessions already open in another window float to the top in all non-relevance so
183208
| `/copy` | Copy the last response to the clipboard. |
184209
| `/cwd`, `/cd [PATH]` | Change the working directory or display the current directory. |
185210
| `/delegate [PROMPT]` | Delegate changes to a remote repository with an AI-generated pull request. See [AUTOTITLE](/copilot/how-tos/copilot-cli/use-copilot-cli/delegate-tasks-to-cca). |
186-
| `/diff` | Review the changes made in the current directory. |
211+
| `/diff` | Review changes in the current directory; auto-switches to branch diff when the working tree is clean (experimental). |
187212
| `/downgrade <VERSION>` | Download and restart into a specific CLI version. Available for team accounts. |
188213
| `/env` | Show loaded environment details (instructions, MCP servers, skills, agents, plugins, LSPs, extensions). |
189214
| `/exit`, `/quit` | Exit the CLI. |
@@ -484,6 +509,27 @@ Use `copilot mcp` to manage MCP server configurations from the command line with
484509
| `timeout` | No | Tool call timeout in milliseconds. |
485510
| `type` | No | `"local"` or `"stdio"`. Default: `"local"`. |
486511

512+
### Private npm registry
513+
514+
Use `--registry` in the `args` array to pull a package from a private npm registry—for example, Artifactory or a {% data variables.product.github %} Packages feed:
515+
516+
```json
517+
{
518+
"mcpServers": {
519+
"my-internal-server": {
520+
"command": "npx",
521+
"args": [
522+
"--registry", "https://npm.pkg.github.com",
523+
"@my-org/internal-mcp-server"
524+
],
525+
"tools": ["*"]
526+
}
527+
}
528+
}
529+
```
530+
531+
The `--registry` flag and other npm config flags (`--userconfig`, `--globalconfig`, `--prefix`, `--cache`, `--node-options`, `--workspace`, `-w`) are treated as value-consuming arguments when computing the server's identity fingerprint. This ensures enterprise allowlist checks and registry verification work correctly when these flags appear before the package name.
532+
487533
### Remote server configuration fields
488534

489535
| Field | Required | Description |

content/copilot/reference/copilot-cli-reference/cli-config-dir-reference.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ These settings apply across all your sessions and repositories. You can edit thi
211211
| `banner` | `"always"` \| `"once"` \| `"never"` | `"once"` | Animated banner display frequency. |
212212
| `bashEnv` | `boolean` | `false` | Enable `BASH_ENV` support for bash shells. Can also be set with `--bash-env` or `--no-bash-env`. |
213213
| `beep` | `boolean` | `true` | Play an audible beep when attention is required. |
214+
| `builtInAgents.rubberDuck` | `boolean` | `true` | Enable the rubber-duck subagent that provides adversarial feedback on agent plans. |
214215
| `colorMode` | `"default"` \| `"dim"` \| `"high-contrast"` \| `"colorblind"` | `"default"` | Color contrast mode. Managed by the `/theme` slash command. |
215216
| `compactPaste` | `boolean` | `true` | Collapse large pastes (more than 10 lines) into compact tokens. |
216217
| `companyAnnouncements` | `string[]` | `[]` | Custom messages shown randomly on startup. One message is randomly selected each time the CLI starts. Useful for team announcements or reminders. |
@@ -241,6 +242,7 @@ These settings apply across all your sessions and repositories. You can edit thi
241242
| `remoteExport` | `boolean` | `true` | Export sessions remotely when session sync is available. Set to `false` to opt out of remote export by default. The `remoteSessions` setting when set to `true`, or the `--remote` flag, still enables export and steering regardless of this setting. |
242243
| `respectGitignore` | `boolean` | `true` | Exclude gitignored files from the `@` file mention picker. When `false`, the picker includes files normally excluded by `.gitignore`. |
243244
| `screenReader` | `boolean` | `false` | Enable screen reader optimizations. |
245+
| `showTipsOnStartup` | `boolean` | `true` | Show a random command tip when the CLI starts. |
244246
| `skillDirectories` | `string[]` | `[]` | Additional directories to search for custom skill definitions (in addition to `~/.copilot/skills/`). |
245247
| `statusLine` | `object` || Custom status line display. `type`: must be `"command"`. `command`: path to an executable script that receives session JSON on stdin and prints status content to stdout. `padding`: optional number of left-padding spaces. |
246248
| `storeTokenPlaintext` | `boolean` | `false` | Allow authentication tokens to be stored in plain text in `config.json` when no system keychain is available. |

content/copilot/reference/hooks-reference.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ When configured with the PascalCase event name `PreToolUse`, the payload uses sn
292292
}
293293
```
294294

295+
> [!IMPORTANT]
296+
> **Command vs HTTP fail behavior for `preToolUse`:** Command `preToolUse` hooks are **fail-closed**—a crash or non-zero exit denies the tool call. HTTP `preToolUse` hooks are **fail-open**—a network error, timeout, or non-2xx response falls through to the default permission flow. Choose the variant that matches your security requirements.
297+
295298
### `postToolUse` / `PostToolUse`
296299

297300
**camelCase input:**
@@ -632,15 +635,18 @@ Several events accept an optional `matcher` regex on each hook entry that filter
632635
| `view` | Read file contents. |
633636
| `web_fetch` | Fetch web pages. |
634637

635-
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 other than `2`, or timeouts) are logged and skipped—they never block agent execution.
638+
If multiple hooks of the same type are configured, they execute in order. For `preToolUse`, if any hook returns `"deny"`, the tool is blocked. For most events, hook failures (non-zero exit codes other than `2`, or timeouts) are logged and skipped. **Exception: `preToolUse` is fail-closed**—a crash, non-zero exit (other than exit 2), or timeout denies the tool call rather than silently allowing it.
636639

637640
## Exit codes for command hooks
638641

639642
| Exit code | Meaning |
640643
|-----------|---------|
641644
| `0` | Success. `stdout` is parsed as the hook output JSON if present. |
642645
| `2` | Treated as a warning by default. `stderr` is surfaced to the user but the run continues. For `permissionRequest`, exit `2` is treated as `{"behavior":"deny"}` and any `stdout` JSON is merged in. For `postToolUseFailure`, exit `2` is treated as `additionalContext` and `stdout` is appended to the failure shown to the agent. |
643-
| Other non-zero | Logged as a hook failure. The run continues (fail-open). |
646+
| Other non-zero | Logged as a hook failure. The run continues (fail-open). **Exception: `preToolUse` is fail-closed**—a non-zero exit (other than exit 2) denies the tool call with `"Denied by preToolUse hook (hook errored)"`. |
647+
| Timeout | Killed after `timeoutSec`. Error logged, agent continues. **Exception: `preToolUse` is fail-closed**—timeout denies the tool call. |
648+
649+
For most events, non-zero exits and timeouts are logged and skipped—agent execution continues. `preToolUse` is the exception: errors, crashes, and timeouts deny the tool call rather than silently allowing it. This prevents a brittle hook from being bypassed when hook input triggers an unexpected crash. Exit 2 is handled per the rules above and does not block execution.
644650

645651
## Disable all hooks
646652

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6f4199ecdb5aec16a6caafade77d0aab7352d176
1+
cb4c40cf4c55ea965aa476893bd504298b2ecfb4

0 commit comments

Comments
 (0)