Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
echo "$RUNNER_TEMP/bend/bin" >> "$GITHUB_PATH"
- run: sh bootstrap.sh
- run: mkdir -p bin
- run: BEND_LIB=$PWD/.ez/lib bend ez/main.bend -o bin/ez.bin
- run: BEND_LIB=$PWD/.ez/lib bend main.bend -o bin/ez.bin
- run: bin/ez.bin prove
6 changes: 4 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ How to work in this repository. It is written for coding agents, and it holds fo

## What ez is

ez is a project manager for Bend 2, written in Bend. Each command is a pure planner (`<cmd>/plan.bend`) over a World (`<cmd>/world.bend`), run by a thin interpreter (`<cmd>/run.bend`). What ez guarantees is listed in `SPEC.md`. The design and its history are in `docs/rfc/ez-spec.md`. The user guide is `docs/guide.md`.
ez is a project manager for Bend 2, written in Bend. Each command is a pure planner (`src/<cmd>/plan.bend`) over a World (`src/<cmd>/world.bend`), run by a thin interpreter (`src/<cmd>/run.bend`). What ez guarantees is listed in `SPEC.md`. The design and its history are in `docs/rfc/ez-spec.md`. The user guide is `docs/guide.md`.

The top-level `main.bend` is ez's program and the entry the hub publishes as `ezx`; it calls `src/ez/main.bend`. Every module lives under `src/`, so the package bend publishes is `main.bend`, the LICENSE beside it and what it imports under `src/`, and `main.bend`'s first line is the hub's description. No file the program reaches may import a `LAWS.bend`, a `PROOF.bend`, `src/check/` or `tests/`.

## Build and check

```bash
sh bootstrap.sh
mkdir -p bin
BEND_LIB=$PWD/.ez/lib bend ez/main.bend -o bin/ez.bin
BEND_LIB=$PWD/.ez/lib bend main.bend -o bin/ez.bin
bin/ez.bin prove # the proof gate: every PROOF.bend must pass
bin/ez.bin tool run bolt -- --gpu off # lint: 0 errors
bin/ez.bin lock # must leave ez.lock.toml unchanged unless you meant to change it
Expand Down
64 changes: 43 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,49 @@ tools for a whole project.

## Install

ez needs Bend 2.0.32 or later; the fleet is built and checked on Bend 2.0.34.
ez needs Bend 2.0.32 or later; it is built and checked on Bend 2.0.34, the
version `flake.lock` pins. Building ez needs clang as well, since ez is one
native binary. Every subcommand runs the `bend` and `git` on your PATH.

### The ledger library, from the hub
### From the hub

ez's ledger library, which reads `ez.toml`, is on the Bend hub as `ezx`. A
plain Bend program imports it by name, at v1.3.0:
With an installed `bend` and nothing else, build ez v1.4.0 from the Bend hub,
where the whole program is published as `ezx@1.4.0.0`. Put this in `t.bend`:

```bend
import ezx@1.3.0.0/main.bend as Ledger
import ezx@1.4.0.0/main.bend as Ez

def main() -> IO(Unit):
Ez.main()
```

and build it:

```bash
curl -fsSL https://bend-lang.com/install.sh | sh
bend t.bend -o ez # fetches ez and its libraries from the hub
./ez --help
```

There is no install step: `bend` fetches the package and the libraries it
imports by hash (shake, snap, ezhttp, eztoml and sha256) on the first build,
into `~/.bend/lib`. `import 0x<hash>/main.bend`, with the hash the hub names
for `ezx@1.4.0.0`, pins it by content.

ez's ledger library, which reads `ez.toml`, comes in the same package, at
`src/ledger/manifest.bend`:

```bend
import ezx@1.4.0.0/src/ledger/manifest.bend as Ledger

def main() -> String:
Ledger.show(Ledger.parse("[package]\nname = \"app\"\nentry = \"main.bend\"\n"))
```

`bend` fetches it from the hub on first run; there is no install step.
`ezx@1.3.0.0` resolves to `0x046551eff0d59a82cf10d858b17b0c84`, and
`import 0x046551eff0d59a82cf10d858b17b0c84/main.bend` pins it by content. In
an ez project, `ez add Emerging-Patterns/ez` records it in the ledger.

The hub package is the library only. The `ez` command is built from a clone,
or installed with nix, as below.
In an ez project, `ez add Emerging-Patterns/ez` records the package in the
ledger.

### The ez command
### From a clone

Install Bend, then fetch the packages ez builds itself with, and build it:

Expand All @@ -42,16 +62,18 @@ git clone https://github.com/Emerging-Patterns/ez
cd ez
sh bootstrap.sh
mkdir -p bin
BEND_LIB=$PWD/.ez/lib bend ez/main.bend -o bin/ez.bin
BEND_LIB=$PWD/.ez/lib bend main.bend -o bin/ez.bin
```

ez's own dependencies are pinned to git revs, and `ez fetch` is what fetches
them, which ez cannot run before it is built. `bootstrap.sh` is that one step, and the one helper script
in the repo: it reads `ez.lock.toml`, fetches each package at its pinned rev
into `.ez/lib`, and checks every file's sha256 and the package's `0x` name
against the lock. It needs `git` and `sha256sum` (or `shasum`), and nothing
comes from the hub. `bend` then only needs telling where the packages are,
since it looks in `~/.bend/lib` otherwise.
The top-level `main.bend` is ez's program; the modules it imports are under
`src/`. ez's own dependencies are pinned to git revs, and `ez fetch` is what
fetches them, which ez cannot run before it is built. `bootstrap.sh` is that
one step, and the one helper script in the repo: it reads `ez.lock.toml`,
fetches each package at its pinned rev into `.ez/lib`, and checks every
file's sha256 and the package's `0x` name against the lock. It needs `git`
and `sha256sum` (or `shasum`), and nothing comes from the hub. `bend` then
only needs telling where the packages are, since it looks in `~/.bend/lib`
otherwise.

Put `bin/ez.bin` on your PATH as `ez`. ez is Bend and nothing else, so the
binary is all there is: no runtime, no helper scripts beside it, nothing to
Expand Down
Loading
Loading