From 668fc6734f343062f0291ebca8dfbc6d47f6dfbe Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 18 Mar 2026 09:20:35 +0000 Subject: [PATCH] =?UTF-8?q?docs:=20update=20Learning=20Hub=20for=20March?= =?UTF-8?q?=202026=20CLI=20releases=20(v1.0.4=E2=80=93v1.0.7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add subagentStart hook event to the hooks events table - Add Cross-Client Compatibility section to hooks page (PascalCase event names, Claude Code nested matcher/hooks structure) - Add subagentStart practical example to hooks page - Add Open Plugin Spec Compatibility section to plugins page (discovery of .claude-plugin/plugin.json, .lsp.json locations) - Update lastUpdated dates to 2026-03-18 Sources: - https://github.com/github/copilot-cli/releases/tag/v1.0.7 - https://github.com/github/copilot-cli/releases/tag/v1.0.6 - https://github.com/github/copilot-cli/releases/tag/v1.0.5 - https://github.com/github/copilot-cli/releases/tag/v1.0.4 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../learning-hub/automating-with-hooks.md | 47 ++++++++++++++++++- .../installing-and-using-plugins.md | 19 +++++++- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/website/src/content/learning-hub/automating-with-hooks.md b/website/src/content/learning-hub/automating-with-hooks.md index 1a688226b..823219fa2 100644 --- a/website/src/content/learning-hub/automating-with-hooks.md +++ b/website/src/content/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-02-26 +lastUpdated: 2026-03-18 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 completes execution | Log results, track usage, format code after edits, send failure alerts | | `agentStop` | Main agent finishes responding to a prompt | Run final linters/formatters, validate complete changes | +| `subagentStart` | A subagent is spawned | Inject additional context into subagent prompts, log subagent spawning, enforce subagent governance | | `subagentStop` | A subagent completes before returning results | Audit subagent outputs, log subagent activity | | `errorOccurred` | An error occurs during agent execution | Log errors for debugging, send notifications, track error patterns | @@ -150,6 +151,28 @@ automatically before the agent commits changes. 3. Adjust the formatter command for your project ``` +## Cross-Client Compatibility + +Hook configuration files work across GitHub Copilot CLI, VS Code, and Claude Code **without modification**. The CLI accepts both camelCase and PascalCase event names (e.g., `postToolUse` and `PostToolUse` are equivalent), and supports Claude Code's nested `matcher/hooks` structure alongside the standard flat format. + +```json +{ + "hooks": [ + { + "matcher": { "event": "PostToolUse" }, + "hooks": [ + { + "type": "command", + "bash": "npx prettier --write ." + } + ] + } + ] +} +``` + +This means a single `hooks.json` file can be committed to your repository and used by team members regardless of which Copilot-compatible client they use. + ## Practical Examples ### Auto-Format After Edits @@ -216,6 +239,28 @@ 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. +### Injecting Context into Subagents with subagentStart + +When your agent spawns subagents (for example via the `task` tool), the `subagentStart` hook fires for each one. You can use it to inject additional context into the subagent's prompt — such as environment information or project-specific constraints — or to log and govern subagent activity: + +```json +{ + "version": 1, + "hooks": { + "subagentStart": [ + { + "type": "command", + "bash": "./scripts/inject-subagent-context.sh", + "cwd": ".", + "timeoutSec": 5 + } + ] + } +} +``` + +The hook receives context about the spawned subagent, allowing your script to output additional instructions that are injected into the subagent's starting prompt. + ### Governance Audit Scan user prompts for potential security threats and log session activity: diff --git a/website/src/content/learning-hub/installing-and-using-plugins.md b/website/src/content/learning-hub/installing-and-using-plugins.md index 28bc87955..901d23ba1 100644 --- a/website/src/content/learning-hub/installing-and-using-plugins.md +++ b/website/src/content/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-02-26 +lastUpdated: 2026-03-18 estimatedReadingTime: '8 minutes' tags: - plugins @@ -219,6 +219,23 @@ If you only need a single agent or skill (rather than a full plugin), you can st See [Using the Copilot Coding Agent](../using-copilot-coding-agent/) for details on this approach. +## Open Plugin Spec Compatibility + +GitHub Copilot CLI is compatible with the [Open Plugin Specification](https://openpluginsspec.org/), meaning plugins authored for other AI tools can often be loaded directly. The CLI discovers plugin manifests from several locations: + +| Location | Description | +|----------|-------------| +| `.github/plugin/plugin.json` | Standard Awesome Copilot format | +| `.claude-plugin/plugin.json` | Claude Code plugin format | +| `.lsp.json` or `.github/lsp.json` | LSP server configuration | + +When using `--plugin-dir`, the CLI automatically scans for these manifest locations. This means a plugin built for Claude Code (using `.claude-plugin/plugin.json`) can be loaded in Copilot CLI without any modifications. + +**Additional compatibility notes**: +- Both camelCase and PascalCase hook event names are accepted (e.g., `postToolUse` and `PostToolUse`) +- The `:` namespace separator is supported in tool names +- `exclusive` path mode is supported for more precise resource scoping + ## Best Practices - **Start with a marketplace plugin** before building your own — there may already be one that fits your needs