Refractored.GitHub.Copilot.SDK.Helpers
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Refractored.GitHub.Copilot.SDK.Helpers --version 1.0.0
NuGet\Install-Package Refractored.GitHub.Copilot.SDK.Helpers -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Refractored.GitHub.Copilot.SDK.Helpers" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Refractored.GitHub.Copilot.SDK.Helpers" Version="1.0.0" />
<PackageReference Include="Refractored.GitHub.Copilot.SDK.Helpers" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Refractored.GitHub.Copilot.SDK.Helpers --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Refractored.GitHub.Copilot.SDK.Helpers, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Refractored.GitHub.Copilot.SDK.Helpers@1.0.0
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Refractored.GitHub.Copilot.SDK.Helpers&version=1.0.0
#tool nuget:?package=Refractored.GitHub.Copilot.SDK.Helpers&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Refractored.GitHub.Copilot.SDK.Helpers
Reusable helper utilities for the GitHub Copilot SDK for .NET. This library provides common functionality for CLI-based Copilot applications.
Installation
dotnet add package Refractored.GitHub.Copilot.SDK.Helpers
Features
CliChecker
Checks if the Copilot CLI is installed and the user is authenticated.
using Refractored.GitHub.Copilot.SDK.Helpers;
// Check status with console output
var status = await CliChecker.CheckCopilotStatusAsync();
// Or check silently (no console output)
var status = await CliChecker.CheckCopilotStatusSilentAsync();
if (!CliChecker.IsReady(status))
{
Console.WriteLine("Copilot is not ready!");
return;
}
ModelSelector
Fetches available models from the Copilot CLI and allows selection.
using Refractored.GitHub.Copilot.SDK.Helpers;
// Interactive selection via console
var model = await ModelSelector.SelectModelAsync();
// Get all available models
var models = await ModelSelector.GetModelsFromCliAsync();
// Get the default (first) model
var defaultModel = await ModelSelector.GetDefaultModelAsync();
// Select by index (0-based)
var model = await ModelSelector.SelectModelByIndexAsync(2);
ChatHelper
Helper methods for streaming chat interactions.
using GitHub.Copilot.SDK;
using Refractored.GitHub.Copilot.SDK.Helpers;
// Stream response to console with colored output
await ChatHelper.SendMessageAndStreamResponse(session, "Hello, Copilot!");
// Get complete response as string
var response = await ChatHelper.SendMessageAndGetResponseAsync(session, "What is 2+2?");
// Use callbacks for custom handling
await ChatHelper.SendMessageWithCallbacksAsync(
session,
"Explain async/await",
onDelta: text => Console.Write(text),
onComplete: () => Console.WriteLine("\n[Done]"),
onError: err => Console.WriteLine($"Error: {err}")
);
Prerequisites
- .NET 8.0, .NET 9.0, or .NET 10.0
- GitHub Copilot CLI installed and configured
- GitHub Copilot access on your GitHub account
Installing Copilot CLI
# macOS/Linux (Homebrew)
brew install copilot-cli
# Windows (WinGet)
winget install GitHub.Copilot
# npm (requires Node.js 22+)
npm install -g @github/copilot
# macOS/Linux (install script)
curl -fsSL https://gh.io/copilot-install | bash
Authentication
Either:
- Run
copilot, then type/loginand follow prompts - Set
GH_TOKENenvironment variable with a token that has "Copilot Requests" permission
Full Example
using GitHub.Copilot.SDK;
using Refractored.GitHub.Copilot.SDK.Helpers;
// Check prerequisites
var status = await CliChecker.CheckCopilotStatusAsync();
if (!CliChecker.IsReady(status))
return;
// Select a model
var model = await ModelSelector.SelectModelAsync();
if (model == null)
return;
// Start client and create session
using var client = new CopilotClient();
await client.StartAsync();
using var session = await client.CreateSessionAsync(new SessionConfig
{
Model = model,
Streaming = true
});
// Chat!
await ChatHelper.SendMessageAndStreamResponse(session, "Hello, Copilot!");
License
MIT License - see LICENSE file.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- GitHub.Copilot.SDK (>= 0.1.15)
-
net8.0
- GitHub.Copilot.SDK (>= 0.1.15)
-
net9.0
- GitHub.Copilot.SDK (>= 0.1.15)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.