brazen 0.0.4

A stateless, swiss-army-knife adapter for every LLM provider and protocol.
Documentation
# One crate, one product: `cargo install brazen` builds the `bz` command — the
# balls→bl pattern (a single package with a `[lib]` and a renamed `[[bin]]`). The
# pure pipeline + canonical types + seam traits are the library; the impure native
# wiring (`ureq` HTTP, `libc` SIGPIPE/isatty, the XDG files) is confined to the
# `bz` bin (`src/main.rs`) and `src/native/`.
#
# The "lib is network-free" invariant (arch §9.5, §10) used to be the crate graph's
# — a separate `bz` crate held `ureq`/`libc` so the lib literally could not link
# them (bl-c420). Collapsing to one publishable crate means `ureq`/`libc` are now
# crate-wide deps, so the compiler can no longer forbid them in a pure module; the
# invariant is re-established as an executable one by `tests/purity.rs`, which fails
# if any library module (everything under `src/` except `main.rs` and `native/`)
# imports `ureq`/`libc`/`std::net` (bl-c1e2).
[package]
name = "brazen"
version = "0.0.4"
edition = "2021"
# Dependency-driven MSRV floor: `ureq` 3 requires Rust 1.85, so the crate cannot
# build on less regardless of our (conservative, edition-2021) code — verified by a
# 1.85-toolchain build. A CI msrv job pins it (bl-a360).
rust-version = "1.85"
license = "MIT"
authors = ["mudbungie <mudbungie@gmail.com>"]
repository = "https://github.com/mudbungie/brazen"
homepage = "https://github.com/mudbungie/brazen"
documentation = "https://docs.rs/brazen"
keywords = ["llm", "ai", "openai", "anthropic", "cli"]
categories = ["command-line-utilities", "api-bindings"]
description = "A stateless, swiss-army-knife adapter for every LLM provider and protocol."
readme = "README.md"
# What goes to crates.io: only what a build/install needs. The whole dev apparatus
# stays out — the test suite, the 500KB specs/ design tree, CI/hooks, the Makefile,
# AGENTS.md. (This also keeps the Anthropic Claude-Code OAuth recipe in tests/ +
# specs/auth.md out of the public tarball — see the security-hygiene audit.) `src/`,
# `data/` (defaults.toml is include_str!'d at src/config/load.rs), SKILL.md (the
# `--skill` card, include_str!'d at src/run/discovery.rs), README, LICENSE stay in
# by default.
exclude = [
    "tests",
    "specs",
    "scripts",
    ".github",
    ".githooks",
    ".claude",
    "AGENTS.md",
    "Makefile",
    ".gitignore",
]

[lib]
name = "brazen"
path = "src/lib.rs"

# The CLI command is `bz` (the token-thrifty sugar), built from the same crate —
# exactly how the `balls` crate ships the `bl` command.
[[bin]]
name = "bz"
path = "src/main.rs"

# Build-time trust roots (arch §12). DEFAULT OFF, secure-by-default (owner ruling
# bl-770f): the plain build trusts only ureq's bundled Mozilla `webpki-roots` — a
# self-contained binary, no OS/corporate store. `native-certs` flips ureq to its
# platform-verifier (OS-native cert verification via `rustls-platform-verifier`) so
# enterprises building from source trust their own roots — `cargo install brazen
# --features native-certs`. The feature-gated wiring lives entirely in
# `src/native/transport.rs` (the coverage-excluded shim); the pure lib never sees it.
#
# `socks-proxy` (arch §10). DEFAULT OFF, mirroring `native-certs`: the plain build
# already honors HTTP/HTTPS CONNECT proxies from `HTTP_PROXY`/`HTTPS_PROXY`/
# `ALL_PROXY`/`NO_PROXY` (ureq reads them in `Config::default()` — no feature, no
# code), which covers the common corporate proxy. `socks-proxy` forwards to
# `ureq/socks-proxy` so a `socks5://`/`socks4://` `ALL_PROXY` is honored too, rather
# than silently ignored — `cargo install brazen --features socks-proxy`. Pure
# additive: zero brazen code is gated on it (it only flips a ureq dep), so the
# default dependency surface and 100% coverage are untouched.
#
# `native-host` (yog DESIGN §16.7 U-brazen; bl-547d). DEFAULT OFF: an embedding host
# (yog, lernie) that links the `brazen` lib needs the `bz` binary's native capability
# — the impure `Transport`/`CredStore`/`ModelCache` impls behind the lib's seams —
# without a system-installed `bz`. This feature re-exposes `src/native/` (the same
# coverage-excluded, purity-exempt shim the `bz` bin owns) as the `brazen::native`
# module, so a host can wire a `Host` and drive `brazen::run`/`generate`/`serve` in
# process. Pure code-gating: no dep changes (`ureq`/`libc` are already crate-wide),
# so the default surface, dependency graph, and 100% coverage are untouched. NO semver
# stability on the exposed impls (pin an exact version) — the feature IS the purity
# boundary, enforced by `tests/purity.rs`.
[features]
default = []
native-certs = ["ureq/platform-verifier"]
socks-proxy = ["ureq/socks-proxy"]
native-host = []

[dependencies]
serde = { version = "1", features = ["derive"] }
serde_json = "1"
toml = "0.8"
# PKCE S256 (RFC 7636): challenge = BASE64URL-NOPAD(SHA256(verifier)). Both are
# pure-Rust, no C deps (the musl/cross-compile story, arch §10, holds), and their
# code is not counted toward the lib's 100% line coverage — only our call sites.
# `sha2` is `default-features = false` — PKCE needs only the no_std `Sha256::digest`,
# not its `std` Write impl (audit bl-2936). `base64` uses the one `URL_SAFE_NO_PAD`
# engine and is also pulled transitively by `ureq`, so it adds no extra crate.
sha2 = { version = "0.10", default-features = false }
base64 = "0.22"

# --- Impure shim deps: used ONLY by the `bz` bin (`src/main.rs`) + `src/native/`. ---
# The pure library never imports these — enforced now by `tests/purity.rs`, since a
# single crate can no longer let the crate graph enforce it (bl-c1e2, was bl-c420).

# The blocking, rustls-backed HTTP client — the ONLY user of `ureq` (`src/native/
# transport.rs`), behind the lib's `Transport` seam. `rustls` TLS (`ring` crypto +
# bundled `webpki-roots`) — no OpenSSL/system lib/`pkg-config` (`ring`'s C/asm is
# vendored + statically linked), no async runtime (arch §10), so the single-binary
# musl/Windows/macOS story holds.
ureq = { version = "3", default-features = false, features = ["rustls"] }

# Unix-only: restore the default SIGPIPE disposition + isatty probes (arch §5.8,
# §5.5). `libc` carries no C deps; used only in `src/main.rs`.
[target.'cfg(unix)'.dependencies]
libc = "0.2"

# Test-only: a throwaway tempdir to root the real `XdgCredStore`/`XdgModelCache` so
# their atomic-write / 0600 / 0700 invariants are verified without touching
# `$XDG_DATA_HOME` (bl-5b5a).
[dev-dependencies]
tempfile = "3"
# Test-only: `tests/interface_parity.rs` parses `src/lib.rs` + the `bz` bin sources
# as syntax trees to derive the public surface and the CLI-reachable set mechanically
# (arch §9.8). Already in the lock graph via `serde_derive`, so it adds no new build
# cost; never shipped (dev-only).
syn = { version = "2", features = ["full", "parsing", "visit"] }