forge

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package forge wraps the gh / glab CLIs to list and clone remote repos. All process execution goes through the runner seam so tests can fake exec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskpassReply

func AskpassReply(prompt string) string

AskpassReply answers a git credential prompt when this binary is invoked as GIT_ASKPASS. Git asks for the username first, then the password: GitHub token auth uses the fixed username "x-access-token" and the token as the password.

func EnvToken

func EnvToken() string

EnvToken returns the GitHub token from the environment (GITHUB_TOKEN, then GH_TOKEN), or "" if neither is set.

Types

type Client

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

Client is the forge facade injected into the handler.

func New

func New() *Client

New returns a Client backed by real exec.

func (*Client) Available

func (c *Client) Available() (github, gitlab bool)

Available reports which forge CLIs are installed.

func (*Client) Clone

func (c *Client) Clone(ctx context.Context, spec, workspace string) (string, error)

Clone clones spec into workspace and returns the project dir. It refuses traversal / shell-unsafe specs. If the target dir already exists it is returned as-is (idempotent "already cloned").

func (*Client) List

func (c *Client) List(ctx context.Context) ([]Repo, error)

List returns repos from every installed forge, labeled by Forge.

type Repo

type Repo struct {
	FullName string // owner/name
	CloneURL string
	Desc     string
	Forge    string // "github" | "gitlab"
}

Repo is one remote repository discovered via a forge CLI.

Jump to

Keyboard shortcuts

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