From 609117e9c32379540783187ca54649d300f28a81 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 2 Apr 2026 19:40:23 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20update=20Learning=20Hub=20for=20Copilot?= =?UTF-8?q?=20CLI=20v1.0.15=E2=80=93v1.0.16=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add PermissionRequest hook event to automating-with-hooks.md with practical CI example (new in v1.0.16) - Add Ctrl+Q / Ctrl+Enter queue shortcut note to copilot-configuration-basics.md (Ctrl+D no longer queues as of v1.0.15) - Add extraKnownMarketplaces config setting to installing-and-using-plugins.md (old 'marketplaces' setting removed in v1.0.16) - Update lastUpdated dates on all three files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../learning-hub/automating-with-hooks.md | 39 ++++++++++++++++++- .../copilot-configuration-basics.md | 4 +- .../installing-and-using-plugins.md | 19 ++++++++- 3 files changed, 59 insertions(+), 3 deletions(-) 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 6e1b7c7ae..1471380e2 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-01 +lastUpdated: 2026-04-02 estimatedReadingTime: '8 minutes' tags: - hooks @@ -93,6 +93,7 @@ Hooks can trigger on several lifecycle events: | `preToolUse` | Before the agent uses any tool (e.g., `bash`, `edit`) | **Approve or deny** tool executions, block dangerous commands, enforce security policies | | `postToolUse` | After a tool **successfully** completes execution | Log results, track usage, format code after edits | | `postToolUseFailure` | When a tool call **fails with an error** | Log errors for debugging, send failure alerts, track error patterns | +| `PermissionRequest` | When the CLI shows a **permission prompt** to the user | Programmatically approve or deny permission requests, enable auto-approval in CI/headless environments | | `agentStop` | Main agent finishes responding to a prompt | Run final linters/formatters, validate complete changes | | `preCompact` | Before the agent compacts its context window | Save a snapshot, log compaction event, run summary scripts | | `subagentStart` | A subagent is spawned by the main agent | Inject additional context into the subagent's prompt, log subagent launches | @@ -207,6 +208,42 @@ automatically before the agent commits changes. ## Practical Examples +### Auto-Approve Permissions in CI with PermissionRequest + +The `PermissionRequest` hook fires when the CLI shows a permission prompt to the user — for example, when the agent wants to run a shell command for the first time. Unlike `preToolUse` (which can block specific tool *calls*), `PermissionRequest` intercepts the permission approval UI itself, making it ideal for **headless and CI environments** where no one is available to click "Allow". + +When your hook script exits with code `0`, the permission request is **approved**. Exit with a non-zero code to **deny** it (the user will still see the prompt). + +```json +{ + "version": 1, + "hooks": { + "PermissionRequest": [ + { + "type": "command", + "bash": "./scripts/ci-permission-policy.sh", + "cwd": ".", + "timeoutSec": 5 + } + ] + } +} +``` + +Example policy script that auto-approves all permissions when running in CI: + +```bash +#!/usr/bin/env bash +# scripts/ci-permission-policy.sh +# Auto-approve all permission requests in CI environments +if [ "${CI}" = "true" ]; then + exit 0 # approve +fi +exit 1 # deny (let the user decide interactively) +``` + +> **Security note**: Use `PermissionRequest` hooks carefully. Blanket auto-approval in non-CI environments removes an important safety check. Scope the auto-approval logic precisely (e.g., only in CI, only for specific tools). + ### Handling Tool Failures with postToolUseFailure The `postToolUseFailure` hook fires when a tool call fails with an error — distinct from `postToolUse`, which only fires on success. Use it to log errors, send failure alerts, or implement retry logic: 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 6e080d51d..c241f9ac3 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-01 +lastUpdated: 2026-04-02 estimatedReadingTime: '10 minutes' tags: - configuration @@ -457,6 +457,8 @@ The `/share html` command exports the current session — including conversation The exported file contains everything needed to view the session without a network connection and can be shared with teammates or stored for later reference. This complements `/share` (which shares via URL) for cases where an offline or attached format is preferred. +**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 `/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: ``` 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 8688d743a..6788cbdae 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-03-30 +lastUpdated: 2026-04-02 estimatedReadingTime: '8 minutes' tags: - plugins @@ -142,6 +142,23 @@ Or from a local path: copilot plugin marketplace add /path/to/local-marketplace ``` +### Sharing Marketplace Registrations Across a Team + +To automatically register an additional marketplace for everyone working in a repository, add an `extraKnownMarketplaces` entry to your `.github/copilot-settings.json` (or `config.json`): + +```json +{ + "extraKnownMarketplaces": [ + { + "name": "my-org-plugins", + "source": "my-org/internal-plugins" + } + ] +} +``` + +With this in place, team members automatically get the `my-org-plugins` marketplace available without running a separate `marketplace add` command. This replaces the older `marketplaces` setting, which was removed in v1.0.16. + ## Installing Plugins ### From Copilot CLI