CLI command design
bom
Exports bill-of-materials data from Altium schematic or project inputs. The command uses the shared BOM/PnP normalization layer for canonical aliases, grouped JSON/CSV/XLSX, configurable DNP handling, optional PCB line items, and JLC BOM rows.
Usage
altium-cruncher bom project.PrjPcb --format json -o output/bom
altium-cruncher bom schematic.SchDoc --format xlsx
altium-cruncher bom project.PrjPcb --variant B4
altium-cruncher bom project.PrjPcb --format grouped-json
altium-cruncher bom project.PrjPcb --format jlc-csv
altium-cruncher bom project.PrjPcb --format jlc-xlsx
altium-cruncher bom --write-config bom.config
altium-cruncher bom project.PrjPcb --config bom.configArguments
file accepts .SchDoc or .PrjPcb. --format selects one legacy output format and overrides multi-output config mode. Without --format, the command loads bom.config from the working directory or creates it when absent. --config selects a specific docs/contracts/bom_pnp_config.v1.schema.json-shaped JSON or JSONC config path and also creates that path on first config-mode use. --write-config writes a default editable config without requiring a design file. --variant and --all-variants override config variant policy. -o is the legacy output directory or the config output root.
Output
Legacy output is written under the selected output directory using the input stem. Config output uses dir_template and name_template with project parameters plus Command, OutputKind, SourceName, SourceStem, and VariantName tokens. Configured BOM outputs include raw-json, legacy-json, grouped-json, grouped-csv, grouped-xlsx, jlc-csv, and jlc-xlsx. The generated default processes all variants including the no-variant base, writes raw-json and grouped-xlsx, groups by mfg, mpn, and description, and emits the grouped fields mfg, mpn, description, quantity, and designators. mfg and mpn are table-field aliases for the canonical manufacturer and manufacturer_part_number parameters. raw-json is a flat list of unaliased component dictionaries from the selected Altium source. Grouped XLSX output omits the line-number item column unless explicitly configured, writes spreadsheet-safe text cells, uses inverse knockout header styling, and does not enable Excel header filter dropdowns. Configured outputs write bom.config.used.json beside generated artifacts.
Tests
Current L3 coverage verifies BOM JSON generation on Hydroscope. Unit tests cover alias resolution, config parsing, grouped BOM lines, natural designator sorting, raw JSON, DNP row placement, DNP XLSX highlighting, grouped table rows, XLSX generation, and JLC BOM rows. Planned BOM parity tests use node_test_array for hierarchy, variants, DNP handling, and field aliasing.