# Copilot Instructions for `o8_pics_size` ## Build, test, and lint commands - Build: `cargo build` - Run app: `cargo run` - Run all tests: `cargo test` - Run a single test: `cargo test ` - Formatting check: `cargo fmt --check` - Lint (if available in your toolchain): `cargo clippy -- -D warnings` ## High-level architecture The application is a single-binary Rust CLI (`src/main.rs`) built as a staged pipeline: 1. Pick an input Excel file (`.xls`/`.xlsx`) via `rfd::FileDialog`. 2. Read workbook/sheet data with `calamine`. 3. Use terminal UI selectors (`dialoguer::Select`) to choose: - sheet - `Cikkszám` column - `Url` column - `img_sequence` column 4. Build input rows from sheet data (header row is row 0, data starts from row 1). 5. Download images from URLs using blocking `reqwest`. 6. Decode image bytes with `image` to extract dimensions; compute size from downloaded byte length. 7. Export results to a new workbook with `rust_xlsxwriter`, saved as `result_[uuid].xlsx` next to the input file. Core helper responsibilities are split into functions in `main.rs`: - selection helpers: `prompt_sheet_selection`, `prompt_column_selection` - sheet parsing helpers: `extract_headers`, `collect_input_rows`, `cell_string` - image metadata fetch: `fetch_image_metadata` - output generation: `build_output_path`, `write_results_excel` ## Key conventions in this repository - **Fail-fast error handling:** most failures print a clear `eprintln!` message and exit with status 1. - **Column naming is contract-like:** output headers are currently written as: - `Cikkszám` - `Sqeuence` (keep this spelling unless intentionally changed) - `Url` - `Width (px)` - `Height (px)` - `Size (KB)` - **Interactive flow is TUI-driven:** keep sheet/column selection cursor-based (`dialoguer::Select`), not numeric text prompts. - **Output path pattern is fixed:** write result files as `result_[uuid].xlsx` in the same directory as the source workbook.