$ bausteinsicht init
Initialized Bausteinsicht project:
- architecture.jsonc
- template.drawio
- architecture.drawio
- .bausteinsicht-sync
$ bausteinsicht init --format json
{"files":["architecture.jsonc","template.drawio","architecture.drawio",".bausteinsicht-sync"],"success":true}
CLI Specification
See Use Cases for the functional overview of all CLI commands.
Command Overview
| Command | Description | Status |
|---|---|---|
|
Initialize a new architecture model with default specification, sample model, and template |
Implemented |
|
Bidirectional synchronization between model and draw.io diagrams |
Implemented |
|
Validate the architecture model for consistency and report errors/warnings |
Implemented |
|
Watch mode — continuously sync on file changes |
Implemented |
|
Add a new element to the model (LLM-friendly) |
Implemented |
|
Add a new relationship to the model (LLM-friendly) |
Implemented |
|
Create a new view or modify a view’s include list (LLM-friendly) |
Implemented |
|
Add element or relationship types to the specification (LLM-friendly) |
Implemented |
|
Rename an element and rewrite every reference to it (LLM-friendly) |
Implemented |
|
Change the title, technology, description or kind of an element (LLM-friendly) |
Implemented |
|
Remove an element and its children, optionally with the references to it |
Implemented |
|
Remove a relationship |
Implemented |
|
Export diagram views to PNG or SVG using the draw.io CLI |
Implemented |
|
Export element attributes as AsciiDoc or Markdown table per view |
Implemented |
|
Export views as PlantUML C4 or Mermaid C4 text diagrams |
Implemented |
|
Export dynamic views as PlantUML or Mermaid sequence diagrams |
Implemented |
|
Check the model against the architectural constraints defined in it |
Implemented |
|
Compute an architecture health score (completeness, conformance, complexity) |
Implemented |
|
Analyze the relationship graph: cycles, centrality, dependency depth |
Implemented |
|
Flag elements that are old (beyond a threshold) and carry neither a lifecycle status nor an ADR link |
Implemented |
|
List elements by lifecycle status |
Implemented |
|
Full-text search over elements, relationships, and views |
Implemented |
|
Show all details of a single element |
Implemented |
|
Save, list, diff, restore, and delete versioned model snapshots |
Implemented |
|
Compare the model’s as-is and to-be sections |
Implemented |
|
Generate an architecture changelog between two versions |
Implemented |
|
Import a model from Structurizr DSL or LikeC4 |
Implemented |
|
Generate a draw.io template from the specification |
Implemented |
|
Compute hierarchical layout and write positions back to draw.io |
Implemented |
|
Apply/list/remove metric heatmap overlays on the diagram |
Implemented |
|
Interactive shell for editing the model |
Implemented |
|
List and show Architecture Decision Records linked to elements |
Implemented |
|
List, merge, validate and fetch (remote sources) multi-model workspaces |
Implemented |
|
Generate the JSON Schema from the Go model types |
Implemented |
|
Display version number |
Implemented |
Global Flags
These flags are available on all subcommands via persistent flags on the root command.
| Flag | Description | Default |
|---|---|---|
|
Output format. |
|
|
Path to the model file ( |
auto-detect |
|
Path to a custom draw.io template file. Must have a |
built-in template |
|
Enable verbose output. Verbose messages are written to stderr so they do not interfere with JSON output on stdout. |
|
|
Note
|
--version is a root-level flag only, not a global flag. It is used as bausteinsicht --version and prints the version string.
|
Auto-Detection Behavior
When --model is not specified, every command that requires a model file invokes auto-detection (health, graph, status, stale, diff, changelog, snapshot, overlay and adr included, #692):
-
The current working directory is scanned for files matching
*.jsonc. -
If exactly one
.jsoncfile is found, it is used. -
If more than one
.jsoncfile is found, the command aborts with exit code 2 and the messagemultiple .jsonc files in <dir> — use --model to select one. It does not silently pick one, because the tool mutates files and synchronizes — operating on the wrong model must never happen by accident. -
If no
.jsoncfile is found, the command exits with code 2 and the messageno model file found in <dir> (looked for *.jsonc) — use --model to select one.
Every command prints these messages as written, without a prefix: they all use one helper for the detection (#692, #774).
Concurrent Use
Commands that change the model (add element|relationship|view|specification|add-from-pattern, update, rename, remove, sync, and every sync cycle of watch) hold an exclusive operating-system file lock on <model>.lock from before they read the model until after they have written it, so parallel runs no longer overwrite each other’s changes (#712). The system releases the lock when the process ends, however it ends, and keeps it while the process is suspended, so there is no time limit and no takeover. A waiting command retries for up to 30 seconds and then fails with exit code 2, naming the lock file and the process that holds it. The lock file stays after the command (it holds only the process ID of the last owner); it can be added to .gitignore. The lock path must be a regular file; a symbolic link there is refused. The lock is advisory and does not cover repl (its save writes the whole session), import --force (it replaces the output file without taking the lock, so importing over a model that another command is changing can lose either write) and programs that edit the file directly.
Writing Files
The model, the draw.io diagram and the other files that a command changes are written atomically: a temporary file next to the target is written and renamed over it. A target that is a symbolic link is updated in place (#723). A target that is read-only (no write bit for its owner) is not replaced: the command fails with exit code 2 and file is read-only: <path>, and the file is left as it is (#724). The replacing file gets the mode of the file it replaces, so 0664 stays 0664; a new file is created with mode 0600.
Text that a command inserts into the model (add element|relationship|view|specification, the comment-preserving patches) gets the line ending that most lines of the file have: a model with CRLF line endings stays CRLF, also inside a value that spans several lines, and a model with LF stays free of CR; when the whole file is rewritten (the fallback that announces note: model rewritten, comments and formatting were not preserved), the line endings of the file are kept as well (#729).
Exit Codes
| Code | Meaning |
|---|---|
0 |
Success |
1 |
Validation error, sync conflict, duplicate element/relationship, or partial export failure |
2 |
File not found, I/O error, invalid arguments, or missing prerequisites |
Detailed Command Specifications
bausteinsicht init
Initializes a new Bausteinsicht project in the current directory by creating a sample model, a default template, an initial draw.io diagram, and the sync state file.
Flags:
-
--generate-template— Generate the template from the model’s specification instead of writing the built-in default template.
Created files:
-
architecture.jsonc— sample architecture model -
template.drawio— default draw.io template -
architecture.drawio— initial diagram generated via forward sync -
.bausteinsicht-sync— sync state file
Behavior:
-
If any of the four files already exist, the command aborts with exit code 2.
-
After writing the model and template, an initial forward sync is performed to generate the draw.io diagram.
-
A page is created for each view defined in the sample model.
Exit codes:
-
0— project initialized successfully -
2— file already exists, or I/O error
Example:
bausteinsicht validate
Validates the architecture model file for consistency. Reports both errors and warnings.
Flags: No command-specific flags. Uses global flags only.
Behavior:
-
Loads the model (via
--modelor auto-detection). -
Runs validation checks including referential integrity and model consistency.
-
In
--verbosemode, prints element/relationship/view counts to stderr before validation. -
Warnings are printed with
WARNING:prefix; errors withERROR:prefix. -
Keys that no field of the model knows are warnings, not errors, because the model is still usable:
WARNING: [model.x] unknown field "titel" (did you mean "title"?), and[(top level)] unknown top-level key "modle" (did you mean "model"?). The closest field name within two edits is suggested. Such keys are dropped when the file is rewritten (update,rename), so the warning is the only notice. The free-form mapsmeta,styleandmetadatamay hold any keys and are not checked (#725).
JSON output structure:
{
"valid": true,
"errors": [],
"warnings": [
{"path": "relationships[0]", "message": "..."}
]
}
Exit codes:
-
0— model is valid (may include warnings) -
1— validation errors found -
2— model file not found or cannot be loaded
Example:
$ bausteinsicht validate
Model is valid.
$ bausteinsicht validate --model my-arch.jsonc --verbose
Validating model: my-arch.jsonc
5 elements, 3 relationships, 2 views
Model is valid.
$ bausteinsicht validate --format json
{
"valid": true,
"errors": [],
"warnings": []
}
bausteinsicht sync
Runs one bidirectional synchronization cycle between the architecture model and the draw.io diagram.
Flags:
-
--relayout— Re-apply auto-layout to all view pages, resetting element positions to the layout engine’s computed positions. Without this flag, existing element positions are preserved. -
--mermaid— Also write Mermaid diagrams of the views to a Markdown file after syncing. -
--mermaid-output <path>— Output file for the Mermaid diagrams (defaultarchitecture.md). Implies--mermaid. -
--drawio <path>— The diagram of this model (defaultarchitecture.drawionext to the model, #650). -
--sync-state <path>— The sync state of this model (default.bausteinsicht-syncnext to the model, #650).
Behavior:
-
Loads the model, draw.io document, sync state, and template.
-
Validates the model before syncing. If validation fails, the sync is aborted with exit code 1.
-
If the draw.io file is missing or has no diagram pages, it is recreated from the template and sync state is reset.
-
Pages are created for new views and orphaned pages (views removed from model) are deleted.
-
New view pages are appended in a fixed order: views without a
scope(landscape and context views) first, then the scoped views, each group sorted by view key. The model file is read into a map, so the declaration order is not available; the same order is used byinit,watchand for the filesexportwrites, so regeneratingarchitecture.drawiofrom the same model gives the same file and draw.io opens on the first context view (#683). Pages that already exist keep their position. -
The title, technology and description of an element and the label of a relationship are written into
html=1text cells as HTML:<,>,&and"are escaped, soR&D <Team>is shown as typed and not read as a tag by draw.io. Reading back (reverse sync) decodes the entities again; text that contains no entity is read as it is, so files written before this rule keep working. The sub-cells and connectors gethtml=1in their style if the template lacks it (#699), also when a connector’s style is replaced or the connector is re-keyed. Cells withouthtml=1show their value literally and are read without decoding. An element with a tooltip takes its description from the tooltip, so an edit of the description sub-cell does not reach the model for such an element. -
Forward sync propagates model changes to draw.io; reverse sync propagates draw.io changes back to the model.
-
Conflicts are resolved with model wins strategy.
-
Model saves preserve JSONC comments and key ordering when possible (patch save), falling back to full save for structural changes.
Derived file paths: Unless --drawio and --sync-state say otherwise, the draw.io file and sync state file paths are derived from the model file location:
-
<model-dir>/architecture.drawio -
<model-dir>/.bausteinsicht-sync
One model per directory: The model, its diagram and its sync state form one unit with these default names; the intended unit of work is one model per directory, and several perspectives on one architecture are views (one page per view, ADR-009), not several models. A directory with more models (--model a.jsonc) gives each its own files with --drawio and --sync-state; otherwise two models would share one diagram and one state. The sync state records the file name of the model it was written for (model_file). sync, watch and rename refuse a state that belongs to another model with exit code 2 and a message that names both models and the two flags (rename then leaves the diagram untouched and prints its usual note); a state without that field (written by an earlier version) is accepted and gets it at the next save. A path given by flag is a written file and must not contain .. (exit code 2) (#650).
JSON output structure:
{
"forward_added": 2,
"forward_updated": 1,
"forward_deleted": 0,
"reverse_added": 0,
"reverse_updated": 0,
"reverse_deleted": 0,
"conflicts": 0
}
Exit codes:
-
0— sync completed without conflicts -
1— sync completed but conflicts were detected (resolved with model wins), or model validation failed -
2— file not found or I/O error
Example:
$ bausteinsicht sync
Forward (model -> draw.io): 3 added, 0 updated, 0 deleted
$ bausteinsicht sync --verbose
Syncing model: architecture.jsonc
5 elements, 3 relationships, 2 views
Forward sync: 2 elements created, 1 updated, 0 deleted; 1 connectors created, 0 updated, 0 deleted
Already in sync. No changes.
$ bausteinsicht sync --format json
{
"forward_added": 0,
"forward_updated": 0,
"forward_deleted": 0,
"reverse_added": 0,
"reverse_updated": 0,
"reverse_deleted": 0,
"conflicts": 0
}
bausteinsicht watch
Watches the model and draw.io files for changes and automatically runs a sync cycle on each detected change.
Flags:
-
--mermaid— Also write Mermaid diagrams of the views to a Markdown file after each sync. -
--mermaid-output <path>— Output file for the Mermaid diagrams (defaultarchitecture.md). Implies--mermaid. -
--drawio <path>,--sync-state <path>— As forsync(#650).
Behavior:
-
Loads the model path (via
--modelor auto-detection) and derives the draw.io path (or takes--drawio). -
Both files must exist before the watcher starts (exit code 2 otherwise).
-
Uses file system notifications with debouncing to detect changes.
-
On each change, runs a full sync cycle (same logic as
bausteinsicht sync). -
Blocks until
SIGINTorSIGTERMis received, then stops gracefully. -
The watcher suppresses sync-triggered file events to avoid infinite loops.
Exit codes:
-
0— watcher stopped gracefully via signal -
2— model or draw.io file not found, or watcher creation failed
Example:
$ bausteinsicht watch
Watching architecture.jsonc and architecture.drawio...
[14:32:05] Sync triggered by architecture.jsonc
Forward (model -> draw.io): 1 added, 0 updated, 0 deleted
^CStopped watching.
$ bausteinsicht watch --model path/to/model.jsonc
Watching path/to/model.jsonc and path/to/architecture.drawio...
bausteinsicht add element
Adds a new element to the architecture model. Designed for LLM-driven workflows.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Unique identifier for the element. Must match |
Yes |
— |
|
Element kind as defined in the model’s specification section. |
Yes |
— |
|
Display title for the element. Must not be empty. |
Yes |
— |
|
Parent element ID in dot notation (e.g., |
No |
(top-level) |
|
Technology description for the element. |
No |
(empty) |
|
Element description. |
No |
(empty) |
Behavior:
-
Validates the ID format, kind against the model specification, and parent existence.
-
Checks for duplicate elements at the target level.
-
Uses comment-preserving insertion to update the JSONC file. If patching fails it falls back to a full save and prints
note: model rewritten, comments and formatting were not preservedto stderr (#635). -
The full element ID is
<parent>.<id>when a parent is specified, or just<id>at the top level.
Exit codes:
-
0— element added successfully -
1— invalid ID, unknown kind, parent not found, parent is not a container, or duplicate element -
2— model file not found or I/O error
Example:
$ bausteinsicht add element --id api --kind component --title "REST API" \
--parent webshop --technology "Go/Gin"
Added element 'webshop.api' (kind: component) to model.
$ bausteinsicht add element --id customer-portal --kind system --title "Customer Portal" \
--format json
{"id":"customer-portal","kind":"system","title":"Customer Portal"}
bausteinsicht add relationship
Adds a new relationship between two existing elements. Designed for LLM-driven workflows.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Source element in dot notation (e.g., |
Yes |
— |
|
Target element in dot notation (e.g., |
Yes |
— |
|
Relationship label displayed on the connector. |
No |
(empty) |
|
Protocol or technology shown on the arrow, e.g. |
No |
(empty) |
|
Relationship kind as defined in the model’s specification section. |
No |
(empty) |
|
Relationship description. |
No |
(empty) |
Behavior:
-
Validates that both
--fromand--toelements exist in the model. -
If
--kindis specified, validates it against the model’s specification. -
Checks for duplicate relationships: the same
from,to,kindandlabelas an existing relationship is refused; another label (or kind) makes another relationship, as invalidate(BR-012, #697). -
A relationship of an element to itself is added; if the element’s kind is not a container kind in the specification, a warning
<id> is related to itself, but its kind "<kind>" is not a container kindis written to stderr. -
Uses comment-preserving array append to update the JSONC file. If patching fails it falls back to a full save and prints
note: model rewritten, comments and formatting were not preservedto stderr (#635).
Exit codes:
-
0— relationship added successfully -
1— element not found, unknown kind, or duplicate relationship -
2— model file not found or I/O error
Example:
$ bausteinsicht add relationship --from webshop.api --to webshop.db \
--label "reads/writes" --kind uses
Added relationship: webshop.api -> webshop.db (reads/writes)
$ bausteinsicht add relationship --from webshop.api --to webshop.db --format json
{
"from": "webshop.api",
"to": "webshop.db"
}
bausteinsicht add view
Creates a new view or modifies an existing view’s include list. Designed for LLM-driven workflows to dynamically filter architecture diagrams.
The <view-key> argument must match [a-zA-Z][a-zA-Z0-9_-]* (the same identifier form as element IDs and specification keys).
Dots are not allowed — they are reserved as element-hierarchy separators.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Parent element ID to set the view’s scope (drill-down level). |
No |
(none) |
|
Element to include in the view (repeatable, e.g., |
No |
(empty) |
|
View title (display name) (required for new views). |
No |
(empty) |
|
View description. |
No |
(empty) |
Behavior:
-
For new views: requires
--title; creates view with all specified fields. -
For existing views: merges fields:
-
--title,--scope,--descriptionupdate respective fields (if specified) -
--includeelements are appended to the existing include list (deduplicated); the order of the existing entries is kept
-
-
Validates that scope element exists (if specified).
-
Validates that all include elements exist (if specified, excluding wildcard patterns).
-
The text output says what happened:
View '<key>' added to modelfor a new view,View '<key>' updated (include: +<id>, …)for an existing one (include list unchangedif nothing was added), the entries that were already in the list (Already included), and the include list as it is now (#704). The JSON output hascreatedandaddedfor the same. -
Uses comment-preserving updates for the JSONC file (#635): a new view is inserted into
views; for an existing view only the given fields are replaced and new include entries are appended. Comments, key order and the formatting of everything else stay as they are. If patching fails it falls back to a full save and printsnote: model rewritten, comments and formatting were not preservedto stderr.
Exit codes:
-
0— view added or updated successfully -
1— scope or include element not found, or missing title for new view -
2— model file not found or I/O error
Example:
# Create a new system context view
$ bausteinsicht add view context \
--include system external_system user \
--title "System Context"
View 'context' added to model
Title: System Context
Includes: [system external_system user]
# Create a nested container view
$ bausteinsicht add view containers \
--scope system \
--include "system.*" \
--title "Containers"
View 'containers' added to model
Title: Containers
Scope: system
Includes: [system.*]
# Merge: add element to existing view's include list
$ bausteinsicht add view containers --include system.logging
View 'containers' added to model
Includes: [system.* system.logging]
# Merge: update title without changing include
$ bausteinsicht add view containers --title "Updated Containers"
View 'containers' added to model
Title: Updated Containers
# JSON output
$ bausteinsicht add view context --title "System Context" --include system --format json
{
"view_key": "context",
"created": true,
"title": "System Context",
"scope": "",
"include": ["system"],
"added": ["system"]
}
# JSON output when merging into an existing view: the view after the change
$ bausteinsicht add view context --include user --format json
{
"view_key": "context",
"created": false,
"title": "System Context",
"scope": "",
"include": ["system", "user"],
"added": ["user"]
}
The JSON result always describes the view as it is after the change, not just the arguments of this call: title, scope and include are the resulting values (description is added when set), created tells whether the view is new, and added lists the --include entries that were not in the view before (an empty array if none).
bausteinsicht add add-from-pattern
bausteinsicht add add-from-pattern <pattern-id> --id <base> [--title <title>] [--prefix <prefix>]
bausteinsicht add pattern list
Expands a pattern of specification.patterns into elements and relationships of the model: the top-level elements of the pattern are added at the top level of the model, their children below them, and the pattern’s relationships to the relationships.
{base} is replaced by --id ({BASE} upper-cased, {Title} by --title, default the ID), and --prefix turns {base} into <prefix>-<base>.
-
Refuses the pattern (exit code
2, nothing written) if a new top-level ID already exists in the model. The children live below the new elements, so an unrelated element with the ID of a child is no conflict (#702). -
Prints every created element with its full ID, children below their parent (
pay,pay.db), then the relationships. -
--id(with--prefix) and the IDs the pattern derives from it must follow the ID rules ofadd element(exit code1). -
The expanded model is validated before it is saved: a pattern that would add an element of an unknown kind, a relationship to an element that does not exist or any other new validation error is refused with exit code
1, the new errors are listed on stderr and nothing is saved. Errors the model had before do not count (#703). -
Known gap: patterns are only added at the top level (no
--parent).
bausteinsicht add specification
Adds new element or relationship types to the model’s specification. Enables definition of custom architecture notations.
The new type is inserted into specification.elements or specification.relationships (the section is created if it does not exist yet) without rewriting the rest of the file: comments, key order and formatting stay as they are (#635). If patching fails, the command falls back to a full save and prints note: model rewritten, comments and formatting were not preserved to stderr.
The <key> names the kind and must match [a-zA-Z][a-zA-Z0-9_-]* (letters, digits, hyphens, underscores — the same identifier form as element IDs).
Dots are not allowed — they are reserved as element-hierarchy separators.
camelCase kinds such as boundaryObject or applicationService are supported.
Add Element Type
Adds a new element kind to the specification.
Command: bausteinsicht add specification element <key>
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Display notation/name for this element type (e.g., "Custom Component"). |
Yes |
— |
|
Description of this element type. |
No |
(empty) |
|
Whether this element can contain child elements. |
No |
false |
Exit codes:
-
0— element type added successfully -
1— invalid key format or duplicate element type -
2— model file not found or I/O error
Example:
$ bausteinsicht add specification element custom_box \
--notation "Custom Component" \
--description "A custom element type" \
--container
Element type 'custom_box' added to specification
Notation: Custom Component
Description: A custom element type
Container: yes
$ bausteinsicht add specification element data_store \
--notation "Data Store" --container --format json
{
"key": "data_store",
"notation": "Data Store",
"container": true
}
Add Relationship Type
Adds a new relationship kind to the specification.
Command: bausteinsicht add specification relationship <key>
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Display notation/label for this relationship type (e.g., "calls"). |
Yes |
— |
|
Description of this relationship type. |
No |
(empty) |
|
Whether this relationship is displayed as a dashed line. |
No |
false |
Exit codes:
-
0— relationship type added successfully -
1— invalid key format or duplicate relationship type -
2— model file not found or I/O error
Example:
$ bausteinsicht add specification relationship depends_on \
--notation "depends on" \
--dashed
Relationship type 'depends_on' added to specification
Notation: depends on
Style: dashed
$ bausteinsicht add specification relationship async_call \
--notation "calls (async)" --format json
{
"key": "async_call",
"notation": "calls (async)",
"dashed": false
}
bausteinsicht rename
Renames an element and rewrites every reference to it, so that IDs no longer have to be changed by hand in six places (#634).
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Element to rename, in dot notation (e.g. |
Yes |
— |
|
New key of the element: its new last path segment, without dots ( |
Yes |
— |
|
Show what would change without saving. |
No |
|
|
The diagram and the sync state to migrate, as for |
No |
next to the model |
Behavior:
-
Moves the element, with its children, to the new key.
-
Rewrites every reference to the element and to its children: relationship
from/to, viewscope,includeandexclude(including patterns such asshop.*), message steps of dynamic views, andfrom/toselectors of constraints. -
Lists every rewritten location (
path,from,to); with--format jsonas{ "dry_run": false, "changes": [ … ] }. -
Validates the model before saving: if the change would introduce validation errors, they are printed and nothing is saved. Errors that were already in the model do not block the command.
-
The change is written as a patch of the file text (#685): comments and formatting stay, a field is replaced in place (or inserted, or removed when it is set to an empty value), an element or relationship is removed together with the comment lines directly above it, and a rename changes the key and every reference in place. The patched text is parsed again and must hold exactly the model the command produced; only if the patch cannot be applied or that check fails is the file rewritten as a whole (
note: model rewritten, comments and formatting were not preservedon stderr). -
After the model is saved, the rename is carried into
architecture.drawioand.bausteinsicht-syncnext to the model (under the same lock): thebausteinsicht_idof the cells of the element and of its children, the page-scoped cell IDs (<view>--<id>), their sub-cells and icons, the connectors that start or end at them (their IDsrel-<from>-<to>-<index>andsource/target), and the element, relationship and rendered-element entries of the sync state. Position, size and style are kept: the nextsyncreports no deleted or added cells and no warning about the old ID (#686). Without--dry-runit printsnote: N draw.io cell(s) of <old> renamed to <new>, their position and style are kepton stderr. If there is no draw.io file, nothing is migrated; if it cannot be read or written, the model rename still stands andnote: the draw.io file was not migrated (…)is printed. If the file could not be written, it is unchanged and the nextsyncfalls back to deleting and re-creating the cells of the element; if it is malformed,syncfails to load it as well until it is repaired, restored or deleted (a deleted file is recreated from the template). The migration is skipped for--dry-run.
Exit codes: 0 — renamed (or dry run); 1 — element not found, new key invalid or already taken, or the change would make the model invalid; 2 — model file not found or I/O error.
bausteinsicht update element
Changes fields of an existing element.
Flags: --id (required, dot notation); at least one of --title, --technology, --description, --kind (the kind must be defined in specification.elements; an empty value for --technology or --description clears the field); --dry-run.
Behavior: Only the fields that are given are changed; fields that already have the requested value are not reported. Validation, JSON output, saving and exit codes work as for rename.
bausteinsicht remove element
Removes an element and its children.
Flags: --id (required, dot notation), --cascade, --dry-run.
Behavior:
-
If relationships, view
include/excludeentries or dynamic view steps still reference the element, the command fails and lists them. With--cascadeit drops them: the relationships, the view entries and the message steps; a dynamic view that is left without a message step is removed as well. Everything that is dropped is listed. -
A view whose
scopeis the element, or a constraint whosefrom/tonames it, always blocks the removal (even with--cascade): change the view or the constraint first. -
Validation, JSON output, saving and exit codes work as for
rename.
bausteinsicht remove relationship
Removes a relationship.
Flags: --from and --to (required, dot notation), --label (only remove the relationship with this label; default: the first relationship between the two elements), --dry-run.
Behavior: Fails with exit code 1 if no such relationship exists. Validation, JSON output, saving and exit codes work as for rename.
bausteinsicht export
Exports draw.io diagram views to image files (PNG or SVG) using the draw.io CLI.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Image format for export: |
No |
|
|
Export only a specific view by its key. When omitted, all views are exported. |
No |
(all views) |
|
The diagram to export (#650). |
No |
|
|
Output directory for exported files. |
No |
|
|
Export scale factor (e.g. |
No |
|
|
Embed the draw.io XML source in the exported image file. |
No |
|
|
Explicit path to the draw.io CLI binary. Overrides |
No |
(auto-detected) |
|
Time limit for the export of one view, as a Go duration ( |
No |
|
|
Export even if the model has validation errors. By default the export aborts with the same errors as |
No |
|
draw.io binary resolution (highest precedence first):
-
--drawio-pathflag — must point at an existing file -
BAUSTEINSICHT_DRAWIO_PATHenvironment variable — must point at an existing file -
Auto-detection:
drawio-exportordrawioordraw.ioonPATH, then platform-native install paths (Scoop, Chocolatey, Homebrew, standard installer)
Behavior:
-
Loads the model and draw.io document to determine which pages to export.
-
Detects the draw.io CLI binary automatically. Exits with code 2 if not found.
-
Creates the output directory if it does not exist.
-
Output files are named
architecture-<view-key>.<format>(e.g.,architecture-context.png). -
Each view page is exported individually; partial failures are reported.
-
A view whose draw.io process does not finish within
--timeoutis reported asview "<key>": draw.io export timed out after <duration>; see <troubleshooting link>followed by everything draw.io printed (stdout and stderr) before it was stopped. The process group of the draw.io wrapper is killed, so noxvfb-run/drawiochild stays behind. The other views are still exported (#716).
|
Note
|
Use --image-format svg when element link fields must remain clickable in the output. SVG export preserves link attributes as native <a href> elements, which are clickable when the SVG is embedded in HTML or processed by Asciidoctor PDF. PNG export is a raster format and discards all link information.
|
|
Note
|
SVG export always passes draw.io’s --embed-svg-fonts false internally (not a flag; not applicable to PNG). Without it, draw.io falls back to rasterizing each text label as an embedded base64 PNG whenever it can’t embed a font subset headlessly, inflating file size by roughly 20× for no visual benefit (#560). Text then relies on the viewer’s system fonts — the normal trade-off for unembedded SVG text, and how GitHub’s own AsciiDoc blob preview renders these diagrams.
|
JSON output structure (the errors array is present only on partial failure):
{
"files": ["architecture-context.png", "architecture-container.png"],
"success": true
}
Exit codes:
-
0— all views exported successfully -
1— one or more exports failed (partial failure) -
2— unsupported format, model/diagram not found, draw.io CLI not available, or no views to export
Example:
$ bausteinsicht export
Exported: ./context.png
Exported: ./container.png
$ bausteinsicht export --image-format svg --output docs/images --view context
Exported: docs/images/context.svg
$ bausteinsicht export --format json --embed-diagram
{
"files": ["./context.png"],
"errors": [],
"success": true
}
bausteinsicht export-table
Exports element attributes as an AsciiDoc or Markdown table per view or as a combined table across all views.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Export only a specific view by its key. When omitted, all views are exported. |
No |
(all views) |
|
Table output format: |
No |
|
|
Output directory for exported files. When omitted, the table is written to stdout. |
No |
(stdout) |
|
Export a single combined table with elements from all views, deduplicated. |
No |
|
|
Export even if the model has validation errors. By default the export aborts with the same errors as |
No |
|
Behavior:
-
Loads the model and resolves view elements.
-
For each view, generates a table with columns: ID, Kind, Title, Technology, Description.
-
Elements are sorted alphabetically by ID within each table.
-
Without
--output, the table(s) are written to stdout. With--output <dir>, files are written there and the output filenames depend on the selection:-
A single view (
--view <key>) →<view-key>-elements.adoc(or.md). -
All views, no
--combined→ one fileall-views-elements.adoc(or.md) covering every view. -
--combined→ one deduplicated fileelements.adoc(or.md).
-
-
Creates the output directory if it does not exist.
JSON output structure — --format json always emits an array of element rows on stdout (not a file list), with or without --output. With --output <dir>, the same rows are additionally written to all-views-elements.json, <view-key>-elements.json or elements.json (same selection rules as above) and Exported: <absolute path> is printed to stderr (#631):
[
{ "id": "customer", "title": "Customer", "kind": "actor", "description": "..." },
{ "id": "webshop.api", "title": "REST API", "kind": "container", "technology": "Go", "description": "..." }
]
Exit codes:
-
0— table(s) exported successfully -
1— one or more exports failed (partial failure) -
2— model file not found, invalid format, or no views to export
Example:
$ bausteinsicht export-table --view context # writes to stdout
=== System Context
...
$ bausteinsicht export-table --table-format md --output docs/tables --view context
Exported: docs/tables/context-elements.md
$ bausteinsicht export-table --combined --output docs/tables
Exported: docs/tables/elements.adoc
$ bausteinsicht export-table --view context --format json
[
{ "id": "customer", "title": "Customer", "kind": "actor", "description": "..." }
]
bausteinsicht export-diagram
Exports views as text diagrams in one of several formats (C4-PlantUML, Mermaid, Graphviz DOT, D2, standalone HTML, or Structurizr DSL).
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Export only a specific view by its key. When omitted, all views are exported. Not supported with |
No |
(all views) |
|
Diagram output format: |
No |
|
|
Output directory for exported files. When omitted, the diagram is written to stdout. |
No |
(stdout) |
|
Export even if the model has validation errors. By default the export aborts with the same errors as |
No |
|
Behavior:
-
Loads the model and resolves view elements and relationships.
-
Auto-detects the C4 level (Context, Container, or Component) from the C4 macros the view’s elements resolve to (see below), so kinds mapped via
c4override or notation select the matchingC4_Container/C4_Componentinclude (#633). -
Generates diagram source in the requested format. C4-PlantUML uses the stdlib include syntax (
!include <C4/C4_Context>, etc.). -
C4-PlantUML diagrams carry the view
title(title <view title>) and, unless the view sets"legend": false,LAYOUT_WITH_LEGEND()right after the include, so readers can tell the C4 shapes apart (#642). Mermaid diagrams carry the title as before. -
The D2 output must compile with the
d2compiler: a node is written asid: "Title\n[kind]" { … }(D2 accepts nothing after the quoted label), quote characters are escaped (#713). The e2e tests run it throughd2when it is installed. -
Line breaks in titles, descriptions, technologies and relationship labels (CRLF, LF or CR) never reach the output as raw breaks inside a quoted string: PlantUML (C4 and sequence diagrams), DOT and D2 write
\n, Mermaid C4 writes<br/>. Double quotes become single quotes in the C4 and DOT formats (#690). -
The arguments of the C4 macros (PlantUML and Mermaid):
PersonandSystem(and their_Extvariants) take(alias, title, description);ContainerandComponent(with theirDb,Queueand_Extvariants) take(alias, title, technology, description). An element of such a kind without technology but with a description gets an empty technology, so that the description stays in its own slot (#828). -
A relationship
technologyis passed as the technology argument ofRel()(Rel(a, b, "charges", "HTTPS/JSON")); dashed PlantUML arrows and the DOT, D2 and HTML formats showlabel [technology]; the Structurizr DSL gets it as the fourth token (#642). -
C4 macro selection (PlantUML and Mermaid) — each element is rendered with the C4 macro resolved from its kind, in this order (#633):
-
the kind’s explicit
specification.elements.<kind>.c4override, if set (for example"c4": "Person"); -
the kind’s key (case-insensitive):
actor,person→Person;system→System;external_system→System_Ext;container,ui,mobile,filestore→Container;datastore→ContainerDb;queue→ContainerQueue;component→Component; -
the kind’s notation (case-insensitive):
Person,Actor→Person;Software System,System→System;External System→System_Ext;Container→Container;Database,Data Store,Datastore→ContainerDb;Queue→ContainerQueue;Component→Component.The same resolution decides the scope boundary of a scoped view:
Container_Boundarywhen the scope element’s kind resolves to aContainer*macro, otherwiseSystem_Boundary. The scope element is rendered only as this boundary, never additionally as a regular element, even if the view’sincludealso matches it (for example with); a duplicate alias would make PlantUML silently drop one of the two declarations (#640). Note thatmatches only top-level elements, so the boundary of a scoped view stays empty unless the view includes the scope’s children, e.g.["", "<scope>."].A kind that matches none of these falls back to
Systemand aWARNING: element kind "<kind>" is not a recognised C4 kind and is rendered as System(…) — set specification.elements.<kind>.c4 to choose a macrois printed to stderr once per kind per run (exit code stays0). For a kind that is not declared inspecification.elementsat all, the warning says so instead (… is not declared in specification.elements …).
-
-
Relationships are filtered to those visible in the view. Endpoints are lifted to visible ancestor elements when the original endpoints are not included in the view.
-
A relationship whose
kindresolves tospecification.relationships.<kind>.dashed: truerenders as a dashed line:style="dashed"edge attribute in DOT, astyle.stroke-dashblock in D2, astroke-dasharraySVG line in HTML, and a raw..>arrow instead of theRel()macro in PlantUML (C4-PlantUML’s own dashed-line style override errors on the versions tested). Mermaid does not yet support a dashed-line override in its C4 syntax, so dashed relationships render the same as solid ones there (#518). -
A model without views has nothing to export:
export-diagram(andexport-table) writeNo views defined in model; add one with 'bausteinsicht add view'.to stderr, asexport-sequencedoes for dynamic views; the exit code is0, and no file is written (#737). -
The HTML viewer (
html) shows the view title as the heading of the page. Every relationship is a line from the border of the source box to the border of the target box with an arrowhead at the target; the exporter computes the two points (they are part of the embedded diagram data asx1,y1,x2,y2), so the arrowhead is not hidden behind the box. Lines are drawn behind the boxes and the labels have a white outline so that they stay readable where lines cross. The boxes are placed on a simple grid and the lines are straight: a line can still run behind a box that lies between its ends (#732). -
Without
--output, the diagram(s) are written to stdout. With--output <dir>, per-view files are named<view-key>.<ext>, where<ext>ispuml,mmd,dot,d2, orhtml. -
--diagram-format structurizris special: it exports the entire workspace as a singleworkspace.dslfile and rejects--view(exit code 1). -
The Structurizr DSL follows Structurizr’s argument order:
container/componentare writtenname description technology(a technology without description keeps its slot as an empty description),person/softwareSystemtake no technology. A view is written<type> <scope> "<key>" "<description>", the key then the title; a system-scoped view that shows an element below the scope is acontainerview, otherwise asystemContextview, a container-scoped view is acomponentview.import --from structurizrreads the same: the first argument after the scope is the view key and the second the description, which becomes the title; with a single argument the key is also the title, and a view with neither is keyed by its scope (#687, #688). -
Creates the output directory if it does not exist.
-
Before rendering each view, prints a
WARNING: view "<key>" resolves to 0 elements — check its scope/include/exclude; the exported diagram will be emptyto stderr if the view’s resolved element set is empty. This does not fail the export (exit code stays0) — it only surfaces a diagram that would otherwise silently look successful despite being empty (#512).
JSON output structure — --format json emits an array of one object per exported view (not a file list):
[
{ "view": "context", "format": "plantuml", "source": "@startuml\n!include <C4/C4_Context>\n..." }
]
With --output <dir> the diagrams are written to files (same names as without --format json) and each entry carries the absolute path of its file instead of source (#631):
[
{ "view": "context", "format": "plantuml", "path": "/abs/docs/diagrams/context.puml" }
]
Views whose keys map to the same output file name are rejected with exit code 1 before anything is written. --diagram-format structurizr yields a single entry with "view": "workspace" (file workspace.dsl).
Exit codes:
-
0— all diagrams exported successfully -
1— one or more exports failed, or--viewused withstructurizr -
2— model file not found, invalid format, or no views to export
Example:
$ bausteinsicht export-diagram --view context # writes to stdout
@startuml
!include <C4/C4_Context>
...
$ bausteinsicht export-diagram --diagram-format mermaid --output docs/diagrams --view context
Exported: docs/diagrams/context.mmd
$ bausteinsicht export-diagram --diagram-format structurizr --output docs
Exported: docs/workspace.dsl
$ bausteinsicht export-diagram --view context --format json
[
{ "view": "context", "format": "plantuml", "source": "@startuml\n..." }
]
bausteinsicht export-sequence
Exports dynamic views from the model as PlantUML or Mermaid sequence diagram source files. Dynamic views describe the runtime behaviour of the system as ordered message sequences between elements.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Path to the model file. |
No |
Auto-detected |
|
Export only the dynamic view with this key. |
No |
All dynamic views |
|
Diagram format: |
No |
|
|
Output directory for exported files. When omitted, output is written to stdout. |
No |
stdout |
|
Output format: |
No |
|
|
Export even if the model has validation errors. By default the export aborts with the same errors as |
No |
|
Behavior:
-
Loads the model and reads
dynamicViewsentries. -
Steps are sorted by
indexand rendered in order. -
Participants are listed in first-appearance order.
-
Participant display names are resolved from the element
title; falls back to element ID if the element is not in the model. -
Participant shapes follow the C4 export: elements that render as
Personbecomeactor(PlantUML and Mermaid); in PlantUML, data stores (*Dbmacros) becomedatabaseand queuesqueue; everything else is aparticipant(#637). -
Step numbers are produced by
autonumber(one line at the top of the diagram), not by prefixing the labels, so they can be styled;indexonly orders the steps. Double quotes in labels are written as typed. -
Block steps (
alt,else,opt,group,end) become PlantUML blocks or the Mermaid equivalents (alt,else,opt,end); Mermaid has nogroup, so it is drawn as a greyrect; arecthas no title, so the label of the group is written as the first line inside it, as a note over the first and the last participant of the diagram (Note over u,s: <label>;Note over u: <label>with one participant; no note without a label) (#711). Steps inside a block are indented. A message without a label is written without a dangling separator:a → bin PlantUML,a→>b:in Mermaid. -
Mermaid text (diagram title, participant names, step labels, block conditions) is made safe for one statement:
;ends a statement in Mermaid and is written as the entity59;, a line break becomes<br/>(#714). Other characters (:,,%%,,,<,>,{,},--,&,|) need no escaping in labels and names. -
If
--outputis given, files are namedsequence-<view-key>.puml(PlantUML) orsequence-<view-key>.md(Mermaid). The.mdfile holds the diagram as a fenced code block (`mermaid ` … `), so that Markdown viewers render it and `mmdc -ifinds it; the output on stdout and thesourceof a JSON entry without--outputare the raw diagram, and.pumlfiles are never fenced (#715). -
If no dynamic views are defined in the model, a warning is written to stderr and the command exits with
0.
Arrow type mapping:
| Step type | PlantUML | Mermaid |
|---|---|---|
|
|
|
|
|
|
|
|
|
JSON output structure:
[
{
"view": "checkout-flow",
"format": "plantuml",
"source": "@startuml checkout_flow\n..."
}
]
With --output <dir> the files sequence-<view-key>.<ext> are written and each entry carries the absolute path instead of source (#631).
Exit codes:
-
0— all sequence diagrams exported successfully (or no dynamic views defined) -
1— specified--viewkey not found -
2— model file not found, invalid--diagram-format, or I/O error
Example:
$ bausteinsicht export-sequence
@startuml checkout_flow
title Checkout Flow
...
@enduml
$ bausteinsicht export-sequence --output docs/sequences
Exported: docs/sequences/sequence-checkout-flow.puml
$ bausteinsicht export-sequence --diagram-format mermaid --view checkout-flow
sequenceDiagram
title Checkout Flow
...
$ bausteinsicht export-sequence --format json
[
{
"view": "checkout-flow",
"format": "plantuml",
"source": "@startuml checkout_flow\n..."
}
]
bausteinsicht lint
Evaluates the architectural constraints defined in the model and reports violations.
Flags: none beyond the global flags.
Behavior: loads the model and evaluates each constraint. Prints All constraints passed. when constraints exist with no violations, No constraints defined. when the model declares none, or the list of violations otherwise. Use in CI as an architecture gate. A violation message starts with the constraint’s description only if it has one, and lists elements by their full ID (shop.api.deep (depth 3)). A constraint that lacks what its rule needs (a from or to selector, max, field, technologies, an element-kind or tag) is reported as a violation constraint is incomplete: … instead of silently matching nothing or everything; validate reports the same as an error (#727). technology-allowed selects its elements by element-kind or tag, like required-field.
bausteinsicht health
Computes an architecture health score (0–100, with a letter grade) across weighted categories such as completeness, conformance, and complexity.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Print only the overall score and grade. |
No |
|
|
Write the report to a file instead of stdout. |
No |
(stdout) |
Behavior: finds the model via --model or auto-detection. Emits a human-readable report (or JSON with --format json) of the overall score, per-category scores, and model statistics.
bausteinsicht graph
Analyzes the relationship graph: cycle detection, dependency depth, and centrality metrics.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Show centrality metrics per element. |
No |
|
|
Show only detected cycles. |
No |
|
|
Write the report to a file instead of stdout. |
No |
(stdout) |
Behavior: finds the model via --model or auto-detection. Reports element/relationship counts, max dependency depth, graph type (DAG / has cycles), and strongly connected components.
bausteinsicht stale
Flags elements that look forgotten. An element is reported only when all three hold: its last modification is older than the threshold, it has no lifecycle status, and it links no ADR (decisions is empty). Archived elements are skipped.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Consider an element stale if unmodified for this many days. |
No |
|
|
Model file path. |
No |
(auto-detect) |
|
draw.io diagram path (auto-detected if empty). |
No |
(auto-detect) |
|
Highlight stale elements in the diagram. |
No |
|
|
Remove stale markers from the diagram (restores original styles). |
No |
|
|
Output format: |
No |
|
Behavior: the last-modified date comes from per-element git history, or from the element’s explicit lastModified field if set. Outside a git repository, elements without an explicit lastModified have no known date and are therefore not flagged by age. Output is deterministically ordered (by risk, then ID).
bausteinsicht status
Lists elements by lifecycle status (proposed, design, implementation, deployed, deprecated, archived).
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Show only elements with this status. |
No |
(all) |
Behavior: finds the model via --model or auto-detection. Groups elements under their status. Elements whose status is not one of the lifecycle statuses (validate warns about them, BR-029) are listed after unset in a section unknown status (<n>) with the status they carry, so that the sections add up to all elements; the JSON summary counts them under that status (#710).
bausteinsicht find
Full-text search over the model.
Arguments: <query> (required) — the search string.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Limit results to |
No |
|
Behavior: returns ranked matches grouped by object type, with the matched fields. --format json emits a structured result.
bausteinsicht show
Displays all fields, relationships, and views for a single element.
Arguments: <element-id> (required) — the dot-path ID.
Behavior: prints the element’s kind, title, description, technology, relationships, and the views it appears in. --format json emits the element as structured data.
bausteinsicht snapshot
Manages versioned model snapshots stored in .bausteinsicht-snapshots/.
Subcommands:
| Subcommand | Description |
|---|---|
|
Capture the current model as a snapshot ( |
|
List saved snapshots as a table; the global |
|
Diff snapshot |
|
Restore a snapshot to a file ( |
|
Delete a snapshot. |
Behavior: diff reports a structured architecture delta (added/removed elements and relationships), not a text diff. The directory also holds index.json; it is not a snapshot, so index is an unknown snapshot ID for diff, restore and delete (exit code 2, snapshot not found: index) and the index is never removed by them (#693).
bausteinsicht diff
Reports the gap between the model’s asIs and toBe sections.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Model file path. |
No |
(auto-detect) |
|
Show only the changes that concern the elements of this view (the view of the model, resolved like for the diagrams, against the elements of the model and of both states, so that an element that exists only as-is or only to-be can be named): the changes of those elements and the relationship changes whose both ends are among them; the summary counts only these. An unknown view is an error (exit code |
No |
(all) |
|
Output format: |
No |
|
Behavior: exits with an error if the model has no asIs/toBe sections. A relationship without a label is printed as from → to, without empty parentheses.
bausteinsicht changelog
Generates a human-readable changelog between two versions of the model.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Starting git ref (commit SHA, tag or branch) or snapshot ID. |
No |
the previous tag: the latest tag before |
|
Ending git ref or snapshot ID. |
No |
|
|
Model file path. |
No |
(auto-detect) |
|
Output format: |
No |
|
|
Write to a file instead of stdout. |
No |
(stdout) |
Behavior: loads the model at each git ref (via git rev-parse / git show) and reports the architecture changes between them. A ref that is the ID of a snapshot in .bausteinsicht-snapshots/ (see snapshot) is read from the snapshot store instead of git, so two snapshots can be compared without a repository, and a snapshot can be compared with a git ref (#728); any other ref is a git ref. --since is required when --until is a snapshot, because a snapshot has no previous tag. Errors say what is wrong, exit code 2: no git repository found outside a repository, no tag found before <ref>: tag a release or use --since <git ref> when --since is omitted and there is no tag, and cannot resolve git ref "<ref>": <git’s message> for an unknown ref (#698). (Note: changelog uses --changelog-format, not the global --format.)
bausteinsicht import
Imports an architecture model from an external DSL and writes a Bausteinsicht .jsonc file.
Arguments: <input-file> (required) — the source DSL file.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Source format: |
Yes |
(none) |
|
Output model file path. |
No |
|
|
Print the generated model to stdout instead of writing the file. |
No |
|
|
Overwrite the output file if it already exists. |
No |
|
|
XMI only: comma-separated |
No |
(none) |
|
Also write |
No |
|
|
Print the post-import summary as machine-readable JSON instead of human-readable text. |
No |
|
Behavior: parses the source DSL, maps people/systems/containers and relationships, and generates a matching specification. Exit 2 if the output file already exists and neither --force nor --dry-run is set — --dry-run prints to stdout and skips the existence check, so it never fails on an existing output. Exit 1 on any other import failure (unknown --from, unreadable input, parse/encoding error). Exit 1 with no elements found in <file> - is --from <format> correct? if the import yields no element (a file in another format, a text file without a model), with and without --dry-run; nothing is written and an existing output file is left alone (#705). A file in another format that happens to contain a line that parses as an element is not detected.
Post-import summary: on a successful (non-dry-run) import, prints an element count per kind, the output file path, the generated view count (omitted when zero — xmi never produces views), and any warnings collected during import. --json emits the same information as {"elements":{"<kind>":<count>,…},"outputPath":"…","views":<count>,"warnings":["…"]} instead (the views key is present but 0 in JSON mode, unlike the omitted text line, since machine consumers should not have to distinguish "zero" from "absent"). Followed by a next-steps hint: bausteinsicht sync and bausteinsicht export diagram on a fresh import; bausteinsicht diff instead of sync when --force overwrote an existing output file (the existing file likely already has synced draw.io state, so reviewing the delta is more useful than re-syncing). The hint is suppressed entirely under --dry-run, since nothing was persisted.
XMI-specific behavior: reads XMI 2.1 files (e.g., Enterprise Architect exports). UML element types are mapped to Bausteinsicht element kinds using --kind-map overrides or the built-in defaults (e.g., uml:Component → component). EA stereotypes (inside xmi:Extension) take precedence over the UML type mapping. Unknown UML types produce a warning and are imported with kind element. Unresolvable relationship endpoints are skipped with a warning. DOCTYPE declarations are rejected (XXE mitigation). Element hierarchy depth is capped at 50 levels. This is a one-way migration — XMI-specific data (layout, tagged values, OCL constraints) is not preserved.
Structurizr-specific behavior: the tag External on a softwareSystem selects the kind external_system and the tag Database on a container the kind datastore, as the default specification names them; the tag itself is not kept. An element with children keeps its kind and its tag, because these two kinds have no children. export-diagram --diagram-format structurizr writes the tags argument again (the tag that its kind stands for first, then the element’s tags), so a round trip keeps kinds and tags. Every other tag (from the tags argument, comma separated, or from a tags statement) stays in the element’s tags and is defined in specification.tags, so the model validates. A view’s key is the key written in the DSL (see export-diagram, #688). a view’s autoLayout <direction> directive is mapped to Bausteinsicht’s layered layout (there is no direction-aware equivalent). The direction argument itself is not preserved, and a warning is emitted noting the dropped value (e.g. line 12: view "context": autoLayout direction "lr" not preserved, mapped to layout: "layered"). include on a container/component view is expanded to also include the view’s scope’s children (e.g. ["", "<scope>."], plus the parent scope for component views), matching Structurizr’s semantics where a scoped view’s wildcard include means "everything visible in this scope" rather than Bausteinsicht’s default top-level-only match. filtered, dynamic, and deployment views are not supported and are skipped with a warning (#512).
LikeC4-specific behavior: the include and exclude predicates of a view are translated into the view’s include and exclude lists: names are resolved to element paths, name. and name.* keep their wildcard. A plain include becomes [""], and in a view of <element> it also adds that element’s children (["", "<element>."]), as for Structurizr; a view without include shows the top-level elements. An imported view is never left without an include list, so sync does not report it as resolving to 0 elements (#706).
bausteinsicht generate-template
Generates a draw.io template with a styled shape for each element kind in the specification.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Visual preset: |
No |
|
|
Output template file. |
No |
|
|
Model file (auto-detected if omitted). |
No |
(auto-detect) |
Behavior: the generated file carries the bausteinsicht_template attributes the sync engine needs, so it works directly as a --template.
bausteinsicht layout
Computes a layered layout for every page of the draw.io diagram and writes the element positions back to the draw.io file.
Flags:
| Flag | Description | Required | Default |
|---|---|---|---|
|
Layout algorithm (currently only |
No |
|
|
Ranking direction: |
No |
|
|
Do not move elements marked |
No |
|
|
Lay out only the page of this view: the key of the view, as in |
No |
(every page) |
|
The diagram to lay out (#650). |
No |
|
Behavior (#654):
-
Per page. Every page is laid out on its own, from the elements and connectors that are on that page. The model is not read, so a view only shows the structure that the view shows. A connector into an element inside a boundary counts as a connector to the boundary on the outer level.
-
Sizes are kept. An element keeps its width and height (template size, person shape, …), except that it grows if its title or technology needs more lines than its text cells have (the cells wrap; synchronization specification, "Long text", #718). Only a boundary or container is resized: to fit the elements inside it, but not smaller than 300x200.
-
Nested elements. Elements inside a boundary or container are laid out inside it and get coordinates relative to it, as draw.io expects, so they stay within the boundary.
-
Info boxes. The metadata box, the legend and the doc-link icon row of the view (cells without a
bausteinsicht_id) are moved below the laid-out content:yis the bottom of the lowest cell on the page, pinned ones included, plus 80;x, width and height are kept, and the icon row keeps its place relative to the metadata box. A page without elements, or without these boxes, is left as it is (#772). -
Deterministic. Elements are ordered by ID and crossings are reduced by a fixed barycenter sweep, so running the command twice, or on a copy of the file with the cells in another order, gives the same positions. A cycle is drawn as a chain that starts at the smallest ID.
-
Connectors. Stored waypoints of connectors on a laid out page are removed, because they belong to the old positions; draw.io routes the connectors again. Only the connectors of opposite directions between the same two elements get new waypoints for the new positions, so that both labels stay readable (#717; see the new-relationship rule of the synchronization specification).
-
No diagram. If
architecture.drawiodoes not exist, or has no pages, the command fails with exit code2andno diagram yet (<path>): run 'bausteinsicht sync' first; a model without views has no diagram, add one with 'bausteinsicht add view'(#737). -
Exit codes:
1unknown--view(view "x" not found in the diagram; views: context, containers, #823), invalid--rank-diror unknown--algorithm(the message names the value and the valid one,hierarchical; the diagram is not changed, #691);2the diagram next to the model cannot be read or written.
bausteinsicht overlay
Loads external metrics (error rate, coverage, …) from a JSON file and overlays them as a heatmap on draw.io elements; original styles are preserved.
Subcommands:
| Subcommand | Description |
|---|---|
|
Apply a metric heatmap ( |
|
List the metrics available in the file, each with its minimum, maximum, number of elements and the description from |
|
Remove the overlay and restore original colors ( |
Metrics file:
{
"meta": { "source": "grafana", "generated": "2026-11-28", "metric_descriptions": { "error_rate": "Errors per request" } },
"metrics": [
{ "elementId": "customer", "error_rate": 0.5, "coverage": 70 },
{ "elementId": "shop.api", "error_rate": 0.1 }
]
}
meta is optional. elementId is the model ID (dot path); every other key of an entry is a number and a metric. A file in another shape (no metrics list, metrics not a list, an empty list) is refused with exit code 2 and a message that shows this shape; overlay apply --help shows it too. apply warns on stderr about every elementId that is not in the model and ignores it (#696).
apply and remove find the model via --model or auto-detection. When --output is omitted it resolves relative to the model file’s directory, not the current directory. Any overlay failure (missing model/metrics file, unreadable diagram, unknown metric) exits with code 2.
bausteinsicht repl
Starts an interactive shell for editing the model.
Flags: none beyond the global flags.
Behavior: keeps the model in memory; supports add/remove/list/show/validate/undo/save (plus help and exit). The start line names the number of all elements, nested ones included. remove element <id> [--cascade] takes a dot path and works like the remove element command: the element and its children go; relationships, view entries and dynamic view steps that refer to it block the removal unless --cascade drops them too, and a view scope or constraint that names it always blocks it (#695). Pure additions are patched comment-preserving; modifications/deletions fall back to a full rewrite (with a warning). exit with unsaved changes prompts for confirmation before quitting; Ctrl-D (EOF) warns about unsaved changes and exits cleanly.
Validate-before-save gate: save runs validation and aborts if the in-memory model has more errors than the on-disk model had at load time. This allows saving valid edits even when the on-disk model already contains validation errors (e.g. a broken view reference that cannot be fixed via REPL commands). If the error count would increase, save is aborted and all errors are listed.
Overwrite behavior: when add element targets an ID that already exists, the existing element is overwritten. The description prompt shows the current description in brackets; pressing Enter without input keeps the existing description unchanged rather than clearing it.
Known limitation: remove relationship tokenizes the label using whitespace splitting. Labels containing consecutive spaces (e.g. "A B") can never be matched — use a single space in labels or remove such relationships by editing the model file directly.
bausteinsicht adr
Lists and shows Architecture Decision Records linked to model elements (the decisions field).
Subcommands:
| Subcommand | Description |
|---|---|
|
List all ADRs, or only those linked to one element ( |
|
Show details of a specific ADR. |
Flags: --model, -m (default: auto-detect). adr list supports --format text|json and --element <id> to filter; adr show prints text only.
bausteinsicht workspace
Works with multi-model workspaces that combine several architecture models.
Subcommands:
| Subcommand | Description |
|---|---|
|
List the models in a workspace configuration. |
|
Merge the configured models into one unified model. An existing output file is only replaced with |
|
Validate a workspace configuration: every model, and what the models cannot check alone (see below). |
|
Download the remote models ( |
Workspace configuration (JSONC like the models: comments and trailing commas are allowed; paths relative to the configuration file):
A key that no field has (a typo such as depthh for depth, or allowedHost for allowedHosts) is not ignored: workspace validate fails with exit code 2 and names the key with its path and the nearest field (unknown key models[0]: unknown field "depthh" (did you mean "depth"?)); list, merge and fetch print the same as a warning: on stderr and go on. The optional key $schema is allowed (#805); point it at schemas/bausteinsicht-workspace.schema.json (https://raw.githubusercontent.com/docToolchain/Bausteinsicht/main/schemas/bausteinsicht-workspace.schema.json) and the IDE completes the keys, flags a typo and offers the layout values (#806). The schema is generated from the configuration types, with additionalProperties: false, and a test keeps the committed file in sync.
{
"workspace": { "name": "landscape" },
"models": [
// import the whole model of team A
{ "id": "team_a", "path": "../team-a/architecture.jsonc" },
// import only the element "billing" of team B, as a black box
{ "id": "team_b", "path": "../team-b/architecture.jsonc", "prefix": "b", "elements": ["billing"], "depth": 1 }
],
"crossModelRelationships": [
{ "id": "pay", "from": "team_a:shop.api", "to": "team_b:billing", "label": "charges via", "kind": "uses" }
],
"views": {
// one page with the systems of both teams
"landscape": { "title": "Landscape", "include-from": ["team_a", "team_b"], "include-kinds": ["system"] }
}
}
| Field | Meaning |
|---|---|
|
Name of the model; used in cross-model relationships. Must be unique. |
|
Prefix for the element IDs of this model in the merged model ( |
|
Optional. Top-level elements to import, each with its children (default: all). Only top-level IDs, without dots. |
|
Optional. How many levels of the imported elements to keep: |
|
Relationships between models. |
|
Workspace views that select elements from several models, keyed by the view key of the merged model. Fields: |
Behavior (#227):
-
mergecombines the models into one: elements get the prefix, each nested element appears once below its parent, and the cross-model relationships are added. A cross-model relationship whose model or element does not exist makesmergefail (exit2) and nothing is written. -
validatechecks every model and then the workspace: duplicate model IDs or prefixes, cross-model relationships that point at models or elements that do not exist (or repeat an ID), and workspace views that are wrong (unknown model or kind, invalid layout, no elements, key already taken). It reports every problem and exits2if there is one. -
The element kinds and relationship kinds of all models are merged. A kind that only one model defines is added. If two models define the same kind differently (element kind:
notation,containerorc4; relationship kind:notationordashed),mergeandvalidatefail with one message per kind that names both models (ADR-012); a differentdescriptionis not a conflict, the first one is kept. -
mergeturns every workspace view into an ordinary view of the merged model: the selected elements are listed by their merged IDs, so nested elements are included, and a partially imported model contributes only what it imports. A kind ininclude-kinds/exclude-kindsmust exist in the merged specification.mergeandvalidatefail, naming the view, if a view selects no elements, names an unknown model or kind, has an invalidlayout, or has the key of a prefixed model view (<prefix>_<view key>); nothing is written then. -
Constraints of a model are merged too; their
fromandto(element IDs) get the model’s prefix, so they keep matching the prefixed elements. Selectors by kind or tag are unchanged. Constraint IDs are not prefixed and must be unique:mergefails on the merged model if two models define the same ID (#689). -
Prefix and element (or view key) are joined with
_, so different pairs can give the same merged ID (prefixawith elementb_c, and prefixa_bwith elementc).mergefails on such a collision instead of replacing one element with the other, andvalidatereports it.validatealso reports constraint IDs that more than one model defines. -
Models in other repositories are used either by checking them out (for example as a git submodule) and pointing
pathat the checkout, or as a pinned remote source (next section).
Remote sources (#227, ADR-012 Phase 2):
A model reference has either a local path or a source: an https URL of a model file, pinned by a tag or a commit in the URL (for example https://raw.githubusercontent.com/acme/billing/v1.4.0/architecture.jsonc). The real pin is the SHA-256 in bausteinsicht.lock: a changed file is an error unless workspace fetch --update; a tag or commit in the URL is the recommended form. A URL with a branch-like path segment (main, master, HEAD, trunk, develop, dev, refs/heads/…) is accepted, but validate, list, merge and fetch print warning: … not pinned by a tag or commit (#805). Remote sources are off by default.
{
"workspace": { "name": "landscape", "allowedHosts": ["raw.githubusercontent.com"] },
"models": [
{ "id": "team_a", "path": "../team-a/architecture.jsonc" },
{ "id": "billing", "source": "https://raw.githubusercontent.com/acme/billing/v1.4.0/architecture.jsonc", "prefix": "b" }
]
}
| Item | Rule |
|---|---|
|
Exact, lower-case host names (no scheme, port or wildcard). A |
|
|
|
Downloads each remote model to |
|
Never use the network. A remote model is read from the cache after its SHA-256 matches the lock; a missing lock entry or cache file is an error that names |
Network rules |
HTTPS with certificate verification, 30 second timeout, response limited to the model file size limit (10 MiB), no redirects (a redirect is an error: use the final URL), no proxy. The host name is resolved by Bausteinsicht and the connection is refused if any resolved address is loopback, private (RFC 1918, ULA), link-local (including the metadata address |
Authentication |
Only through the environment variable |
|
JSON |
A download is parsed as a model before anything is written, with the loader that local files go through: content that does not parse (a README, an HTML error page behind a status 200) or that has neither a specification nor a model (a JSON error object) is refused with <url> is not a Bausteinsicht model: <reason>, and neither the cache nor bausteinsicht.lock changes, also with --update (the pin that is there stays) (#734).
The SHA-256 in the lock file is compared as a hex number: a hash written in upper case is the same hash, and it is written in lower case the next time the lock is saved. When a model is no longer remote (removed from the configuration, renamed, or given a path), fetch drops its lock entry and deletes its cache file .bausteinsicht-cache/<id>.jsonc; other files in the cache directory, and lock entries whose ID cannot be a file name, are left alone (#735).
fetch prints one line per remote model (<id>: fetched|restored|updated|up-to-date (sha256 <prefix>)) or {"results": […]} with --format json. Exit code 2 on any error.
bausteinsicht schema
Manages the JSON Schema for Bausteinsicht models.
Subcommands:
| Subcommand | Description |
|---|---|
|
Generate the JSON Schema from the Go model types ( |
Behavior: the schema is generated from internal/model types, so it stays in sync with the model definitions.
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.