Skip to main content

Crate degenbot_cli_core

Crate degenbot_cli_core 

Source
Expand description

degenbot-cli-core — the clap-free semantics home for the degenbot console (ADR-051 D1/D2).

The console has two first-class front ends: the pure-Rust argv facade (degenbot-cli, clap) and the Python passthrough (src/degenbot/_cli.py). Both map argv into the SAME command model declared here, so command semantics — prompt policy, dry-run text, exit-code mapping — exist exactly once. This crate is deliberately pyo3-free (so the pure-Rust consumer can depend on it) and clap-free/indicatif-free (argv spelling and progress rendering are the facade’s job; asserted by just check-cli-core-purity).

§Shape

  • Command + the per-group enums: the constructor-parsed command model.
  • Command::execute / run_with_cancel: the execution entries, returning a typed CommandReport.
  • CliError → ExitCode: declared at exactly one From site; the workspace exit = "deny" lint stands, so run returns codes and never aborts the process. The typed fleet boot refusal (FF-T1) maps to EX_CONFIG 78 (lifted out of DegenbotCLI.invoke).
  • PromptPlan + Prompter: interactive policy is declared data, ported verbatim from the click handlers and audited, never redesigned (D4).
  • CancelHandle: the cooperative cancel carrier the updater arms thread into run_pool_update / run_aave_update (the facade owns the SIGINT policy, ADR-051 D7).

§Groups

  • database (DatabaseCommand): the template group; ports src/degenbot/cli/database.py arm for arm.
  • exchange (ExchangeCommand): the 34 Python click verbs collapse to one data-driven command resolving (chain, name) through the degenbot-uniswap deployments registry (ADR-051 D5).
  • pool (PoolCommand): the degenbot-pool-updater chunk loop + on-chain-truth verify.
  • aave (AaveCommand): the degenbot-aave market run + row flips.
  • fleet (FleetCommand): the live cordon posture over the operator command channel (ADR-051 D6).
  • path (PathCommand): live add-path / bounded discovery over the same operator command channel.

Re-exports§

pub use aave::resolve_aave_deployment;
pub use aave::AaveCommand;
pub use aave::AaveDeployment;
pub use aave::AAVE_DEPLOYMENTS;
pub use block::parse_to_block;
pub use block::resolve_chain_selector;
pub use block::resolve_to_block;
pub use block::BlockTag;
pub use block::ToBlockSpec;
pub use block::DEFAULT_CHUNK_SIZE;
pub use block::DEFAULT_TO_BLOCK;
pub use block::DEFAULT_VERIFY_ALL_INTERVAL;
pub use cancel::CancelHandle;
pub use command::Command;
pub use command::DatabaseCommand;
pub use context::CliContext;
pub use database::database_backup_path;
pub use error::CliError;
pub use error::ExitCode;
pub use exchange::resolve_deployment;
pub use exchange::ExchangeCommand;
pub use exchange::ExchangeDeployment;
pub use exchange::PoolManagerDeployment;
pub use exchange::RETIRED_EXCHANGES;
pub use fleet::FleetCommand;
pub use operator::parse_hop_token;
pub use operator::parse_sim_intake_floor;
pub use operator::render_json_sorted;
pub use operator::resolve_socket;
pub use operator::validate_posture_patch;
pub use operator::PathDirection;
pub use operator::PathFamily;
pub use operator::PathStep;
pub use operator::PosturePatchEntry;
pub use operator::PosturePatchValue;
pub use operator::WireRequest;
pub use operator::WireResponse;
pub use operator::FLEET_POSTURE_THRESHOLD_KEYS;
pub use operator::SIM_INTAKE_FLOOR_RESTORE;
pub use operator::SOCKET_DEFAULT;
pub use operator::SOCKET_ENV;
pub use path::PathCommand;
pub use pool::PoolCommand;
pub use pool::PoolFamily;
pub use prompt::PromptPlan;
pub use prompt::Prompter;
pub use registrations::ensure_supported_registrations;
pub use registrations::RegistrationReport;
pub use report::schema_state_label;
pub use report::AavePositionLine;
pub use report::AaveReport;
pub use report::AaveUpdateEntry;
pub use report::AaveUpdateOutcome;
pub use report::ActivateOutcome;
pub use report::CommandOutcome;
pub use report::CommandReport;
pub use report::CutoverOutcome;
pub use report::DatabaseReport;
pub use report::DeactivateOutcome;
pub use report::DryRunKind;
pub use report::ExchangeActiveState;
pub use report::ExchangeListRow;
pub use report::ExchangeReport;
pub use report::FleetReport;
pub use report::PathReport;
pub use report::PoolReport;
pub use report::StrategyReport;
pub use strategy::descriptor;
pub use strategy::descriptors;
pub use strategy::EndpointSummary;
pub use strategy::MutationOutcome;
pub use strategy::StrategyCommand;
pub use strategy::StrategyFacet;
pub use strategy::StrategyFacetDescriptor;

Modules§

aave
The aave command arms (ADR-051 D1;).
block
The --to-block block-identifier port .
cancel
The cooperative cancel carrier the updater arms thread into the cores.
command
The constructor-parsed command model (ADR-051 D1).
context
The driver-domain context a command executes against (ADR-051 D8).
database
The database command arms (ADR-051 D1/D4) — the template group.
error
Typed console failures and the single CliError → ExitCode mapping (ADR-051 D1).
exchange
The exchange command arms (ADR-051 D5) — data, not 34 verbs.
fleet
The fleet command arms (ADR-051 D6;).
operator
The operator command-channel client: JSON-lines over a Unix domain socket (ADR-051 D6;).
path
The path command arms (ADR-051 D6;).
pool
The pool command arms (ADR-051 D1;).
prompt
Interactive policy as declared data (ADR-051 D4).
registrations
The supported-registration seam (ADR-051 D5 extension): the console no longer requires the operator to CREATE rows. Every supported (chain, DEX) pair (RETIRED_EXCHANGES) and every supported Aave V3 market (AAVE_DEPLOYMENTS) that is NOT found in the DB is registered inactive by ensure_supported_registrations — the operator then flips rows active with exchange activate / aave activate.
report
Typed command reports (ADR-051 D1: execution returns typed results; the facade renders them — Q1).
strategy
The strategy command arms: the console’s typed view AND write path over the strategy facets.

Functions§

run
The ONE execution entry: run command against ctx, asking prompter when the command’s PromptPlan requires it.
run_with_cancel
The cancellable execution entry (ADR-051 D7).