cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo testDo not commit unless all three pass. Fix issues before committing.
cargo build --verbose # debug
cargo build --release # release (LTO, stripped)Integration tests require a debug build to exist before running cargo test.
Bear generates JSON compilation databases (compile_commands.json) for Clang tooling.
It intercepts compiler invocations during a build and records them.
| Crate | Purpose |
|---|---|
bear |
Main driver, CLI, semantic analysis, output |
intercept-preload |
LD_PRELOAD / DYLD_INSERT_LIBRARIES shared library |
platform-checks |
Build-time platform capability detection |
bear-codegen |
Code generator for compiler flag tables |
integration-tests |
End-to-end tests |
Before modifying code in a subdirectory, read the CLAUDE.md in that directory first.
These files contain rules, context, and constraints specific to that area.
| When you are about to... | Read first |
|---|---|
| Modify CLI arguments or output format | bear/CLAUDE.md |
| Edit or add compiler interpreter YAML | bear/interpreters/CLAUDE.md |
| Write or modify integration tests | integration-tests/CLAUDE.md |
| Touch the preload interception library | intercept-preload/CLAUDE.md |
| Edit or regenerate the man page | man/CLAUDE.md |
| Add, modify, or review a requirement | requirements/CLAUDE.md |
Do not skip these reads. They contain constraints that prevent regressions.
- Interception - capture compiler invocations via
LD_PRELOAD(Linux/macOS) or wrapper executable (other platforms) - Semantic analysis - filter non-compiler commands using interpreter YAML definitions
- Configuration - apply user config for output formatting
- Output - write
compile_commands.json
For architectural changes or new features:
- Check
requirements/for existing requirement specs - Write a requirement spec if one does not exist (see
requirements/CLAUDE.md) - Provide a Decision Log before writing code:
- Proposed approach
- Alternatives considered
- Trade-offs (performance vs simplicity)
- Await "GO" before implementation
- Write integration tests that reference the requirement
- Follow Rust 2024 edition idioms
- Maintain existing code structure
- Write tests for new functionality
- Keep dependencies minimal
- No speculative features or over-engineering
- ASCII only in all files (no em dashes, smart quotes, Unicode bullets)
- Use hyphens, straight quotes, three dots, asterisks/hyphens for bullets