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 ¶
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 --recover [--only CAPABILITY]... [--agent NAME] [--write [--push [--pr]] [--hooks]] [--json]",
}
Usage is the command's synopsis lines.
Functions ¶
func Run ¶
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 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 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.