{"modulePath":"github.com/contextvibes/cli","version":"v0.6.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\nPackage github provides a client for interacting with the GitHub API. It wraps both the REST API (google/go-github) and the GraphQL API (shurcooL/githubv4), providing high-level methods for operations like listing projects, managing issues, and repository creation.\n\n## Constants\n\n```go\nconst GHTokenEnvVar = \"GITHUB_TOKEN\"\n```\nGHTokenEnvVar is the environment variable name for the GitHub token.\n\n```go\nconst PassTokenKey = \"github/token\"\n```\nPassTokenKey is the key used in the password store.\n\n## Variables\n\n```go\nvar (\n\n\t// ErrInvalidRemoteURL is returned when the remote URL is invalid.\n\tErrInvalidRemoteURL = errors.New(\"invalid remote URL\")\n\t// ErrTokenNotFound is returned when the GitHub token is not found.\n\tErrTokenNotFound = errors.New(\"GitHub token not found\")\n\t// ErrProjectNotFound is returned when a project is not found.\n\tErrProjectNotFound = errors.New(\"project not found\")\n\t// ErrInvalidProjectID is returned when a project ID is invalid.\n\tErrInvalidProjectID = errors.New(\"invalid project ID\")\n\t// ErrUserLoginNotFound is returned when the user login cannot be determined.\n\tErrUserLoginNotFound = errors.New(\"could not determine user login\")\n\t// ErrRepoAlreadyExists is returned when a repository already exists.\n\tErrRepoAlreadyExists = errors.New(\"repository already exists\")\n\t// ErrRepoNotFoundOrAuth is returned when a repository is not found or auth fails.\n\tErrRepoNotFoundOrAuth = errors.New(\"repository not found or token lacks permission\")\n\t// ErrPassCommandNotFound is returned when the 'pass' command is not available.\n\tErrPassCommandNotFound = errors.New(\"'pass' command not found\")\n\t// ErrPassOutputEmpty is returned when 'pass' returns no output.\n\tErrPassOutputEmpty = errors.New(\"pass output was empty\")\n)\n```\n\n## Functions\n\n```go\nfunc ParseGitHubRemote(remoteURL string) (owner, repo string, err error)\n```\nParseGitHubRemote extracts the owner and repository name from a GitHub remote URL.\n\n## Types\n\n```go\ntype Client struct {\n\t*github.Client\n\n\tGraphQL *githubv4.Client\n\t// contains filtered or unexported fields\n}\n```\nClient wraps the go-github clients for both REST and GraphQL APIs.\n\n```go\nfunc NewClient(ctx context.Context, logger *slog.Logger, owner, repo string) (*Client, error)\n```\nNewClient creates a new GitHub client. It first checks the GITHUB\\_TOKEN environment variable. If not found, it attempts to retrieve the token from 'pass' (github/token).\n\n```go\nfunc (c *Client) AddIssueToProject(ctx context.Context, projectID string, issueID string) error\n```\nAddIssueToProject adds an issue (by its GraphQL Node ID) to a project (by its GraphQL Node ID).\n\n```go\nfunc (c *Client) CreateRepo(\n\tctx context.Context,\n\towner, name, description string,\n\tisPrivate bool,\n) (*github.Repository, error)\n```\nCreateRepo creates a new repository on GitHub for a specific owner (user or org).\n\n```go\nfunc (c *Client) GetAuthenticatedUserLogin(ctx context.Context) (string, error)\n```\nGetAuthenticatedUserLogin returns the login name of the user authenticated by the token.\n\n```go\nfunc (c *Client) GetProjectByNumber(ctx context.Context, number int) (*ProjectWithID, error)\n```\nGetProjectByNumber fetches a single project by its number to get its GraphQL Node ID.\n\n```go\nfunc (c *Client) ListProjects(ctx context.Context) ([]Project, error)\n```\nListProjects fetches the first 100 GitHub Projects (V2) for the repository's owner.\n\n```go\nfunc (c *Client) UpdateBranchProtection(\n\tctx context.Context,\n\tbranch string,\n\trequest github.ProtectionRequest,\n) error\n```\nUpdateBranchProtection applies a set of protection rules to the client's configured branch.\n\n```go\ntype Project struct {\n\tTitle  string\n\tNumber int\n\tURL    string\n}\n```\nProject represents a GitHub Project (V2) for listing.\n\n```go\ntype ProjectWithID struct {\n\tID     string\n\tTitle  string\n\tNumber int\n\tURL    string\n}\n```\nProjectWithID represents a GitHub Project (V2) with its GraphQL Node ID.\n\n","path":"github.com/contextvibes/cli/internal/github","name":"github","synopsis":"Package github provides a client for interacting with the GitHub API.","isRedistributable":true}
