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

@mailhooks/cli

v0.3.0

Published

Command-line interface for the Mailhooks email platform, designed for agentic systems

Readme

@mailhooks/cli

Command-line interface for the Mailhooks email platform, designed for agentic systems and shell scripts.

Every command emits JSON to stdout and JSON errors to stderr, so the CLI composes cleanly with jq, pipelines, and LLM tool loops.

Install

npm install -g @mailhooks/cli
# or one-off:
npx @mailhooks/cli emails list

Quick start

# Option 1: store credentials once (plaintext, mode 0600 in ~/.config/mailhooks/)
mailhooks login --api-key mh_live_...

# Multiple environments? Use profiles:
mailhooks login --profile prod    --api-key mh_prod_...
mailhooks login --profile staging --api-key mh_staging_... --base-url https://staging-api.mailhooks.dev/api
mailhooks profiles list
mailhooks --profile staging emails list    # per-invocation override
mailhooks profiles use staging              # or switch the default

# Option 2: env var (no disk persistence)
export MAILHOOKS_API_KEY=mh_live_...

# Then use any command:
mailhooks emails list --per-page 5
mailhooks emails wait-for --subject "verification" --timeout 60000
mailhooks whoami   # active profile, creds (masked), source, domains
mailhooks logout   # remove the current profile (use --all to nuke everything)

Resolution order: --api-key flag → MAILHOOKS_API_KEY → current profile. Profile selection: --profileMAILHOOKS_PROFILEcurrentProfile in config.

Agent usage

The CLI is intended to be called from agentic systems (LLM tool loops, scripts, automations). See AGENTS.md for the full agent-facing guide, including the canonical wait-for → content → mark-read loop, exit code contract, and patterns like extracting one-time codes.

Commands

  • mailhooks login [--profile name] — store API key (flag, stdin, or hidden TTY prompt)
  • mailhooks logout [--profile name] [--all] — remove credentials
  • mailhooks whoami — show active credentials (masked), source, profile, domains
  • mailhooks profiles list — list configured profiles
  • mailhooks profiles use <name> — switch the current profile
  • mailhooks emails list — paginated list with filters
  • mailhooks emails get <id> — fetch a single email (metadata)
  • mailhooks emails content <id> — fetch HTML + text body
  • mailhooks emails wait-for — block until a matching email arrives
  • mailhooks emails mark-read <id> / mark-unread <id>
  • mailhooks emails delete <id>
  • mailhooks emails download-eml <id>
  • mailhooks emails download-attachment <emailId> <attachmentId>
  • mailhooks parse-eml [file] — parse an EML file (path or stdin) into JSON
  • mailhooks listen — forward real-time email events to a local webhook (like stripe listen)

Run mailhooks --help or mailhooks <command> --help for full flag lists.

Configuration

| Env var | Flag | Purpose | |---|---|---| | MAILHOOKS_API_KEY | --api-key | API key. Required unless stored via mailhooks login. | | MAILHOOKS_API_URL | --base-url | Override API base. Default: https://mailhooks.dev/api. | | MAILHOOKS_PROFILE | --profile | Which stored profile to use. | | MAILHOOKS_CONFIG_PATH | — | Override the config file path. |

Global flags: --pretty / --no-pretty (format JSON — defaults to pretty on a TTY, compact when piped), --help, --version.

Stored config lives at ~/.config/mailhooks/config.json (mode 0600). See AGENTS.md for the full security note.

listen

Forward real-time email events to a local webhook endpoint — like the Stripe CLI's stripe listen or ngrok, but for Mailhooks.

# Forward all email events to localhost:3000/webhooks
mailhooks listen

# Custom endpoint
mailhooks listen -f http://localhost:8080/api/webhooks

# With webhook signature (so your server can verify X-Webhook-Signature)
mailhooks listen --secret whsec_dev_secret

# Distributed mode (load-balanced SSE — only one listener gets each event)
mailhooks listen --mode distributed

# Quiet mode (no stdout, just forwarding)
mailhooks listen --no-print

The CLI connects to Mailhooks via SSE. Each email.received or email.updated event is POSTed to your local URL as JSON with headers Content-Type, X-Mailhooks-Event, and optionally X-Webhook-Signature.

License

MIT