tidy

package
v0.0.42 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package tidy takes out of the definitions on the package branches what a release can be read for.

The conversion stopped writing it in, so a definition written since says only the part a release can't answer. The ones written before still say the rest, and nothing else would ever reach them: a definition is read on every generation and rewritten on none.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	// Packages limits the tidy to the ones named. Empty is every package the registry
	// holds a definition of.
	Packages []string
	// Limit bounds how many pull requests one run opens. A pull request per package is
	// what one branch per package makes of a change to them all.
	Limit int
	// DryRun says what would change and writes nothing.
	DryRun bool
}

Args are the command's own options.

type AutoMerger

type AutoMerger interface {
	EnableAutoMerge(ctx context.Context, pullRequestID string) error
}

AutoMerger turns a pull request over to its checks.

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

Controller tidies definitions.

func New

func New(registry Registry, defs Definitions, automerge AutoMerger) *Controller

New creates a Controller. automerge may be nil, and then the pull requests wait for someone.

func (*Controller) Tidy

func (c *Controller) Tidy(ctx context.Context, logger *slog.Logger, args *Args) error

Tidy takes what a release can be read for out of each definition that still says it.

type Definitions

type Definitions interface {
	Files(ctx context.Context, logger *slog.Logger, prefix, path string) (map[string]string, error)
}

Definitions reads every package branch's definition in one pass.

type Registry

type Registry interface {
	File(ctx context.Context, ref, path string) (string, error)
	PackagesInFlight(ctx context.Context) (map[string]struct{}, error)
	BranchSHA(ctx context.Context, branch string) (string, error)
	Commit(ctx context.Context, branch, parent, message string, files []*g2.File) error
	CreatePullRequest(ctx context.Context, logger *slog.Logger, pkgName, title, body string) (*gogithub.PullRequest, error)
}

Registry is what a tidy reads and writes.

Jump to

Keyboard shortcuts

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