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

twexapi-cli

v0.1.0

Published

CLI for twexapi with saved app auth, profiles, and xurl-style requests

Readme

twexapi-cli

An xurl-style CLI for the twexapi service.

What it supports

  • Generic HTTP-style requests to twexapi paths
  • Saved app configs for API keys and base URLs
  • Saved profiles for cookies or auth_token values
  • Convenience commands for users, about, search, followers/following, lists, tweets, and follow/unfollow
  • Modular code layout under src/ so config, parsing, requests, and commands evolve independently

Install

If the package has been published to npm, other users can install it globally with:

npm install -g twexapi-cli
twexapi --help

If you are working from this repository before publishing, use:

cd /Users/jiangyong/code/twexapi-cli
node ./bin/twexapi.js --help

If you want a local executable command while developing from source:

npm link
twexapi --help

Config management

Get your API key from the twexapi dashboard:

twexapi dashboard

When a request is missing an API key, the CLI will include that URL in the error output.

Save an app config:

twexapi auth apps add --name prod --api-key "twitterx_..."
twexapi auth apps list
twexapi auth apps use prod

Save a write profile:

twexapi auth profiles add --name founder --cookie "ct0=...; auth_token=..."
twexapi auth profiles use founder

Create a profile from auth_token via the documented cookie endpoint:

twexapi auth cookie --auth-token "your_auth_token" --save-as founder

Inspect config:

twexapi config show
twexapi config path

By default config is stored in ~/.twexapi/config.json. For testing, you can isolate it:

twexapi --config-dir ./.twexapi-local config show

Request examples

Query an endpoint directly:

twexapi /twitter/elonmusk/about

Send a JSON body with a POST:

twexapi -X POST -d '["elonmusk","sama"]' /twitter/users

Preview a request without sending it:

twexapi --app prod --dry-run users elonmusk sama
twexapi --app prod --profile founder --dry-run tweet create --text "hello"

Convenience commands

Read commands:

twexapi --app prod users elonmusk sama
twexapi --app prod about elonmusk
twexapi --app prod search tweets "founder" "ai" --count 20 --sort Latest
twexapi --app prod search users "openai" --count 20
twexapi --app prod followers elonmusk --count 100
twexapi --app prod following elonmusk --count 100
twexapi --app prod list search --query "ai founders" --count 20
twexapi --app prod list members 123456789 --count 100
twexapi --app prod list subscribers 123456789 --count 100
twexapi --app prod tweet lookup 1900000000000000000 1900000000000000001
twexapi --app prod tweet replies 1900000000000000000 --count 25 --sort Recency

Write commands:

twexapi --app prod --profile founder tweet create --text "hello from cli"
twexapi --app prod --profile founder tweet create --text "hello with image" --media-url "https://example.com/a.jpg"
twexapi --app prod --profile founder tweet quote --text "worth reading" --quote-url "https://x.com/user/status/123"
twexapi --app prod --profile founder tweet like 1900000000000000000
twexapi --app prod --profile founder tweet unlike 1900000000000000000
twexapi --app prod --profile founder tweet bookmark 1900000000000000000
twexapi --app prod --profile founder tweet unbookmark 1900000000000000000
twexapi --app prod --profile founder tweet retweet 1900000000000000000
twexapi --app prod --profile founder tweet unretweet 1900000000000000000
twexapi --app prod --profile founder list create --name "AI Builders" --description "Interesting builders" --private
twexapi --app prod --profile founder user follow someuser
twexapi --app prod --profile founder user unfollow someuser

Project layout

bin/twexapi.js         # thin executable entrypoint
src/index.js           # main boot flow
src/parser.js          # global option parsing
src/config.js          # config load/save and auth profile helpers
src/request.js         # HTTP execution and dry-run preview
src/commands.js        # command routing and endpoint mapping
src/help.js            # help text
src/constants.js       # defaults and option metadata
src/utils.js           # shared helpers

Notes

  • Global options such as --app, --profile, --api-key, and --dry-run should be placed before the command.
  • For unsupported endpoints, use the generic twexapi <path> form.
  • The CLI masks secrets in config output and dry-run previews.
  • Direct local file upload for media is not included yet; the current CLI supports --media-url for tweet creation.
  • DM commands are not included yet because I have not found a confirmed public DM endpoint in the twexapi docs we based this CLI on.