discover

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package discover finds the repositories to operate on by reconciling the local ~/projects/{org}/{repo} tree with the non-archived repositories GitHub reports for the relevant orgs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthUser

func AuthUser() (string, error)

AuthUser returns the authenticated GitHub login via gh.

func MemberOrgs

func MemberOrgs() ([]string, error)

MemberOrgs returns the GitHub orgs the authenticated user belongs to. This is the authoritative source of "owners I control" — local directory names are not, since they include third-party clones.

Types

type Repo

type Repo struct {
	Org      string
	Name     string
	Path     string // local working-tree path; empty if not cloned locally
	CloneURL string // ssh URL from GitHub; empty if only known locally
	Archived bool
	IsFork   bool
	Local    bool
	Remote   bool
}

Repo identifies a single repository and where it lives.

func ListRemote

func ListRemote(owner string) ([]Repo, error)

ListRemote returns all repos for owner via gh. The archived flag is preserved so callers can report and skip archived repos explicitly.

func Reconcile

func Reconcile(local, remote []Repo) []Repo

Reconcile merges locally-cloned repos with remotely-listed ones, keyed by org/name. Remote metadata (archived flag, clone URL) wins where both exist. The result is sorted by slug for deterministic output.

func ScanLocal

func ScanLocal(projectsRoot string) ([]Repo, error)

ScanLocal walks projectsRoot two levels deep ({org}/{repo}) and returns every canonical git repository. Linked worktrees use a .git file and are excluded: they are alternate checkouts of a canonical repository, not fleet members.

func (Repo) Slug

func (r Repo) Slug() string

Slug returns the "org/repo" identifier.

Jump to

Keyboard shortcuts

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