driveplan

package
v0.68.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package driveplan proposes how to drive a set of tasks: which to bundle on one branch, which to leave alone, and which After: lines to add. It reads nothing itself, so every rule is a table test; gathering lives in drive.

Index

Constants

View Source
const (
	KindFeature  = "feature"
	KindBug      = "bug"
	KindRefactor = "refactor"
	KindSpike    = "spike"
)

The kinds a task may carry, as fetch settles them.

View Source
const Tradeoff = "a bundle is one PR: one revert, one review over a mixed diff, " +
	"and a later bug is traced to its lead with the riders named"

Tradeoff is said once under a proposal holding a bundle.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edit

type Edit struct {
	Task   string `json:"task"`
	After  string `json:"after"` // "none" drops the line
	Reason string `json:"reason"`
}

An Edit is an After: line the proposal adds to a task, applied only on a yes.

type Entry

type Entry struct {
	IDs     []string `json:"ids"`
	Reason  string   `json:"reason"`
	Base    string   `json:"after,omitempty"` // the one base outside the entry
	Lines   int      `json:"lines,omitempty"`
	Profile string   `json:"profile,omitempty"`
	// contains filtered or unexported fields
}

An Entry is one item of the drive command: a task or a bundle.

func (Entry) Token

func (e Entry) Token() string

Token is how the drive command names the entry.

type Formed

type Formed struct {
	Bundles int `json:"bundles"`
	Bundled int `json:"bundled"`
	Waits   int `json:"ciWaitsSaved"`
}

Formed is a saving the rules found by themselves.

type Input

type Input struct {
	Tasks    []Task
	MaxLines int // bundle_max_lines
	Parallel int // the ceiling on --parallel, 0 for none
}

Input is the candidates in the parent's order, with the caps.

type Plan

type Plan struct {
	Stages   []Stage  `json:"stages"`
	Edits    []Edit   `json:"edits,omitempty"`
	Args     []string `json:"args"` // the drive command's arguments
	Parallel int      `json:"parallel"`
	Waits    int      `json:"ciWaitsSaved"`
	Finishes int      `json:"finishesSaved"`
	Bundles  int      `json:"bundles"`
	Bundled  int      `json:"bundled"` // tasks inside a bundle
	// Formed counts the bundles the rules formed, the user's own left out, so
	// a hint never offers what the user already bundled
	Formed Formed `json:"formed"`
}

A Plan is the proposal.

func Propose

func Propose(in Input) (Plan, error)

Propose applies the rules: alone first, then bundles within a class by shared files or areas, split at the cap, then stages by After: depth.

func (Plan) Command

func (p Plan) Command(extra ...string) string

Command is the drive command line the plan runs, extra flags appended.

func (Plan) Hint

func (p Plan) Hint() string

Hint is the one line a plain start prints when the rules alone would save at least one CI wait, "" otherwise: the start command that saves them.

func (Plan) Saving

func (p Plan) Saving() string

Saving is the line naming what bundling saves, "" when it saves nothing.

func (Plan) Write

func (p Plan) Write(w io.Writer, notes []string, extra ...string) error

Write prints the proposal: the stages, the command, the saving, the After: edits waiting on a yes, and the trade-off once.

type Stage

type Stage struct {
	Entries []Entry `json:"entries"`
}

A Stage is the entries at one depth of the After: graph.

type Task

type Task struct {
	ID    string   `json:"id"`
	Title string   `json:"title,omitempty"`
	Kind  string   `json:"kind,omitempty"` // "" reads as feature
	Areas []string `json:"areas,omitempty"`
	Files []string `json:"files,omitempty"`
	Lines int      `json:"lines,omitempty"` // changed lines; 0 is not sized
	// Estimated marks Lines as a model's guess rather than a measured diff
	Estimated bool   `json:"estimated,omitempty"`
	Base      string `json:"after,omitempty"`     // the body's After: line
	BuildsOn  string `json:"buildsOn,omitempty"`  // a task whose code this one builds on, with no After: saying so
	Flow      string `json:"flow,omitempty"`      // the flow its areas map to, "" for the drive's
	Profile   string `json:"profile,omitempty"`   // its :profile as typed
	Risky     string `json:"risky,omitempty"`     // the word that marks it risky (migration), "" for none
	Alone     bool   `json:"alone,omitempty"`     // the user kept it alone
	With      string `json:"with,omitempty"`      // the user bundled it with this task
	After     string `json:"afterEdit,omitempty"` // the user's After: for it, "none" to drop the body's
}

A Task is one candidate and what is known about it.

Jump to

Keyboard shortcuts

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