How sync works in 5 minutes
bausteinsicht sync keeps two files in agreement: the model architecture.jsonc (text) and the diagram architecture.drawio. It is not a copy in one direction and not a merge of two files. It works like this:
-
It reads the model, the diagram and a third file,
.bausteinsicht-sync, the sync state: what both looked like after the last sync. -
It compares each side with that state. What changed on the model side goes to the diagram, what changed on the diagram side goes to the model.
-
If both sides changed the same thing, the model wins and sync prints a warning that names the element.
-
It writes both files and a new sync state.
The model is the source of truth for the structure of the architecture; the diagram is where you arrange it and where you may edit texts.
What happens when I change something
| I changed … | Sync does … | Note |
|---|---|---|
the title (or technology, description) of an element in the model |
the shape in the diagram shows the new text |
|
the title of an element in draw.io (the text of its title cell) |
the model gets the new title |
Empty titles are refused. The same holds for technology and description. |
the same title on both sides |
the model’s value is kept in both files and sync warns about a conflict |
"Model wins". The text you typed in draw.io is overwritten. Sync still writes both files, but ends with exit code |
a new element in the model (and it is in a view) |
a new shape appears, with a red dashed border |
The border only marks "new"; remove it in draw.io when you have arranged the shape. |
a new shape in draw.io (a box with a label) |
the model gets a new element with an ID made from the label, the first kind of the specification in alphabetical order (or the kind the shape carries, if the specification has it), and a warning to review it |
New arrows from or to such a shape become relationships. |
a shape deleted in draw.io |
the element is removed from the model, together with its relationships and its entries in views |
Sync warns and lists what it removed. A view’s |
an element deleted in the model |
the shape and its arrows are removed from the diagram |
|
a shape moved or resized in draw.io |
nothing in the model |
Layout belongs to the diagram. |
a relationship added, relabelled or removed |
the arrow follows (model to diagram), and in the other direction a new arrow, a new label or a deleted arrow reaches the model |
|
a view added or removed in the model |
a page is added to or removed from the diagram |
What is not read back from draw.io
-
Layout: positions, sizes and colours are not copied to the model.
-
Links of elements: they are written to the diagram, but a link changed in draw.io is not read back.
-
Style changes on a shape (colours, fonts): kept in draw.io, ignored by the model; the template decides the style of new shapes.
-
Shapes without a label are not imported as elements.
One model per directory
The model, its diagram and its sync state belong together and are expected next to each other: architecture.jsonc, architecture.drawio, .bausteinsicht-sync. Use one model per directory. Several perspectives on one architecture are views (one page each), not several models. If a directory must hold more models, give each its own diagram and state with --drawio and --sync-state; the sync state remembers its model and refuses to be used with another one.
When something looks wrong
-
A shape has a red dashed border: it is new, see above.
-
An edit you made in draw.io is gone after sync: you changed the same thing in the model, or it is something that is not read back (see the list above).
-
More: Troubleshooting. The details of the algorithm are in the sync specification.
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.