Developer guide
DSL
The Ninja DSL (Domain-Specific Language) provides an interactive command interface for service management.
Core Commands
Shuriken Management
# List installed shurikens
list
# List with state information
list state
# Select a shuriken for operations
select {name}
# Start selected shuriken
start
# Stop selected shuriken
stop
# Install from package
install {path}
# Deselect current shuriken
exitConfiguration
# Generate configuration
configure
# Configure with inline values
configure {
port = 8080
host = "localhost"
debug = true
}
# Set individual value
set {key} {value}
# Get value
get {key}
# Toggle boolean
toggle {key}Tools and Scripts
# Execute Ninja script
execute {script_path}
# Run shuriken tool
run-tool {tool_name}HTTP API Server
# Start HTTP server on port
http {port}Value Types
The DSL auto-detects types:
set name "string value" # String with quotes
set name value # String without quotes
set count 42 # Number
set enabled true # BooleanComments
# Hash-style comment
// Slash-style comment
configure {
option = value # Inline comment
}Example Scripts
Basic Setup
# Install and configure service
install ./my-service.shuriken
select my-service
configure {
port = 8080
workers = 4
}
start
list stateConfiguration Management
select webserver
# Set individual options
set port 9000
set ssl true
set log_level "debug"
# Generate config from template
configure
# Start service
startProgrammatic Usage
The DSL is available via:
- CLI -
shurikenctlREPL mode - GUI - Embedded command execution
- HTTP API -
/dsl/executeendpoint - Scripts -
.nsfiles with DSL commands
In Code
use ninja::dsl::DslContext;
let ctx = DslContext::new(manager);
execute_commands(&ctx, "start example-service")?;Use Cases
- Interactive management - REPL for quick operations
- Automation scripts - Batch configuration and deployment
- GUI integration - Backend for dashboard actions
- Deep links -
shurikenctl://start?shuriken={name}
Limitations
The DSL is designed for orchestration and short automation. For complex logic:
- Use management scripts (
.nswith Lua) - Write custom tools with full Ninja API access
- Use external orchestration tools
See also: DSL Syntax Reference, API Reference