Command-line interface for managing Triva applications. Manage logs, errors, cache, and server directly from your terminal.
npm install -g @trivajs/cliOr use with npx:
npx @trivajs/cli logs list# View recent logs
triva logs list
# Check errors
triva errors list
# Cache operations
triva cache get user:123
# Server status
triva server status✅ Logs Management - View, filter, export request logs
✅ Error Tracking - List, resolve, analyze errors
✅ Cache Control - Get, set, delete cache entries
✅ Statistics - View application metrics
✅ Server Management - Start, stop, restart server
✅ Zero Dependencies - Lightweight CLI tool
# List recent logs
triva logs list
# List with limit
triva logs list --limit 100
# Filter by time
triva logs list --since 24h
# Get specific log
triva logs get abc123
# Export to JSON
triva logs export --format json --output logs.json
# Export to CSV
triva logs export --format csv --output logs.csv
# Clear old logs
triva logs clear --since 7d
# Clear all logs (requires --force)
triva logs clear --force
# Filter logs
triva logs filter --method GET --status 200 --path /api# List unresolved errors
triva errors list
# List resolved errors
triva errors list --resolved true# Filter by severity
triva errors list --severity error
# Get specific error
triva errors get abc123
# Resolve error
triva errors resolve abc123
# Clear resolved errors
triva errors clear --resolved
# Clear all errors (requires --force)
triva errors clear --force
# Show error statistics
triva errors stats# List all keys
triva cache list
# List with pattern
triva cache list --pattern "user:*"# Get value
triva cache get user:123
# Set value
triva cache set user:123 '{"name":"John"}'# Set with TTL (milliseconds)
triva cache set session:abc "data" --ttl 3600000
# Delete key
triva cache delete user:123
# Delete pattern
triva cache delete "users:*"# Clear all cache (requires --force)
triva cache clear --force
# Show cache statistics
triva cache stats# Request statistics
triva stats requests
# Performance metrics
triva stats performance
# Health check
triva stats health# Start server
triva server start
# Start in background (daemon)
triva server start --daemon
# Start custom entry file
triva server start --entry app.js
# Stop server
triva server stop
# Restart server
triva server restart
# Check status
triva server status--config <path> Path to config file (default: triva.config.js)
--format <type> Output format: json, table, csv (default: table)
--limit <number> Limit results (default: 50)
--output <file> Save output to file
--severity <level> Filter by severity: info, warn, error
--since <time> Time filter: 1h, 24h, 7d, 30d
--force Skip confirmation prompts
--help, -h Show help
--version, -v Show versionCreate triva.config.js in your project root:
exportdefault{cache: {type: 'memory',retention: 3600000},throttle: {limit: 100,window_ms: 60000},retention: {enabled: true,maxEntries: 10000},errorTracking: {enabled: true,maxEntries: 5000}};Then use CLI:
triva logs list --config triva.config.js# Export yesterday's logs
triva logs export --since 24h --output logs-$(date +%Y-%m-%d).json# Check for new errors
triva errors list --limit 10
# Resolve all errors in bulk (after fixing)
triva errors list --format json | jq -r '.[].id'| xargs -I {} triva errors resolve {}# Clear old session data
triva cache delete "session:*"# Check cache usage
triva cache stats
# Backup cache keys
triva cache list > cache-backup.txt# Check slow endpoints
triva stats performance --limit 1000
# Monitor health
triva stats health# Production deployment
triva server start --daemon --entry dist/server.js
# Quick restart after code changes
triva server restart
# Check if running
triva server statustriva logs list
# id | timestamp | method | path | status | duration# abc123 | 2026-02-04 12:00:00 | GET | /api/data | 200 | 45mstriva logs list --format json
# [# {# "id": "abc123",# "timestamp": "2026-02-04T12:00:00.000Z",# "method": "GET",# "pathname": "/api/data",# "statusCode": 200,# "responseTime": 45# }# ]triva logs list --format csv
# id,timestamp,method,pathname,statusCode,responseTime# abc123,2026-02-04T12:00:00.000Z,GET,/api/data,200,45Use in shell scripts:
#!/bin/bash# Check for errors
ERROR_COUNT=$(triva errors list --format json | jq length)if [ $ERROR_COUNT-gt 10 ];thenecho"Too many errors: $ERROR_COUNT"# Send alert
curl -X POST https://alerts.example.com/webhook
fi# Export logs daily
triva logs export --since 24h --output "logs-$(date +%Y-%m-%d).json"# Clear old logs
triva logs clear --since 30d --forceUse CLI commands from Node.js:
import{exec}from'child_process';import{promisify}from'util';constexecAsync=promisify(exec);// Get logs as JSONconst{ stdout }=awaitexecAsync('triva logs list --format json');constlogs=JSON.parse(stdout);console.log(`Found ${logs.length} logs`);Install globally:
npm install -g @trivajs/cliOr use npx:
npx @trivajs/cli logs listSpecify config path:
triva logs list --config ./config/triva.config.jsMake binary executable:
chmod +x node_modules/@trivajs/cli/bin/triva.jsCheck if port is in use:
triva server status# Clone repository
git clone https://github.com/yourusername/triva.git
cd triva/extensions/cli
# Install dependencies
npm install
# Test CLI
node bin/triva.js logs listMIT License - see LICENSE file
Issues and PRs welcome! See main Triva repository for contribution guidelines.
- Triva Framework - Main framework
- @trivajs/cors - CORS middleware