2.1 KiB
2.1 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Commands
cargo build # debug build
cargo build --release # release build
cargo run -- <args> # run with args (see CLI section)
cargo check # fast type/borrow check without linking
cargo clippy # lint
No tests exist yet in this project.
Configuration
The binary reads environment config from ~/.config/rcc/<env> (dotenv format). Default env is local.
Required keys: DB_USERNAME, DB_PASSWORD
Optional keys: DB_LOCATION (default: localhost), DB_PORT (default: 3306), DB (default: efulfilment)
Pass -e <env> to select a config file (e.g., -e stage loads ~/.config/rcc/stage).
Architecture
Three-layer structure: CLI → Service → Repository, wired together in container.rs.
src/cli/command.rs— Clap structs defining all subcommands (Merch,Schema,Filter,Page,Job,Use)src/cli/controller.rs— dispatches parsed args to the appropriate servicesrc/container.rs— factory functions that constructRepo → Servicepairs from aDbinstancesrc/database/db.rs—Dbwraps aArc<Mutex<Pool>>(mysql);Db::initialize(env)loads the dotenv config and opens a connection poolsrc/repository/— one repo per domain entity; each holds aDband executes raw MySQL queriessrc/service/— one service per domain; holds the corresponding repo, formats and prints results to stdoutsrc/entity/— plain structs withmysql::FromRowderives representing DB rowssrc/lib.rs— exports theTerminalSizetrait (used by services to adapt output width to the terminal)
CLI Usage
rcc [-e <env>] <subcommand>
merch <search> # search merchants by name
schema <search> # list columns for a table
filter <id> [-a] [-c] [-l] # filter info; -a=all, -c=config, -l=log
page <id> # page/file info
job <id> [-l] # job info; -l=log
use <file_name> # find filters that use a given file/module