Documentation
¶
Overview ¶
Package copilot provides an ACP client for GitHub Copilot CLI via its `copilot --acp --stdio` subprocess. The ACP session lifecycle — connection wiring, stderr streaming, event translation and result capture — is provided by the shared client package; this package only resolves the copilot binary and builds its ACP-mode argument list.
Index ¶
Constants ¶
const BinaryName = "copilot"
BinaryName is the expected name of the GitHub Copilot CLI binary.
Variables ¶
var DefaultArgs = []string{"--acp", "--stdio"}
DefaultArgs are the flags that put Copilot CLI into ACP mode over stdio.
var DefaultBinaryPaths = []string{
"copilot",
".local/bin/copilot",
"/usr/local/bin/copilot",
"/usr/bin/copilot",
"/opt/homebrew/bin/copilot",
}
DefaultBinaryPaths lists common installation locations for copilot CLI.
Functions ¶
This section is empty.
Types ¶
type RunRequest ¶
type RunRequest struct {
Prompt string // Prompt to send to Copilot CLI
SessionID string // Optional session ID to resume
CWD string // Working directory
Env []string // Additional environment variables
Command []string // Optional command override for testing (defaults to copilot --acp --stdio)
// Copilot-specific options
Model string // Optional model override (informational; Copilot picks per-task)
}
RunRequest describes a Copilot CLI prompt turn.
type Runner ¶
type Runner struct {
// ClientInfo identifies this client to the agent.
ClientInfo acp.Implementation
// Binary is the path to the copilot binary.
// If empty, uses the first found in DefaultBinaryPaths.
Binary string
// Logger for connection debugging.
Logger *slog.Logger
// ExtraEnv is additional environment variables to pass to the subprocess.
ExtraEnv []string
}
Runner launches GitHub Copilot CLI in ACP mode and manages the client-side connection. Authentication is taken from the environment (GITHUB_TOKEN / GH_TOKEN) unless the copilot CLI is already logged in.
func (Runner) Start ¶
func (r Runner) Start(ctx context.Context, req RunRequest) (*client.RunningSession, error)
Start launches the Copilot CLI subprocess and begins the ACP flow, delegating the session lifecycle to the shared client runner.