diff --git a/website/src/content/docs/learning-hub/automating-with-hooks.md b/website/src/content/docs/learning-hub/automating-with-hooks.md index 1471380e2..ac2f9300d 100644 --- a/website/src/content/docs/learning-hub/automating-with-hooks.md +++ b/website/src/content/docs/learning-hub/automating-with-hooks.md @@ -3,7 +3,7 @@ title: 'Automating with Hooks' description: 'Learn how to use hooks to automate lifecycle events like formatting, linting, and governance checks during Copilot agent sessions.' authors: - GitHub Copilot Learning Hub Team -lastUpdated: 2026-04-02 +lastUpdated: 2026-04-16 estimatedReadingTime: '8 minutes' tags: - hooks @@ -332,6 +332,37 @@ Block dangerous commands before they execute: The `preToolUse` hook receives JSON input with details about the tool being called. Your script can inspect this input and exit with a non-zero code to **deny** the tool execution, or exit with zero to **approve** it. +### Modifying Tool Arguments with preToolUse + +Beyond approve/deny, `preToolUse` hooks can also **modify tool arguments** before they are passed to the tool, and inject **additional context** into the agent's reasoning. To do this, write JSON to stdout from your hook script: + +```bash +#!/usr/bin/env bash +# scripts/sanitize-bash-args.sh +# +# Reads the proposed bash command from stdin, strips dangerous flags, +# and writes back the sanitized command as modifiedArgs. + +INPUT=$(cat) +COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty') + +# Strip the --no-sandbox flag if present +SAFE_COMMAND=$(echo "$COMMAND" | sed 's/--no-sandbox//g') + +echo "{\"modifiedArgs\": {\"command\": \"$SAFE_COMMAND\"}, \"additionalContext\": \"Command was sanitized by security policy.\"}" +``` + +The output fields are: + +| Field | Description | +|-------|-------------| +| `modifiedArgs` (or `updatedInput`) | Replacement tool arguments. These are used instead of the originals. | +| `additionalContext` | Text injected into the agent's context for this turn — useful for explaining why a change was made. | + +This enables sophisticated patterns like normalizing file paths, enforcing naming conventions, adding required flags, or surfacing policy context—without blocking the tool entirely. + +> **Note**: Both `modifiedArgs` and `updatedInput` are accepted field names for the replacement arguments (for cross-tool compatibility). + ### Governance Audit Scan user prompts for potential security threats and log session activity: diff --git a/website/src/content/docs/learning-hub/copilot-configuration-basics.md b/website/src/content/docs/learning-hub/copilot-configuration-basics.md index c241f9ac3..eaac88636 100644 --- a/website/src/content/docs/learning-hub/copilot-configuration-basics.md +++ b/website/src/content/docs/learning-hub/copilot-configuration-basics.md @@ -3,7 +3,7 @@ title: 'Copilot Configuration Basics' description: 'Learn how to configure GitHub Copilot at user, workspace, and repository levels to optimize your AI-assisted development experience.' authors: - GitHub Copilot Learning Hub Team -lastUpdated: 2026-04-02 +lastUpdated: 2026-04-16 estimatedReadingTime: '10 minutes' tags: - configuration @@ -459,6 +459,24 @@ The exported file contains everything needed to view the session without a netwo **Keyboard shortcuts for queuing messages**: Use **Ctrl+Q** or **Ctrl+Enter** to queue a message (send it while the agent is still working). **Ctrl+D** no longer queues messages — it now has its default terminal behavior. If you have muscle memory for Ctrl+D queuing, switch to Ctrl+Q. +The `/ask` command lets you ask a quick question without affecting your conversation history. The current session context is preserved, so you can use it for one-off lookups without derailing an ongoing task: + +``` +/ask What does the `retry` utility in src/utils do? +``` + +The `/env` command shows all loaded environment details — instructions, MCP servers, skills, agents, and plugins — in a single view. Use it to verify that the right resources are active for the current session: + +``` +/env +``` + +The `/statusline` command (with `/footer` as an alias) lets you control which items appear in the terminal status bar. You can show or hide individual indicators like the working directory, current branch, effort level, context window usage, and quota: + +``` +/statusline # show the statusline configuration menu +``` + The `/allow-all` command (also accessible as `/yolo`) enables autopilot mode, where the agent runs all tools without asking for confirmation. It now supports `on`, `off`, and `show` subcommands: ``` @@ -477,6 +495,18 @@ gh copilot --effort high "Refactor the authentication module" Accepted values are `low`, `medium`, and `high`. You can also set a default via the `effortLevel` config setting. +### CLI Startup Flags + +The `--mode` flag (along with its aliases `--autopilot` and `--plan`) lets you launch the CLI directly in a specific agent mode without waiting for the interactive session to start: + +```bash +copilot --mode agent # start in agent mode (autonomous tool use) +copilot --autopilot # alias for --mode autopilot (allow-all) +copilot --plan # start in plan mode (propose without executing) +``` + +This is useful in scripts or CI pipelines where you want the CLI to immediately begin working in a specific mode without an interactive prompt. + ## Common Questions **Q: How do I disable Copilot for specific files?** diff --git a/website/src/content/docs/learning-hub/installing-and-using-plugins.md b/website/src/content/docs/learning-hub/installing-and-using-plugins.md index 6788cbdae..6fa2af7da 100644 --- a/website/src/content/docs/learning-hub/installing-and-using-plugins.md +++ b/website/src/content/docs/learning-hub/installing-and-using-plugins.md @@ -3,7 +3,7 @@ title: 'Installing and Using Plugins' description: 'Learn how to find, install, and manage plugins that extend GitHub Copilot CLI with reusable agents, skills, hooks, and integrations.' authors: - GitHub Copilot Learning Hub Team -lastUpdated: 2026-04-02 +lastUpdated: 2026-04-16 estimatedReadingTime: '8 minutes' tags: - plugins @@ -175,6 +175,8 @@ Or from an interactive session: /plugin install database-data-management@awesome-copilot ``` +> **Deprecation notice**: Installing plugins directly from a GitHub repository URL, raw URL, or local file path (e.g., `copilot plugin install github/awesome-copilot`) is deprecated and will be removed in a future release. Use marketplace-based installation instead. + ### From VS Code Browse to the plugin via `@agentPlugins` in the Extensions search view or via **Chat: Plugins** in the Command Palette, then click **Install**. @@ -190,6 +192,9 @@ copilot plugin list # Update a plugin to the latest version copilot plugin update my-plugin +# Refresh all marketplace catalogs (fetch the latest list of available plugins) +copilot plugin marketplace update + # Remove a plugin copilot plugin uninstall my-plugin ``` diff --git a/website/src/content/docs/learning-hub/understanding-mcp-servers.md b/website/src/content/docs/learning-hub/understanding-mcp-servers.md index 72af15f34..6252929bc 100644 --- a/website/src/content/docs/learning-hub/understanding-mcp-servers.md +++ b/website/src/content/docs/learning-hub/understanding-mcp-servers.md @@ -3,7 +3,7 @@ title: 'Understanding MCP Servers' description: 'Learn how Model Context Protocol servers extend GitHub Copilot with access to external tools, databases, and APIs.' authors: - GitHub Copilot Learning Hub Team -lastUpdated: 2026-04-01 +lastUpdated: 2026-04-16 estimatedReadingTime: '8 minutes' tags: - mcp @@ -91,6 +91,24 @@ Example `.mcp.json` or `.vscode/mcp.json`: } ``` +### Installing MCP Servers from the Registry + +GitHub Copilot CLI can install MCP servers directly from the official registry with guided configuration — no manual JSON editing required. During an interactive session, run: + +``` +/mcp install +``` + +A picker will list available servers from the registry. After selecting one, the CLI prompts for any required configuration values (connection strings, API keys, etc.) and writes the completed entry to your persistent MCP config automatically. + +You can also install a specific server by name without the picker: + +``` +/mcp install @modelcontextprotocol/server-postgres +``` + +This guided flow is the recommended way to add new MCP servers, especially for servers that require multiple configuration values. + ### Configuration Fields **command**: The executable to run the MCP server (e.g., `npx`, `python`, `docker`). @@ -99,6 +117,8 @@ Example `.mcp.json` or `.vscode/mcp.json`: **env**: Environment variables passed to the server process. Use these for connection strings, API keys, and configuration—never hardcode secrets in the JSON file. +**type** (remote servers): The transport type for remote MCP servers (`http` or `sse`). This field can now be omitted — the CLI defaults to `http` when no type is specified, simplifying remote server configuration. + ### Managing Persistent MCP Configuration via Server RPCs In addition to file-based configuration, GitHub Copilot CLI exposes **server RPCs** that let MCP servers and tooling scripts manage the persistent MCP server registry at runtime. This enables programmatic setup — for example, an installer script that registers a server without requiring you to hand-edit a JSON file. diff --git a/website/src/content/docs/learning-hub/using-copilot-coding-agent.md b/website/src/content/docs/learning-hub/using-copilot-coding-agent.md index dcd48b51a..c4ea5248c 100644 --- a/website/src/content/docs/learning-hub/using-copilot-coding-agent.md +++ b/website/src/content/docs/learning-hub/using-copilot-coding-agent.md @@ -3,7 +3,7 @@ title: 'Using the Copilot Coding Agent' description: 'Learn how to use GitHub Copilot coding agent to autonomously work on issues, generate pull requests, and automate development tasks.' authors: - GitHub Copilot Learning Hub Team -lastUpdated: 2026-03-25 +lastUpdated: 2026-04-16 estimatedReadingTime: '12 minutes' tags: - coding-agent @@ -334,6 +334,45 @@ This repository provides a curated collection of agents, skills, and hooks desig > **Example workflow**: Combine a `test-specialist` agent with a `database-migrations` skill and a linting hook. Assign an issue to the coding agent using the test-specialist agent — it will automatically pick up the migrations skill when relevant, and the hook ensures all code is formatted before completion. +## Remote Control + +You can connect to and steer a running coding agent session from a local Copilot CLI terminal using **remote control**. This lets you observe the agent's progress, send follow-up prompts, and redirect its work in real time — without waiting for it to open a PR first. + +### Starting a Remote-Controlled Session + +Launch a session that registers with GitHub for remote access: + +```bash +copilot --remote +``` + +Or open a remote control tab from inside an existing session: + +``` +/remote +``` + +The **Remote** tab in the CLI shows all active coding agent tasks from the repository. Select a task to connect and begin sending steering messages. + +### Resuming from the Session Picker + +Remote sessions also appear in the `--resume` picker, so you can reconnect to a coding agent session you were previously controlling without needing to know the session ID: + +```bash +copilot --resume +``` + +### Why Use Remote Control? + +| Scenario | Benefit | +|----------|---------| +| Long-running tasks | Monitor progress without waiting for the final PR | +| Mid-course corrections | Redirect the agent if it heads in the wrong direction | +| Interactive refinement | Provide clarification and feedback as the agent works | +| No PR required | You can steer tasks that haven't yet opened a pull request | + +> **Note**: Remote control replaces the earlier "steering" feature. If you see references to steering in older documentation, remote control is the updated equivalent. + ## Hooks and the Coding Agent Hooks are especially valuable with the coding agent because they provide deterministic guardrails for autonomous work: