CLI Specification

See Use Cases for the functional overview of all CLI commands.

Command Overview

Command Description Status

bausteinsicht init

Initialize a new architecture model with default specification, sample model, and template

Implemented

bausteinsicht sync

Bidirectional synchronization between model and draw.io diagrams

Implemented

bausteinsicht validate

Validate the architecture model for consistency and report errors/warnings

Implemented

bausteinsicht watch

Watch mode — continuously sync on file changes

Implemented

bausteinsicht add element

Add a new element to the model (LLM-friendly)

Implemented

bausteinsicht add relationship

Add a new relationship to the model (LLM-friendly)

Implemented

bausteinsicht add view

Create a new view or modify a view’s include list (LLM-friendly)

Implemented

bausteinsicht add specification

Add element or relationship types to the specification (LLM-friendly)

Implemented

bausteinsicht export

Export diagram views to PNG or SVG using the draw.io CLI

Implemented

bausteinsicht export-table

Export element attributes as AsciiDoc or Markdown table per view

Implemented

bausteinsicht export-diagram

Export views as PlantUML C4 or Mermaid C4 text diagrams

Implemented

bausteinsicht export-sequence

Export dynamic views as PlantUML or Mermaid sequence diagrams

Implemented

bausteinsicht lint

Check the model against the architectural constraints defined in it

Implemented

bausteinsicht health

Compute an architecture health score (completeness, conformance, complexity)

Implemented

bausteinsicht graph

Analyze the relationship graph: cycles, centrality, dependency depth

Implemented

bausteinsicht stale

Flag elements that are old (beyond a threshold) and carry neither a lifecycle status nor an ADR link

Implemented

bausteinsicht status

List elements by lifecycle status

Implemented

bausteinsicht find

Full-text search over elements, relationships, and views

Implemented

bausteinsicht show

Show all details of a single element

Implemented

bausteinsicht snapshot

Save, list, diff, restore, and delete versioned model snapshots

Implemented

bausteinsicht diff

Compare the model’s as-is and to-be sections

Implemented

bausteinsicht changelog

Generate an architecture changelog between two versions

Implemented

bausteinsicht import

Import a model from Structurizr DSL or LikeC4

Implemented

bausteinsicht generate-template

Generate a draw.io template from the specification

Implemented

bausteinsicht layout

Compute hierarchical layout and write positions back to draw.io

Implemented

bausteinsicht overlay

Apply/list/remove metric heatmap overlays on the diagram

Implemented

bausteinsicht repl

Interactive shell for editing the model

Implemented

bausteinsicht adr

List and show Architecture Decision Records linked to elements

Implemented

bausteinsicht workspace

List, merge, and validate multi-model workspaces

Implemented

bausteinsicht schema

Generate the JSON Schema from the Go model types

Implemented

bausteinsicht --version

Display version number

Implemented

Global Flags

These flags are available on all subcommands via persistent flags on the root command.

Flag Description Default

--format text|json

Output format. json produces machine-readable output suitable for LLM and scripting use. Errors in JSON mode are written to stderr as {"error": "…​", "code": N}.

text

--model <path>

Path to the model file (.jsonc). When omitted, auto-detection scans the current directory for a single *.jsonc file; if more than one is present, the command aborts and asks for --model (see Auto-Detection Behavior).

auto-detect

--template <path>

Path to a custom draw.io template file. Must have a .drawio extension. When omitted, the built-in default template is used.

built-in template

--verbose

Enable verbose output. Verbose messages are written to stderr so they do not interfere with JSON output on stdout.

false

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, all commands that require a model file invoke auto-detection:

  1. The current working directory is scanned for files matching *.jsonc.

  2. If exactly one .jsonc file is found, it is used.

  3. If more than one .jsonc file is found, the command aborts with exit code 2 and the message multiple .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.

  4. If no .jsonc file is found, the command exits with code 2 and an error message.

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 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}

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 --model or auto-detection).

  • Runs validation checks including referential integrity and model consistency.

  • In --verbose mode, prints element/relationship/view counts to stderr before validation.

  • Warnings are printed with WARNING: prefix; errors with ERROR: prefix.

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 (default architecture.md). Implies --mermaid.

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.

  • 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: The draw.io file and sync state file paths are derived from the model file location:

  • <model-dir>/architecture.drawio

  • <model-dir>/.bausteinsicht-sync

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 (default architecture.md). Implies --mermaid.

Behavior:

  • Loads the model path (via --model or auto-detection) and derives the draw.io path.

  • 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 SIGINT or SIGTERM is 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

--id

Unique identifier for the element. Must match [a-zA-Z][a-zA-Z0-9_-]* (no dots).

Yes

 — 

--kind

Element kind as defined in the model’s specification section.

Yes

 — 

--title

Display title for the element. Must not be empty.

Yes

 — 

--parent

Parent element ID in dot notation (e.g., webshop.backend). The parent must exist and its kind must be a container.

No

(top-level)

--technology

Technology description for the element.

No

(empty)

--description

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, falling back to full save if patching fails.

  • 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

--from

Source element in dot notation (e.g., webshop.api).

Yes

 — 

--to

Target element in dot notation (e.g., webshop.db).

Yes

 — 

--label

Relationship label displayed on the connector.

No

(empty)

--kind

Relationship kind as defined in the model’s specification section.

No

(empty)

--description

Relationship description.

No

(empty)

Behavior:

  • Validates that both --from and --to elements exist in the model.

  • If --kind is specified, validates it against the model’s specification.

  • Checks for duplicate relationships (same from, to, and kind combination).

  • Uses comment-preserving array append to update the JSONC file, falling back to full save if patching fails.

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.

Flags:

Flag Description Required Default

--scope

Parent element ID to set the view’s scope (drill-down level).

No

(none)

--include

Element to include in the view (repeatable, e.g., --include elem1 --include elem2). Supports wildcard patterns like system.*.

No

(empty)

--title

View title (display name) (required for new views).

No

(empty)

--description

View description.

No

(empty)

Behavior:

  • For new views: requires --title; creates view with all specified fields.

  • For existing views: merges fields:

    • --title, --scope, --description update respective fields (if specified)

    • --include elements are added to existing include list (deduplicated)

  • Validates that scope element exists (if specified).

  • Validates that all include elements exist (if specified, excluding wildcard patterns).

  • Uses comment-preserving insertion to update the JSONC file.

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" --format json
{
  "view_key": "context",
  "title": "System Context",
  "scope": "",
  "include": ["system", "external_system", "user"]
}

bausteinsicht add specification

Adds new element or relationship types to the model’s specification. Enables definition of custom architecture notations.

Add Element Type

Adds a new element kind to the specification.

Command: bausteinsicht add specification element <key>

Flags:

Flag Description Required Default

--notation

Display notation/name for this element type (e.g., "Custom Component").

Yes

 — 

--description

Description of this element type.

No

(empty)

--container

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

--notation

Display notation/label for this relationship type (e.g., "calls").

Yes

 — 

--description

Description of this relationship type.

No

(empty)

--dashed

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 export

Exports draw.io diagram views to image files (PNG or SVG) using the draw.io CLI.

Flags:

Flag Description Required Default

--image-format

Image format for export: png or svg.

No

png

--view

Export only a specific view by its key. When omitted, all views are exported.

No

(all views)

--output

Output directory for exported files.

No

. (current directory)

--scale

Export scale factor (e.g. 2.0 for retina, 3.0 for print). Values greater than 1 require a hardware GPU.

No

1

--embed-diagram

Embed the draw.io XML source in the exported image file.

No

false

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.

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

--view

Export only a specific view by its key. When omitted, all views are exported.

No

(all views)

--table-format

Table output format: adoc (AsciiDoc) or md (Markdown).

No

adoc

--output

Output directory for exported files. When omitted, the table is written to stdout.

No

(stdout)

--combined

Export a single combined table with elements from all views, deduplicated.

No

false

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 file all-views-elements.adoc (or .md) covering every view.

    • --combined → one deduplicated file elements.adoc (or .md).

  • Creates the output directory if it does not exist.

JSON output structure--format json emits an array of element rows (not a file list):

[
  { "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

--view

Export only a specific view by its key. When omitted, all views are exported. Not supported with --diagram-format structurizr (which always exports the whole workspace).

No

(all views)

--diagram-format

Diagram output format: plantuml, mermaid, dot, d2, html, or structurizr.

No

plantuml

--output

Output directory for exported files. When omitted, the diagram is written to stdout.

No

(stdout)

Behavior:

  • Loads the model and resolves view elements and relationships.

  • Auto-detects the C4 level (Context, Container, or Component) from the view content.

  • Generates diagram source in the requested format. C4-PlantUML uses the stdlib include syntax (!include <C4/C4_Context>, etc.).

  • 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.

  • Without --output, the diagram(s) are written to stdout. With --output <dir>, per-view files are named <view-key>.<ext>, where <ext> is puml, mmd, dot, d2, or html.

  • --diagram-format structurizr is special: it exports the entire workspace as a single workspace.dsl file and rejects --view (exit code 1).

  • Creates the output directory if it does not exist.

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..." }
]

Exit codes:

  • 0 — all diagrams exported successfully

  • 1 — one or more exports failed, or --view used with structurizr

  • 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

--model

Path to the model file.

No

Auto-detected

--view

Export only the dynamic view with this key.

No

All dynamic views

--diagram-format

Diagram format: plantuml or mermaid.

No

plantuml

--output

Output directory for exported files. When omitted, output is written to stdout.

No

stdout

--format

Output format: text or json.

No

text

Behavior:

  • Loads the model and reads dynamicViews entries.

  • Steps are sorted by index and 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.

  • If --output is given, files are named sequence-<view-key>.puml (PlantUML) or sequence-<view-key>.md (Mermaid).

  • 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

sync (or omitted)

A → B

A→>B

return

A -→ B

A-→>B

async

A →> B

A-)B

JSON output structure:

[
  {
    "view": "checkout-flow",
    "format": "plantuml",
    "source": "@startuml checkout_flow\n..."
  }
]

Exit codes:

  • 0 — all sequence diagrams exported successfully (or no dynamic views defined)

  • 1 — specified --view key 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.

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

--summary

Print only the overall score and grade.

No

false

--output

Write the report to a file instead of stdout.

No

(stdout)

Behavior: requires an explicit --model. 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

--centrality

Show centrality metrics per element.

No

false

--cycles-only

Show only detected cycles.

No

false

--output

Write the report to a file instead of stdout.

No

(stdout)

Behavior: requires an explicit --model. 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

--days, -d

Consider an element stale if unmodified for this many days.

No

90

--model, -m

Model file path.

No

architecture.jsonc

--drawio-file

draw.io diagram path (auto-detected if empty).

No

(auto-detect)

--mark-drawio

Highlight stale elements in the diagram.

No

false

--unmark-drawio

Remove stale markers from the diagram (restores original styles).

No

false

--format, -f

Output format: text or json.

No

text

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

--filter, -f

Show only elements with this status.

No

(all)

Behavior: requires an explicit --model. Groups elements under their status.

bausteinsicht find

Full-text search over the model.

Arguments: <query> (required) — the search string.

Flags:

Flag Description Required Default

--type

Limit results to element, relationship, view, or all.

No

all

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

save

Capture the current model as a snapshot (--message adds a note).

list

List saved snapshots (--output-format table|json).

diff <id1> [id2]

Diff snapshot id1 against id2, or against the current model if id2 is omitted (--format text|json).

restore <id> <output-path>

Restore a snapshot to a file (--force to overwrite).

delete <id>

Delete a snapshot.

Behavior: diff reports a structured architecture delta (added/removed elements and relationships), not a text diff.

bausteinsicht diff

Reports the gap between the model’s asIs and toBe sections.

Flags:

Flag Description Required Default

--model

Model file path.

No

architecture.jsonc

--view

Accepted for forward compatibility but currently has no effect (per-view diff is not yet implemented).

No

(all)

--format

Output format: text or json.

No

text

Behavior: exits with an error if the model has no asIs/toBe sections.

bausteinsicht changelog

Generates a human-readable changelog between two versions of the model.

Flags:

Flag Description Required Default

--since

Starting git ref (commit SHA or tag). Must be provided — there is no implemented default.

Yes (in practice)

(none)

--until

Ending git ref.

No

HEAD

--model

Model file path.

No

architecture.jsonc

--changelog-format

Output format: markdown, asciidoc, or json.

No

markdown

--output

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. Only git refs are supported — snapshot IDs are not (yet) resolved, and an empty --since fails to resolve. (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

--from

Source format: structurizr (.dsl) or likec4 (.c4).

Yes

(none)

--output

Output model file path.

No

architecture.jsonc

--dry-run

Print the generated model to stdout instead of writing the file.

No

false

--force

Overwrite the output file if it already exists.

No

false

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).

bausteinsicht generate-template

Generates a draw.io template with a styled shape for each element kind in the specification.

Flags:

Flag Description Required Default

--style

Visual preset: default, c4, minimal, or dark.

No

default

--output

Output template file.

No

architecture-template.drawio

--model

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 hierarchical layout for the diagram and writes the element positions back to the draw.io file.

Flags:

Flag Description Required Default

--algorithm

Layout algorithm (currently only hierarchical).

No

hierarchical

--rank-dir

Ranking direction: TB (top-to-bottom) or LR (left-to-right).

No

TB

--preserve-pinned

Do not move elements marked bausteinsicht-pinned=true.

No

true

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 <metrics-file>

Apply a metric heatmap (--metric <key>, default: first available; --output, default <model-dir>/architecture.drawio, i.e. next to the model file).

list <metrics-file>

List the metrics available in the file.

remove

Remove the overlay and restore original colors (--output, same default).

apply and remove load the model directly and do not auto-detect — pass --model (there is no default). 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). Validates before every save; 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.

bausteinsicht adr

Lists and shows Architecture Decision Records linked to model elements (the decisions field).

Subcommands:

Subcommand Description

list

List all ADRs, or only those linked to one element (--element <id>).

show <adr-id>

Show details of a specific ADR.

Flags: --model, -m (default architecture.jsonc). 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 <config-file>

List the models in a workspace configuration.

merge <config-file> <output-file>

Merge the configured models into one unified model.

validate <config-file>

Validate a workspace configuration.

bausteinsicht schema

Manages the JSON Schema for Bausteinsicht models.

Subcommands:

Subcommand Description

generate

Generate the JSON Schema from the Go model types (--output, default schemas/bausteinsicht.schema.json).

Behavior: the schema is generated from internal/model types, so it stays in sync with the model definitions.