One command line for the Latch → LEP → Relay → Trace loop: scaffold the Latch integration, build and flash firmware, run the stack locally, and decode captured envelopes.
Status:
v1.2.0, CI green onmaster. The first tagged release is pending; until it ships, install from source. Hardware evidence lives in the Latch repository.
- Firmware:
initscaffolds the Latch integration files for ESP32, Cortex-M, RISC-V, Zephyr, Arduino or host;builddrives CMake andctest;flashcallsidf.py,westor OpenOCD. - Stack:
upstarts the LastState compose stack,simruns a virtual fleet, andmockserves Trace/Relay endpoints without Docker. - Evidence:
testchecks the integration against LEP vectors;ingest,analyzeandsymbolicatemove and decode captures. - Operations:
configanddoctorkeep endpoints, secrets and toolchains honest.
The CLI is glue: it drives the component repos' public commands and APIs, and
prints - when it cannot verify something.
Node 18+.
git clone https://github.com/laststate/cli.git
cd cli
npm ci
npm run build
npm link # exposes `laststate` and `ls`
laststate doctor# 404 until the first tagged release is published
npm install -g laststate-cliThe package is not on the registry yet; the first tagged release will publish it. Until then, use the source install above.
laststate is a driver, not a project generator: it runs against your firmware
checkout and the LastState stack.
laststate doctordoctor reports tools, config, secrets and live endpoints. It prints - for
anything it cannot check (a stack that is not running, for example) and exits
nonzero only when a required check fails.
git clone --recurse-submodules https://github.com/laststate/laststate.git
cd laststate
laststate up --open
laststate sim run --scenario crash-storm
laststate status
laststate downup runs docker compose from the repo root, waits for health and can open
the Trace UI. --appliance uses docker-compose.appliance.yml; --no-sim
skips the simulator. sim run accepts demo, steady, crash-storm,
outage, recovery or boot-loop.
laststate init --project-name Demo --target cortex-m --yesinit creates Demo/ with laststate.yaml, a Latch main.c, .gitignore
and CMakeLists.patch.txt (plus partition.csv for ESP32). It does not
create a buildable project: merge the patch into your own CMakeLists.txt,
add Latch under third_party/latch, and provide the CMake preset that
build will use. Latch's own CMakePresets.json is the reference for
host-debug, arm-cortex-m4, riscv32 and riscv64.
With those in place, laststate build, laststate flash and
laststate test run against your project. test probes includes,
ls_boot() wiring and the LEP vectors it can find; anything it cannot
verify prints -, never a false pass.
The generated laststate.yaml carries a local-only dev- ingest token.
Replace it before sharing the project or pointing it at a shared Relay;
laststate config generate-secrets writes strong values to .env, which take
precedence over the project file.
laststate analyze capture.lep
laststate analyze capture.lep --output-format json
laststate ingest capture.lep --to relay --url http://localhost:8384analyze accepts .lep, .hex and .bin, checks the header and CRCs, walks
TLVs and can deframe raw, latch-stream or cobs. A protocol vector works
as a known-good input:
laststate analyze ../protocol/test-vectors/valid/lep-v2-basic.hex.
ingest posts to Relay or Trace with a rate/ETA bar and reports the event ID.
symbolicate upload-artifact stores an ELF in Trace; symbolicate resolve
uses llvm-symbolizer or addr2line locally.
| Command | What it does |
|---|---|
laststate init |
Scaffold Latch integration files for esp32, cortex-m, riscv, riscv64, zephyr, arduino or host. |
laststate build |
Configure and build with CMake presets, then run ctest. |
laststate flash |
Flash through idf.py, west or OpenOCD. |
laststate test |
Static integration probes plus LEP vectors; ✓/✗/- per check. |
| Command | What it does |
|---|---|
laststate up / down / ps / logs / status |
Start, stop, list, tail or health-check the compose stack. |
laststate sim run / sim stop |
Run the virtual fleet with a named scenario. |
laststate deploy |
Secrets, preflight and compose up for local, production, appliance or k8s. |
laststate doctor |
Audit tools, config, secrets and live endpoints. |
laststate mock |
Serve Trace/Relay endpoints for development without Docker. |
| Command | What it does |
|---|---|
laststate ingest (alias send) |
POST .lep files to Relay or Trace. |
laststate analyze |
Decode header, CRCs, TLVs and framing; text or JSON. |
laststate symbolicate |
upload-artifact to Trace or resolve addresses locally. |
laststate config |
list, get, set, paths, generate-secrets, preflight. |
laststate billing |
status, checkout, portal, watch against billing-service. |
laststate update |
Check for a newer CLI version. |
Per-command flags: laststate <command> --help. Global flags on every command:
--json --yes --verbose --quiet --no-color --no-banner --profile <name>
--json disables colors, banners and spinners and emits machine-readable
output. CI=true also disables the banner.
Precedence: --flag > env > laststate.yaml > global conf > default. Common
environment names are TRACE_URL, RELAY_URL and LASTSTATE_*_TOKEN.
laststate config list
laststate config get trace_url
laststate config set trace_url http://localhost:8080
laststate config generate-secrets --only-missing
laststate config preflight --deploy-env production
laststate config pathsconfig generate-secrets fills only missing or weak values. config preflight
fails on REPLACE_ME placeholders and weak secrets before a production deploy.
npm ci
npm test # vitest: LEP codec, config, validation, wiring, tasks, UI
npm run build # tsc -> dist/
npm run lintTo release, push a vX.Y.Z tag equal to package.json. The release workflow
builds and tests, publishes to npm (OIDC trusted publishing or NPM_TOKEN),
packs the tarball, smoke-tests the published package and creates the GitHub
release.
| Topic | Where |
|---|---|
| Latch runtime and HIL evidence | laststate/latch |
| LEP wire format and vectors | laststate/protocol |
| Relay gateway | laststate/relay |
| Trace backend and UI | laststate/trace |
| Full self-hosted stack | laststate/laststate |
| Billing realtime contract | docs/BILLING_REALTIME.md |
Apache-2.0. See LICENSE.