CLI command design

schlib

Authors schematic libraries through generated MCO operations.

Purpose

schlib creates a valid blank schematic library seed for fixture and generated-project workflows. A blank SchLib intentionally contains one empty part/symbol so it opens as useful editable library content in Altium.

Usage

altium-cruncher schlib create symbols/generated.SchLib
altium-cruncher schlib create symbols/generated.SchLib --symbol BLANK_SYMBOL --description "Blank symbol"
altium-cruncher schlib create symbols/generated.SchLib --emit-mco generated.mco.json --json

Arguments

ArgumentContract
create fileDestination .SchLib. Paths are passed into generated MCO as file.
--symbolInitial symbol name. If omitted, the output filename stem is used.
--descriptionInitial symbol description.
--emit-mco, --force, --dry-run, --json, --json-outputFollow the shared MCO command semantics for operation emission, overwrite, non-mutating planning, stdout JSON, and sidecar JSON report output.

MCO Shape

schlib create compiles to schlib.create followed by schlib.add_symbol. Keeping creation and symbol insertion separate makes later symbol-primitive operations reusable by generated workflows.

Output

The command writes the requested .SchLib unless --dry-run is used. Human output is the standard MCO execution summary. In --json mode, lower-level save progress is redirected to stderr so stdout is only the execution report JSON.

Tests

Coverage lives in tests/test_mco.py and tests/test_document_create_commands.py. It verifies MCO execution, command MCO emission, clean JSON stdout, and reparsing the generated library with exactly one named symbol.