# AGENTS.md — `hyperlane-plugin-env`
Concise engineering and iteration guidelines for `hyperlane-plugin-env` (`plugin/env/`).
Global rules live in [`../../.agents/skills/hyperlane/SKILL.md`](../../.agents/skills/hyperlane/SKILL.md), [`../README.md`](../README.md), and `~/.agents/skills/rust-standards/SKILL.md`.
## Scope & Module Boundaries
- **Role**: Zero-external-dependency `.env` parser, layered typed environment loader, redacting `SecretValue`, and `HYPERLANE_*` `ServerConfig` builder.
- **Dependencies**: Internal `hyperlane` ONLY (zero external dependencies).
- **Layout**: `src/{lib,const,enum,fn,impl,static,struct}.rs` (`ENV_PLUGIN` and parser helpers stay `pub(crate)`); tests in `tests/`.
## Core Iteration Invariants
- **Startup-only / zero runtime hooks**: Register NO `ServerHook` or middleware in this crate; keep per-request overhead strictly zero while providing optional `OnceLock` `EnvPlugin::{init, get}` access.
- **Unconditional secret redaction**: `SecretValue` MUST NOT derive `Debug` or print raw secrets in `Debug`/`Display` (always emit `"[REDACTED]"`); raw access is strictly via `.expose()`.
- **`.env` quoting & interpolation semantics**: Keep single-quoted values strictly literal, unescape double-quoted values before `${VAR}` interpolation, strip inline `" #"` comments on unquoted values, resolve prior `.env` keys before OS env vars, and enforce `[A-Za-z_][A-Za-z0-9_]*` keys (after optional `export `).
- **`ServerConfig` validation**: `ADDRESS` overrides `HOST`+`PORT`, TLS activates only when both `TLS_CERT` and `TLS_KEY` are present, `PROTOCOL` accepts only `http1|http2|http3`, and errors report the full prefixed key name.
## Code & Documentation Standards
- Follow `rust-standards`: pure 9-keyword filenames, 3-section `mod.rs`, centralized imports in `src/lib.rs` and `tests/mod.rs`, `pub(crate)` struct fields with `lombok-macros` accessors (no `self.field`), explicit types on all `let`/closure bindings, zero `#[allow]`/`unwrap()`/`expect()`/`panic!()`, `pub` before `pub(crate)` in `const.rs`/`static.rs`, strict `Cargo.toml` dependency order, and comment-free tests in `tests/`.
- Keep all code, comments, docs, and commits pure English. Update `plugin/env/README.md` (and `plugin/README.md` / root `README.md` if public surface or env keys change) in the same commit.
## Local Verification
```sh
cargo run -p hyperlane-cli -- fmt --check
cargo clippy -p hyperlane-plugin-env --all-features --all-targets -- -D warnings
cargo test -p hyperlane-plugin-env --all-features
python3 ~/.agents/skills/rust-standards/scripts/staged_file_gate.py .
python3 ~/.agents/skills/rust-standards/scripts/verify_dep_order.py .
```