mirror of
https://github.com/github/awesome-copilot.git
synced 2026-04-30 12:15:56 +00:00
docs: update Learning Hub with HTTP hooks and CLI configuration improvements
- Add HTTP hook type documentation to automating-with-hooks.md (new in v1.0.35-0: hooks can POST JSON payloads to a URL instead of running a local command) - Add practical HTTP hook webhook example to Practical Examples section - Add `auto` model selection documentation to copilot-configuration-basics.md (new in v1.0.32: select auto to let Copilot pick the best model) - Add `continueOnAutoMode` config setting to CLI settings table (new in v1.0.35-2: auto-switch to auto model on rate limit) - Add session naming with --name flag and --resume=<name> (new in v1.0.35-4: name sessions at startup, resume by name) - Update lastUpdated dates to 2026-04-22 for both files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
0e422e6dff
commit
3750ab5797
@@ -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.'
|
description: 'Learn how to use hooks to automate lifecycle events like formatting, linting, and governance checks during Copilot agent sessions.'
|
||||||
authors:
|
authors:
|
||||||
- GitHub Copilot Learning Hub Team
|
- GitHub Copilot Learning Hub Team
|
||||||
lastUpdated: 2026-04-16
|
lastUpdated: 2026-04-22
|
||||||
estimatedReadingTime: '8 minutes'
|
estimatedReadingTime: '8 minutes'
|
||||||
tags:
|
tags:
|
||||||
- hooks
|
- hooks
|
||||||
@@ -156,7 +156,9 @@ This makes it straightforward to write plugin hooks that are portable across mac
|
|||||||
|
|
||||||
### Event Configuration
|
### Event Configuration
|
||||||
|
|
||||||
Each hook entry supports these fields:
|
There are two hook types: **command** hooks run a local shell script, and **http** hooks POST a JSON payload to a URL.
|
||||||
|
|
||||||
|
#### Command hooks
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
@@ -171,7 +173,7 @@ Each hook entry supports these fields:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
**type**: Always `"command"` for shell-based hooks.
|
**type**: `"command"` for shell-based hooks.
|
||||||
|
|
||||||
**bash**: The command or script to execute on Unix systems. Can be inline or reference a script file.
|
**bash**: The command or script to execute on Unix systems. Can be inline or reference a script file.
|
||||||
|
|
||||||
@@ -183,6 +185,26 @@ Each hook entry supports these fields:
|
|||||||
|
|
||||||
**env**: Additional environment variables merged with the existing environment.
|
**env**: Additional environment variables merged with the existing environment.
|
||||||
|
|
||||||
|
#### HTTP hooks
|
||||||
|
|
||||||
|
HTTP hooks POST the same JSON context payload (that command hooks receive via stdin) to a configured URL. This lets you integrate Copilot lifecycle events with external systems — webhooks, observability platforms, notification services — without a local process:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"type": "http",
|
||||||
|
"url": "https://hooks.example.com/copilot/session-end",
|
||||||
|
"timeoutSec": 10
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**type**: `"http"` for HTTP-based hooks.
|
||||||
|
|
||||||
|
**url**: The endpoint that receives a `POST` request with the event's JSON payload as the body.
|
||||||
|
|
||||||
|
**timeoutSec**: Maximum time in seconds to wait for a response (default: 30).
|
||||||
|
|
||||||
|
> **Note**: HTTP hooks are useful for CI/CD integrations, Slack/Teams notifications, audit logging to external services, and any scenario where running a local script is impractical. The receiving endpoint should respond with HTTP 2xx to indicate success; any other status code is treated as a hook failure.
|
||||||
|
|
||||||
### README.md
|
### README.md
|
||||||
|
|
||||||
The README provides metadata and documentation for the Awesome Copilot repository. While not required in your own implementation, it serves as a useful way to document them for your team.
|
The README provides metadata and documentation for the Awesome Copilot repository. While not required in your own implementation, it serves as a useful way to document them for your team.
|
||||||
@@ -428,6 +450,34 @@ Send a Slack or Teams notification when an agent session completes:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Sending Events to an External Webhook (HTTP Hook)
|
||||||
|
|
||||||
|
Use an HTTP hook to POST session events to an external system — an observability platform, a Slack app, a custom audit log service — without needing a local script at all:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"version": 1,
|
||||||
|
"hooks": {
|
||||||
|
"sessionEnd": [
|
||||||
|
{
|
||||||
|
"type": "http",
|
||||||
|
"url": "https://hooks.example.com/copilot/session-end",
|
||||||
|
"timeoutSec": 10
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Copilot POSTs the same JSON context payload to the URL that a command hook would receive on stdin. This is useful when you want to:
|
||||||
|
|
||||||
|
- Notify a Slack/Teams webhook that a coding session finished
|
||||||
|
- Send session metadata to a centralized audit log
|
||||||
|
- Trigger a CI/CD pipeline step on agent completion
|
||||||
|
- Integrate with observability tools like Datadog or Splunk
|
||||||
|
|
||||||
|
> **Tip**: Combine an HTTP hook with a `sessionStart` HTTP hook to bracket a session with start/end events in your external system.
|
||||||
|
|
||||||
### Injecting Context into Subagents
|
### Injecting Context into Subagents
|
||||||
|
|
||||||
The `subagentStart` hook fires when the main agent spawns a subagent (e.g., via the `task` tool). Use it to inject additional context—such as project conventions or security guidelines—directly into the subagent's prompt:
|
The `subagentStart` hook fires when the main agent spawns a subagent (e.g., via the `task` tool). Use it to inject additional context—such as project conventions or security guidelines—directly into the subagent's prompt:
|
||||||
|
|||||||
@@ -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.'
|
description: 'Learn how to configure GitHub Copilot at user, workspace, and repository levels to optimize your AI-assisted development experience.'
|
||||||
authors:
|
authors:
|
||||||
- GitHub Copilot Learning Hub Team
|
- GitHub Copilot Learning Hub Team
|
||||||
lastUpdated: 2026-04-16
|
lastUpdated: 2026-04-22
|
||||||
estimatedReadingTime: '10 minutes'
|
estimatedReadingTime: '10 minutes'
|
||||||
tags:
|
tags:
|
||||||
- configuration
|
- configuration
|
||||||
@@ -391,6 +391,7 @@ CLI settings use **camelCase** naming. Key settings added in recent releases:
|
|||||||
| `statusLine` | Show status line in the terminal UI |
|
| `statusLine` | Show status line in the terminal UI |
|
||||||
| `include_gitignored` | Include gitignored files in `@` file search |
|
| `include_gitignored` | Include gitignored files in `@` file search |
|
||||||
| `extension_mode` | Control extensibility (agent tools and plugins) |
|
| `extension_mode` | Control extensibility (agent tools and plugins) |
|
||||||
|
| `continueOnAutoMode` | Automatically switch to the `auto` model when a rate limit is hit, instead of pausing |
|
||||||
|
|
||||||
> **Note**: Older snake_case names (e.g., `include_gitignored`, `auto_updates_channel`) are still accepted for backward compatibility, but camelCase is now the preferred format.
|
> **Note**: Older snake_case names (e.g., `include_gitignored`, `auto_updates_channel`) are still accepted for backward compatibility, but camelCase is now the preferred format.
|
||||||
|
|
||||||
@@ -405,6 +406,8 @@ These files follow the same format as `config.json` and are loaded after the glo
|
|||||||
|
|
||||||
The model picker opens in a **full-screen view** with inline reasoning effort adjustment. Use the **← / →** arrow keys to change the reasoning effort level (`low`, `medium`, `high`) directly from the picker without leaving the session. The current reasoning effort level is also displayed in the model header (e.g., `claude-sonnet-4.6 (high)`) so you always know which level is active.
|
The model picker opens in a **full-screen view** with inline reasoning effort adjustment. Use the **← / →** arrow keys to change the reasoning effort level (`low`, `medium`, `high`) directly from the picker without leaving the session. The current reasoning effort level is also displayed in the model header (e.g., `claude-sonnet-4.6 (high)`) so you always know which level is active.
|
||||||
|
|
||||||
|
Select **`auto`** to let Copilot automatically choose the best available model for each session. Auto mode adapts to rate limits and model availability at runtime, so you always get a capable model without manually switching. You can pair this with the `continueOnAutoMode` config setting to automatically fall back to `auto` when your preferred model hits a rate limit instead of pausing.
|
||||||
|
|
||||||
### CLI Session Commands
|
### CLI Session Commands
|
||||||
|
|
||||||
GitHub Copilot CLI has two commands for managing session state, with distinct behaviours:
|
GitHub Copilot CLI has two commands for managing session state, with distinct behaviours:
|
||||||
@@ -425,6 +428,20 @@ The `/session rename` command renames the current session. When called **without
|
|||||||
|
|
||||||
Auto-generated names help you find sessions quickly when switching between multiple backgrounded sessions.
|
Auto-generated names help you find sessions quickly when switching between multiple backgrounded sessions.
|
||||||
|
|
||||||
|
You can also **name a session when you start it** using the `--name` flag:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
copilot --name "auth-refactor"
|
||||||
|
```
|
||||||
|
|
||||||
|
Named sessions can be resumed by name instead of by session ID, which is easier to remember across days or projects:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
copilot --resume=auth-refactor
|
||||||
|
```
|
||||||
|
|
||||||
|
This is particularly useful when you regularly return to long-running sessions — for example, a dedicated debugging session or a feature branch you're working on incrementally.
|
||||||
|
|
||||||
The `/rewind` command opens a timeline picker that lets you roll back the conversation to any earlier point in history, reverting both the conversation and any file changes made after that point. You can also trigger it by pressing **double-Esc**:
|
The `/rewind` command opens a timeline picker that lets you roll back the conversation to any earlier point in history, reverting both the conversation and any file changes made after that point. You can also trigger it by pressing **double-Esc**:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user