Expand description
House-style ADR/blueprint/site-page parsing and roteiro check drift
detection.
An ADR becomes an adr node with adr_section children; its
[[path#Symbol]] wiki-links and @rto:<id> source annotations become
authored edges into the derived code graph. check::run validates those
links against the graph and fails on drift (a link to a missing symbol, or a
@rto: annotation to an unknown or superseded ADR).
SitePage is the same treatment for the public website: a document that
declares itself published becomes a site_page node whose links are
drift-checked like an ADR’s, so roteiro.dev stops being the one documentation
surface outside the gate. See site for why publication is a
frontmatter marker rather than a directory.
Structs§
- AdrDoc
- A fully-parsed ADR: metadata, section structure, and authored links.
- AdrMeta
- Metadata for one ADR, as read from its frontmatter.
- Annotation
- A
@rto:<id>annotation found in a source file. - Authored
Docs - The authored layer plus the site pages — everything one tree’s classify pass yields.
- Authored
Layer - The authored documents found in one tree, ready for
crate::check::runorcrate::check::validate. - Blueprint
Doc - A fully-parsed blueprint: title, section structure, and authored links.
- Check
Report - The outcome of a
run: how much authored content was checked and any drift found. - Checked
Against - Which graph the verdict describes, so a reader can tell what was compared.
- DocVersion
- A two-component ADR document version, e.g.
1.10. - Graphify
Import - The result of importing a Graphify graph: the facts to apply and a report.
- Import
Report - An auditable summary of a Graphify import.
- Inline
Version Ref - One
(Update, vX.Y…)note found in an ADR body. - LatAnnotation
- A
@lat:backlink found in a source file: a code→lat reference carried in a[[…]]wiki-link on a comment line. - LatImport
- The result of importing a lat.md directory: the authored facts and a report.
- LatReport
- An auditable summary of a lat.md import.
- Section
- One
##section of an ADR body. - Site
Page - A fully-parsed site page: what the site publishes, and the authored links the check validates.
- Spec
Context - Graph-grounded context for a topic: the related symbols (with neighbourhood), related docs/ADRs, and the set of ADRs that govern any matched symbol.
- Symbol
Context - A code symbol related to the topic, with the slice of its graph neighbourhood that grounds authoring: what defines it, what it calls / is called by, and the authored ADRs/sections that govern it.
- Tool
Check - The tool-surface
checkresult. - Validation
- The outcome of a read-only
validate: the report, plus theauthorededges the valid links and annotations would weave into the graph. - Version
Facts - Every claim an ADR makes about its own version, gathered so
crate::check::validatecan cross-check them against each other. - Violation
- A single authored-layer drift finding.
- Wiki
Link - A
[[path#Symbol]](or[[path]]) authored link found in an ADR, resolved to the graph node key it should point at.
Enums§
- AdrStatus
- ADR lifecycle states, exactly as the house style defines them.
- Gate
- The gate verdict, as a value rather than an exit code.
- Import
Error - Errors raised while importing.
- Parse
Error - Errors raised while parsing ADR metadata.
- Site
Parse Error - Why a document that declared itself a site page could not be parsed as one.
- Violation
Kind - The category of an authored-layer drift.
Constants§
- GRAPHIFY_
REF src_refstamped on every edge imported from Graphify, so it can be told apart from otherinferrededges (e.g. the embedding layer’s).- LAT_REF
src_refstamped on every edge imported from lat.md, so it can be told apart from otherauthorededges (ADRs) and re-derived authoritatively on re-import.- SITE_
PAGE_ FIELD - The frontmatter field that declares a document published, and carries its slug. Its presence is the whole classification rule.
- SPEC_
SCHEMA - Versioned schema tag for authoring outputs, so agents can depend on the shape.
- TOOL_
CHECK_ SCHEMA - Schema tag for the tool-surface
checkdocument.
Functions§
- apply_
drafts - Splice generated prose back into a scaffold: each
_TODO…_line under a heading present indrafts(as(heading, prose)) is replaced by that prose. Headings without a draft, and all other lines, are left unchanged. - authored_
blobs - Which files in
source’s tree carry the authored layer. - authored_
docs - Read and parse everything the authored classification yields from
source’s tree: the file set fromauthored_blobs, the bytes fromRepo::read_source, and the classification fromauthored_docs_from. - authored_
docs_ from - Classify and parse the authored layer out of
blobs, reading each blob’s bytes withread. - authored_
layer - Read and parse the authored layer from
source’s tree, discarding the site pages — seeauthored_layer_from. - authored_
layer_ from - Classify and parse the authored layer out of
blobs, reading each blob’s bytes withread— discarding the site pages. - context
- Assemble graph-grounded
SpecContextfortopic, keeping up tolimitsymbols and up tolimitdocs (most relevant first). - draft_
prompt - Build a grounded generation prompt (a plain-text user message) for the
headingsection of an artifact abouttopic, usinghintas guidance andctxas the real symbols/ADRs the model may reference. The prompt constrains the model to the grounded facts so drafts stay honest. - draft_
targets - The placeholder sections of a scaffold a generator should fill:
(heading, hint)for each_TODO…_line, in document order.hintis the guidance text after_TODO:(empty for a bare_TODO._). - import_
graphify - Import a Graphify node-link JSON graph into Roteiro facts.
- import_
lat - Import a lat.md directory.
filesare(repo-relative path, content)pairs for the markdown underlat.md/. Cross-file section links are resolved against the set of files provided. - import_
lat_ backlinks - Resolve
@lat:backlinks against the lat file set, returningauthoredreferencesedges (file:<path>→ lat section, stampedLAT_REF) and the number that named no known lat file. Only lat-section references resolve here; a backlink to a non-lat target is dropped (and counted unresolved). - is_
blueprint - Whether a markdown file is a house-style blueprint: it lives under
docs/blueprint/docs/blueprints, or its first H1 carries the— Technical Implementation Planmarker. Callers apply this only to non-ADR markdown (ADRs are recognised first). - is_
site_ page - Whether a markdown document declares itself published: its frontmatter
carries a non-empty
MARKER_FIELD. - parse_
adr - Parse an ADR markdown document at
rel_path. - parse_
blueprint - Parse a house-style blueprint markdown document at
rel_path. Infallible: with no frontmatter there is nothing that can fail to parse (an empty or heading-less file yields a titled node with no sections/links). - parse_
site_ page - Parse a house-style site page at
rel_path. - resolve_
lat_ ref - A lat reference (in a
[[…]]link or a@lat:annotation) resolved to the graph node key it targets, if it names a known lat file. - run
- Apply the authored layer to
storeand validate it against the derived graph, returning aCheckReport. - run_
layer runover a wholeAuthoredDocs, including its site pages. Seevalidate_layerfor why both entry points exist.- scaffold_
adr - Generate a house-style ADR skeleton for
topic, grounded inctx: correct frontmatter (idadr_id,Draft), the house section headings with placeholders, a clarify interview checklist, and a build-plan outline. The[[…]]links it emits — affected symbols and related ADRs — are drawn from the graph, so they resolve and the scaffold isroteiro check-clean by construction.dateisYYYY-MM-DD(the caller supplies today’s date). - scaffold_
blueprint - Generate a house-style blueprint (technical implementation plan) skeleton
for
topic, grounded inctx. Blueprints have no YAML frontmatter: an— Technical Implementation PlanH1, a grounding intro citing related ADRs and affected code, aStatusblockquote, then numbered sections (scope → crate placement → design → testing → phased build order → risks) plus a clarify interview. Grounded[[…]]links resolve against real nodes. - scan_
annotations - Find every
@rto:<id>annotation on a comment line intext, tagged withrel_path. - scan_
lat_ annotations - Find every
@lat:backlink intext, tagged withrel_path. Recognition is restricted to comment lines (as with@rto:) so example tokens in string literals are not mistaken for real backlinks, and the reference must be a[[…]]wiki-link so a lat name containing spaces is delimited unambiguously. A single comment may carry several (// @lat: [[a#x]] [[b#y]]). - site_
nav - The site navigation order: every page, sorted by
site-orderthen slug. - tool_
check - Run
roteiro check’s drift validation read-only againststore, with the authored layer read from the committedHEADtree of the repository atroot. - validate
- Validate the authored layer against the derived graph without writing anything, returning the report and the edges a writing caller should weave.
- validate_
layer validateover a wholeAuthoredDocs— the same verdict, plus the site pages the three-slice form has no parameter for.
Type Aliases§
- Blob
Reader - Yields a blob’s authored bytes, or
Nonewhen the tree has no such file (a worktree deletion, which the caller drops).