mirror of
https://github.com/github/awesome-copilot.git
synced 2026-04-11 18:55:55 +00:00
docs: update Learning Hub for Copilot CLI v1.0.15–v1.0.16 changes (#1273)
- 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: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
46bef1b61a
commit
b80ea43e62
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
```
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user