prlink

package
v0.2.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package prlink finds the open pull request that holds the work checked out in a local working tree, from the discovery cache. Live sessions use it to show an agent session on its pull request, and hook refresh to refresh the pull request an agent session ended on. It reads git configuration and the cache only: it never contacts GitHub and never fetches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Find

func Find(snapshot discovery.Snapshot, w Work) int

Find returns the unique matching open pull request, or zero when evidence is missing, conflicting or ambiguous.

Types

type Selection

type Selection struct {
	PR             int
	Method, Status string
}

Selection preserves how a live PR association was established.

func Resolve

func Resolve(snapshot discovery.Snapshot, w Work) Selection

Resolve refuses ambiguous or contradictory branch, upstream and HEAD evidence.

type Work

type Work struct {
	Repository, UpstreamRepository string
	// Branch is the current branch, "" when HEAD is detached.
	Branch string
	// Upstream names the configured upstream branch on the same GitHub host;
	// UpstreamRepository distinguishes a fork from the base repository.
	Upstream string
	// Head is the commit checked out.
	Head string
}

Work is what a working tree has checked out, as far as pull requests go.

func At

func At(ctx context.Context, repo *gitlocal.Repo, repository, branch, head string) Work

At is the work of a commit made on branch ("" when detached) in repo, a working tree of repository, read from the clone's remotes rather than from what it has checked out now: what a commit recorded as it was made.

func Local

func Local(ctx context.Context, repo *gitlocal.Repo, repository string) Work

Local reads the work checked out in repo, a working tree of repository ("owner/name", as the registry names it). A part git cannot read stays empty.

Jump to

Keyboard shortcuts

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