Skip to main content

Module archify

Module archify 

Source
Expand description

Archify architecture-diagram JSON exporter (seeded, grouped, tier-typed). Archify architecture-diagram exporter.

Turns a seeded, depth-limited code subgraph into Archify architecture diagram JSON. sqry supplies the code-grounded facts (real symbols, kinds, files, languages, calls, HTTP/DB/queue edges); Archify owns the presentation layer (themed HTML/SVG rendering). This module is the bridge and adds no new graph facts, node kinds, or edge kinds.

§What it emits

A typed model (Section “Emission model”) that mirrors Archify’s schema exactly, so invalid diagram types, component types, card colours, or extra fields are unrepresentable. Symbols group into tier-typed components and package boundaries; retained edges aggregate into connections; summary cards explain the picture; a deterministic grid layout fixes placement with no pixel math.

§Independent edge retention (decoupled)

[archify_classify_edge] is this module’s own edge-retention policy. It retains the semantically rich cross-service edges (HttpRequest, DbQuery, MessageQueue, …) that the raw dot / d2 / mermaid / json exporters intentionally drop. It does not touch, widen, or share the MCP export walk’s classify_edge_for_export, so those existing formats are provably unchanged by this feature.

§Determinism

Same graph + same seeds + same limits produce byte-identical JSON, including across parallel graph rebuilds. Every ordering is explicit: the seeded walk ([super::subgraph]) is deterministic, component ids are assigned in sorted cluster-key order with stable collision suffixing, connections sort by (from, to), grid columns follow stable BFS rank, and elision tie-breaks by (degree, id).

§Confidence tiers (fail-safe inference)

Component-type inference is tiered. High-confidence types are code-evident (a React component node, an HTTP endpoint, a DB target). Medium/Fallback types are inferred and degrade to backend / external, are tagged inferred with their basis in the sublabel, and are listed in an “Inferred tiers” card. Low-confidence cloud / security name heuristics are deliberately deferred in v1 (never emitted); such clusters fall back to backend / external.

Structs§

ArchifyBoundary
A package/region boundary wrapping component ids.
ArchifyBuildMeta
An Archify document plus the seeded-walk signals (ArchifyBuildMeta) callers need to report accurate truncated / total fields, instead of hardcoding them (the walk itself is the only place that knows whether max_results was hit).
ArchifyCard
A summary card.
ArchifyComponent
A single architecture component.
ArchifyConfig
Archify exporter configuration.
ArchifyConnection
An aggregated connection between two components.
ArchifyDocument
Top-level Archify architecture document.
ArchifyLayout
Grid layout descriptor (mode: "grid" only).
ArchifyMeta
Diagram metadata block.

Enums§

ArchifyEdgeClass
Archify connection category for a retained edge.
ArchifyError
Fail-closed self-validation errors. The exporter returns one of these rather than write a malformed diagram to disk.
BoundaryKind
Archify boundary kind.
CardDot
Archify card accent colour.
ComponentType
Archify component tier type (the seven schema componentType values).
Variant
Archify connection visual variant.

Constants§

ARCHIFY_SCHEMA_VERSION
Archify JSON schema contract version this exporter targets.
DEFAULT_MAX_COMPONENTS
Default cap on the number of emitted components after grouping.
GRID_COL_CAP
Archify grid layout hard column cap (schema: cols in 1..=12).

Functions§

archify_classify_edge
The Archify edge-retention policy: independent from the raw exporters.
build_archify_document
Build an Archify architecture document from concrete seeds.
build_archify_document_with_meta
Build an Archify document, also returning the seeded-walk’s truncation/total signals.
export_archify_json
Build an Archify document and serialize it to pretty JSON bytes-string.