Expand description
§aidoc-core
Core library that turns rustdoc JSON output into LLM-facing
documentation artifacts. This crate holds all of the logic shared by
the two thin front ends in this workspace: the cargo aidoc subcommand
(crates/cargo-aidoc) and the MCP server (crates/aidoc-mcp).
§Architecture
The pipeline is split into three stages:
- Index — read rustdoc’s JSON output (produced via
cargo +nightly rustdoc -- -Z unstable-options --output-format json) and load it into an in-memory representation of the crate’s public API surface. - Generate — project the index into one or more LLM-facing
artifacts: an
llms.txtsummary, per-crate / per-module narrative markdown,llms-full.txt, and a deterministicapi/<crate>.jsonfor machine consumption (diffing, CI checks). - Lint — check the index against a set of doc-coverage rules
(crate root has a narrative, public modules are documented, the
generated
llms-full.txtfits a soft size cap) and report violations.
Both cargo-aidoc (CLI) and aidoc-mcp (MCP server) are thin front
ends over this pipeline; neither crate should contain pipeline logic
of its own. The single entry point for both is run, which returns
a Report of generated artifacts and lint diagnostics.
Re-exports§
pub use config::Config;pub use config::Platform;pub use config::Preset;pub use config::UnknownPlatform;pub use error::Error;pub use error::Result;pub use error_catalog::ErrorEntry;pub use error_catalog::Snippet;pub use generate::Artifact;pub use generate::ArtifactLocation;pub use index::IndexedCrate;pub use index::IndexedWorkspace;pub use lint::Diagnostic;pub use lint::Level;
Modules§
- config
- Configuration for the aidoc pipeline.
- error
- Error type for the aidoc pipeline.
- error_
catalog - Error-catalog extractor: build an LLM-facing catalog of every diagnostic emitted by the workspace, straight from rustdoc JSON.
- generate
- Generate stage: project an
IndexedWorkspaceinto LLM-facing artifacts. - index
- Indexed representation of a Rust workspace’s public API surface.
- lint
- Lint stage: report doc-coverage issues on top of an indexed workspace (and, for size-related lints, on top of the generated artifacts).
- platform
- Platform overlay dispatch: given a
Config::platformslist, add the platform-specific artifacts on top of the coredocs/aidoc/output produced bycrate::generate::render_all.
Structs§
- Diff
Summary - Detailed classification of every diff in a check-mode run.
- Report
- The output of a single pipeline run: everything a front end needs to
either write artifacts to disk (
cargo aidoc) or compare them to a checked-in tree (cargo aidoc --check).
Functions§
- classify_
diffs - Compare every artifact in
reportagainst its on-disk copy and return the categorised diff. Seewrite_reportfor howout_dirandworkspace_rootare interpreted. - diff_
report - Backwards-compatible wrapper around
classify_diffs. Returns the same flat list of paths that earlier versions of aidoc-core produced; new callers should preferclassify_diffsso they can distinguish missing from modified artifacts. - run
- Run the full index → generate → lint pipeline against the workspace
rooted at
workspace_root, usingconfigfor defaults, exclusions and strict-mode toggling. - write_
report - Write every artifact in
reportto disk.out_diris the base for artifacts whose location isArtifactLocation::OutDir; the workspace root is the base forArtifactLocation::WorkspaceRootartifacts (typically platform manifests such ascontext7.json).