mirror of
https://github.com/github/awesome-copilot.git
synced 2026-06-18 13:41:26 +00:00
1140812aaa
* Update .NET Copilot SDK cookbook for GitHub.Copilot.SDK 1.0 Align the dotnet copilot-sdk cookbook recipes and docs with the 1.0.1 release: - Namespace GitHub.Copilot.SDK -> GitHub.Copilot - MCP config uses Dictionary<string, McpServerConfig> + McpStdioServerConfig (drop Type discriminator) - StopAsync no longer returns an error list; wrap graceful shutdown in try/catch - GetMessagesAsync -> GetEventsAsync with event pattern matching - LogLevel string -> CopilotLogLevel.Error enum * Address PR review: clarify package/namespace, default event case, MCP stdio wording - Note that the GitHub.Copilot.SDK package exposes the GitHub.Copilot namespace in each recipe - Add a default case + note to the GetEventsAsync history example so other event kinds are not silently dropped - Refine accessibility-report docs to describe a local stdio MCP server (McpStdioServerConfig via npx) * Address re-review: add using for event types, note StopAsync throw behavior
Runnable Recipe Examples
This folder contains standalone, executable C# examples for each cookbook recipe. These are file-based apps that can be run directly with dotnet run.
Prerequisites
- .NET 10.0 or later
- GitHub Copilot SDK package (referenced automatically)
Running Examples
Each .cs file is a complete, runnable program. Simply use:
dotnet run <filename>.cs
Available Recipes
| Recipe | Command | Description |
|---|---|---|
| Error Handling | dotnet run error-handling.cs |
Demonstrates error handling patterns |
| Multiple Sessions | dotnet run multiple-sessions.cs |
Manages multiple independent conversations |
| Managing Local Files | dotnet run managing-local-files.cs |
Organizes files using AI grouping |
| PR Visualization | dotnet run pr-visualization.cs |
Generates PR age charts |
| Persisting Sessions | dotnet run persisting-sessions.cs |
Save and resume sessions across restarts |
Examples with Arguments
PR Visualization with specific repo:
dotnet run pr-visualization.cs -- --repo github/copilot-sdk
Managing Local Files (edit the file to change target folder):
# Edit the targetFolder variable in managing-local-files.cs first
dotnet run managing-local-files.cs
File-Based Apps
These examples use .NET's file-based app feature, which allows single-file C# programs to:
- Run without a project file
- Automatically reference common packages
- Support top-level statements