npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@trivajs/cli

v1.0.0

Published

Command-line interface for managing Triva applications - logs, errors, cache, and more

Downloads

20

Readme

@trivajs/cli

Command-line interface for managing Triva applications. Manage logs, errors, cache, and server directly from your terminal.

Installation

npm install triva
npm install -g @trivajs/cli

Or use with npx:

npx @trivajs/cli logs list

Quick Start

# View recent logs
triva logs list

# Check errors
triva errors list

# Cache operations
triva cache get user:123

# Server status
triva server status

Features

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

Commands

Logs

# 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

Errors

# 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

Cache

# 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

Stats

# Request statistics
triva stats requests

# Performance metrics
triva stats performance

# Health check
triva stats health

Server

# 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

Global Options

--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 version

Configuration

Create triva.config.js in your project root:

export default {
  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

Examples

Daily Log Export

# Export yesterday's logs
triva logs export --since 24h --output logs-$(date +%Y-%m-%d).json

Error Monitoring

# 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 {}

Cache Maintenance

# Clear old session data
triva cache delete "session:*"

# Check cache usage
triva cache stats

# Backup cache keys
triva cache list > cache-backup.txt

Performance Monitoring

# Check slow endpoints
triva stats performance --limit 1000

# Monitor health
triva stats health

Server Management

# Production deployment
triva server start --daemon --entry dist/server.js

# Quick restart after code changes
triva server restart

# Check if running
triva server status

Output Formats

Table (Default)

triva logs list
# id       | timestamp           | method | path      | status | duration
# abc123   | 2026-02-04 12:00:00 | GET    | /api/data | 200    | 45ms

JSON

triva logs list --format json
# [
#   {
#     "id": "abc123",
#     "timestamp": "2026-02-04T12:00:00.000Z",
#     "method": "GET",
#     "pathname": "/api/data",
#     "statusCode": 200,
#     "responseTime": 45
#   }
# ]

CSV

triva logs list --format csv
# id,timestamp,method,pathname,statusCode,responseTime
# abc123,2026-02-04T12:00:00.000Z,GET,/api/data,200,45

Scripting

Use in shell scripts:

#!/bin/bash

# Check for errors
ERROR_COUNT=$(triva errors list --format json | jq length)

if [ $ERROR_COUNT -gt 10 ]; then
  echo "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 --force

Programmatic Usage

Use CLI commands from Node.js:

import { exec } from 'child_process';
import { promisify } from 'util';

const execAsync = promisify(exec);

// Get logs as JSON
const { stdout } = await execAsync('triva logs list --format json');
const logs = JSON.parse(stdout);

console.log(`Found ${logs.length} logs`);

Troubleshooting

Command not found

Install globally:

npm install -g @trivajs/cli

Or use npx:

npx @trivajs/cli logs list

Config file not found

Specify config path:

triva logs list --config ./config/triva.config.js

Permission denied

Make binary executable:

chmod +x node_modules/@trivajs/cli/bin/triva.js

Server won't start

Check if port is in use:

triva server status

Development

# 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 list

License

MIT License - see LICENSE file

Contributing

Issues and PRs welcome! See main Triva repository for contribution guidelines.

Triva Framework - Main framework