@purpleturret/cli 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,6 +18,8 @@ Most sellers create products in the dashboard. This CLI is for people who would
18
18
  - `purpleturret push` diffs it against your account and applies the changes, Terraform-style, after showing you the plan.
19
19
  - `purpleturret pull` brings dashboard-managed products into the file.
20
20
  - `purpleturret status`, `whoami`, and `products list` tell you where things stand.
21
+ - `purpleturret orders`, `subscriptions`, `customers`, `leads`, `pixels`, `pages`, `tracking`, `domains`, `webhooks`, `groups` and `account` do everything else the dashboard does, from the terminal or CI.
22
+ - `purpleturret mcp` runs the same surface as an MCP server for Claude Code, Cursor, Codex and other agents.
21
23
 
22
24
  Everything the CLI does goes through the public REST API, so anything you can do here you can also do from your own scripts with [`@purpleturret/sdk`](https://www.npmjs.com/package/@purpleturret/sdk).
23
25
 
@@ -44,7 +46,7 @@ Your checkout links are printed after a successful push.
44
46
 
45
47
  ## Authentication
46
48
 
47
- Mint a **seller API key** in [Dashboard → Settings → Developers](https://purpleturret.com/dashboard/settings). Keys start with `pt_sk_` and carry scopes: `config:read`, `config:write`, `credits:read`, `credits:write`, `entitlements:read`. The CLI needs the two `config` scopes. Hosting keys (`pt_host_…`) are a different product and are rejected.
49
+ Mint a **seller API key** in [Dashboard → Settings → Developers](https://purpleturret.com/dashboard/settings). Keys start with `pt_sk_` and carry scopes (`config:*`, `credits:*`, `entitlements:read`, `account:*`, `orders:*`, `customers:read`, `analytics:*`, `tracking:*`, `pages:*`, `domains:*`, `webhooks:*`). `push` needs the two `config` scopes; each other family needs its own, and keys minted before the families existed must be re-minted to get them. Hosting keys (`pt_host_…`) are a different product and are rejected.
48
50
 
49
51
  The key is resolved in this order:
50
52
 
@@ -118,6 +120,28 @@ The CLI finds `purpleturret.config.{ts,mts,js,mjs,json}` in the current director
118
120
 
119
121
  Global flags accepted before or after the subcommand: `--config <path>`, `--api-key <key>`, `--api-url <origin>`, `--profile <name>`, `--json` (machine-readable stdout, diagnostics on stderr), `--no-color` (also `NO_COLOR`), `--verbose` (log every request and stack traces).
120
122
 
123
+ ### Everything else
124
+
125
+ Each family mirrors a dashboard page. `purpleturret <family> <subcommand> --help` lists the flags; `--json` prints the API object.
126
+
127
+ | Family | Subcommands |
128
+ | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
129
+ | `products` | `list`, `get`, `create`, `update`, `delivery`, `copy-styles`, `archive`, `visits` |
130
+ | `groups` | `list`, `create`, `update`, `delete` (cascades to the group's webhooks; its products keep selling without a tier) |
131
+ | `orders` | `list`, `get`, `refund` (cannot be undone) |
132
+ | `subscriptions` | `list`, `get`, `portal-link`, `portal-email` |
133
+ | `customers` | `list`, `get` (orders, subscriptions, credits, lifetime spend) |
134
+ | `leads` | `checkout`, `pages` |
135
+ | `pixels` | `list`, `get`, `create`, `update`, `archive`, `attach`, `detach`, `stats`, `pages`, `funnels`, `ads`, `people`, `session`, `person`, `spend` |
136
+ | `pages` | `list`, `get`, `files`, `deploy <dir>`, `update`, `publish`, `unpublish`, `delete`, `submissions`, `visits`, `clicks` |
137
+ | `tracking` | `get`, `set`, `product get\|set`, `page get\|set` (Meta pixel / Conversions API, GA4) |
138
+ | `domains` | `list`, `get`, `add`, `verify`, `update`, `remove` |
139
+ | `webhooks` | `list`, `add`, `update`, `delete`, `test` |
140
+ | `account` | `get`, `update`, `stripe status\|onboard\|refresh\|connect-key\|branding`, `paypal status\|connect\|disconnect`, `billing-portal`, `keys` |
141
+ | `support` | `support <message>` |
142
+
143
+ `pages deploy <dir>` uploads every file in the directory and creates the page, or replaces the files of the page with that slug (`--slug`, `--title`, `--pixel`, `--id`). Secrets such as Stripe keys, PayPal credentials and the Meta Conversions API token are passed as flags and never echoed back.
144
+
121
145
  ### What a push looks like
122
146
 
123
147
  ```
@@ -140,6 +164,31 @@ Checkout links:
140
164
 
141
165
  Applies carry an `Idempotency-Key` and are retried once on a network error, so re-running an interrupted push is safe.
142
166
 
167
+ ## MCP server
168
+
169
+ `purpleturret mcp` serves the whole CLI surface as 88 MCP tools over stdio, using the same credential resolution as every other command. Tools are named `<verb>_<resource>` (`list_orders`, `deploy_page`, `set_product_tracking`); destructive ones (`push_config`, `refund_order`, archive/delete/remove/disconnect, `consume_credits`, `adjust_credits`) carry `destructiveHint` so agents ask first. `push_config` is a dry run unless `confirm: true`.
170
+
171
+ ```bash
172
+ # Claude Code
173
+ claude mcp add purpleturret -- npx -y @purpleturret/cli mcp
174
+ claude mcp add purpleturret --env PURPLETURRET_API_KEY=pt_sk_… -- npx -y @purpleturret/cli mcp
175
+ ```
176
+
177
+ ```json
178
+ // Cursor (.cursor/mcp.json) and Claude Desktop (claude_desktop_config.json)
179
+ { "mcpServers": { "purpleturret": { "command": "npx", "args": ["-y", "@purpleturret/cli", "mcp"], "env": { "PURPLETURRET_API_KEY": "pt_sk_…" } } } }
180
+ ```
181
+
182
+ ```toml
183
+ # Codex (~/.codex/config.toml)
184
+ [mcp_servers.purpleturret]
185
+ command = "npx"
186
+ args = ["-y", "@purpleturret/cli", "mcp"]
187
+ env = { PURPLETURRET_API_KEY = "pt_sk_…" }
188
+ ```
189
+
190
+ Hosted, no install: `https://api.purpleturret.com/mcp` (Streamable HTTP). `claude mcp add --transport http purpleturret https://api.purpleturret.com/mcp --header "Authorization: Bearer pt_sk_…"`, or add it as a custom connector in claude.ai or ChatGPT and sign in with OAuth. Revoking the key in Dashboard → Settings → Developers ends the session.
191
+
143
192
  ## CI
144
193
 
145
194
  ```yaml
@@ -191,7 +240,7 @@ Details and other agents: https://purpleturret.com/docs/ai-skills
191
240
  - **Developer docs** (apps, entitlements API, webhooks, signature verification): https://purpleturret.com/docs
192
241
  - **AI skills** (agent skill, AGENTS.md snippet, example prompts): https://purpleturret.com/docs/ai-skills
193
242
  - **OpenAPI 3.1** for every REST endpoint: https://api.purpleturret.com/v1/openapi.json
194
- - **`@purpleturret/sdk`** (typed client for entitlements and credits): https://www.npmjs.com/package/@purpleturret/sdk
243
+ - **`@purpleturret/sdk`** (typed client for the whole API): https://www.npmjs.com/package/@purpleturret/sdk
195
244
 
196
245
  ## License
197
246