Shared interface design

BOM and PnP Interfaces

The BOM/PnP model is the shared normalization layer for manufacturing output commands. It keeps raw Altium Monkey data available, adds canonical fields through aliases, and produces grouped BOM and JLC rows without tying the CLI to private workflow code.

BomPnpConfig

Rationale

BOM, PnP, and JLC output need one versioned config shape for aliases, variants, output kinds, DNP placement/highlighting, PnP position mode, and naming templates.

Purpose

Represents the shared JSON config contract consumed by the BOM/PnP command family.

Test Requirements

Tests must cover parsing, default serialization, output kind validation, DNP display policy, default grouped BOM columns, PnP position mode selection, configured output path resolution, and semantic output-kind filename suffixes.

Working Definition

Working when a JSON-style mapping can select outputs, resolve paths, and round-trip into a deterministic template. The default name template uses OutputKindSuffix so format-only outputs rely on the file extension while semantic variants such as raw, grouped, and jlc-cpl remain visible in the stem. Default grouped BOM review output uses mfg, mpn, description, quantity, and designators, and omits line numbers unless the user explicitly adds the item field.

FieldAliasConfig

Rationale

Real projects use inconsistent parameter names for manufacturer, MPN, supplier, and value fields.

Purpose

Defines canonical field names and accepted aliases for BOM and PnP normalization.

Test Requirements

Tests must prove config-style mappings resolve parameters and can serialize deterministically.

Working Definition

Working when messy input parameters resolve to canonical fields without losing the source field name.

NormalizedBomComponent

Rationale

BOM outputs need both raw component parameters and normalized manufacturing fields.

Purpose

Represents one normalized BOM component with canonical fields and field-source traceability. Raw BOM JSON output deliberately bypasses this interface and writes a flat list of unaliased component dictionaries.

Test Requirements

Tests must cover alias resolution, source tracking, DNP state, JSON serialization, and the separate flat raw JSON output contract.

Working Definition

Working when raw BOM dictionaries become deterministic records suitable for raw JSON and grouping.

GroupedBomLine

Rationale

Manufacturing BOM outputs need line items grouped by equivalent purchasable identity.

Purpose

Represents one grouped BOM line with quantity, designator list, DNP state, and resolved fields.

Test Requirements

Tests must cover alias-based grouping, natural designator ordering, DNP line separation, DNP row placement, DNP XLSX highlighting, text-safe spreadsheet cells, inverse knockout headers, and the absence of Excel filter dropdowns.

Working Definition

Working when fitted and DNP components can be grouped into stable line items for JSON, XLSX, and JLC output while preserving review-visible DNP state.

NormalizedPlacement

Rationale

PnP output uses PCB placement data while sharing BOM-style parameter aliases.

Purpose

Represents one normalized placement with units, selected PnP position mode, layer, coordinate, rotation, and canonical fields.

Test Requirements

Tests must cover top/bottom ordering, natural designator sorting, JLC CPL formatting, and JSON payload shape.

Working Definition

Working when Altium Monkey PnP entries and dict fixtures produce stable CSV/JSON/JLC records.