copilotcli

package
v1.223.0-rc.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package copilotcli provides an AI provider that invokes the GitHub Copilot CLI as a subprocess, reusing the user's GitHub Copilot subscription.

Index

Constants

View Source
const (
	// ProviderName is the name of this provider for configuration lookup.
	ProviderName = "copilot-cli"
	// DefaultBinary is the default binary name for the GitHub Copilot CLI.
	DefaultBinary = "copilot"
	// CopilotHomeEnvVar overrides the Copilot CLI configuration directory (~/.copilot by default).
	CopilotHomeEnvVar = "COPILOT_HOME"
)

Variables

This section is empty.

Functions

func ExtractResult

func ExtractResult(output []byte) (string, error)

ExtractResult extracts the final text response from Copilot CLI output. With the -s (silent) flag, stdout contains only the agent's plain-text response.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client invokes the GitHub Copilot CLI in non-interactive (programmatic) mode. Authentication is handled by the Copilot CLI itself: `copilot /login`, or the COPILOT_GITHUB_TOKEN / GH_TOKEN / GITHUB_TOKEN environment variables (in that precedence order) with a token that carries a Copilot subscription.

func NewClient

func NewClient(atmosConfig *schema.AtmosConfiguration) (*Client, error)

NewClient creates a new Copilot CLI client from Atmos configuration.

func (*Client) GetMaxTokens

func (c *Client) GetMaxTokens() int

GetMaxTokens returns 0 — managed by Copilot CLI internally.

func (*Client) GetModel

func (c *Client) GetModel() string

GetModel returns the configured model name.

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, message string) (string, error)

SendMessage sends a prompt to Copilot CLI and returns the response.

func (*Client) SendMessageWithHistory

func (c *Client) SendMessageWithHistory(ctx context.Context, messages []types.Message) (string, error)

SendMessageWithHistory concatenates history into a single prompt.

func (*Client) SendMessageWithSystemPromptAndTools

func (c *Client) SendMessageWithSystemPromptAndTools(
	ctx context.Context,
	systemPrompt string,
	atmosMemory string,
	messages []types.Message,
	_ []tools.Tool,
) (*types.Response, error)

SendMessageWithSystemPromptAndTools sends with system prompt prepended.

func (*Client) SendMessageWithTools

func (c *Client) SendMessageWithTools(_ context.Context, _ string, _ []tools.Tool) (*types.Response, error)

SendMessageWithTools is not supported — Copilot CLI manages its own tools.

func (*Client) SendMessageWithToolsAndHistory

func (c *Client) SendMessageWithToolsAndHistory(_ context.Context, _ []types.Message, _ []tools.Tool) (*types.Response, error)

SendMessageWithToolsAndHistory is not supported.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL