Complete reference for all loko commands and flags.
| Flag | Description |
|---|---|
--help, -h |
Show help for any command |
--version, -v |
Show loko version |
Initialize a new loko project in the current directory.
loko init [project-name] [flags]Flags:
| Flag | Type | Default | Description |
|---|---|---|---|
--template |
string | standard-3layer |
Project template (standard-3layer, serverless) |
--description |
string | "" |
Project description |
Examples:
loko init my-project
loko init payment-service --template serverlessCreate a new architecture element (system, container, or component).
loko new system [flags]Flags:
| Flag | Type | Required | Description |
|---|---|---|---|
--name |
string | Yes | System display name |
--description |
string | No | System description |
loko new container [flags]Flags:
| Flag | Type | Required | Description |
|---|---|---|---|
--name |
string | Yes | Container display name |
--technology |
string | No | Technology stack |
--system |
string | Yes | Parent system name |
--description |
string | No | Container description |
loko new component [flags]Flags:
| Flag | Type | Required | Description |
|---|---|---|---|
--name |
string | Yes | Component display name |
--technology |
string | No | Technology (used for template auto-selection) |
--container |
string | Yes | Parent container name |
--system |
string | Yes | Parent system name |
--description |
string | No | Component description |
--template |
string | No | NEW v0.2.0 — Override auto-selected template (e.g., compute, datastore, messaging) |
--preview |
bool | No | NEW v0.2.0 — Render and display a D2 diagram preview after creation |
Template auto-selection (v0.2.0):
AWS Lambda→computeDynamoDB,RDS→datastoreSQS,SNS,Kinesis→messagingAPI Gateway,REST→apiEventBridge,Step Functions→eventS3,EFS→storage- (anything else) →
generic
Examples:
# Auto-select template based on technology
loko new component --name "Payment Processor" \
--technology "AWS Lambda" \
--container api-gateway \
--system payment-service
# Override template selection
loko new component --name "Cache Manager" \
--technology "Redis" \
--template datastore \
--container backend \
--system my-service
# Show diagram preview after creation
loko new component --name "Auth Handler" \
--technology "Go" \
--container api \
--system auth-service \
--previewBuild architecture documentation.
loko build [flags]Flags:
| Flag | Type | Default | Description |
|---|---|---|---|
--format |
string | html |
Output format: html, markdown, pdf, toon |
--output |
string | ./docs/output |
Output directory |
--project |
string | . |
Project root directory |
Examples:
loko build
loko build --format markdown --output ./docs
loko build --format pdf
loko build --format toonValidate the architecture for consistency issues.
loko validate [flags]Flags:
| Flag | Type | Default | Description |
|---|---|---|---|
--check-drift |
bool | false |
NEW v0.2.0 — Check for inconsistencies between D2 diagrams and frontmatter |
--project |
string | . |
Project root directory |
Drift detection (--check-drift):
- Reports
DriftDescriptionMismatchas WARNING (D2 tooltip ≠ frontmatter description) - Reports
DriftMissingComponentas ERROR (D2 arrow targets non-existent component) - Reports
DriftOrphanedRelationshipas ERROR (frontmatter relationship to deleted component) - Exit code
1if any ERROR-level drift is found;0otherwise
Examples:
loko validate
loko validate --check-drift
loko validate --check-drift --project /path/to/projectSample output (with drift):
❌ Validation failed - Critical drift detected
Issues found:
auth-handler (ERROR): Orphaned relationship - target 'old-service' not found
Summary:
Components checked: 17
Drift issues found: 1 (0 warnings, 1 error)
Start the local documentation server.
loko serve [flags]Flags:
| Flag | Type | Default | Description |
|---|---|---|---|
--port |
int | 3000 |
Port to listen on |
--host |
string | localhost |
Host address |
--project |
string | . |
Project root directory |
Start the MCP (Model Context Protocol) server for AI assistant integration.
loko mcp [flags]Flags:
| Flag | Type | Default | Description |
|---|---|---|---|
--project |
string | . |
Project root directory |
See the MCP Integration Guide for setup instructions.
Watch for file changes and rebuild documentation automatically.
loko watch [flags]Flags:
| Flag | Type | Default | Description |
|---|---|---|---|
--format |
string | html |
Output format to rebuild on changes |
--project |
string | . |
Project root directory |
Export architecture data to various formats.
loko export [flags]Flags:
| Flag | Type | Default | Description |
|---|---|---|---|
--format |
string | json |
Export format: json, toon |
--output |
string | stdout |
Output file path |
Generate shell completion scripts.
loko completion [bash|zsh|fish|powershell]Examples:
# Bash
loko completion bash > /etc/bash_completion.d/loko
# Zsh
loko completion zsh > "${fpath[1]}/_loko"
# Fish
loko completion fish > ~/.config/fish/completions/loko.fishPrint the current version.
loko version| Variable | Description |
|---|---|
LOKO_CONFIG_HOME |
Override config directory (default: ~/.config/loko) |
LOKO_PROJECT_ROOT |
Override project root detection |
XDG_CONFIG_HOME |
XDG config base directory |
XDG_DATA_HOME |
XDG data base directory |
XDG_CACHE_HOME |
XDG cache base directory |