API design docs

API

Typed helper interfaces used by the public CLI workflows and release gates.

Version

Rationale

Date-based releases need a typed view over the package version string so CLI, tests, and release automation can agree on the encoded calendar date.

Purpose

Version carries the parsed major, minor, patch, optional build, original string, and derived release date for kicad-cruncher.

Test Requirements

L99 verifies that pyproject metadata, package API, CLI output, changelog, and dated release notes all match the same date-version contract.

Working Definition

The interface is working when kicad_cruncher.version() parses the installed distribution version or source fallback into a valid date-version object.

KiCadModelPose

Rationale

Assembly SVG projection needs one KiCad-facing model pose that can be passed unchanged to Geometer HLR and model-bounds calls.

Purpose

KiCadModelPose carries the resolved model-to-KiCad-3D-world matrix, footprint side, board thickness, and a rounded cache signature for one footprint model.

Test Requirements

L3 verifies the dedicated HLR fixture against KiCad STEP-exporter transform order, including model offset, rotations, board thickness, and world-to-SVG coordinate conversion.

Working Definition

The interface is working when the same pose matrix aligns HLR detail, HLR simple, transformed model bounds, and copper fallback bounds for the signoff fixture and broader PCB SVG outputs.

PcbSvgComposition

Rationale

The PCB SVG command composes physical KiCad layers with derived virtual layers, so callers need both rendered SVG text and the physical layer dependencies used to build it.

Purpose

PcbSvgComposition is the internal return contract for A0 PCB SVG composition: it carries complete SVG text and the normalized physical layers represented in that output.

Test Requirements

L3 exercises explicit config rendering, layer outputs, virtual outputs, manifests, configured views, and enriched metadata that depends on the composition contract.

Working Definition

The interface is working when layer and view outputs render from the same compositor path and their manifests accurately report the physical layers behind each SVG artifact.

Policy

When another public dataclass or major interface is added, it must be listed here with machine-readable test ownership before L99 signoff can pass.