ghcli

package
v0.38.0 Latest Latest
Warning

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

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

Documentation

Overview

Package ghcli provides access to the local GitHub CLI (gh) for authentication and lightweight command execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Login

func Login(ctx context.Context) (string, error)

Login returns the login of the currently authenticated GitHub user, cached for the lifetime of the process (it is read on every API request in local mode, and the gh identity does not change under a running server).

func Run

func Run(ctx context.Context, args ...string) (string, error)

Run executes `gh` with the given arguments and returns its stdout. The gh binary name is fixed and arguments are supplied by aeman itself, never by untrusted input.

Types

type TokenSource

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

TokenSource resolves a GitHub token from the local gh CLI and caches it. It is also the GitHub side of forge.CLI: the token plus the signed-in login.

func NewTokenSource

func NewTokenSource() *TokenSource

NewTokenSource returns a TokenSource backed by `gh auth token`.

func (*TokenSource) Login added in v0.26.0

func (t *TokenSource) Login(ctx context.Context) (string, error)

Login returns the login of the currently authenticated GitHub user. The gh identity is one per machine, not per TokenSource, so this is the package Login and shares its process-wide cache.

func (*TokenSource) Token

func (t *TokenSource) Token(ctx context.Context) (string, error)

Token returns a cached GitHub token, fetching a fresh one when the cache has expired. It returns an error if gh is missing or the user is not logged in.

Jump to

Keyboard shortcuts

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