notes for coding agents working on hasheus-cli. the readme is the runbook for setup, config, sample data, and releasing; this file covers what it doesn't.
a change is done when all of these pass. ci runs the same, with the tests under cargo-llvm-cov for coverage:
cargo fmt --check
cargo clippy --locked --all-targets -- -D warnings
cargo test --locked
cargo build --lockedthe tests run against nostr-sdk's in-process relay, so they need no network or running relay.
src/is flat: one module per file, each with one job and named after it. a module that acts is named as a doer (verification_fetcher,file_hash_reporter,secret_key_reader); one that holds data is a plain noun (relay_config,file_event). a new concept gets a new module, declared in alphabetical order inmain.rs; anything else goes in the module it supports.main.rsandcli.rsstay thin.file_verifierandverification_publisherorchestrateverifyandpublish, and delegate to the other modules.- tests live in a
#[cfg(test)] mod testsat the bottom of the module they test. shared test helpers are the test-onlytest_event_buildersandtest_relaysmodules (run_relay,build_relay_config,DEAD_RELAY_URL).
- all copy is lowercase: help text, messages, errors, comments, and docs.
clap's own help text is rewritten to match in
cli.rs, and thelowercases_the_helptest enforces it. env vars and other case-sensitive tokens keep their case. - errors: every failure is a variant of
HasheusError, with a lowercase message in itsDisplayand a stable snake_casecode()for the json output. scripts branch on the code, so never rename an existing one. never include a secret key, password, or a value that could be a mangled secret in a message. - output: with
--json, results and errors both go to stdout, errors as{"error":{"code":…,"message":…}}with exit code 1. an unverified file isn't an error: the exit code is 0 unless something fails. text output only prompts with a terminal on stdin (OutputFormat::can_prompt), and json never does. - untrusted input: anyone can publish to nostr, so only http and https urls
are shown, and text from an event goes through
text_sanitizer::sanitizebefore it's printed as text. json escapes it already, so--jsonpasses it through as is. - parity with the web app: the cli mirrors
hasheus (cloned next to this repo as
../hasheus): the same event tags, form limits, caching, and verdicts. check the web app before changing any of those, and say so in a comment when matching it ("like the web page, …"). - comments are rare and explain why, not what, in lowercase full sentences.
- new words that trip the spell checker go in
cSpell.wordsin.vscode/settings.json, alphabetized. - the rust version is pinned in
rust-toolchain.tomlandrust-versioninCargo.toml; bump both together.
- run
bin/releasewithout--dry-run: it creates a github release and publishes verifications to the production relays. - run
hasheus publishagainst the production relays. pointHASHEUS_FILE_RELAY_URLSandHASHEUS_USER_RELAY_URLSat a local relay, likenak serve(see the readme's sample data), since a published verification can't be undone.