A lightweight Gerber PCB manufacturing file inspection and preflight tool written in MoonBit.
Dependencies
moon version --all
moon updatemoon run cmd/main --target native -- inspect <FILE> [--json]
moon run cmd/main --target native -- check <FILE> [--json]
moon run cmd/main --target native -- --help
moon run cmd/main --target native -- --versionmoon run cmd/main --target native -- inspect samples/pass/minimal.gbrGerberGuard 0.1.0
File: samples/pass/minimal.gbr
Format: Gerber Layer Format (supported subset)
Unit: millimeter
Coordinate format: 4.6
File function: Copper,L1,Top
File polarity: Positive
Generation software: -
Statistics
----------
Apertures: 1
Aperture macros: 0
Moves: 1
Draws: 1
Flashes: 0
Regions: 0
Arc draws: 0
Comments: 0
Attributes: 2
Unknown commands: 0
Result: PASS
Errors: 0
Warnings: 0moon run cmd/main --target native -- check samples/fail/undefined_aperture.gbrGerberGuard 0.1.0
ERROR G201 line 4
Undefined aperture D15.
Result: FAIL
Errors: 1
Warnings: 0moon run cmd/main --target native -- check \
samples/pass/minimal.gbr \
--json{
"tool": "gerberguard",
"version": "0.1.0",
"command": "check",
"file": "samples/pass/minimal.gbr",
"status": "pass",
"unit": "mm",
"coordinate_format": { "integer_digits": 4, "decimal_digits": 6 },
"file_function": "Copper,L1,Top",
"file_polarity": "Positive",
"generation_software": null,
"statistics": {
"apertures": 1,
"aperture_macros": 0,
"moves": 1,
"draws": 1,
"flashes": 0,
"regions": 0,
"arc_draws": 0,
"comments": 0,
"attributes": 2,
"unknown_commands": 0
},
"errors": 0,
"warnings": 0,
"issues": []
}| Code | Meaning |
|---|---|
| 0 | PASS or PASS WITH WARNINGS |
| 1 | Report contains one or more Error issues |
| 2 | CLI usage / argument error |
| 3 | File IO / UTF-8 decode error |
moon fmt
moon check --target all --deny-warn
moon test --target all --deny-warn
moon build --release --target native
moon info
git diff --exit-codemodel.mbt
scanner.mbt
parser.mbt
checker.mbt
report_text.mbt
report_json.mbt
cli.mbt
cmd/main/main.mbt
samples/{pass,warn,fail}/
docs/{ARCHITECTURE,SUPPORTED_SYNTAX,ERROR_CODES}.md
.github/workflows/ci.ymlpub(all) struct GerberAttribute {
scope : AttributeScope
name : String
raw_value : String?
line : Int
} derive(Eq, Debug)pub(all) enum GerberCommand {
Comment(String)
Format(CoordinateFormat)
Unit(GerberUnit)
ApertureMacro(String, String)
ApertureDefinition(ApertureDefinition)
SelectAperture(Int)
SetPlotMode(PlotMode)
MultiQuadrant
Move(CoordinateFields)
Draw(CoordinateFields)
Flash(CoordinateFields)
BeginRegion
EndRegion
SetPolarity(Polarity)
Attribute(GerberAttribute)
DeleteAttribute(String?)
EndFile
UnknownWord(String)
UnknownExtended(String)
Malformed(String)
} derive(Eq, Debug)pub(all) struct GerberReport {
status : AnalysisStatus
unit : GerberUnit?
coordinate_format : CoordinateFormat?
file_function : String?
file_polarity : String?
generation_software : String?
statistics : GerberStatistics
issues : Array[Issue]
} derive(Eq, Debug)A lightweight Gerber PCB manufacturing file inspection and preflight tool written in MoonBit.
Dependencies