CLI pattern:
commands/mod.rs
Execute
commands/foo.rs
#[derive(Args)] pub struct FooCommand
main.rs
Cli
#[command(subcommand)]
Current appview state:
Command
commands/
Plan: 1. Create commands/mod.rs with subcommand enum + dispatch 2. Create commands/run.rs, commands/index.rs, commands/serve.rs, commands/status.rs 3. Move the run_full, run_index, run_serve, run_status bodies into command structs 4. Keep shared helpers (load_config_or_exit, open_db_or_exit, build_state, serve_http, shutdown_signal, spawn_indexer) in main.rs — they're infra, not commands 5. Slim main.rs to parse + dispatch
commands/run.rs
commands/index.rs
commands/serve.rs
commands/status.rs
Pattern to match
CLI pattern:
commands/mod.rs— declares submodules +Executetraitcommands/foo.rswith#[derive(Args)] pub struct FooCommandmain.rs—Clistruct with#[command(subcommand)], match dispatchCurrent appview state:
main.rs—Cli,Commandenum, and all run_*/status/serve functions inlinecommands/directoryPlan: 1. Create
commands/mod.rswith subcommand enum + dispatch 2. Createcommands/run.rs,commands/index.rs,commands/serve.rs,commands/status.rs3. Move the run_full, run_index, run_serve, run_status bodies into command structs 4. Keep shared helpers (load_config_or_exit, open_db_or_exit, build_state, serve_http, shutdown_signal, spawn_indexer) in main.rs — they're infra, not commands 5. Slim main.rs to parse + dispatch