Skip to main content

Module setup

Module setup 

Source
Expand description

lev setup - the guided path from “just installed Leviath” to “ready to run an agent”.

The previous version was nine print!/read_line prompts in a fixed order: it asked every user for four API keys whether they had them or not, echoed them in plaintext, touched about eight of Config’s twenty-odd fields, and knew nothing about MCP servers or agent blueprints. It also ended by claiming “All API keys look valid” on the strength of a starts_with check. A fresh install came out the other side with a config file and no agents.

This is a ratatui wizard instead: pick the providers you actually use, configure and verify each, set defaults and limits, install the bundled blueprints, and import MCP servers already configured in other harnesses.

§Shape

  • state - what step we’re on and what’s been chosen. Pure data.
  • input - key handling.
  • render - drawing.
  • plan - the decisions as plain data, and the only code that writes.
  • catalog - which providers exist and how each is configured.
  • import - MCP servers found in other tools.
  • verify - proving a credential works.

The terminal is a front-end, not the feature: everything it collects lands in a plan::SetupPlan, and --non-interactive builds the same struct from flags. A future mobile or web host would be a third builder with nothing downstream changing - which is why none of the platform-shaped parts (scanning a home directory, taking over a TTY) are prescribed anywhere but here.

Modules§

catalog
The providers lev setup can configure, and how each one is configured.
import
Discovering MCP servers already configured in other agent harnesses.
input
Key handling for the setup wizard.
plan
What setup decided, as plain data, and applying it.
render
Drawing the setup wizard.
state
The wizard’s state: what step we’re on, what’s been chosen, and how a choice turns back into a SetupPlan.
verify
Proving a provider credential actually works, before the config is written.

Structs§

SetupArgs
Arguments for lev setup.
SetupEnv
Everything the wizard needs from the outside world, injected so tests point it at tempdirs and a fake environment instead of the developer’s real home.

Functions§

build_wizard
Build a wizard against env.
execute_core
Set up the terminal, run the loop, tear the terminal down, then apply.
execute_with
lev setup: the flags path, or the wizard.
real_agents_dir
Resolve ~/.leviath/agents for the real environment.
run_non_interactive
The non-interactive arm: apply flags to the config on disk and save.
run_wizard_loop
The wizard’s draw/input loop.
verification_loop
Answer verification requests until the wizard drops its sender.

Type Aliases§

EnvLookup
Reads an environment variable. Injected so a test can hand the wizard a fixed environment instead of the developer’s real one.