Lemonsqueezy

From mvanhorn/printing-press-library · View interactive version

Lemonsqueezy is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. Every Lemon Squeezy resource, plus a local SQLite mirror that surfaces MRR, churn, license seats, and discount-campaign pace. Trigger phrases: `check Lemon Squeezy revenue`, `show MRR trend`, `what subscriptions churned this week`, `find failed renewals`, `audit Lemon Squeezy webhooks`, `track Found

How to use this skill

Skill file

Lemon Squeezy — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the lemonsqueezy-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer. It defaults binaries to $HOME/.local/bin on macOS/Linux and %LOCALAPPDATA%\Programs\PrintingPress\bin on Windows:

```bash

npx -y @mvanhorn/printing-press-library install lemonsqueezy --cli-only

```

  1. Verify: lemonsqueezy-pp-cli --version
  2. Ensure the reported install directory is on $PATH for the agent/runtime that will invoke this skill.

If the npx install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.6 or newer):

go install github.com/mvanhorn/printing-press-library/library/payments/lemonsqueezy/cmd/lemonsqueezy-pp-cli@latest

If --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.

When to Use This CLI

Reach for this CLI when running ongoing Lemon Squeezy operations — Monday-morning revenue/churn sweeps, post-refund license-key disables, live capacity tracking during a capped sale, or webhook coverage audits across multiple stores. The cross-entity SQL and transcendence commands are the differentiator. For one-shot dashboard tasks (creating one product, editing a single discount) the LS web UI is still faster.

Anti-triggers

Do not use this CLI for:

Catalog setup rule (public API limitation)

Do not try to create Lemon Squeezy products, variants, or digital files through the public API. Official docs and OPTIONS checks show those catalog resources are list/get only. import products, import variants, and import files intentionally refuse with resource_read_only / operation_not_supported_by_public_api instead of emitting fake POST dry-runs.

Use these commands instead:

# Ask what writes are supported before mutating anything.
lemonsqueezy-pp-cli capabilities --json
lemonsqueezy-pp-cli which "create product" --json
lemonsqueezy-pp-cli which "upload file" --json

# Prepare a dashboard handoff packet for catalog setup.
lemonsqueezy-pp-cli dashboard handoff product \
  --name "Juno Home Chief of Staff Starter Kit" \
  --slug juno-home-chief-of-staff-starter-kit \
  --sku juno-home-chief-of-staff-starter-kit \
  --price-usd 149 \
  --type "digital download" \
  --redirect-url https://www.littlemight.com/ai-house-manager/thank-you/ \
  --affiliate-percent 25 \
  --affiliate-approval "manual approval" \
  --affiliate-cookie-days 30 \
  --json

# After the dashboard-created variant exists, create checkout URLs via API.
lemonsqueezy-pp-cli checkouts create --store-id <STORE_ID> --variant-id <VARIANT_ID> --dry-run --json

Checkout creation is supported by POST /v1/checkouts only after you already have a valid store ID and variant ID. Live checkouts create validates both before POSTing and returns the checkout URL/ID.

Unique Capabilities

These capabilities aren't available in any other tool for this API.

Revenue + churn signal

_Reach for this when you want one number for 'how is the store doing right now' without walking every order through the API._

```bash

lemonsqueezy-pp-cli revenue-snapshot --agent

```

_Pick this over a raw list-subscriptions call when you need to show how MRR moved week-over-week, not just where it stands today._

```bash

lemonsqueezy-pp-cli mrr-trend --weeks 12 --json

```

_Reach for this on Monday-morning sweeps to see what changed since Friday — beats clicking through the dashboard's status filters._

```bash

lemonsqueezy-pp-cli churn-watch --since 7d --json

```

_Use this to find subs whose latest renewal failed but who haven't churned yet — the window where a Slack ping or grace email recovers revenue._

```bash

lemonsqueezy-pp-cli dunning-alert --json

```

License + refund ops

_Reach for this when you need to surface piracy-shaped seat distributions or just answer 'how many keys are active per variant'._

```bash

lemonsqueezy-pp-cli license-rollup --json --select keys

```

_Use this after a refund hits, to make sure the buyer's license keys actually get disabled instead of staying active._

```bash

lemonsqueezy-pp-cli refund-cascade order_3aBc --dry-run --json

```

Campaign + integration ops

_Run this during a capped sale (Founding-Member tier, Early Access) to know when a tier will sell out so you can expire the code before overselling._

```bash

lemonsqueezy-pp-cli campaign-watch FOUNDING-LIFETIME FOUNDING-2YR FOUNDING-1YR --json

```

_Reach for this to catch orphaned webhooks pointing at last week's ngrok URL before they cause a missed event in production._

```bash

lemonsqueezy-pp-cli webhook-audit --json

```

Command Reference

agent-native catalog workflows — Public API capability discovery and dashboard handoffs

affiliates — Manage affiliates

checkouts — Manage checkouts

customers — Manage customers

discount-redemptions — Manage discount redemptions

discounts — Manage discounts

files — Manage files

health — Manage health

license-key-instances — Manage license key instances

license-keys — Manage license keys

order-items — Manage order items

orders — Manage orders

prices — Manage prices

products — Manage products

stores — Manage stores

subscription-invoices — Manage subscription invoices

subscription-items — Manage subscription items

subscriptions — Manage subscriptions

usage-records — Manage usage records

users — Manage users

variants — Manage variants

webhooks — Manage webhooks

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

lemonsqueezy-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Recipes

Monday-morning revenue + churn sweep

lemonsqueezy-pp-cli sync --resources stores,subscriptions,subscription-invoices,orders --since 14d && lemonsqueezy-pp-cli revenue-snapshot --json && lemonsqueezy-pp-cli churn-watch --since 7d --json

Refreshes the local mirror, then prints the revenue rollup and the past-week churn delta — the ritual that replaces the dashboard click-walk.

Find recoverable failed renewals

lemonsqueezy-pp-cli dunning-alert --json --select rows.customer_email,rows.amount_usd

Lists every failed invoice whose subscription is still active or past_due — the dollar-recoverable window before the customer churns.

Refund cascade for an order

lemonsqueezy-pp-cli refund-cascade order_3aBc --json

Walks the order → order-items → license-keys chain and previews which keys would be disabled. Add --apply on the rerun to actually disable them (the command refuses --apply unless LS itself reports the order as refunded).

Track a capped Founding-Member sale

lemonsqueezy-pp-cli sync --resources discounts,discount-redemptions && lemonsqueezy-pp-cli campaign-watch FOUNDING-LIFETIME FOUNDING-2YR FOUNDING-1YR --json

Live capacity + redemption velocity per tier with sellout projection — run hourly during a launch to expire codes before overselling.

Webhook coverage audit

lemonsqueezy-pp-cli sync --resources webhooks && lemonsqueezy-pp-cli webhook-audit --json --select hosts.url,hosts.stale,hosts.event_count

Groups every webhook across every store by URL host, flags localhost/ngrok/*.test destinations so orphans don't break production.

Auth Setup

Lemon Squeezy uses HTTP Bearer auth. Create an API key at https://app.lemonsqueezy.com/settings/api, then export LEMONSQUEEZY_API_KEY=<your-key>. Verify with lemonsqueezy-pp-cli doctor.

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.

```bash

lemonsqueezy-pp-cli affiliates list --agent --select id,name,status

```

Response envelope

Commands that read from the local store or the API wrap output in a provenance envelope:

{
  "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
  "results": <data>
}

Parse .results for data and .meta.source to know whether it's live or local. A human-readable N results (live) summary is printed to stderr only when stdout is a terminal AND no machine-format flag (--json, --csv, --compact, --quiet, --plain, --select) is set — piped/agent consumers and explicit-format runs get pure JSON on stdout.

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

lemonsqueezy-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
lemonsqueezy-pp-cli feedback --stdin < notes.txt
lemonsqueezy-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.local/share/lemonsqueezy-pp-cli/feedback.jsonl. They are never POSTed unless LEMONSQUEEZY_FEEDBACK_ENDPOINT is set AND either --send is passed or LEMONSQUEEZY_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

| Sink | Effect |

|------|--------|

| stdout | Default; write to stdout only |

| file:<path> | Atomically write output to <path> (tmp + rename) |

| webhook:<url> | POST the output body to the URL (application/json or application/x-ndjson when --compact) |

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

lemonsqueezy-pp-cli profile save briefing --json
lemonsqueezy-pp-cli --profile briefing affiliates list
lemonsqueezy-pp-cli profile list --json
lemonsqueezy-pp-cli profile show briefing
lemonsqueezy-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Exit Codes

| Code | Meaning |

|------|---------|

| 0 | Success |

| 2 | Usage error (wrong arguments) |

| 3 | Resource not found |

| 4 | Authentication required |

| 5 | API error (upstream issue) |

| 7 | Rate limited (wait and retry) |

| 10 | Config error |

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show lemonsqueezy-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

  1. Install the MCP server:

```bash

go install github.com/mvanhorn/printing-press-library/library/payments/lemonsqueezy/cmd/lemonsqueezy-pp-mcp@latest

```

  1. Register with Claude Code:

```bash

claude mcp add lemonsqueezy-pp-mcp -- lemonsqueezy-pp-mcp

```

  1. Verify: claude mcp list

Direct Use

  1. Check if installed: which lemonsqueezy-pp-cli

If not found, offer to install (see Prerequisites at the top of this skill).

  1. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  2. Execute with the --agent flag:

```bash

lemonsqueezy-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: lemonsqueezy-pp-cli <command> --help.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.