![]() |
VOOZH | about |
dotnet add package Refractored.GitHub.Copilot.SDK.Helpers --version 1.3.0
NuGet\Install-Package Refractored.GitHub.Copilot.SDK.Helpers -Version 1.3.0
<PackageReference Include="Refractored.GitHub.Copilot.SDK.Helpers" Version="1.3.0" />
<PackageVersion Include="Refractored.GitHub.Copilot.SDK.Helpers" Version="1.3.0" />Directory.Packages.props
<PackageReference Include="Refractored.GitHub.Copilot.SDK.Helpers" />Project file
paket add Refractored.GitHub.Copilot.SDK.Helpers --version 1.3.0
#r "nuget: Refractored.GitHub.Copilot.SDK.Helpers, 1.3.0"
#:package Refractored.GitHub.Copilot.SDK.Helpers@1.3.0
#addin nuget:?package=Refractored.GitHub.Copilot.SDK.Helpers&version=1.3.0Install as a Cake Addin
#tool nuget:?package=Refractored.GitHub.Copilot.SDK.Helpers&version=1.3.0Install as a Cake Tool
Reusable helper utilities for the GitHub Copilot SDK for .NET. This library provides common functionality for CLI-based Copilot applications.
dotnet add package Refractored.GitHub.Copilot.SDK.Helpers
Checks if the Copilot CLI is installed and the user is authenticated using the Copilot SDK.
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;
}
Fetches available models from the Copilot SDK and allows selection.
using Refractored.GitHub.Copilot.SDK.Helpers;
// Interactive selection via console
var model = await ModelSelector.SelectModelAsync();
// Get all available models (names only)
var models = await ModelSelector.GetModelsAsync();
// Get models with full info including billing multipliers
var modelsInfo = await ModelSelector.GetModelsWithInfoAsync();
foreach (var modelInfo in modelsInfo)
{
Console.WriteLine($"{modelInfo.Id}: Multiplier = {modelInfo.Billing?.Multiplier}");
}
// Get the default (first) model
var defaultModel = await ModelSelector.GetDefaultModelAsync();
// Select by index (0-based)
var model = await ModelSelector.SelectModelByIndexAsync(2);
// Optionally pass an existing CopilotClient to reuse the connection
var client = new CopilotClient();
await client.StartAsync();
var models = await ModelSelector.GetModelsAsync(client);
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}")
);
Manages Copilot sessions including listing, resuming, and cleanup.
using GitHub.Copilot.SDK;
using Refractored.GitHub.Copilot.SDK.Helpers;
// List all available sessions with formatted console output
var sessions = await SessionManager.ListSessionsAsync();
// Get sessions without console output
var sessions = await SessionManager.GetSessionsAsync();
// Get the most recently used session ID
var lastSessionId = await SessionManager.GetLastSessionIdAsync();
// Resume the last session
var client = new CopilotClient();
await client.StartAsync();
var session = await SessionManager.ResumeLastSessionAsync(client);
// Delete a specific session
await SessionManager.DeleteSessionAsync("session-id-123");
// Clean up old sessions (older than 7 days)
int deletedCount = await SessionManager.CleanupOldSessionsAsync(TimeSpan.FromDays(7));
// Get CLI version and protocol information
var status = await SessionManager.ShowCliStatusAsync();
Console.WriteLine($"CLI Version: {status.Version}");
// Optionally pass an existing CopilotClient to reuse the connection
var client = new CopilotClient();
await client.StartAsync();
var sessions = await SessionManager.GetSessionsAsync(client);
# 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
Either:
copilot, then type /login and follow promptsGH_TOKEN environment variable with a token that has "Copilot Requests" permissionusing 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!");
MIT License - see file.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.