- Entry Point: Maintain CLI source as
src/main.rsand library core assrc/lib.rs. - Binary Structure: CLI uses feature flag
cliand entry point is built via default features or explicit--features=cli. - Comments:
- Do not remove or modify comments unless the related code is changed.
- Only add comments that explain code functionality; no AI instructional comments.
- No External Binaries: Never embed or call external binaries from RUST code.
- Temporary Files: Use
_temp.rsextension for any temporary.rsfiles. - Build Quality: Ensure
cargo build --releasehas no errors or warnings. - File Editing: Always edit files inline; do not use
catto write to files.
- Library-first design: Core logic in
src/lib.rsand CLI entry point insrc/main.rs.- Shared code: Parser modules (
src/parser/) and export functions (src/export.rs) are shared by both library and CLI. - CLI as thin wrapper: The CLI (
src/main.rs) uses library export functions (export_to_csv,export_to_gpx,export_to_event) with CLI-specific status messages. - Current state: Full unification complete — parsing and export layers unified, CLI is thin wrapper with zero public functions.
- Shared code: Parser modules (
- Decision criteria: "Is this needed by crate consumers?" determines placement — shared logic in library, CLI-only logic in
src/main.rs. - Feature flags:
csv,cli,json,serdecontrol optional dependencies; default:csv+cli. - CRATE_USAGE.md reference: See
CRATE_USAGE.mdfor library API examples with feature flags. - Testing: Comprehensive tests distributed across
src/main.rs,src/conversion.rs,src/parser/stream.rs, andsrc/parser/helpers.rs. - Public API:
parse_bbl_file(),parse_bbl_bytes(),BBLLog,ExportOptions,export_to_csv(),export_to_gpx(),export_to_event(), conversion utilities, parser helpers.
- Method Selection:
- When choosing math or scientific methods, compare alternatives for accuracy and efficiency.
- Fact-check method decisions.
- Readme: Maintain a proper
README.mdfile. - Overview: Maintain a proper
OVERVIEW.mdfile - Summaries:
- Output final summaries to
./INFORMATION/*.md(not in git). - Use date-prefixed, uppercase filenames (e.g.,
2025-06-25_SUMMARY.md). - List new files when created.
- Output final summaries to
- Setup Script: Use
.github/setup-dev.shfor automated development environment setup - Pre-commit Hook:
.github/pre-commit-hook.shautomatically formats code before commits - CI Compliance: All changes must pass the GitHub Actions CI pipeline
- Goals: Reference project goals in
GOALS.mdand request clarification if needed. - Source Code Resources:
- Primary: blackbox_decode (blackbox-tools)
- Fallback: blackbox-log-viewer (BBE)
- REQUIRED: The CSV output must precisely match the format and header order of blackbox_decode CSV files.
- Prefer native tooling: Use GitHub Actions features,
gitCLI,ghCLI (not third-party actions). - Reuse artifacts: Build once (ci.yml), download in downstream jobs (release.yml) — ~8-10x faster, lower costs.
- Explicit dependencies: Use
needs:clauses for job ordering; validate upstream success before proceeding. - Error handling: Validate artifacts exist; use
set -ein scripts; provide clear error messages.
- Commit Conditions: Only commit if:
cargo clippy --all-targets --all-features -- -D warningspasses.cargo fmt --all -- --checkpasses.cargo test --verbosepasses.cargo test --features=cli --verbosepasses.cargo build --releasepasses with no errors or warnings.
- Files to Commit:
- Only
src/**/*.rs,Cargo.*,README.md,OVERVIEW.md,.gitignore, and.github/**— nevergit add .orgit add -A. - Follow
.gitignore.
- Only
- User Confirmation: Ask user before committing.
- Commit Message:
- Check
git diff --cachedbefore committing. - Use concise commit messages and descriptions.
- Use
feat:,fix:,docs:where applicable.
- Check
- BEFORE ANY CODE CHANGES: Always run
cargo clippy --all-targets --all-features -- -D warningsto catch ALL issues. - BEFORE ANY CODE CHANGES: Always run
cargo fmt --all -- --checkto ensure formatting compliance. - IMMEDIATE FORMATTING FIX: If
cargo fmt --all -- --checkfails, IMMEDIATELY runcargo fmt --allto fix formatting. - NO OPTIONAL FEATURES ERRORS: All feature combinations must compile without errors.
- NO FORMATTING VIOLATIONS: Code must pass
cargo fmt --all -- --checkwithout any formatting issues. - STRICT COMPLIANCE: Never skip clippy checks or formatting checks. Never allow warnings to pass.
- AUTOMATIC FORMATTING: ALWAYS run
cargo fmt --allafter making ANY code changes before moving to next steps. - DOUBLE CHECK FORMATTING: After running
cargo fmt --all, ALWAYS verify withcargo fmt --all -- --checkbefore proceeding.