Structurizr CLI
repository·master·Indexed 20 days ago
https://github.com/structurizr/cliA command-line tool for interacting with Structurizr, featuring capabilities to export workspaces to formats like PlantUML, Mermaid, and static websites; migrate workspaces from Structurizr Cloud to On-Premises; and manage workspaces via push, pull, lock, and merge commands. It also includes an inspect command for analyzing architectural violations and a list command for viewing model elements. Note: This tool is currently being deprecated in favor of new consolidated tooling.
What's inside structurizr-cli
- The Structurizr CLI is no longer receiving updates. Users are advised to migrate to the new consolidated tooling. For details on the new tooling and available commands, refer to the Structurizr vNext documentation and the official commands guide.
Structure of exported workspace data
masterWhen running the
cloud-to-onpremisescommand, the output directory will contain the following structure for each workspace:structurizr.properties: Global configuration for the exported set.structurizr.users: User credentials file.<workspace-id>/:workspace.json: The main workspace definition.workspace.properties: Workspace-specific configuration (API keys, owner, permissions, etc.).branches/(optional):<branch-name>/workspace.json: The workspace definition for a specific branch.
Migrate workspaces from Structurizr Cloud to On-Premises
masterThe
cloud-to-onpremisescommand allows you to export your workspaces from the Structurizr Cloud service to a local directory. This is useful for migrating to an On-Premises installation. The command fetches workspace metadata, downloads the workspace JSON (including branches if applicable), and generates necessary configuration files likestructurizr.properties,structurizr.users, andworkspace.propertiesto facilitate the migration.Important: The specified output directory must not already exist; the command will fail if it does to prevent overwriting data.
# Example usage (placeholders used) # Note: The output directory '/path/to/output' must not exist before running this. structurizr cloud-to-onpremises --apiKey YOUR_API_KEY --username YOUR_USERNAME --output /path/to/outputExport a static website from a workspace
masterUsing the
staticformat generates a complete, ready-to-host static website.Key behaviors of the static export:
- It unzips a default static site template into the output directory.
- It automatically adds default views and styles if none exist in the workspace.
- It applies Graphviz automatic layout locally to ensure diagrams are positioned.
- It generates a
workspace.jsfile in the output directory containing the workspace data as a base64 encoded string (const jsonAsString = '...';). - Note: Documentation (textual descriptions) is cleared during this process as it is not supported by the static site generator.
structurizr-cli export -w my-workspace.dsl -f static -o ./my-static-siteReference the `inspect` command options
masterThe following options are available for the
inspectcommand:Option Long Flag Required Description -w--workspaceYes Path or URL to the workspace JSON/DSL file -i--inspectorNo Inspector implementation to use (defaults to com.structurizr.inspection.DefaultInspector)-s--severityNo A comma-separated list of the severity level(s) to show Severity Levels
When using the
--severityflag, you can specify any of the following levels (case-insensitive):ERRORWARNINGINFOIGNORE
If no severity is specified, the command defaults to showing
ERROR,WARNING,INFO, andIGNORE.inspect --workspace ./workspace.dsl --severity ERROR,WARNINGReference the unlock command options
masterThe following options are available for the
unlockcommand:Option Long Flag Required Description -u--structurizrApiUrlNo Structurizr API URL (default: https://api.structurizr.com)-i--workspaceIdYes The unique ID of the workspace -k--apiKeyYes The Workspace API key -s--apiSecretYes The Workspace API secret Reference: `push` command options
masterThe following options are available for the
pushcommand:Long Flag Short Flag Description Required --structurizrApiUrl-urlStructurizr API URL (default: https://api.structurizr.com)No --workspaceId-idWorkspace ID Yes --apiKey-keyWorkspace API key Yes --apiSecret-secretWorkspace API secret Yes --branch-branchBranch name No --workspace-wPath or URL to the workspace JSON/DSL file Yes --passphrase-passphraseClient-side encryption passphrase No --mergeFromRemote-mergeWhether to merge layout information from the remote workspace (default: true)No --archive-archiveStores the previous version of the remote workspace (default: true)No --debug-debugEnable debug logging No List command options
masterThe
listcommand accepts the following options:Flag Long Option Required Description -w--workspaceYes Path or URL to the workspace JSON/DSL file Reference: pull command options
masterThe following options are available for the
pullcommand. Note thatworkspaceId,apiKey, andapiSecretare required.--structurizrApiUrl <value> Structurizr API URL (default: https://api.structurizr.com) --workspaceId <value> Workspace ID (Required) --apiKey <value> Workspace API key (Required) --apiSecret <value> Workspace API secret (Required) --branch <value> Branch name --passphrase <value> Client-side encryption passphrase --debug Enable debug loggingReference: cloud-to-onpremises CLI flags
masterThe
cloud-to-onpremisescommand accepts the following options:Flag Long Name Required Description --key--apiKeyYes The API key for the Structurizr Cloud service. --user--usernameNo The username for the Structurizr Cloud service. -o--outputNo Path to a new output directory where workspaces will be exported. --debug--debugNo Enable debug logging. Reference the export command options
masterThe
exportcommand accepts the following options:Flag Long Option Description -w--workspaceRequired. Path or URL to the workspace JSON file or DSL file(s). -f--formatRequired. The export format (see supported formats below). -o--outputOptional. Path to the output directory. If not provided, it defaults to the parent directory of the workspace file. Supported Formats
Diagram Formats:
mermaid: Mermaid diagram definitions.plantuml: Structurizr PlantUML format.plantuml/c4plantuml: C4 PlantUML format.plantuml/structurizr: Structurizr-specific PlantUML subformat.dot: Graphviz DOT format.websequencediagrams: WebSequenceDiagrams format.
Workspace & Data Formats:
json: The workspace exported as JSON.theme: The workspace theme exported as JSON.static: A complete static website export (includes aworkspace.jscontaining base64 encoded JSON).ilograph: Ilograph format.
PlantUML Color Schemes: For PlantUML formats, you can append color scheme suffixes:
plantuml-light(orplantuml/structurizr-light, etc.)plantuml-dark(orplantuml/structurizr-dark, etc.)
# List of supported format strings for the -f flag: # mermaid, dot, websequencediagrams, ilograph, json, theme, static, # plantuml, plantuml/c4plantuml, plantuml/structurizrReference: validate command options
masterThe
validatecommand uses the following options to specify the workspace to be checked.-w, --workspace <string> Path or URL to the workspace JSON/DSL file (Required)