Files
ianitor/CLAUDE.md
T

57 lines
4.3 KiB
Markdown

# CLAUDE.md — Ianitor Domi
Ianitor is a reverse proxy built on Cloudflare's Pingora, with a small Domi CA, a web UI and an API.
NixOS-native, with Caddy as a tested fallback. MPL-2.0. Plan, decisions and status: docs/ROADMAP.md — read it first.
## Layout
crates/core config model, schema, compilers (Pingora runtime + Caddy JSON), CA (Ianitor's view of the shared
crate domi-pki, pinned by tag). Pure: no I/O, no network.
crates/edge Pingora data plane. Reads compiled config, serves traffic. Never decides policy.
crates/control API, git routes repo, apply/rollback, share links, PKI flows. Loopback only. Never serves public traffic.
apps/web Svelte 5 (runes, TypeScript strict). A client of the API; no logic.
packages/ui shared dark Domi theme, murex palette.
tests/diff same requests against Ianitor and Caddy, responses compared.
tests/support shared test fixtures (test CA, upstreams, mock Authelia, clients); test-only.
tests/fuzz cargo-fuzz targets.
deploy/nixos NixOS module + VM tests.
scripts version check, release pin, test layers 2 and 5 (conformance, bench), the Nix pin. Releases: docs/release.md.
bench layer 5 results as data (CSV/JSON), layer 2 outputs.
## Commands
cargo test --workspace # quote test counts per crate; an exit code alone is not green
cargo run -p ianitor-control -- --dev
pnpm --filter web dev # 127.0.0.1 only, never --host
node apps/web/scripts/shots.mjs # the release's screenshots (demo data, headless Edge) -> target/aula (docs/release.md)
node scripts/check-version.mjs X.Y.Z # Cargo.toml and both package.json carry the version
scripts/conformance.sh # layer 2: h2spec + testssl.sh, Ianitor vs Caddy (nix develop .#ci)
tests/fuzz/run.sh 60 # layer 3: cargo-fuzz, 60 s a target; crashes become regressions
scripts/bench.sh <label> # layer 5: load and soak vs Caddy -> bench/results
scripts/nix-pin.sh # reproducible build check; writes .fabrica/nix/pin.json before a tag
nix build .#ianitor
nix flake check # includes NixOS VM tests (Linux + KVM)
On Windows, build and test in WSL2 Debian (ROADMAP §8.3: Pingora's Windows support is best effort; edge, diff and
ACME tests are Linux-only). Use a Linux target dir, and put caddy, pebble and pebble-challtestsrv on PATH (`nix profile add nixpkgs#caddy nixpkgs#pebble`):
wsl -d Debian -- bash -lc 'cd /mnt/f/Akce/Ianitor && CARGO_TARGET_DIR=$HOME/ianitor-target cargo test --workspace'
One-time per clone: git config core.hooksPath .githooks (self-test: bash .githooks/test-pre-commit.sh)
## Rules
- Commits: `[<crate|app>] <Feature>: <one line>`. No AI attribution, no trailers, ever.
- Never in git: target/, node_modules/, dist/, binaries, private keys, files over 5 MB. A pre-commit hook enforces it.
- $GITEA_TOKEN never echoed or written anywhere. Secrets come only from Custos or systemd credentials, never the Nix store.
- ianitor-control and every dev server listen on 127.0.0.1 only; only ianitor-edge binds public ports.
- Disks (Mark's machine): never write, move or delete anything on C:, and nothing on D: either. Everything goes on F:
(build output, clones, caches, temp files, tools, WSL swap), under F:\C-Drive-Migration when it replaces a C: path.
The only file kept on C: is C:\Users\chode\.wslconfig (WSL reads it only there; it points swap to F:). Every agent's
brief repeats this rule.
- Route files, API bodies, CSRs, headers and share tokens are hostile input: typed Result, no unwrap() on input paths, no swallowed errors.
- Every route change goes through the core compiler and the differential tests.
- Tests first only where the risk is: parsing, CA, share tokens, forward-auth, apply/rollback, secret injection.
- Workflow: branch → Gitea PR via API → short adversarial self-review in the PR body → merge --no-ff → push → verify hashes.
- Server changes: prepare the Nix change and show the command; Mark runs nixos-rebuild himself. deploy/test-access.sh must pass.
- When reporting done, say which build is deployed and whether it changed visibly.
- UI: dark Domi theme, murex palette; every action ≤ 3 clicks, plain English; Latin only in the brand name.
## Session end
Update the Status table and the Handover section at the bottom of docs/ROADMAP.md. No separate handover file.