CLI Reference

CLI Commands

Complete reference for the Lelu CLI commands available in all SDK packages. View audit logs and manage authorization policies directly from your terminal.

Installation

The CLI is included with all Lelu SDK packages. Choose your preferred language:

npm install -g @lelu-auth/lelu

Available Commands

# View audit logs
npx @lelu-auth/lelu audit-log

# List all policies
npx @lelu-auth/lelu policies list

# View specific policy
npx @lelu-auth/lelu policies get auth

# Create/update policy from file
npx @lelu-auth/lelu policies set auth ./auth.rego

# Delete policy
npx @lelu-auth/lelu policies delete old-policy

# Show help
npx @lelu-auth/lelu help

Command Reference

Audit Log Commands

CommandDescription
audit-logView recent authorization events and audit trail data

Policy Management Commands

CommandDescription
policies listList all policies with metadata
policies get <name>View a specific policy's content and details
policies set <name> <file>Create or update a policy from a Rego file
policies delete <name>Delete a policy by name

Environment Variables

Configure CLI behavior using these environment variables:

VariableDefaultDescription
LELU_PLATFORM_URLhttp://localhost:9091Platform API URL
LELU_PLATFORM_API_KEYplatform-dev-keyPlatform API key for authentication
LELU_TENANT_IDdefaultTenant ID for multi-tenant setups
LELU_AUDIT_LIMIT20Number of audit events to fetch

Examples

Basic Usage

terminal
# View recent audit events
lelu audit-log

# List all policies
lelu policies list

# View a specific policy
lelu policies get auth

Policy Management

terminal
# Create a new policy from file
lelu policies set auth ./auth.rego

# Update existing policy
lelu policies set auth ./updated-auth.rego

# Delete policy
lelu policies delete old-policy

Custom Configuration

terminal
# Use custom platform URL
LELU_PLATFORM_URL=https://your-platform.com lelu audit-log

# Use different tenant
LELU_TENANT_ID=prod lelu policies list

# Fetch more audit events
LELU_AUDIT_LIMIT=50 lelu audit-log

Error Handling

The CLI provides helpful error messages and troubleshooting guidance:

Platform Service Required

All CLI commands require the Lelu platform service to be running. If the service is not available, the CLI will:

  • • Display clear error messages
  • • Provide Docker setup instructions
  • • Show the current connection URL
  • • Suggest troubleshooting steps