Scaffold from an existing component¶
When you want to learn from a component that already exists — or take
one as the starting point for something new — simkit generate-dsl
turns an exported component into editable unified-DSL (.kts) source.
It is the counterpart to scaffolding from scratch:
instead of an empty skeleton, you get the real schema, interface, and
metadata filled in.
Prerequisites¶
- SimKit CLI installed and authenticated (see installation).
Export the component, then generate¶
First export the component (and its dependency closure) to an archive, then generate DSL from that archive:
simkit export --component-version simscale.cad:box:1.0.0 -o box.zip
simkit generate-dsl box.zip -o ./scaffold
generate-dsl writes one <id>.<kind>.kts per component version in
the archive (box.data-type.kts, and a file for each dependency it
pulled in). Use --no-dependencies on the export if you only want the
one component and not the types it builds on.
What you get¶
The generated .kts recompiles to an equivalent component — the whole
component is reverse-generated:
metadata— reference (with any snapshot suffix trimmed back to a clean version), name, and description;dependencies— each declared with the right builder (dataType/method/workflowType);- the full schema (
dataSchema/configurationSchema) — every field kind, including measurement units, dimensionals, entity assignments, and nested data types, with their labels and docs; - validation rule sets, UI configuration, and resource estimation;
- a method's
dataInterfaceandexecutableblock; - a workflow type's
workflowDefinition— its full operation graph.
The only difference from the original is stylistic: a few advanced constructs are written out with their explicit constructors instead of the shortest-possible shorthand. The scaffold still builds to the same component.
Make it your own¶
Before building, edit the scaffold:
- Change the
metadata { reference }to your owngroup:id:version— you are authoring a new component, not re-registering the original. - Adjust anything you want to differ from the original — that is the whole point of starting from a working example.
Then build and register as usual:
Cross-references¶
- Scaffold a component — the empty-skeleton starting point.
- Reference: unified DSL — the
.ktssurface you are editing. - Components and versions — choosing your new reference.
- Component export / import
— the archive format
generate-dslreads.