Documentation
¶
Overview ¶
Command devicegen generates the device layer's device types from the resolved layer of parity/schema.json (the matter.js model extract): one file per device type in scope under device/, holding the type's id and revision, its [device.Type] with the cluster requirements matter.js's generator derives, a constructor and the typed accessors of its default servers — plus device/types_gen.go, the registry of every generated type, device/types_gen_test.go, which calls every constructor and accessor, device/doc_gen.go, the package doc with the lists of typed cluster packages and device types, docs/reference/device-types.md, the requirement tables of every type (docs.go). The device-type name is schema.DeviceTypeName's; the module keeps no second label table (review 2026-11 W5-api-15).
It is matter.js's support/codegen/src/endpoints translated: matter.js generates packages/node/src/devices and packages/node/src/endpoints from the model (EndpointFile.ts, RequirementGenerator.ts, ClusterRequirements.ts); so does this module. See docs/adr/0018-device-layer-and-node-facade.md.
Usage, from the module root (make generate-matter-schema runs it after clustergen, whose committed definitions it references):
go run ./script/devicegen # regenerate device/*_gen.go
go run ./script/devicegen -out DIR # into DIR instead (the reference
# page too)
The committed set is the device types in scope (committed in devicetypes.go): since wave 27-C2 every snapshot device type, 91/91. excluded, empty now, is where a snapshot device type taken out of scope is listed with its reason.