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 ac2f9300..aeee0892 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-16 +lastUpdated: 2026-04-22 estimatedReadingTime: '8 minutes' tags: - hooks @@ -156,7 +156,9 @@ This makes it straightforward to write plugin hooks that are portable across mac ### 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 { @@ -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. @@ -183,6 +185,26 @@ Each hook entry supports these fields: **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 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 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: 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 eaac8863..52c6bbf4 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-16 +lastUpdated: 2026-04-22 estimatedReadingTime: '10 minutes' tags: - configuration @@ -391,6 +391,7 @@ CLI settings use **camelCase** naming. Key settings added in recent releases: | `statusLine` | Show status line in the terminal UI | | `include_gitignored` | Include gitignored files in `@` file search | | `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. @@ -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. +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 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. +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**: ```