|
1 | 1 | # Copilot Instructions for RUST Project |
2 | 2 |
|
3 | 3 | ## General |
4 | | -- **Entry Point:** Maintain source as `src/main.rs`. |
| 4 | +- **Entry Point:** Maintain CLI source as `src/main.rs` and library core as `src/lib.rs`. |
| 5 | +- **Binary Structure:** CLI uses feature flag `cli` and entry point is built via default features or explicit `--features=cli`. |
5 | 6 | - **Comments:** |
6 | 7 | - Do not remove or modify comments unless the related code is changed. |
7 | 8 | - Only add comments that explain code functionality; no AI instructional comments. |
|
10 | 11 | - **Build Quality:** Ensure `cargo build --release` has no errors or warnings. |
11 | 12 | - **File Editing:** Always edit files inline; do not use `cat` to write to files. |
12 | 13 |
|
| 14 | +## Architecture & Code Organization |
| 15 | +- **Library-first design:** Core logic in `src/lib.rs` and CLI entry point in `src/main.rs`. |
| 16 | + - **Shared code:** Parser modules (`src/parser/`) are used by both library and CLI (`parse_frames`, `parse_headers_from_text`). |
| 17 | + - **Duplicated code:** Export implementations exist separately in `src/export.rs` (library) and `src/main.rs` (CLI). CLI does NOT use library export functions. |
| 18 | + - **Current state:** **Partial unification** — parsing shared, export duplicated (~1800 lines in `src/main.rs`). |
| 19 | +- **Decision criteria:** "Is this needed by crate consumers?" determines placement — shared logic in library, CLI-only logic in `src/main.rs`. |
| 20 | +- **Feature flags:** `csv`, `cli`, `json`, `serde` control optional dependencies; default: `csv` + `cli`. |
| 21 | +- **CRATE_USAGE.md reference:** See `CRATE_USAGE.md` for library API examples with feature flags. |
| 22 | +- **Code quality goals:** Reduce duplication by migrating CLI export logic to use library `export_to_csv()`, `export_to_gpx()`, `export_to_event()` functions. |
| 23 | +- **Testing:** Comprehensive tests distributed across `src/main.rs`, `src/conversion.rs`, `src/parser/stream.rs`, and `src/parser/helpers.rs`. |
| 24 | +- **Public API:** `parse_bbl_file()`, `parse_bbl_bytes()`, `BBLLog`, `ExportOptions`, conversion utilities, parser helpers. |
| 25 | + |
13 | 26 | ## Algorithms |
14 | 27 | - **Method Selection:** |
15 | 28 | - When choosing math or scientific methods, compare alternatives for accuracy and efficiency. |
16 | 29 | - Fact-check method decisions. |
17 | 30 |
|
18 | 31 | ## Documentation |
19 | 32 | - **Readme:** Maintain a proper `README.md` file. |
20 | | -- **Overview** Maintain a proper `OVERVIEW.md` file |
| 33 | +- **Overview:** Maintain a proper `OVERVIEW.md` file |
21 | 34 | - **Summaries:** |
22 | 35 | - Output final summaries to `./INFORMATION/*.md` (not in git). |
23 | 36 | - Use date-prefixed, uppercase filenames (e.g., `2025-06-25_SUMMARY.md`). |
|
0 commit comments