Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help


title: "CLI Basics" weight: 10 summary: "Install, verify, and use the Sruja CLI to work with architecture models." tags: ["cli", "getting-started"]

CLI Basics

This tutorial teaches the essential Sruja CLI commands for day‑to‑day work.

Install and Verify

curl -fsSL https://raw.githubusercontent.com/sruja-ai/sruja/main/scripts/install.sh | bash
sruja --version

If sruja is not found, ensure the install directory is in your PATH:

# If installed via install script, ensure ~/.local/bin (or script’s target) is in PATH
export PATH="$HOME/.local/bin:$PATH"

Create a Model

import { * } from 'sruja.ai/stdlib'


App = system "My App" {
Web = container "Web Server"
DB = database "Database"
}
User = person "User"

User -> App.Web "Visits"
App.Web -> App.DB "Reads/Writes"

view index {
include *
}

Lint and Compile

sruja lint example.sruja
sruja compile example.sruja

Format

sruja fmt example.sruja > example.formatted.sruja

Tree View

sruja tree --file example.sruja

Export to D2

sruja export d2 example.sruja > example.d2