reposrc

package
v0.8.21 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package reposrc discovers git repositories on the client filesystem and resolves a user-supplied --repo value into something the daemon can clone.

Resolution is deliberately client-side: the TUI and CLI run where the repos live, while the daemon may run on another host (DEJIMA_HOST). The default is to hand the daemon a *remote URL* (works regardless of where the daemon runs); a read-only local-copy seed is only used when the daemon is local and the repo is local-only or carries unpushed work.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GitHubAvailable

func GitHubAvailable() error

GitHubAvailable reports whether the gh CLI is installed and authenticated on this client. It's the precondition for reading the local identity to seed the daemon (LocalGitHubLogin); repo browsing itself is daemon-side.

func IsURL

func IsURL(s string) bool

IsURL reports whether s looks like a git URL rather than a local path. It recognizes scheme URLs (https://, ssh://, git://) and scp-like SSH shorthand (git@github.com:owner/repo).

func LocalGitHubLogin

func LocalGitHubLogin(host string) (login, token string, err error)

LocalGitHubLogin returns the active gh account's login and token on this client — used to seed a daemon GitHub identity via `dejima auth push --github`. Switch accounts with `gh auth switch` first to push the other one. host selects which authenticated gh host to read; empty/"github.com" uses the default host, anything else (a GitHub Enterprise host) is passed to gh via --hostname so an enterprise token can be seeded.

func OriginURL

func OriginURL(path string) (string, error)

OriginURL reads the origin remote URL straight from <path>/.git/config without spawning git. Returns "" (no error) when there is no origin.

Types

type Repo

type Repo struct {
	Path   string // absolute path on the client
	Name   string // base name, used as the default island name
	Origin string // origin remote URL, or "" if none
}

Repo is a git repository discovered on disk.

func Discover

func Discover(root string, maxDepth int) ([]Repo, error)

Discover walks root up to maxDepth levels deep and returns every git repo it finds, reading each origin from .git/config. It does not descend into a repo once found, and never spawns git — it is cheap enough to run on every load.

type Resolution

type Resolution struct {
	Repo     string // value to send as CreateIslandRequest.Repo (URL or upstream)
	SeedPath string // host path to bind-mount read-only as a clone source, or ""
	Mode     string // "remote" or "local-copy"
	Note     string // human-readable explanation of what will happen
}

Resolution is the outcome of turning a --repo value into a create request.

func Resolve

func Resolve(input string, daemonLocal, forceLocalCopy bool) (Resolution, error)

Resolve turns a --repo value into a Resolution. daemonLocal must be true only when the daemon shares this filesystem (no DEJIMA_HOST). forceLocalCopy forces the read-only seed path even when an origin exists (to capture unpushed work).

type Status

type Status struct {
	Dirty  bool // uncommitted or untracked changes
	Ahead  int  // commits ahead of upstream
	Behind int  // commits behind upstream
}

Status is the (lazily computed) working-tree state of a repo.

func GetStatus

func GetStatus(path string) Status

GetStatus computes the working-tree status for a repo. It shells out to git, so callers should run it lazily (e.g. for the highlighted repo only), not for a whole list on every render. Errors collapse to a zero Status.

Jump to

Keyboard shortcuts

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