gh

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthStatus

type AuthStatus struct {
	Username string
	Protocol string
}

AuthStatus represents the authentication status from gh CLI

type Client

type Client struct{}

Client wraps the gh CLI for GitHub operations

func NewClient

func NewClient() *Client

NewClient creates a new GitHub CLI wrapper

func (*Client) Clone

func (c *Client) Clone(repoURL, dest string) error

Clone clones a GitHub repository to the specified destination. repoURL can be:

If dest is empty, clones to the repo name in current directory.

func (*Client) CloneToTemp

func (c *Client) CloneToTemp(repoURL string) (string, error)

CloneToTemp clones a repository to a temporary directory and returns the path. The caller is responsible for cleaning up the directory.

func (*Client) GetAuthStatus

func (c *Client) GetAuthStatus() (*AuthStatus, error)

GetAuthStatus returns the current authentication status

func (*Client) IsAvailable

func (c *Client) IsAvailable() bool

IsAvailable checks if the gh CLI is installed and authenticated

func (*Client) IsInstalled

func (c *Client) IsInstalled() bool

IsInstalled checks if the gh CLI is installed (regardless of auth status)

func (*Client) IssueClose added in v0.17.0

func (c *Client) IssueClose(opts IssueCloseOptions) error

IssueClose closes an issue

func (*Client) IssueComment added in v0.20.0

func (c *Client) IssueComment(opts IssueCommentOptions) error

IssueComment adds a comment to an issue

func (*Client) IssueCreate added in v0.17.0

func (c *Client) IssueCreate(opts IssueCreateOptions) (*Issue, error)

IssueCreate creates a new issue

func (*Client) IssueEdit added in v0.21.0

func (c *Client) IssueEdit(opts IssueEditOptions) error

IssueEdit edits an issue (add/remove labels)

func (*Client) IssueList added in v0.17.0

func (c *Client) IssueList(opts IssueListOptions) ([]Issue, error)

IssueList lists issues in a repository

func (*Client) IssueView added in v0.17.0

func (c *Client) IssueView(number int, repo string) (*Issue, error)

IssueView retrieves a single issue by number

func (*Client) LabelCreate added in v0.21.0

func (c *Client) LabelCreate(opts LabelCreateOptions) (*Label, error)

LabelCreate creates a new label

func (*Client) LabelDelete added in v0.21.0

func (c *Client) LabelDelete(opts LabelDeleteOptions) error

LabelDelete deletes a label

func (*Client) LabelList added in v0.21.0

func (c *Client) LabelList(opts LabelListOptions) ([]Label, error)

LabelList lists labels in a repository

func (*Client) Login added in v0.17.0

func (c *Client) Login() error

Login runs gh auth login interactively

func (*Client) PRList added in v0.22.0

func (c *Client) PRList(opts PRListOptions) ([]PR, error)

PRList lists pull requests in a repository

func (*Client) ReleaseCreate added in v0.19.0

func (c *Client) ReleaseCreate(opts ReleaseCreateOptions) (*Release, error)

ReleaseCreate creates a new release

func (*Client) ReleaseList added in v0.19.0

func (c *Client) ReleaseList(opts ReleaseListOptions) ([]Release, error)

ReleaseList lists releases in a repository

func (*Client) ReleaseView added in v0.19.0

func (c *Client) ReleaseView(tag string, repo string) (*Release, error)

ReleaseView retrieves a single release by tag (or latest if tag is empty)

func (*Client) RepoCreate added in v0.28.0

func (c *Client) RepoCreate(opts RepoCreateOptions) (*Repo, error)

RepoCreate creates a new GitHub repository

func (*Client) SearchIssues added in v0.23.0

func (c *Client) SearchIssues(opts SearchIssuesOptions) ([]Issue, error)

SearchIssues searches for issues globally across all repos

func (*Client) SearchPRs added in v0.23.0

func (c *Client) SearchPRs(opts SearchPRsOptions) ([]PR, error)

SearchPRs searches for pull requests globally across all repos

type Issue added in v0.17.0

type Issue struct {
	Number    int      `json:"number"`
	Title     string   `json:"title"`
	State     string   `json:"state"`
	Author    string   `json:"author"`
	Labels    []string `json:"labels"`
	Assignees []string `json:"assignees"`
	CreatedAt string   `json:"createdAt"`
	URL       string   `json:"url"`
	Body      string   `json:"body"`
}

Issue represents a GitHub issue

type IssueCloseOptions added in v0.17.0

type IssueCloseOptions struct {
	Number  int
	Comment string
	Reason  string // "completed" or "not planned"
	Repo    string
}

IssueCloseOptions contains options for closing an issue

type IssueCommentOptions added in v0.20.0

type IssueCommentOptions struct {
	Number int
	Body   string
	Repo   string
}

IssueCommentOptions contains options for commenting on an issue

type IssueCreateOptions added in v0.17.0

type IssueCreateOptions struct {
	Title    string
	Body     string
	Labels   []string
	Assignee string
	Repo     string
}

IssueCreateOptions contains options for creating an issue

type IssueEditOptions added in v0.21.0

type IssueEditOptions struct {
	Number       int
	AddLabels    []string
	RemoveLabels []string
	Repo         string
}

IssueEditOptions contains options for editing an issue

type IssueListOptions added in v0.17.0

type IssueListOptions struct {
	State    string // open, closed, all
	Label    string
	NoLabel  bool // filter for issues with no labels (client-side)
	Assignee string
	Limit    int
	Repo     string // optional: owner/repo
}

IssueListOptions contains options for listing issues

type Label added in v0.21.0

type Label struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Color       string `json:"color"`
}

Label represents a GitHub label

type LabelCreateOptions added in v0.21.0

type LabelCreateOptions struct {
	Name        string
	Description string
	Color       string // hex color without # prefix
	Repo        string
}

LabelCreateOptions contains options for creating a label

type LabelDeleteOptions added in v0.21.0

type LabelDeleteOptions struct {
	Name    string
	Confirm bool
	Repo    string
}

LabelDeleteOptions contains options for deleting a label

type LabelListOptions added in v0.21.0

type LabelListOptions struct {
	Limit int
	Repo  string
}

LabelListOptions contains options for listing labels

type PR added in v0.22.0

type PR struct {
	Number    int      `json:"number"`
	Title     string   `json:"title"`
	State     string   `json:"state"`
	Author    string   `json:"author"`
	Assignees []string `json:"assignees"`
	URL       string   `json:"url"`
	IsDraft   bool     `json:"isDraft"`
}

PR represents a GitHub pull request

type PRListOptions added in v0.22.0

type PRListOptions struct {
	State    string // open, closed, merged, all
	Assignee string
	Author   string
	Limit    int
	Repo     string
}

PRListOptions contains options for listing pull requests

type Release added in v0.19.0

type Release struct {
	TagName      string `json:"tagName"`
	Name         string `json:"name"`
	Body         string `json:"body"`
	IsDraft      bool   `json:"isDraft"`
	IsPrerelease bool   `json:"isPrerelease"`
	IsLatest     bool   `json:"isLatest"`
	CreatedAt    string `json:"createdAt"`
	PublishedAt  string `json:"publishedAt"`
	Author       string `json:"author"`
	URL          string `json:"url"`
}

Release represents a GitHub release

type ReleaseCreateOptions added in v0.19.0

type ReleaseCreateOptions struct {
	Tag           string
	Title         string
	Notes         string
	NotesFile     string
	GenerateNotes bool
	Draft         bool
	Prerelease    bool
	Latest        *bool // nil = auto, true = mark as latest, false = don't mark
	Target        string
	Repo          string
}

ReleaseCreateOptions contains options for creating a release

type ReleaseListOptions added in v0.19.0

type ReleaseListOptions struct {
	Limit              int
	ExcludeDrafts      bool
	ExcludePrereleases bool
	Repo               string
}

ReleaseListOptions contains options for listing releases

type Repo added in v0.28.0

type Repo struct {
	Name        string `json:"name"`
	FullName    string `json:"fullName"`
	Description string `json:"description"`
	URL         string `json:"url"`
	CloneURL    string `json:"cloneURL"`
	Private     bool   `json:"private"`
}

Repo represents a GitHub repository

type RepoCreateOptions added in v0.28.0

type RepoCreateOptions struct {
	Name          string // repo name or owner/name
	Description   string
	Private       bool
	Public        bool
	Internal      bool
	Clone         bool   // clone the repo locally after creation
	Source        string // path to local source to push
	GitIgnore     string // gitignore template (e.g., Go, Node, Python)
	License       string // license template (e.g., MIT, Apache-2.0)
	AddReadme     bool
	DisableWiki   bool
	DisableIssues bool
}

RepoCreateOptions contains options for creating a repository

type SearchIssuesOptions added in v0.23.0

type SearchIssuesOptions struct {
	Assignee string
	Author   string
	State    string // open, closed
	Limit    int
}

SearchIssuesOptions contains options for searching issues globally

type SearchPRsOptions added in v0.23.0

type SearchPRsOptions struct {
	Assignee      string
	Author        string
	ReviewRequest string // reviewer:username
	State         string // open, closed, merged
	Limit         int
}

SearchPRsOptions contains options for searching PRs globally

Jump to

Keyboard shortcuts

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