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

@stanley2058/xcli

v0.0.3

Published

Simple CLI for the X API v2 (currently read-only).

Readme

xcli

Simple CLI for the X API v2 (currently read-only).

Install

npm i -g @stanley2058/xcli
# or
bun i -g @stanley2058/xcli

xcli --help

Or run:

npx @stanley2058/xcli --help
# or
bunx @stanley2058/xcli --help

Usage

Examples:

# User lookup (inferred)
X_API_BEARER_TOKEN=... bun run xcli -- users XDevelopers
X_API_BEARER_TOKEN=... bun run xcli -- users 2244994945
X_API_BEARER_TOKEN=... bun run xcli -- users https://x.com/XDevelopers

# Post lookup (inferred)
X_API_BEARER_TOKEN=... bun run xcli -- posts 1228393702244134912
X_API_BEARER_TOKEN=... bun run xcli -- posts https://x.com/XDevelopers/status/1228393702244134912

# Download post attachment files (when media URLs are available)
X_API_BEARER_TOKEN=... bun run xcli -- posts 1228393702244134912 --download-media
X_API_BEARER_TOKEN=... bun run xcli -- posts 1228393702244134912 --expansions attachments.media_keys --media-fields media_key,type,url,preview_image_url --download-media

# Post search (recent or full archive)
X_API_BEARER_TOKEN=... bun run xcli -- posts search recent --query "from:XDevelopers -is:retweet"
X_API_BEARER_TOKEN=... bun run xcli -- posts search all --query "lang:en #ai -is:retweet"

# User search
X_API_BEARER_TOKEN=... bun run xcli -- users search --query "python developer"

# Trends by WOEID
X_API_BEARER_TOKEN=... bun run xcli -- trends 1
X_API_BEARER_TOKEN=... bun run xcli -- trends "new york"

# WOEID lookup (fuzzy)
bun run xcli -- trends search "new york"

# Explicit subcommands still supported
X_API_BEARER_TOKEN=... bun run xcli -- users by-username XDevelopers

# JSON output modes
X_API_BEARER_TOKEN=... bun run xcli -- users XDevelopers --json
X_API_BEARER_TOKEN=... bun run xcli -- users XDevelopers --json-pretty

# Field references
bun run xcli -- fields users
bun run xcli -- fields trends

Persistent config:

{
  "bearerToken": "YOUR_X_API_BEARER_TOKEN"
}
  • Save as ~/.config/xcli/config.json.
  • Precedence is: --bearer-token > env vars (X_API_BEARER_TOKEN, BEARER_TOKEN) > config file.

Notes:

  • Default output is human-readable tables.
  • Color output honors TTY, NO_COLOR, and FORCE_COLOR.
  • Post tables include short media fields: Media (e.g. img2,vid1) and DL (downloadable/total).
  • trends search uses a public WOEID index, fetched on demand and cached locally.
  • Optional: set XCLI_WOEID_CACHE_PATH to override the default cache file path.

Development

To install dependencies:

bun install

To run:

bun run xcli -- --help