copilot

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package copilot provides GitHub Copilot integration.

Index

Constants

View Source
const (
	SignupURL = "https://github.com/github-copilot/signup?editor=seshat"
	FreeURL   = "https://docs.github.com/en/copilot/how-tos/manage-your-account/get-free-access-to-copilot-pro"
)

Variables

View Source
var ErrNotAvailable = errors.New("github copilot not available")

Functions

func Headers

func Headers() map[string]string

func NewClient

func NewClient(isSubAgent, debug bool) *http.Client

NewClient creates a new HTTP client with a custom transport that adds the X-Initiator header based on message history in the request body.

func PollForToken

func PollForToken(ctx context.Context, dc *DeviceCode) (*oauth.Token, error)

PollForToken polls GitHub for the access token after user authorization.

func RefreshToken

func RefreshToken(ctx context.Context, githubToken string) (*oauth.Token, error)

RefreshToken refreshes the Copilot token using the GitHub token.

func RefreshTokenFromDisk

func RefreshTokenFromDisk() (string, bool)

Types

type DeviceCode

type DeviceCode struct {
	DeviceCode      string `json:"device_code"`
	UserCode        string `json:"user_code"`
	VerificationURI string `json:"verification_uri"`
	ExpiresIn       int    `json:"expires_in"`
	Interval        int    `json:"interval"`
}

func RequestDeviceCode

func RequestDeviceCode(ctx context.Context) (*DeviceCode, error)

RequestDeviceCode initiates the device code flow with GitHub.

Jump to

Keyboard shortcuts

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