# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Commands ```bash cargo build # debug build cargo build --release # release build cargo run -- # 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/` (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 ` 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 service - `src/container.rs` — factory functions that construct `Repo → Service` pairs from a `Db` instance - `src/database/db.rs` — `Db` wraps a `Arc>` (mysql); `Db::initialize(env)` loads the dotenv config and opens a connection pool - `src/repository/` — one repo per domain entity; each holds a `Db` and executes raw MySQL queries - `src/service/` — one service per domain; holds the corresponding repo, formats and prints results to stdout - `src/entity/` — plain structs with `mysql::FromRow` derives representing DB rows - `src/lib.rs` — exports the `TerminalSize` trait (used by services to adapt output width to the terminal) ## CLI Usage ``` rcc [-e ] merch # search merchants by name schema # list columns for a table filter [-a] [-c] [-l] # filter info; -a=all, -c=config, -l=log page # page/file info job [-l] # job info; -l=log use # find filters that use a given file/module ```