Command-line inspection, authoring, and compilation for canonical SQLite .shift documents.
The crate builds the shift-cli binary. inspect opens a document, summarizes the font model, and can emit stable JSON for scripts and CI. Resource commands apply semantic Shift intents through a temporary recovery overlay and save only after the complete change validates. compile sends the canonical Shift model directly through fontir/fontc to produce a TrueType font.
cargo run -p shift-cli -- inspect path/to/Family.shift
cargo run -p shift-cli -- inspect --view axes path/to/Family.shift
cargo run -p shift-cli -- inspect --view mappings path/to/Family.shift
cargo run -p shift-cli -- inspect --view sources path/to/Family.shift
cargo run -p shift-cli -- inspect --view layers path/to/Family.shift
cargo run -p shift-cli -- inspect --json path/to/Family.shift
cargo run -p shift-cli -- glyph inspect path/to/Family.glyphs Aacute
cargo run -p shift-cli -- glyph inspect path/to/Family.designspace Aacute \
--location wght=700 --view variation --json
cargo run -p shift-cli -- compile path/to/Family.shift --output path/to/Family.ttf
cargo run -p shift-cli -- font create path/to/Lab.shift
cargo run -p shift-cli -- axis add path/to/Lab.shift \
--tag wght --name Weight --min 100 --default 400 --max 900
cargo run -p shift-cli -- source add path/to/Lab.shift \
--name Black --location wght=900
cargo run -p shift-cli -- glyph add path/to/Lab.shift A \
--unicode U+0041
cargo run -p shift-cli -- layer add path/to/Lab.shift \
--glyph A --source Regular --input A-regular.json
cargo run -p shift-cli -- layer copy path/to/Lab.shift \
--glyph A --from-source Regular --source BlackHuman-readable output is quiet by default and uses plain text when stdout is redirected. Use --json when another tool needs the complete report.
Document inspection views:
summary: document identity, schema, counts, and sourcesaxes: variable font axesmappings: independent and cross-axis mappingssources: design sources and locationsglyphs: glyph names, Unicode values, and layer countslayers: glyph layer source bindings and geometry counts
glyph inspect reads one glyph through Shift's semantic font model from .shift, UFO,
Designspace, Glyphs, TTF, or OTF input. Locations use external/user-space TAG=VALUE
coordinates and are mapped once into design space. Its views are:
summary: identity, location, selection mode, bounds, and geometry countsstructure: resolved root contours, anchors, and ordered component occurrencessources: layer presence and structural compatibility by sourcevariation: selected interpolation model, source weights, and support regionsresolved: location-evaluated points with components flattened
--json emits the complete GlyphInspection regardless of the selected human-readable view.
Authoring commands operate on Shift domain objects rather than persistence rows. The resource surface creates font topology, glyph identity, and sparse authored layers:
shift font create Lab.shift
shift axis add Lab.shift --tag wght --name Weight --min 100 --default 400 --max 900
shift source add Lab.shift --name Black --location wght=900
shift glyph add Lab.shift A --unicode U+0041
shift layer add Lab.shift --glyph A --source Regular --input A-regular.json
shift layer copy Lab.shift --glyph A --from-source Regular --source BlackShift mints every new entity ID. Human and agent workflows may read returned IDs and use them as selectors, but authoring commands never accept caller-chosen identity.
layer add reads a semantic layer payload from a JSON file, or from stdin when --input - is used. Glyph and source membership stay in the command selectors instead of being duplicated inside the payload:
{
"advance": 600,
"contours": [
{
"closed": true,
"points": [
{ "x": 0, "y": 0 },
{ "x": 300, "y": 700, "pointType": "onCurve" },
{ "x": 600, "y": 0 }
]
}
],
"anchors": [{ "name": "top", "x": 300, "y": 700 }]
}Identity is not part of the layer payload. pointType defaults to onCurve; accepted values are onCurve, offCurve, and qCurve. A new layer payload currently authors contours and anchors. layer copy preserves complete authored layer content, including components, while minting fresh internal identities.
Every mutation supports:
--dry-runto execute real domain validation without writing;--jsonfor a structured result; and--output Variant.shiftto leave the input untouched and write an independent document.
In-place changes retain DocumentId. --output refuses to overwrite an existing destination and mints a new DocumentId. All mutations use a temporary sparse recovery overlay; canonical bytes change only after the complete semantic change succeeds.
cargo install --path crates/shift-cli --bin shift-cli --force
shift-cli inspect --view layers path/to/Family.shift
shift-cli compile path/to/Family.shift --output path/to/Family.ttfAfter pulling or merging main, rerun the same cargo install command to update the installed binary.
cargo test -p shift-cli
cargo run -p shift-cli -- inspect --help
cargo run -p shift-cli -- compile --help
cargo run -p shift-cli -- axis add --help
cargo run -p shift-cli -- source add --help
cargo run -p shift-cli -- glyph add --help
cargo run -p shift-cli -- glyph inspect --help
cargo run -p shift-cli -- layer add --help
cargo run -p shift-cli -- layer copy --help