initrun

package
v0.0.25 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 38 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 initrun is physa init as a command: it reads init's flags, runs the phases asked for against the repo's store, and prints what it did. Init is never bounded: it has no appetite and no circuit breaker, and is up front about its cost instead. Bare, it runs every phase in order, estimating the rest of the run in weighted tokens once it has gathered and asking before it goes on, and with --write it writes the map to physa/init through initbranch, then pushes it, opens its PR and installs the Session: hook when asked. The phases' own work is in gather, mapping, recovery, newcodebase and initbranch.

Index

Constants

This section is empty.

Variables

View Source
var Usage = []string{
	"physa init [--yes] [--write [--push [--pr]] [--hooks]] [--agent NAME] [--answers FILE] [--since YYYY-MM-DD] [--max-prs N] [--json]",
	"physa init --gather [--since YYYY-MM-DD] [--max-prs N] [--agent NAME] [--json]",
	"physa init --propose [--agent NAME] [--json]",
	"physa init --areas [--agent NAME] [--json]",
	"physa init --walk [--agent NAME] [--json]",
	"physa init --place [--json]",
	"physa init --recover [--only CAPABILITY]... [--agent NAME] [--write [--push [--pr]] [--hooks]] [--json]",
}

Usage is the command's synopsis lines.

Functions

func Run

func Run(o Flags, args, words []string, stdout, stderr io.Writer, env Env) int

Run runs physa init on the repo in the current directory: the phase named, or every phase in order; --write then writes the map to physa/init. No phase has an appetite or a circuit breaker (design 10 Q6). Every session is weighed through a spend.Meter, and the prices it learns are saved to the machine's spend cache. It returns 0 when all asked was done, 1 when it stopped before proposing, for want of a yes or for a source larger than one share of propose, or some capabilities are not yet recovered (still written with --write), 2 when it could not (a capability failed, the map failed its check, the hook was refused), and command.BadUsage for a bad line. o is the line's flags as Declare read them, args its positionals and words the words typed after init, which a rerun hint repeats.

Types

type Env

type Env struct {
	Store      func(dir string) (*store.Store, error)
	Repo       func(dir string) (vcs.Repo, error)
	Forge      func(dir string) forge.Forge
	PRExists   func(dir string) func(int) (bool, error)
	Agent      func(name string) (adapter.Adapter, error)
	Now        func() time.Time
	Writer     func(dir string) (vcs.Writer, error)
	Hooks      func(dir string) (vcs.Hooks, error)
	Stdin      io.Reader
	IsTerminal func() bool
	Confirm    func(question string) (bool, error)
	Spend      string
	Skill      func(agent string) string
}

Env is what init reaches outside itself through, each a seam the caller owns: the store, repo, forge, writer and hooks of the repo at a directory, the agent a name selects (empty for the default), the clock, and the person's input, where a new codebase's answers are asked, and Confirm asks whether to go on past the estimate, when IsTerminal. PRExists resolves #N anchors; nil checks them for form only. Spend is the file of the machine's spend cache (spend.Path); empty keeps prices for the run only. Skill is the line saying the agent a name selects has no current Physa skill, empty for none; nil says nothing.

type Flags

type Flags struct {
	Gather, Propose, Recover, Areas, Walk, Place bool
	Only                                         []string
	Yes                                          bool
	Agent                                        string
	Since                                        time.Time
	SinceSet                                     bool
	MaxPRs                                       int
	JSON                                         bool
	Write, Push, PR, Hooks                       bool
	Answers                                      string
	// contains filtered or unexported fields
}

Flags is a physa init command line as its declared flags read it. Since is the bound's start: the date given (SinceSet), or twelve months before now; MaxPRs is --max-prs, or 0 for no PR limit. Gather, Propose, Areas, Walk, Place and Recover select one phase; none selects the full run. Agent is empty when not given; Only empty means every capability. Yes goes on past the full run's estimate without asking. Write, Push, PR and Hooks write physa/init, push it, open its PR and install the Session: hook; Answers is a new codebase's answers file.

func (*Flags) Declare

func (o *Flags) Declare(fs *pflag.FlagSet)

Declare declares the flags of physa init on fs and starts o afresh, so it runs once for every command line: the switches, and the values --since (YYYY-MM-DD), --max-prs (at least 1), --agent, --answers and --only (repeatable or comma-separated).

func (Flags) Full

func (o Flags) Full() bool

Full reports whether the flags select the full run: no phase named.

Jump to

Keyboard shortcuts

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