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

@dailyautomations/terminal-logger

v0.1.0

Published

Terminal command logger with Supabase sync for swarm prompts

Downloads

29

Readme

Terminal Logger

A Node.js/TypeScript package that captures terminal commands and syncs them to Supabase for tracking swarm prompts and command history.

Features

  • 📝 Captures terminal commands from shell history
  • 🔄 Syncs commands to Supabase database
  • 🤖 Detects and tags swarm-related commands
  • 💾 Local JSON storage with automatic backups
  • ⏰ Configurable sync intervals
  • 🔍 Search and query command history
  • 📊 Session tracking and metadata

Installation

npm install @dailyautomations/terminal-logger

Or clone and build from source:

git clone <repo>
cd terminal-logger
npm install
npm run build

Setup

  1. Run the setup script:
npm run setup
  1. Configure your .env file:
SUPABASE_URL=your-supabase-url
SUPABASE_ANON_KEY=your-supabase-anon-key
LOG_FILE_PATH=./logs/commands.json
SYNC_INTERVAL_MINUTES=5
ENABLE_REAL_TIME_SYNC=false
  1. Create Supabase tables:
-- Terminal Commands Table
CREATE TABLE terminal_commands (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  command_id TEXT UNIQUE NOT NULL,
  timestamp TIMESTAMPTZ NOT NULL,
  command TEXT NOT NULL,
  directory TEXT NOT NULL,
  user_name TEXT NOT NULL,
  session_id TEXT NOT NULL,
  hostname TEXT NOT NULL,
  exit_code INTEGER,
  duration INTEGER,
  metadata JSONB,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

-- Sessions Table
CREATE TABLE terminal_sessions (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  session_id TEXT UNIQUE NOT NULL,
  start_time TIMESTAMPTZ NOT NULL,
  end_time TIMESTAMPTZ,
  user_name TEXT NOT NULL,
  hostname TEXT NOT NULL,
  shell TEXT NOT NULL,
  terminal TEXT NOT NULL,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

-- Create indexes
CREATE INDEX idx_commands_timestamp ON terminal_commands(timestamp);
CREATE INDEX idx_commands_session ON terminal_commands(session_id);
CREATE INDEX idx_commands_metadata ON terminal_commands(metadata);

Usage

As a standalone service:

npm start

As a library:

import { TerminalLogger } from '@dailyautomations/terminal-logger';

const logger = new TerminalLogger();

// Start logging
await logger.start();

// Get recent commands
const recentCommands = await logger.getRecentCommands(50);

// Search commands
const searchResults = await logger.searchCommands('claude-flow');

// Get swarm commands
const swarmCommands = await logger.getSwarmCommands();

// Check sync status
const syncStatus = logger.getSyncStatus();

// Stop logging
await logger.stop();

Shell Integration

Add to your ~/.bashrc or ~/.zshrc:

# Ensure history is written immediately
export PROMPT_COMMAND='history -a'

# Or for zsh:
# setopt INC_APPEND_HISTORY

Configuration

| Environment Variable | Description | Default | |---------------------|-------------|---------| | SUPABASE_URL | Supabase project URL | - | | SUPABASE_ANON_KEY | Supabase anonymous key | - | | LOG_FILE_PATH | Local JSON log file path | ./logs/commands.json | | SYNC_INTERVAL_MINUTES | Minutes between syncs | 5 | | ENABLE_REAL_TIME_SYNC | Sync immediately on command | false | | SHELL_HISTORY_FILE | Shell history file path | ~/.bash_history | | WATCH_INTERVAL_MS | History check interval | 1000 | | LOG_LEVEL | Logging level | info |

Swarm Command Detection

The logger automatically detects and tags swarm-related commands:

  • Commands containing claude-flow swarm
  • Commands with npx claude-flow
  • MCP tool invocations (mcp__*__*)
  • Swarm operations (init, spawn, orchestrate)

Tagged metadata includes:

  • isSwarmPrompt: boolean
  • swarmId: extracted swarm identifier
  • agentType: detected agent type
  • taskId: associated task ID

Development

# Install dependencies
npm install

# Build TypeScript
npm run build

# Watch mode
npm run watch

# Run tests
npm test

# Lint code
npm run lint

# Format code
npm run format

License

MIT