Rust CLI (the degenbot console)¶
The degenbot console is a Rust binary (ADR-051). One argv declaration
exists — the clap v4 tree in degenbot-cli
(rust/crates/shells/degenbot-cli/src/argv.rs) over the clap-free command model in
degenbot-cli-core (rust/crates/shells/degenbot-cli-core/src/command.rs). The
Python console script is a five-line passthrough to the same binary
(degenbot._ffi.cli_main), so Python and Rust operators run the same program
with the same vocabulary. Rendering, prompting, progress, and SIGINT are the
façade’s job; execution returns typed reports and one CliError → ExitCode
mapping (ADR-051 D1/D2/Q1).
This page is the authoritative command/flag/exit-code reference. Per-domain background lives in the sibling pages: database, pool, aave.
Global options¶
Accepted before or after the subcommand (clap global = true).
Option |
Resolved value / cascade |
|---|---|
|
SQLite database path: |
|
Session chain id: |
|
Node RPC endpoint. The value classifies its own transport: |
|
Print help and exit 0. |
|
Print the workspace version plus the shared build receipt and exit 0. |
These value options are the driver-domain resolvers (ADR-051 D8), owned
by degenbot-config (rust/crates/foundation/degenbot-config/src/resolvers.rs): each is a
cascade over an explicit argument, the environment, and the database.path /
session.chain_id / nodes.* file tables, with the winning layer reported as
provenance, with the file the BASE layer. The pre-0.6 [rpc]/[ws]/
[database] filepath/default_chain_id spellings stay refused (see
config-migration).
Commands¶
degenbot database¶
Command |
Flags |
Behaviour |
|---|---|---|
|
— |
Write the |
|
|
Remove and recreate the database at the current schema (prompts unless |
|
|
RETIRED (ADR-052 D4): prints |
|
— |
|
|
|
One-way flip of an Alembic-marker DB into Rust schema ownership (ADR-010). Refuses foreign/no-history DBs; prompts unless |
|
|
Out-of-place dump-and-restore rebuild into Rust ownership (ADR-011); accepts a legacy Alembic-marker DB, refuses a foreign file; prompts unless |
|
— |
Read-only schema-state report ( |
degenbot exchange¶
Command |
Flags |
Behaviour |
|---|---|---|
|
|
Activate a DEX deployment: resolve |
|
|
Deactivate a DEX deployment. Idempotent: an already-inactive pair reports |
CHAIN is a chain slug (base, ethereum) or a numeric chain id; NAME is the
DEX name slug stored in the database (aerodrome_v2, uniswap_v3,
uniswap_v4, …). ADR-051 D5 collapses the retired 34 click verbs onto this
one data-driven pair.
degenbot pool¶
Command |
Flags |
Behaviour |
|---|---|---|
|
|
Advance liquidity-pool state for every activated exchange, committing per chunk. |
|
|
Compare a pool’s committed liquidity map against on-chain truth at |
BLOCK is a block tag (earliest, finalized, safe, latest, pending,
<number>) with an optional :offset, e.g. latest:-64 or safe:128.
degenbot aave¶
Command |
Flags |
Behaviour |
|---|---|---|
|
— |
Activate the Aave V3 market for the session chain (Ethereum default 1 when no chain layer supplied a value). |
|
|
Deactivate a market. |
|
|
Advance Aave V3 position state for active markets. |
|
|
Print a user’s collateral and debt positions. |
degenbot fleet / degenbot path (live operator channel)¶
These are a JSON-lines Unix-domain-socket client (ADR-051 D6); the running
bot’s OperatorServer is the authority. --socket resolves through
--socket > DEGENBOT_OPERATOR_SOCKET > ~/.config/degenbot/operator.sock.
Command |
Flags |
Behaviour |
|---|---|---|
|
|
Echo the live cordon posture (thresholds + Nominal/Cordoned). |
|
|
null>` |
|
|
Add one specific path to the live bot mid-run. |
|
|
Trigger a bounded on-demand discovery sweep. |
degenbot config¶
The read and write surface over the operator file (ADR-062 D6/D12). The
mutating arms confirm unless --force; every rendered value is redacted.
Command |
Flags |
Behaviour |
|---|---|---|
|
— |
The driver-domain values the operator FILE declares: |
|
|
The same keys as the process resolves them, each annotated with its winning layer: |
|
— |
Resolve one key ( |
|
|
Write one declared key or |
|
|
Remove one key’s or entry’s override so the declared default (or a shadowing env var) applies again. |
|
— |
Print the config file the mutating arms read and write: |
Credentials never appear in a rendered line: userinfo (user:secret@) and the
credential-bearing query parameters (api_key, apikey, key, token,
secret, password, access_token) are redacted in config show, config get, write reports, and config error text. The file on disk keeps what the
operator wrote, so an operator who writes
config set nodes.http.1 'https://user:secret@host/x?api_key=abc' sees
nodes.http[1] = https://host/x?api_key=REDACTED (file) on the next read.
$ degenbot --config ./config.toml config show --resolved
config = ./config.toml
database.path = /home/you/.local/state/degenbot/db/degenbot.db (default)
session.chain_id = 8453 (file)
nodes.http[1] = http://127.0.0.1:8545 (file)
nodes.ws[1] = ws://127.0.0.1:8546 (env)
nodes.ipc = (unresolved)
Exit codes¶
Execution returns typed results and cli-core declares the one
CliError → ExitCode site (rust/crates/shells/degenbot-cli-core/src/error.rs); the
façade returns the code (exit = "deny" — a library never aborts the host).
Code |
Meaning |
|---|---|
|
Success — the command completed, including a |
|
A typed command failure: a declined confirmation prompt, a schema refusal (stale/foreign/nothing-to-do), a database op failure, or the retired |
|
argv/usage error: unknown or missing subcommand (clap’s usage exit), or a refused typed config at boot. |
|
|
Interaction policy¶
Prompt policy is declared data per command (ADR-051 D4): --force skips the
unless-force confirmations, and database backup confirms only when the target
backup exists. SIGINT is Rust-owned on both entry paths (ADR-051 D7): the first
Ctrl+C sets the cooperative cancel flag the updaters poll at chunk boundaries
(committed chunks stay durable); a second Ctrl+C restores the default
disposition and aborts.
The no-Python gate¶
The console is proven Python-free by a dedicated CI job and a local recipe:
just ci-no-python-cli-gate
.github/workflows/cli-no-python-gate.sh builds degenbot-cli (Rust only),
runs --help, --version, database inspect over committed Alembic-stamped
fixtures, and exchange activate/deactivate idempotence on a fresh DB copy,
then diffs the machine-checkable stdout against the checked-in oracle
.github/workflows/cli-no-python-expected.txt. Two DEGENBOT_CLI_GATE_SEED
modes prove the comparator can fail (a mutated oracle line, and a live
Rust-owned-state divergence). The CI job cli-no-python provisions no Python
toolchain and never invokes uv.