cli

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Overview

PR-number resolution for `gitl review pr/N` (§ post-MVP). The GitHub CLI (`gh`) resolves a PR number into base/head SHAs; the diff itself is then computed locally by gitlog.Runner (triple-dot base...head, like GitHub), so the whole shaping pipeline (exclude_globs, truncation, stats) stays identical across review modes.

Package cli wires up the gitl command tree (cobra) and shared scaffolding: persistent flags, viper-backed config loading, and slog setup.

One file per command: root.go (this scaffold), version.go, review.go, changelog.go, digest.go (see docs/TECHNICAL_PLAN.md §6, §9, §10).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(ctx context.Context, args []string) error

Execute runs the gitl command tree with the given context and args. It returns a non-nil error to signal a non-zero exit code; the error is printed to stderr here so main stays thin.

Types

type PRRef added in v0.4.0

type PRRef struct {
	BaseSHA     string
	HeadSHA     string
	HeadRef     string // head branch name, for diagnostics
	BaseRefName string // base branch name (e.g. "main") — fetched by name, more robust than a bare SHA
	URL         string // full PR URL — identifies the PR's repository for remote-name resolution
	// CrossRepo marks a PR from a fork. Not an error: `git fetch <remote>
	// pull/N/head` works for forks too, so PR review handles them
	// transparently.
	CrossRepo bool
}

PRRef is the resolved base/head SHA pair for a pull request.

type PRResolver added in v0.4.0

type PRResolver interface {
	ResolvePR(ctx context.Context, num int) (PRRef, error)
}

PRResolver resolves a PR number into SHAs. The production ghResolver shells out to `gh`; tests substitute a fake, so no test ever talks to GitHub.

Jump to

Keyboard shortcuts

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