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/reference/copilot-cli-reference/cli-command-reference.md
+47-1Lines changed: 47 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,6 +144,31 @@ Sessions sort by the following modes:
144
144
145
145
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.
146
146
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). |
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
+
147
172
## Navigation shortcuts in the interactive interface
148
173
149
174
| Shortcut | Purpose |
@@ -183,7 +208,7 @@ Sessions already open in another window float to the top in all non-relevance so
183
208
|`/copy`| Copy the last response to the clipboard. |
184
209
|`/cwd`, `/cd [PATH]`| Change the working directory or display the current directory. |
185
210
|`/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). |
187
212
|`/downgrade <VERSION>`| Download and restart into a specific CLI version. Available for team accounts. |
@@ -484,6 +509,27 @@ Use `copilot mcp` to manage MCP server configurations from the command line with
484
509
|`timeout`| No | Tool call timeout in milliseconds. |
485
510
|`type`| No |`"local"` or `"stdio"`. Default: `"local"`. |
486
511
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.
|`bashEnv`|`boolean`|`false`| Enable `BASH_ENV` support for bash shells. Can also be set with `--bash-env` or `--no-bash-env`. |
213
213
|`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. |
214
215
|`colorMode`|`"default"`\|`"dim"`\|`"high-contrast"`\|`"colorblind"`|`"default"`| Color contrast mode. Managed by the `/theme` slash command. |
215
216
|`compactPaste`|`boolean`|`true`| Collapse large pastes (more than 10 lines) into compact tokens. |
216
217
|`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
241
242
|`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. |
242
243
|`respectGitignore`|`boolean`|`true`| Exclude gitignored files from the `@` file mention picker. When `false`, the picker includes files normally excluded by `.gitignore`. |
|`showTipsOnStartup`|`boolean`|`true`| Show a random command tip when the CLI starts. |
244
246
|`skillDirectories`|`string[]`|`[]`| Additional directories to search for custom skill definitions (in addition to `~/.copilot/skills/`). |
245
247
|`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. |
246
248
|`storeTokenPlaintext`|`boolean`|`false`| Allow authentication tokens to be stored in plain text in `config.json` when no system keychain is available. |
Copy file name to clipboardExpand all lines: content/copilot/reference/hooks-reference.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -292,6 +292,9 @@ When configured with the PascalCase event name `PreToolUse`, the payload uses sn
292
292
}
293
293
```
294
294
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
+
295
298
### `postToolUse` / `PostToolUse`
296
299
297
300
**camelCase input:**
@@ -632,15 +635,18 @@ Several events accept an optional `matcher` regex on each hook entry that filter
632
635
|`view`| Read file contents. |
633
636
|`web_fetch`| Fetch web pages. |
634
637
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.
636
639
637
640
## Exit codes for command hooks
638
641
639
642
| Exit code | Meaning |
640
643
|-----------|---------|
641
644
|`0`| Success. `stdout` is parsed as the hook output JSON if present. |
642
645
|`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.
0 commit comments