~/bend-docscommunity

src/add/run.bend relies on unsafe/foreign

raw source on the hub · import ezx@1.14.0.0/src/add/run.bend as Run

add/run: the interpreter for ez add. It reads the directory it runs in, HOME, ez.toml, .gitignore and the .bend files git lists into a World, then loops: it asks the planner (add/relock.bend) what is still open, answers each question with the lock's interpreter (Run.answer.ups: what git prints for tags, HEAD or a ref, and a checkout at a rev with its NAR hash and every file's text; Run.answer.all: for a hub package's name, what the hub says the name names, and the package's manifest and files, and for the lock that follows the add, each package and name it reads, as ez lock answers them), and adds the answers to the World, until nothing is left to ask. Then it runs the planner's plan with the lock's effect runner (Run.exec.plan), which exits 1 with the reason when the plan refuses. It decides nothing; that it reads and executes faithfully is trusted in ez/app.bend.

10 imports
import Base
import 0x8e26a6f8c31689519e618374376ee3dd/main.bend as R
import ../io/file.bend as F
import ../lock/run.bend as Run
import ../lock/up.bend as Up
import ../lock/world.bend as W
import ./world.bend as A
import ../ws/run.bend as WsRun
import ./relock.bend as AR
import ../ws/relock.bend as Rel

Definitions

def more source · line 26 · raw

@world:0xe21073738926f8a159714d5cdaf60edb/src/add/relock.World -> @rs:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/lock/up.Reply> -> 0xe21073738926f8a159714d5cdaf60edb/src/add/relock.World

the World with more answers in it

def more.hub source · line 32 · raw

@world:0xe21073738926f8a159714d5cdaf60edb/src/add/relock.World -> @rs:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/lock/world.Reply> -> 0xe21073738926f8a159714d5cdaf60edb/src/add/relock.World

the World with more of the hub's answers in it

def more.lock source · line 38 · raw

@world:0xe21073738926f8a159714d5cdaf60edb/src/add/relock.World -> @rs:List<&2, 0xe21073738926f8a159714d5cdaf60edb/src/lock/world.Reply> -> 0xe21073738926f8a159714d5cdaf60edb/src/add/relock.World

the World with more of the lock's answers in it

def loop.step source · line 44 · raw

@st:0xe21073738926f8a159714d5cdaf60edb/src/add/relock.Next -> @+lib:String -> @world:0xe21073738926f8a159714d5cdaf60edb/src/add/relock.World -> @go:(@_:0xe21073738926f8a159714d5cdaf60edb/src/add/relock.World -> IO(Unit)) -> IO(Unit)

the planner's step: its questions answered and the loop gone round again, or its plan run

def rounds source · line 65 · raw

Nat

the rounds the loop may take. The add asks at most three rounds for a git target and two for a name; the lock after it asks a round per level of the import graph, as ez lock does (Run.rounds). This is only a guard against a planner that keeps asking, and running out of it dies loudly.

def loop source · line 70 · raw

@fuel:Nat -> @+lib:String -> @+ws:0xe21073738926f8a159714d5cdaf60edb/src/ws/relock.Ws -> @+world:0xe21073738926f8a159714d5cdaf60edb/src/add/relock.World -> IO(Unit)

the loop, under fuel. Every round adds an answer, since the planner never asks what the World answers already, so the fuel is only a guard.

def run source · line 78 · raw

@+target:String -> @+ref:String -> @+entry:String -> @+rename:String -> IO(Unit)

ez add <target> [ref] [entry.bend] [--rename NAME]