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

@miketromba/polar-cli

v0.1.5

Published

Unofficial CLI for the Polar (polar.sh) platform — optimized for developers and AI agents

Readme

Getting Started

Install the CLI, then give your AI assistant the skill to use it:

npm install -g @miketromba/polar-cli
npx skills add miketromba/polar-cli

That's it. Your AI assistant now knows how to manage your Polar products, customers, subscriptions, checkouts, and more — just ask it naturally.

Other package managers

# yarn
yarn global add @miketromba/polar-cli

# pnpm
pnpm add -g @miketromba/polar-cli

# bun
bun install -g @miketromba/polar-cli

# or run without installing
npx @miketromba/polar-cli products list

Works with Node.js 18+.

Quick Start

# Authenticate
polar auth login --token polar_pat_...

# List your products
polar products list

# Get a specific customer
polar customers get cust_abc123

# Count active subscriptions
polar subscriptions list --active -o count

# Create a checkout
polar checkouts create --products prod_123 --success-url https://example.com/thanks

AI-Agent Optimized Output

The CLI auto-detects whether it's being piped and adjusts output accordingly:

  • TTY (interactive) — table format with colors
  • Piped / non-TTY — compact key=value format, minimal tokens
# Human sees a table
polar products list

# AI agent (piped) sees compact output
polar products list | cat
# products 1-5/42 page=1
#   [1] id=prod_123 name="Pro Plan" isRecurring=true prices=1
#   [2] id=prod_456 name="Starter" isRecurring=true prices=1
# next: polar products list --page 2 --limit 5

Output Formats

| Flag | Format | Best For | |------|--------|----------| | -o compact | key=value one-liners | AI agents (default when piped) | | -o table | Aligned columns | Humans (default in terminal) | | -o json | Minified JSON | Programmatic consumption | | -o jsonl | JSON Lines | Streaming / jq | | -o csv | CSV with headers | Export / spreadsheets | | -o tsv | Tab-separated | Unix tools (cut, awk) | | -o id | IDs only, one per line | Piping to other commands | | -o count | Single integer | "How many?" queries |

Field Selection

# Only show specific fields
polar customers list --fields id,email,name

# Full detail on a single entity
polar products get prod_123 --detail

Commands

Core

| Command | Description | |---------|-------------| | polar products | Manage products (list, create, update, archive) | | polar subscriptions | Manage subscriptions (list, get, create, revoke) | | polar orders | Manage orders (list, get, invoices, export) | | polar customers | Manage customers (list, create, update, delete) | | polar checkouts | Manage checkout sessions | | polar checkout-links | Manage reusable checkout links |

Monetization

| Command | Description | |---------|-------------| | polar benefits | Manage benefits (custom, Discord, GitHub, downloads, license keys) | | polar benefit-grants | View benefit grant history | | polar license-keys | Manage and validate license keys | | polar discounts | Manage discount codes and promotions | | polar refunds | Manage refunds | | polar disputes | View payment disputes | | polar payments | View payment history |

Usage-Based Billing

| Command | Description | |---------|-------------| | polar meters | Manage usage meters | | polar customer-meters | View customer meter usage | | polar events | Manage and ingest custom events | | polar event-types | Manage event type definitions | | polar metrics | Query analytics metrics |

Organization

| Command | Description | |---------|-------------| | polar orgs | Manage organizations | | polar members | Manage organization members | | polar org-tokens | Manage organization access tokens | | polar webhooks | Manage webhook endpoints and deliveries | | polar custom-fields | Manage custom checkout/order fields | | polar files | Manage file uploads |

Identity

| Command | Description | |---------|-------------| | polar oauth2 | OAuth2 authorization and token management | | polar oauth2-clients | Manage OAuth2 clients | | polar customer-sessions | Create customer portal sessions | | polar member-sessions | Create member sessions | | polar customer-seats | Manage subscription seats |

Customer Portal

All under polar portal:

polar portal subscriptions list
polar portal orders get ord_123
polar portal license-keys validate --key LK-...
polar portal benefit-grants list
polar portal wallets list
# ...and more

Configuration

# Set default organization
polar config set organizationId org_abc123

# Use sandbox environment
polar config set server sandbox

# View all config
polar config list

Environment Variables

| Variable | Purpose | |----------|---------| | POLAR_ACCESS_TOKEN | Access token (overrides stored credential) | | POLAR_ORGANIZATION_ID | Default organization ID | | POLAR_SERVER | production or sandbox | | POLAR_OUTPUT | Default output format |

Global Flags

| Flag | Short | Description | |------|-------|-------------| | --output <format> | -o | Output format | | --fields <list> | -f | Comma-separated field selection | | --detail | -d | Full detail view | | --server <name> | -s | Server: production or sandbox | | --org <id> | | Organization ID override | | --yes | -y | Skip confirmation prompts | | --quiet | -q | Data only, no hints | | --limit <n> | -l | Items per page (list commands) | | --page <n> | -p | Page number (list commands) | | --first <n> | | Shorthand for --limit N --page 1 |

Development

Requires Bun for development (end users only need Node.js 18+).

# Install dependencies
bun install

# Run the CLI locally (via Bun, no build step)
bun run polar -- products list

# Run tests (200 tests, ~3s)
bun test

# Run tests in watch mode
bun test --watch

# Lint
bun run lint

# Type check
bun run typecheck

# Build for distribution (outputs dist/polar.js)
bun run build

License

MIT