Skip to content
Prompt

whop-client — Cursor Rules

by wheblabs

AI Summary

Cursor Rules for the Whop CLI wrapper that establishes a shared mental model for projects integrating @whoplabs/whop-client, helping developers maintain SDK contracts and avoid reimplementing authentication/networking logic. Benefits CLI developers building on top of the Whop SDK.

Install

Copy this and paste it into Claude Code, Cursor, or any AI assistant:

I want to add the "whop-client — Cursor Rules" prompt rules to my project.
Repository: https://github.com/wheblabs/whop-client

Please read the repo to find the rules/prompt file, then:
1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type)
2. If there's an existing rules file, merge the new rules in rather than overwriting
3. Confirm what was added

Description

Whop account SDK

Resource Capabilities (map to CLI commands)

• auth: • sendOTP(email) → ticket. • verify({ code, ticket, persist? }) → populates tokens, optional session persistence. • refresh() currently unimplemented; rely on automatic refresh instead. • apps: • get(appId) returns rich public metadata, including nested access pass attachments. • getCredentials(appId, companyId) exposes API keys, URLs, permissions, agent users, stats. • create(input) builds a company app and flattens API keys/agent users from nodes wrappers. • update(appId, input) mutates app metadata and returns the full UpdatedApp payload. • getUrl(appId, companyId) derives the dashboard URL via companies.listExperiences. • companies: • list() fetches owned companies. • listApps(companyId) returns app summaries (includes DAU/WAU/MAU/time spent). • installApp(companyId, appId, options?) installs an app, optionally attaching to experiences/access passes. • listExperiences(companyId, options?) paginates experiences with optional filters. • listAccessPasses(companyId, options?) and createAccessPass, updateAccessPass manage storefront products. • createPlan, updatePlan, listAccessPassPlans manage pricing plans (renewals, one-time, expiration). • me.get() returns the authenticated user profile (email, username, avatar variants).

Type Usage & Re-exports

• Import types from the package root (import type { Company, AppCredentials } from '@whoplabs/whop-client'). Entry file src/index.ts re-exports the relevant interfaces. • DTOs correspond closely to GraphQL shapes; avoid mutating them in-place. If CLI needs view models, derive new objects without altering originals.

Purpose

• Provide Cursor with a shared mental model for projects that wrap @whoplabs/whop-client inside a CLI. • Preserve the SDK contracts: instantiate Whop, call resource methods, and let the SDK handle authentication token refresh and error types. • Favor composition over reimplementation: reuse the SDK helpers (graphqlRequest, session utilities, error classes) instead of rolling new network/auth code.

Key Architecture

• Entry point: src/client.ts exports Whop, which wires resources (auth, apps, companies, me) and keeps auth tokens + session file path. • Low-level helpers in src/lib: • errors defines typed errors (WhopError base + Auth/API/Network/Parse variants) that consumers should surface to users. • graphql.ts builds Whop GraphQL requests, sends cookie-authenticated fetch calls, and invokes _updateTokens when the API rotates credentials. • session.ts persists tokens on disk with saveSession/loadSessionSync. • server-actions.ts scrapes Next.js bundles to extract server action IDs required for login; heavy network call but cached per process. • cookies.ts parses Set-Cookie headers into the AuthTokens shape. • rsc.ts posts multipart payloads to Next.js server actions and parses minimal RSC responses. • Resources in src/resources are thin facades that: • assert authentication by calling client.getTokens() and throwing WhopAuthError if missing. • declare the GraphQL document inline, call graphqlRequest, flatten nodes wrappers, and return typed data structures. • Auth uses server actions instead of GraphQL, handles OTP login, extracts tokens, and optionally persists to disk. • src/types re-exports all DTOs used by the resources for CLI display, prompts, and validation.

Discussion

0/2000
Loading comments...

Health Signals

MaintenanceCommitted 4mo ago
Stale
AdoptionUnder 100 stars
1 ★ · Niche
DocsMissing or thin
Undocumented

GitHub Signals

Stars1
Issues0
Updated4mo ago
View on GitHub
MIT License

My Fox Den

Community Rating

Sign in to rate this booster

Works With

Any AI assistant that accepts custom rules or system prompts

Claude
ChatGPT
Cursor
Windsurf
Copilot
+ more