# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Build Commands
```bash
cargo build --release # Build (auto-downloads cwe.json if missing)
cargo run -- get 79 # Get CWE by ID
cargo run -- search injection # Search by keyword (case-insensitive)
```
## Architecture
**Build-time pipeline** (`build.rs`):
1. Downloads `cwe.json` from CWE-CAPEC repo if missing
2. Splits into individual `data/CWE-{id}.json` files
3. Filters out `ContentHistory` field to reduce size
4. Files embedded via `include_dir` crate
**Runtime** (`src/main.rs`):
- CLI uses clap with derive macros
- `DATA_DIR` static embeds all JSON files at compile time
- Lookup by filename pattern: `CWE-{id}.json`
## Key Files
- `build.rs` - Downloads and splits CWE data, runs at compile time
- `src/main.rs` - CLI entry point with `get` and `search` subcommands
- `src/search.rs` - Case-insensitive search across embedded CWE data
- `data/` - Generated JSON files (1400+ entries), gitignored
- `cwe.json` - Source data, auto-downloaded, gitignored
## Data Types
Three CWE entry types share the same lookup:
- Weaknesses (e.g., CWE-79)
- Categories (e.g., CWE-1)
- Views (e.g., CWE-1000)