src/add/plan.bend fails
raw source on the hub · import 0x74799d3f846634a3d7461d4336d7c9d4/src/add/plan.bend as Plan
add/plan: ez add as a pure planner. It reads a World (add/world.bend) and
returns either the questions it still needs answered (step) or a Plan:
the effects to run and how the command ends (plan). The interpreter
(add/run.bend) loops on step, answering each question by IO, until
nothing is left to ask, then executes the plan.
Before it asks anything the planner refuses what needs no answer: no
ledger, one that does not parse, a target that names nothing, a --rename
that is no TOML bare key, and a name clash the ledger alone decides (a
--rename, or a source it already records). Then it asks at most three
rounds: what the ref names (the remote's tags, then its HEAD when no tag is
semver-ish; or the named ref), then the checkout at that rev, which carries
its NAR hash and the text of every file. A 40-hex ref is the commit, and
the first question is the checkout. Every question carries the source as
git is to read it, P.anchor(here, url), which the planner computes.
With the checkout answered, the package is walked from its entry by the
pure walk (K.of) over the checkout's files, so the hash, the texts laid
and the manifest come from one list. The entry is the one given, else the
checkout's [package] entry, bin or main.bend, and one the checkout
does not hold is refused. The name is Named.as's, refused when
Named.why.as objects.
The plan of an add that succeeds, in order: the tree laid under
$BEND_LIB, or under .ez/lib when the entry it replaces is vendored;
ez.toml written with the dependency added (Rend.add.keep, which keeps
that vendor bit); .gitignore written when the allowlist I.sync derives
from the new ledger changes it; the old committed tree removed when a
vendored dependency's hash moved and nothing else names it; and the lines a
person is told. A refusal has no effect at all: nothing laid, nothing
written, no cache fill.
A target bend reads as a hub package's <name>@<version> is planned by
add/hub.bend instead (H.plan). command is the plan ez add runs, which
is plan for a git or path target and H.plan for a name, and next is
the interpreter's step over both.
The Effect, Plan and Outcome types are the lock's (lock/plan.bend), as for
ez remove and ez init; see "Update (A1, A4)" and "Update (A2)" in
docs/rfc/ez-add-planner.md.
14 imports
import Base import ./world.bend as A import ./hub.bend as H import ../lock/plan.bend as P import ../lock/world.bend as W import ../lock/up.bend as Up import ../ledger/manifest.bend as M import ../ledger/render.bend as Rend import ../ledger/ignore.bend as I import ../pkg/pkg.bend as K import ../pkg/path.bend as Path import ../git/git.bend as Git import ../ez/named.bend as Named import ../ez/target.bend as Tgt
The reader could not load this file (at 0x74799d3f846634a3d7461d4336d7c9d4/src/add/hub.bend:87). What bend.ts says:
Error:
- expected : a fresh constructor name (duplicate declaration: Wait)
- observed : 'Wait'
Location:
86 | Go{hash: String, files: List<&2, K.Item>, srcs: List<&2, String>}
87>| Wait{asks: List<&2, W.Ask>}
| ^^^^
88 | Stop{why: String}