forge

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package forge fetches tracker claims (issues, PRs) from a forge via its CLI. Fetching is strictly read-only and strictly optional: when no forge is reachable the audit degrades to pure git inference.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignee

type Assignee struct {
	Login string `json:"login"`
}

type Data

type Data struct {
	Repo   string  `json:"repo"`
	Issues []Issue `json:"issues"`
	PRs    []PR    `json:"prs"`

	// Checks reports CI state ("success", "failure", "pending", "unknown")
	// for a commit, or ok=false when the forge can't answer. Lazy per-SHA
	// call — only consulted for landed specs. Nil when unavailable, and the
	// audit must then say nothing about CI rather than guess.
	Checks func(sha string) (string, bool) `json:"-"`
}

func Fetch

func Fetch(path string) (*Data, bool)

Fetch tries each supported forge in turn: GitHub via gh, then GitLab via glab. Returns ok=false when no forge is reachable — the audit degrades to pure git inference.

func FetchGitHub

func FetchGitHub(path string) (*Data, bool)

FetchGitHub returns tracker data for the repository at path, or ok=false when gh is not installed, not authenticated, or the repo has no GitHub remote. Failures are silent by contract — the audit must keep working.

func FetchGitLab

func FetchGitLab(path string) (*Data, bool)

FetchGitLab returns tracker data for the repository at path via glab, or ok=false when glab is missing, unauthenticated, or the repo isn't on a GitLab instance. Failures are silent by contract.

type Issue

type Issue struct {
	Number    int        `json:"number"`
	Title     string     `json:"title"`
	State     string     `json:"state"` // OPEN, CLOSED
	UpdatedAt time.Time  `json:"updatedAt"`
	Assignees []Assignee `json:"assignees"`
}

func (Issue) Assigned

func (i Issue) Assigned() bool

Assigned reports whether anyone has claimed the issue. An unassigned open issue is backlog, not a promise, and is never audited for staleness.

type PR

type PR struct {
	Number      int       `json:"number"`
	Title       string    `json:"title"`
	State       string    `json:"state"` // OPEN, CLOSED, MERGED
	IsDraft     bool      `json:"isDraft"`
	HeadRefName string    `json:"headRefName"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

Jump to

Keyboard shortcuts

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