On This Page (9)
kcr health
Scan a KiCad project for local assets, embedded model references, external STEP/STP references, and missing model payloads.
| Command | Aliases | Category | Runtime | Config | Guide |
|---|---|---|---|---|---|
kcr health | — | Projects, Libraries & Assets | Python kcr | None (CLI flags only) | — |
Usage
kcr health [-h] [-o OUTPUT] [--fail-on-issues]
[--require-embedded] [--show-exempt] [--show-all]
[--json] [--no-color]
[file]Positional Arguments
| Argument | Description |
|---|---|
file | KiCad .kicad_pro project; optional when one .kicad_pro is in CWD |
Options
| Flag | Description |
|---|---|
-o, --output OUTPUT | Output directory (default: ./output/health) |
--fail-on-issues | Return a nonzero exit code when diagnostics or missing models are found |
--require-embedded | Treat resolved external 3D models as issues (enforce embedded portability) |
--show-exempt | List expected model-less footprints (test points, fiducials, mounting holes, DNP) |
--show-all | Show every table row instead of truncating after 15 rows |
--json | Also print the machine-readable JSON report to stdout |
--no-color | Disable ANSI colors and animated spinners |
How It Works
kcr health is a 100% read-only asset and 3D-model portability auditor for KiCad projects (.kicad_pro). It scans schematics, PCBs, footprints, library tables, and 3D model references, then writes:
<output>/project_health.json(kicad_cruncher.project_health.a0) — full machine-readable diagnostic report (default output directory:./output/health).<output>/README.md— human-readable summary of counts, missing models, external references, and actionable footprints without 3D models.
Pass --json to also print the complete project_health.json payload to stdout for CI scripts and agents.
Issue Classification & Promotion Rules
kcr health cleanly separates hard portability issues (ok: false), non-fatal warnings, and expected exemptions:
| Finding | Default Status | With --require-embedded | Notes |
|---|---|---|---|
Missing embedded payload (kicad-embed:// absent from embedded_files) | Issue (missing_embedded_payload) | Issue | Broken reference inside .kicad_pcb/.kicad_mod |
| Unresolved external model file | Issue (missing_or_unresolved_model) | Issue | External path does not resolve on disk |
| Resolved external STEP/STP model | Warning / informational | Promoted to Issue (external_model_reference) | Enforces self-contained CI portability; fix with kcr pcb embed-models |
Resolved .wrl-only model (no .step/.stp sibling) | Warning only | Promoted if external (external_model_reference) | WRL-only by itself is a warning (not a hard error) when embedded; Geometer 3D HLR requires STEP |
| Actionable footprint missing a visible 3D model | Issue (footprint_without_model) | Issue (footprint_without_model) | Grouped by footprint + PCB; hidden-only models are flagged |
| Exempt model-less footprint | Exempt (hidden unless --show-exempt) | Exempt | See exemption rules below |
Exempt Model-Less Footprints
Footprints without visible 3D models are automatically classified as exempt (never cluttering actionable issues) when they match any of:
Edge.Cutsboard-template footprints (edge_cuts),board_only, no pads at all (no_pads),dnp, or bothexclude_from_bom+exclude_from_pos_files(non_bom_non_pos).- Net ties and solder jumpers (
net_tie_or_jumper). - Single-pad or NPTH-only (
pad_shape) mechanical features: test points (TP*,TEST*,PROBE*), fiducials (FID*,FD*), and mounting holes (H*,MH*,MP*,MTG*,HOLE*, or NPTH-only holes).- Guardrail: a multi-pin connector named
TP1is not exempt because the prefix exemption only applies topad_shape(single-pad / NPTH-only) footprints.
- Guardrail: a multi-pin connector named
Exit Codes & CI Gating
- Default behavior: returns exit code
0even when issues are found (so interactive audits can inspect the full report). --fail-on-issues: returns exit code1wheneverreport["ok"]isfalse(any scan diagnostic or portability issue — includingmissing_embedded_payload,missing_or_unresolved_model,footprint_without_model, andexternal_model_referencewhen--require-embeddedis also set).- Table truncation: terminal tables cap at 15 rows by default; pass
--show-allto print every row and--show-exemptto include the exempt model-less table.
Quick Examples
# Audit embedded vs external STEP/STP references and missing payloads
kcr health project.kicad_pro --fail-on-issues# Fail if any board/footprint model is still external instead of kicad-embed://
kcr health project.kicad_pro --require-embedded --fail-on-issues