~/bend-docscommunity

src/doctor/run.bend fails

raw source on the hub · import 0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/run.bend as Run

doctor/run: the interpreter for ez doctor. It reads $CC, $BEND_LIB, the ledger's text and the lock's text into a World, then loops: it asks the planner (doctor/plan.bend) what is still open, answers each question, 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 prints each line and exits 1 when the plan fails the command.

A version question runs the program with --version, except bend, which is asked through run/bend since it has answered the question two ways over its versions. The library is listed with ls, the sources are read as ez lock reads them (Run.read.listing), and a package's tree is read from under BEND_LIB as ez lock reads one there (Run.disk.all), and never fetched, and a name's file under BEND_LIB/names is read as it is. None of these writes anything, and the plan writes nothing either. It decides nothing; that it reads and executes faithfully is EZ-TRUST-2.

10 imports
import Base
import 0xabe575924687afad4cee1a2c1194d639/main.bend as R
import ../run/bend.bend as Bend
import ../io/file.bend as F
import ../share/args.bend as Args
import ../lock/run.bend as Run
import ../lock/world.bend as W
import ../lock/lock.bend as L
import ./world.bend as DW
import ./plan.bend as DP

Definitions

def probe.ask source · line 29 · raw

@is_bend:Bool -> @name:String -> IO(String)

how a program is asked for its version, once it is known whether this is bend. Everything else answers the flag.

def tree.read source · line 39 · raw

@+dir:String -> @+manifest:String -> IO(0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.Answer)

a tree under BEND_LIB, as it is: its manifest and every file it names, read from beside it. A file that is not there reads as "", which does not hash to its sum.

def tree.seen source · line 45 · raw

@got:Maybe<&2, String> -> @+dir:String -> IO(0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.Answer)

a tree whose manifest was looked for; none there is none at all

def tree source · line 53 · raw

@+dir:String -> IO(0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.Answer)

a package's tree under the library directory

def answer source · line 59 · raw

@+lib:String -> @ask:0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.Ask -> IO(0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.Answer)

one question, answered. lib is the library directory the planner names.

def answer.all source · line 81 · raw

@+lib:String -> @asks:List<&2, 0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.Ask> -> IO(List<&2, 0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.Reply>)

every question, answered

def more source · line 92 · raw

@world:0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.World -> @rs:List<&2, 0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.Reply> -> 0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.World

the World with more answers in it

def loop.step source · line 98 · raw

@st:0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/plan.Step -> @+lib:String -> @world:0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.World -> @go:(@_:0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.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 111 · raw

Nat

the rounds the loop may take. The lock check's trees follow the sources and each other, and the packages they reach are not known until BEND_LIB has answered, so this is a guard against a planner that keeps asking, not a limit on a project: running out of it dies loudly.

def loop source · line 117 · raw

@fuel:Nat -> @+lib:String -> @+world:0x74799d3f846634a3d7461d4336d7c9d4/src/doctor/world.World -> IO(Unit)

the loop, under fuel. Every round adds at least one answer, since the planner never asks what the World answers already, and the lock check asks about each package at most once.

def var source · line 125 · raw

@name:String -> IO(String)

a variable's text, "" when it is unset

def run source · line 131 · raw

IO(Unit)

ez doctor: the toolchain and the project, reported on