CLI command design
json-dump
Writes compact JSON snapshots of parsed Altium documents for reference inspection.
Purpose
json-dump makes fixture and workflow development faster by exposing parsed SchDoc, SchLib, PcbDoc, and PcbLib contents without requiring custom Python snippets. The command envelope uses the altium_cruncher.json_dump.a0 schema, while document payloads use Altium Monkey-owned document contracts. SchDoc and SchLib payloads identify as altium_monkey.schdoc.interop.a0 and altium_monkey.schlib.interop.a0; PcbDoc and PcbLib payloads identify as altium_monkey.pcbdoc.structural.a0 and altium_monkey.pcblib.structural.a0 so the same shapes can become direct import targets when those importers are promoted.
Usage
altium-cruncher json-dump [files-or-directories...] -o output/json-dump
altium-cruncher json-dump board.PcbDoc --stdout
altium-cruncher json-dump project.PrjPcb
altium-cruncher json-dump . --recursive --layout flatArguments
| Argument | Contract |
|---|---|
paths | Optional files or directories. With no paths, the command looks for one project in the current directory, otherwise dumps supported files in the current directory. |
--recursive | When a directory is supplied, include supported files under descendants. |
-o, --output | Output directory. Defaults to output/json-dump. |
--layout | Batch output layout. by-kind is the default and writes domain folders such as schdoc/ and pcbdoc/ directly under the output directory. flat writes all dump files directly under the output directory. |
--stdout | Write the single resolved document payload to stdout. This is invalid when more than one document is resolved. |
Output
Each dump file uses an altium_cruncher.json_dump.a0 envelope with only schema, kind, and document. The nested document value is the parsed Altium document payload and follows the owning altium-monkey document shape. Batch runs with the default by-kind layout write document payloads under schdoc/, schlib/, pcbdoc/, or pcblib/ based on document kind. --layout flat writes every dump file directly under the output directory. Batch runs also write manifest.json with schema altium_cruncher.json_dump.manifest.a0 to map source paths to output files.
{
"schema": "altium_cruncher.json_dump.a0",
"kind": "PcbDoc",
"document": {}
}Tests
Coverage lives in tests/test_json_dump.py. It verifies PcbDoc structural dumping, SchLib dumping, project expansion, manifest shape, stdout behavior, default by-kind output, flat output, and CLI registration.