Skip to content

Commit 861a53e

Browse files
docs-botgithub-actions[bot]Copilothubwriter
authored
docs: update copilot-cli content from source docs (#61640)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: hubwriter <54933897+hubwriter@users.noreply.github.com> Co-authored-by: hubwriter <hubwriter@github.com>
1 parent 48cafe3 commit 861a53e

3 files changed

Lines changed: 65 additions & 6 deletions

File tree

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ Holding <kbd>↑</kbd> or <kbd>↓</kbd> accelerates scrolling after the first 1
196196
| Command | Purpose |
197197
|-----------------------------------------------------|---------|
198198
| `/add-dir PATH` | Add a directory to the allowed list for file access. |
199+
| `/after [DELAY PROMPT]`, `/after` | Schedule a non-recurring prompt, skill, or schedulable slash command for the current session (for example, `/after 30m remind me the time` or `/after 1h /chronicle standup`). With no arguments the schedule manager is displayed. {% data reusables.copilot.experimental %} |
199200
| `/agent` | Browse and select from available agents (if any). See [AUTOTITLE](/copilot/concepts/agents/copilot-cli/about-custom-agents). |
200201
| `/ask QUESTION` | Ask a quick side question without adding to the conversation history. {% data reusables.copilot.experimental %} |
201202
| `/allow-all [on\|off\|show]`, `/yolo [on\|off\|show]` | Enable all permissions (tools, paths, and URLs). |
@@ -209,8 +210,9 @@ Holding <kbd>↑</kbd> or <kbd>↓</kbd> accelerates scrolling after the first 1
209210
| `/cwd`, `/cd [PATH]` | Change the working directory or display the current directory. |
210211
| `/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). |
211212
| `/diff` | Review changes in the current directory; auto-switches to branch diff when the working tree is clean (experimental). |
212-
| `/downgrade <VERSION>` | Download and restart into a specific CLI version. Available for team accounts. |
213+
| `/downgrade VERSION` | Download and restart into a specific CLI version. Available for team accounts. |
213214
| `/env` | Show loaded environment details (instructions, MCP servers, skills, agents, plugins, LSPs, hooks, extensions). |
215+
| `/every [INTERVAL PROMPT]`, `/every` | Schedule a recurring prompt, skill, or schedulable slash command for the current session (for example, `/every 1h run tests` or `/every 1d /chronicle standup`). With no arguments the schedule manager is displayed. {% data reusables.copilot.experimental %} |
214216
| `/exit`, `/quit` | Exit the CLI. |
215217
| `/extensions [manage\|mode]`, `/extension` | Manage CLI extensions. |
216218
| `/experimental [on\|off\|show]` | Toggle, set, or show experimental features. |
@@ -255,7 +257,7 @@ Holding <kbd>↑</kbd> or <kbd>↓</kbd> accelerates scrolling after the first 1
255257
| `/usage` | Display session usage metrics and statistics. |
256258
| `/user [show\|list\|switch]` | Manage the current {% data variables.product.github %} user. |
257259
| `/version` | Display version information and check for updates. |
258-
| `/worktree [branch]`, `/move [branch]` | Create a new git worktree and switch to it, moving any uncommitted changes along. If you omit the branch name, a name is auto-generated from the conversation. Requires a git repository. {% data reusables.copilot.experimental %} |
260+
| `/worktree [branch]`, `/move [branch]` | Create a new Git worktree and switch to it, moving any uncommitted changes along. If you omit the branch name, a name is auto-generated from the conversation. Requires a Git repository. {% data reusables.copilot.experimental %} |
259261

260262
For a complete list of available slash commands enter `/help` in the CLI's interactive interface.
261263

@@ -311,7 +313,7 @@ For a complete list of available slash commands enter `/help` in the CLI's inter
311313
| `--output-format=FORMAT` | FORMAT can be `text` (default) or `json` (outputs JSONL: one JSON object per line). |
312314
| `-p PROMPT`, `--prompt=PROMPT` | Execute a prompt programmatically (exits after completion). See [AUTOTITLE](/copilot/how-tos/copilot-cli/automate-copilot-cli/run-cli-programmatically). |
313315
| `--plan` | Start in plan mode. Shorthand for `--mode plan`. Cannot be combined with `--mode` or `--autopilot`. |
314-
| `--plain-diff` | Disable rich diff rendering (syntax highlighting via the diff tool specified by your git config). |
316+
| `--plain-diff` | Disable rich diff rendering (syntax highlighting via the diff tool specified by your Git config). |
315317
| `--plugin-dir=DIRECTORY` | Load a plugin from a local directory (can be used multiple times). |
316318
| `--remote` | Enable remote access to this session from {% data variables.product.prodname_dotcom_the_website %} and {% data variables.product.prodname_mobile %}. See [AUTOTITLE](/copilot/how-tos/copilot-cli/use-copilot-cli/steer-remotely). |
317319
| `-r`, `--resume[=VALUE]` | Resume a previous interactive session by choosing from a list. Optionally specify a session ID, ID prefix, or session name. Name matching is exact and case-insensitive; falls back to the auto-generated summary when no explicit name matches. |
@@ -426,6 +428,7 @@ copilot --allow-tool='MyMCP'
426428
| `COPILOT_ALLOW_ALL` | Set to `true` to allow all permissions automatically (equivalent to `--allow-all`). |
427429
| `COPILOT_AUTO_UPDATE` | Set to `false` to disable automatic updates. |
428430
| `COPILOT_CACHE_HOME` | Override the cache directory (used for marketplace caches, auto-update packages, and other ephemeral data). See [AUTOTITLE](/copilot/reference/copilot-cli-reference/cli-config-dir-reference#changing-the-location-of-the-configuration-directory) for platform defaults. |
431+
| `COPILOT_COMPUTER_USE_LINUX` | Set to opt in to the `computer-use` MCP server on Linux distributions that support it. The `computer-use` server is not available on Alpine Linux (musl libc). |
429432
| `COPILOT_CUSTOM_INSTRUCTIONS_DIRS` | Comma-separated list of additional directories for custom instructions. |
430433
| `COPILOT_EDITOR` | Editor command for interactive editing (checked after `$VISUAL` and `$EDITOR`). Defaults to `vi` if none are set. |
431434
| `COPILOT_ENABLE_HTTP2` | Set to `1` or `true` to opt into HTTP/2 transport. HTTP/1.1 is the default. |
@@ -615,6 +618,7 @@ The CLI includes built-in MCP servers that are available without additional setu
615618
| `playwright` | Browser automation: navigate, click, type, screenshot, and form handling. |
616619
| `fetch` | HTTP requests via the `fetch` tool. |
617620
| `time` | Time utilities: `get_current_time` and `convert_time`. |
621+
| `computer-use` | Screen capture and mouse/keyboard automation. Not available on Alpine Linux (musl libc). Set `COPILOT_COMPUTER_USE_LINUX` to opt in on other Linux distributions where it is available. |
618622

619623
Use `--disable-builtin-mcps` to disable all built-in servers, or `--disable-mcp-server SERVER-NAME` to disable a specific one.
620624

@@ -764,7 +768,7 @@ Custom agents are specialized AI agents defined in Markdown files. The filename
764768
| User | `~/.copilot/agents/` |
765769
| Plugin | `<plugin>/agents/` |
766770

767-
Project-level agents take precedence over user-level agents. Plugin agents have the lowest priority.
771+
For project-scoped agents, the CLI walks upward from your current working directory to the Git root, loading `.github/agents/` and `.claude/agents/` directories at each ancestor level. This means each package or subdirectory in a monorepo can contribute its own agents. When multiple `.github/agents/` directories exist in the path, all are loaded, with the deepest directory taking highest priority. The `.github/agents/` convention takes precedence over `.claude/agents/` at the same level. User-level agents have lower priority than project-level agents. Plugin agents have the lowest priority.
768772

769773
### Subagent limits
770774

@@ -797,7 +801,7 @@ When the full dialog is shown, you can also choose from these options:
797801
| This location | Until manually cleared | Saved to disk per location |
798802
| Always | Permanent | Config file |
799803

800-
The **This location** option appears when the CLI can determine a location key (git root or current directory). It persists the approval to disk so the same permission is automatically granted the next time you work in that directory without prompting again.
804+
The **This location** option appears when the CLI can determine a location key (Git root or current directory). It persists the approval to disk so the same permission is automatically granted the next time you work in that directory without prompting again.
801805

802806
Use `/permissions reset` to clear in-memory approvals for the current session.
803807

content/copilot/reference/hooks-reference.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,34 @@ Command hooks run shell scripts and are supported on all hook types.
115115
| `timeoutSec` | number | No | Timeout in seconds. Default: `30`. |
116116
| `type` | `"command"` | No | Hook type. Defaults to `"command"` when omitted. |
117117

118+
#### Progress messages
119+
120+
Command hooks can emit progress status lines to the CLI timeline while executing. Write a `{"type": "progress", "message": "..."}` JSON object to stdout before writing the final output:
121+
122+
```bash
123+
echo '{"type": "progress", "message": "Checking policy..."}'
124+
# ... perform work ...
125+
echo '{"permissionDecision": "allow"}'
126+
```
127+
128+
Set `"temporary": true` to emit a transient status line. A transient line replaces the previous transient line and is cleared when the assistant responds, instead of accumulating in the timeline:
129+
130+
```bash
131+
echo '{"type": "progress", "message": "Routing...", "temporary": true}'
132+
echo '{"type": "progress", "message": "Thinking...", "temporary": true}'
133+
# ... perform work ...
134+
echo '{"permissionDecision": "allow"}'
135+
```
136+
137+
Progress messages are display-only and do not affect hook output or decision logic.
138+
139+
**How stdout is parsed when progress messages are mixed in.** — The CLI scans stdout line-by-line as the hook runs. Any line that, after trimming, is a single complete JSON object with `"type": "progress"` is consumed as a progress event and **removed from the hook's output stream**. Every other line—blank lines, plain text, and JSON objects that are not progress messages—is preserved verbatim. When the hook exits, the preserved lines are concatenated, trimmed, and parsed with a single `JSON.parse` call: that result is the hook's output (the "hook output JSON" referenced elsewhere in this article). This means:
140+
141+
* Emitting progress lines alongside a final decision object (as in the examples above) is safe and is the intended pattern—the progress lines never reach the JSON parser.
142+
* Each progress message must be on its own line and must be valid JSON on that single line. Multi-line / pretty-printed progress objects are not recognized as progress and will be left in the output stream, where they will likely cause the final `JSON.parse` to fail.
143+
* The final decision object, by contrast, may span multiple lines—only progress *recognition* is line-oriented; what remains after progress stripping is parsed as one JSON document, not as line-delimited JSON.
144+
* If the leftover output is empty, or fails to parse as JSON, the hook is treated as having produced no output and falls through to default behavior. Two or more non-progress JSON objects on stdout (for example, two `echo '{"permissionDecision": ...}'` calls) will therefore concatenate into invalid JSON and be ignored—emit exactly one final decision object.
145+
118146
### HTTP hooks
119147

120148
HTTP hooks send the input payload as a JSON `POST` to a URL.
@@ -311,6 +339,30 @@ When configured with the PascalCase event name `PreToolUse`, the payload uses sn
311339
}
312340
```
313341

342+
**Claude-format matchers (PascalCase `PreToolUse`):** Hooks configured with the PascalCase event name `PreToolUse`—as used in Claude Code plugins and the Open Plugins format—apply Claude's matcher semantics instead of the native regex rule:
343+
344+
* `*`, `**`, or an empty matcher fires for every tool.
345+
* A literal name or `|`-separated alternation (for example, `Bash` or `Edit|Write`) fires when any token equals the runtime tool name or its Claude tool name from the table below.
346+
* Any other value is treated as a case-sensitive regex anchored as `^(?:pattern)$` tested against the Claude tool name (or the runtime name for tools with no Claude equivalent).
347+
348+
Payloads for PascalCase `PreToolUse` report `tool_name` as the Claude tool name (for example, `Bash`, not `bash`).
349+
350+
| Runtime tool | Claude tool name |
351+
|---|---|
352+
| `bash`, `powershell` | `Bash` |
353+
| `view` | `Read` |
354+
| `create` | `Write` |
355+
| `edit`, `str_replace_editor`, `apply_patch` | `Edit` |
356+
| `grep`, `rg` | `Grep` |
357+
| `glob` | `Glob` |
358+
| `web_fetch` | `WebFetch` |
359+
| `web_search` | `WebSearch` |
360+
| `ask_user` | `AskUserQuestion` |
361+
| `update_todo` | `TodoWrite` |
362+
| `task` | `Agent` (the literal `Task` is also accepted) |
363+
364+
Tools with no Claude equivalent keep their runtime names.
365+
314366
> [!IMPORTANT]
315367
> **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.
316368
@@ -573,6 +625,9 @@ All configured `permissionRequest` hooks run for each request (except `read` and
573625

574626
**Matcher:** Optional regex tested against `toolName`. Anchored as `^(?:pattern)$`; must match the full tool name. When set, the hook fires only for matching tool names.
575627

628+
> [!NOTE]
629+
> **Claude-format matchers (PascalCase `PermissionRequest`):** Hooks configured with the PascalCase event name `PermissionRequest` use the same Claude matcher semantics as `PreToolUse`. See [Claude-format matchers (PascalCase PreToolUse)](#claude-format-matchers-pascalcase-pretooluse) for the matcher rules and tool name table.
630+
576631
Output JSON to stdout to control the permission decision:
577632

578633
| Field | Values | Description |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c05adb990b05f7ab88981904a6f5e0d67ab1387c
1+
005830f576fb7f53962c8080fdd86d7a382587c6

0 commit comments

Comments
 (0)