Skip to content

Rust API

The reference for the crate is generated by rustdoc from the //! and /// comments in the source — the same text you get from cargo doc --open. Because it is generated, it always matches the code.

Open the Rust API reference

What is in there

surface is a binary crate, so rustdoc runs with --document-private-items and what you get is the internals rather than a library API. That is the useful part: the module-level documentation is the design record, carrying the measurements and the rejected alternatives behind each decision.

Module Covers
scan The four sections, and the catch_unwind failure isolation around each
scan::tooling The 17-tool table and the five detection channels
scan::sites AI-domain history reads, and why the filter lives inside SQL
scan::usage Transcript parsing, and the two ways token counting goes wrong
scan::apps Installed application names, the one non-filesystem channel
ledger Dedup keys, byte offsets, per-day pruning
pricing The three price sources, and the three cost states
repo Turning a working directory into owner/name, and what is never emitted
browser Profile discovery, and the blind spots it reports
app / ui Dashboard state, row builders, and the six views
config / paths Settings, precedence, and platform directories

A few of those docstrings are worth reading before trusting a number: scan::usage explains the 15× overcount that cumulative sources cause, pricing explains why unpriced is not free, and repo lists exactly what never reaches the ledger.

How it gets built

An MkDocs hook (scripts/rustdoc_hook.py) runs cargo doc --no-deps --document-private-items on every site build and folds the output in under rust/ — in mkdocs serve, in mkdocs build, and in CI alike. Details in Writing docs.

Editing the crate while serving

mkdocs serve watches docs/, not src/, so changes to the crate do not trigger a rebuild on their own. Touch any docs page (or restart the server) and the hook regenerates the reference on the next build.

Not a library

There is no lib target and nothing here is a public API. Depending on these internals from another crate is not supported, and they change without notice — see Stability.

Testing it

cargo test                          # 246 tests, no fixtures and no network
cargo test --no-default-features    # the pure-Rust path

The tests are in the same files as the code they exercise, so a module's documentation, implementation and proof sit together.