initrun

package
v0.0.29 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: 42 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 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

View Source
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

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); 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.

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, --cap 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