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 has no appetite and no circuit breaker; a person may give it a --cap, and it stops before a session that would pass it. Bare, it runs every phase in order to the end, 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 [--write [--push [--pr]] [--hooks]] [--agent NAME] [--answers FILE] [--since YYYY-MM-DD] [--max-prs N] [--cap <amount>] [--json]",
"physa init --gather [--since YYYY-MM-DD] [--max-prs N] [--agent NAME] [--cap <amount>] [--json]",
"physa init --propose [--agent NAME] [--cap <amount>] [--json]",
"physa init --areas [--agent NAME] [--cap <amount>] [--json]",
"physa init --walk [--agent NAME] [--cap <amount>] [--json]",
"physa init --place [--json]",
"physa init --recover [--only CAPABILITY]... [--agent NAME] [--cap <amount>] [--write [--push [--pr]] [--hooks]] [--json]",
"physa init --consolidate [--agent NAME] [--cap <amount>] [--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); a --cap holds every session to it (initcap). 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 a source larger than one share of propose, or before a session that would pass the cap, or some capabilities are not yet recovered (still written with --write), or, for --consolidate, a session of consolidation was left as it was (see consolidate.Result.ExitCode; a write then still happens), 2 when it could not (a capability failed, the map failed its check, the hook was refused, the cap needs usage the agent cannot report), 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
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 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, Consolidate bool
Only []string
Agent string
Since time.Time
SinceSet bool
MaxPRs int
JSON bool
Write, Push, PR, Hooks bool
Answers string
Cap initcap.Cap
// 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, Recover and Consolidate select one phase; none selects the full run. Agent is empty when not given; Only empty means every capability. 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; Cap is --cap, none when not given.