docs: update AGENTS.md for parser/ submodule layout
This commit is contained in:
parent
3bf914ee15
commit
43a0bf36e1
14
AGENTS.md
14
AGENTS.md
|
|
@ -3,8 +3,16 @@
|
|||
## Project Structure & Module Organization
|
||||
- `src/main.rs`: Entry point; wires CLI to parser.
|
||||
- `src/cli.rs`: Clap-based argument parsing (flags like `--file`, `--input-format`).
|
||||
- `src/parser.rs`: DER decoding and pretty-printing using `yasna`.
|
||||
- `src/color.rs`: Minimal ANSI color helpers.
|
||||
- `src/parser/`: Parser submodule containing all DER decoding and pretty-printing logic.
|
||||
- `mod.rs`: Public API surface for the parser (re-exports types and `pretty_print_der`, `parse_and_print`).
|
||||
- `asn1_types.rs`: TLV parsing, OID decode, helpers.
|
||||
- `encoding_utils.rs`: Hex/bits formatting utilities and truncation logic.
|
||||
- `pretty_printer.rs`: Recursive DER walker and structure rendering.
|
||||
- `value_printer.rs`: Leaf value formatting (strings, times, OIDs, bit/octet strings).
|
||||
- `certificate_utils.rs`: X.509-specific helpers and detection.
|
||||
- `time_utils.rs`: UTCTime/GeneralizedTime humanization.
|
||||
- `oid_registry.rs`: Friendly OID names.
|
||||
- `tests/data/`: Sample keys/certs used by integration tests or manual runs.
|
||||
- `Cargo.toml`: Rust 2021 package config and dependencies.
|
||||
|
||||
|
|
@ -24,12 +32,12 @@
|
|||
## Coding Style & Naming Conventions
|
||||
- Rust 2021; 4-space indent; `rustfmt` defaults (`cargo fmt`).
|
||||
- Naming: modules `snake_case`; types/enums `CamelCase`; functions `snake_case`; constants `SCREAMING_SNAKE_CASE`.
|
||||
- Avoid `unsafe`; prefer clear, small functions. Keep CLI parsing in `cli.rs`, decoding/formatting in `parser.rs`.
|
||||
- Avoid `unsafe`; prefer clear, small functions. Keep CLI parsing in `cli.rs`, decoding/formatting in `src/parser/`.
|
||||
- Run `cargo clippy` locally and fix lints before PRs.
|
||||
|
||||
## Testing Guidelines
|
||||
- Framework: built-in Rust tests (`cargo test`).
|
||||
- Unit tests: add `#[cfg(test)] mod tests { ... }` near code in `parser.rs`.
|
||||
- Unit tests: add `#[cfg(test)] mod tests { ... }` near code in the relevant file under `src/parser/`.
|
||||
- Integration tests: create Rust files under `tests/` (e.g., `tests/parse_certificate.rs`) and use fixtures in `tests/data/`.
|
||||
- Naming: prefer descriptive test names (e.g., `it_parses_bit_string_flags`).
|
||||
- If output formats change, update or add tests that assert on rendered lines.
|
||||
|
|
|
|||
Loading…
Reference in New Issue