adapty-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAdapty CLI Skill
Adapty CLI 技能
Installation
安装
sh
npm install -g adaptyOr run without installing:
sh
npx adapty@latestTwo modes: Setup (new users, quiz-driven) and Manage (existing users, direct commands).
sh
npm install -g adapty或者无需安装直接运行:
sh
npx adapty@latest提供两种模式:Setup(设置)(面向新用户,由交互式问答引导)和Manage(管理)(面向已有用户,使用直接命令)。
Mode: Setup (New to Adapty)
模式:Setup(Adapty 新用户)
The setup flow has 3 phases: Quiz → Create → Guide. Collect ALL information first, then create everything, then tell the user what to do next.
设置流程分为3个阶段:问答 → 创建 → 引导。先收集所有必要信息,再完成所有创建操作,最后告知用户后续步骤。
Phase 1: Quiz
阶段1:交互式问答
Before creating anything, detect the platform and then run an interactive quiz to collect all data.
CRITICAL: You MUST use the AskUserQuestion tool for EVERY quiz question. Do NOT print questions as regular text output. Each question must be a separate AskUserQuestion tool call so the user gets an interactive input prompt. After each answer, proceed to the next AskUserQuestion. This is non-negotiable.
Step 1: Detect platform — silently glob the codebase:
| Platform | Glob pattern |
|---|---|
| iOS/Swift | |
| Android/Kotlin | |
| Flutter | |
| React Native | |
| Unity | |
| Capacitor | |
| KMP | |
Step 2: Ask questions — use AskUserQuestion tool calls. Bundle related sub-questions into a single AskUserQuestion to minimize round-trips (e.g. app name + platforms + bundle ID = one question). Suggest defaults so the user can just confirm or pick a number. Aim for 2-3 total AskUserQuestion calls, not one per field.
Bundle into 2-3 AskUserQuestion calls:
AskUserQuestion 1: App + Products — bundle app info and product selection:
App name: [suggest from package.json, Info.plist, or AndroidManifest] Bundle ID: [suggest from detected config files] Platforms: 1. iOS only / 2. Android only / 3. BothProducts: 1. Monthly () / 2. Annual (monthly) / 3. Monthly + Annual / 4. Weekly (annual) / 5. Lifetime (weekly) / 6. CustomlifetimeValidvalues:--period,weekly,monthly,two_months,trimonthly,semiannual,annual. Do NOT uselifetime,month,year, or any other aliases — use these exact API values. Product name prefix: [suggest based on app name, e.g. "Premium"]yearly
After this answer, you have enough to generate store product IDs. Pre-fill them using the convention and include in the next question.
<bundle_id>.<prefix>.<period>AskUserQuestion 2: Store IDs + Placements + Paywall approach — confirm generated IDs and collect remaining info:
Store product IDs — these MUST match the IDs you create (or will create) in App Store Connect / Google Play Console. Confirm or edit the suggested IDs:
- iOS:
/com.example.app.premium.monthlycom.example.app.premium.annual- Android product ID:
/ base plan:premium_monthly(if Android)monthly-baseIf your iOS and Android IDs differ, enter them separately (e.g. "iOS: com.app.monthly, Android: monthly_sub / base plan: monthly-bp"). If you haven't created store products yet, these suggestions work — just use the same IDs when you set them up in App Store Connect / Google Play Console later.Placements: 1. Onboarding () / 2. Settings (onboarding) / 3. Feature gate (settings) / 4. All of the above / 5. Customfeature_gatePaywall UI: 1. Paywall Builder (visual editor, no UI code) / 2. Custom (your own UI)
在创建任何内容之前,先检测平台,然后通过交互式问答收集所有数据。
重要提示:所有问答环节必须使用AskUserQuestion工具。 不要以普通文本形式输出问题。每个问题都必须作为单独的AskUserQuestion工具调用,以便用户获得交互式输入提示。每收到一个答案后,再进行下一个AskUserQuestion调用。这是硬性要求。
步骤1:检测平台 —— 自动扫描代码库:
| 平台 | Glob 匹配模式 |
|---|---|
| iOS/Swift | |
| Android/Kotlin | |
| Flutter | |
| React Native | |
| Unity | |
| Capacitor | |
| KMP | |
步骤2:发起问答 —— 使用AskUserQuestion工具调用。将相关子问题整合到一个AskUserQuestion调用中,以减少交互次数(例如,应用名称 + 平台 + Bundle ID = 一个问题)。提供默认选项,用户只需确认或选择对应编号即可。目标是总共发起2-3次AskUserQuestion调用,而非每个字段单独调用一次。
整合为2-3次AskUserQuestion调用:
AskUserQuestion 1:应用 + 产品 —— 整合应用信息和产品选择:
应用名称:[从package.json、Info.plist或AndroidManifest中建议默认值] Bundle ID:[从检测到的配置文件中建议默认值] 平台:1. 仅iOS / 2. 仅Android / 3. 两者都选产品类型:1. 月度() / 2. 年度(monthly) / 3. 月度+年度 / 4. 周度(annual) / 5. 终身(weekly) / 6. 自定义lifetime有效的参数值:--period,weekly,monthly,two_months,trimonthly,semiannual,annual。请勿使用lifetime、month、year或其他别名 —— 请严格使用这些标准API值。 产品名称前缀:[基于应用名称建议,例如“Premium”]yearly
收到此问题的答案后,你将获得足够信息来生成商店产品ID。使用的规则预填充这些ID,并将其包含在下一个问题中。
<bundle_id>.<prefix>.<period>AskUserQuestion 2:商店ID + 展示位置 + 付费墙方案 —— 确认生成的ID并收集剩余信息:
商店产品ID —— 这些ID必须与你在App Store Connect / Google Play Console中创建(或将要创建)的ID完全匹配。 确认或编辑建议的ID:
- iOS:
/com.example.app.premium.monthlycom.example.app.premium.annual- Android产品ID:
/ 基础套餐:premium_monthly(如果是Android平台)monthly-base如果你的iOS和Android ID不同,请分别输入(例如:“iOS: com.app.monthly, Android: monthly_sub / 基础套餐: monthly-bp”)。 如果你还未在商店中创建产品,这些建议值完全可用 —— 后续在App Store Connect / Google Play Console中设置时使用相同ID即可。展示位置:1. 新手引导() / 2. 设置页面(onboarding) / 3. 功能入口(settings) / 4. 全部选上 / 5. 自定义feature_gate付费墙UI:1. Paywall Builder(可视化编辑器,无需编写UI代码) / 2. 自定义(使用你自己的UI)
Phase 2: Create
阶段2:创建
After collecting all answers, confirm the plan with the user in a summary table, then create everything sequentially. Do NOT ask questions during creation — use collected data.
IMPORTANT: Products and paywalls cannot be fully edited after creation (period, store product IDs, base plan IDs are permanent). This is why Phase 1 confirmation is critical.
Execution order (each step uses output from previous):
- (if not already authenticated, check with
adapty auth login)adapty auth whoami - → save output:
adapty apps create --title "..." --platform ... --apple-bundle-id/--google-bundle-id ...(use asid),--app(use in SDK), plus the default access levelsdk_keyandidprinted after creationsdk_id - For each product: → save product IDs. Android subscriptions (non-lifetime) require
adapty products create --app <APP_ID> --title "..." --period ... --access-level-id <DEFAULT_AL_ID> --ios-product-id/--android-product-id ... [--android-base-plan-id ...].--android-base-plan-id - → save paywall ID
adapty paywalls create --app <APP_ID> --title "..." --product-id <ID1> --product-id <ID2> ... - For each placement:
adapty placements create --app <APP_ID> --title "..." --developer-id ... --paywall-id <PAYWALL_ID>
Print progress as you go (e.g. "Created app ✓", "Created product 'Monthly' ✓").
If a step fails, stop and ask the user how to proceed — don't retry blindly.
收集所有答案后,用汇总表格向用户确认计划,然后按顺序完成所有创建操作。创建过程中请勿发起新的问答 —— 使用已收集的数据。
重要提示:产品和付费墙创建后无法完全编辑(周期、商店产品ID、基础套餐ID是永久性的)。这就是为什么阶段1的确认环节至关重要。
执行顺序(每一步都依赖上一步的输出):
- (如果尚未认证,先使用
adapty auth login检查状态)adapty auth whoami - → 保存输出内容中的
adapty apps create --title "..." --platform ... --apple-bundle-id/--google-bundle-id ...(用作id参数)、--app(在SDK中使用),以及创建完成后显示的默认访问级别sdk_key和idsdk_id - 针对每个产品:→ 保存产品ID。Android订阅(非终身类型)需要
adapty products create --app <APP_ID> --title "..." --period ... --access-level-id <DEFAULT_AL_ID> --ios-product-id/--android-product-id ... [--android-base-plan-id ...]参数。--android-base-plan-id - → 保存付费墙ID
adapty paywalls create --app <APP_ID> --title "..." --product-id <ID1> --product-id <ID2> ... - 针对每个展示位置:
adapty placements create --app <APP_ID> --title "..." --developer-id ... --paywall-id <PAYWALL_ID>
执行过程中打印进度(例如:“已创建应用 ✓”、“已创建产品‘月度’ ✓”)。
如果某一步执行失败,请停止操作并询问用户下一步如何处理 —— 不要盲目重试。
Phase 3: Guide (Interactive Loop)
阶段3:引导(交互式循环)
After all entities are created, print a brief summary with key values:
Dashboard: https://app.adapty.io
Your SDK key: <sdk_key from apps create>
Placement developer IDs: <list of developer_ids>
Access level SDK ID: <sdk_id from access level, e.g. "premium">Then use AskUserQuestion to ask what they want to do next. Repeat this after each sub-guide until the user says they're done. Build the options dynamically based on their setup answers:
What do you want to do next?
- Integrate SDK into the codebase
- Configure app/products on Apple side (only if iOS)
- Configure app/products on Google side (only if Android)
- Design paywall in Paywall Builder (only if they chose Paywall Builder)
- I'm done for now
Option 1: SDK Integration — print the quickstart link for their platform + paywall approach, plus the key values above. Use Context7 MCP for latest SDK code examples:
resolve-library-id: "adaptyteam/adapty-docs"
query-docs: topic="<platform> <feature>"Paywall Builder quickstarts:
- iOS:
https://adapty.io/docs/ios-quickstart-paywalls.md - Android:
https://adapty.io/docs/android-quickstart-paywalls.md - Flutter:
https://adapty.io/docs/flutter-quickstart-paywalls.md - React Native:
https://adapty.io/docs/react-native-quickstart-paywalls.md
Custom paywall quickstarts:
- iOS:
https://adapty.io/docs/ios-quickstart-manual.md - Android:
https://adapty.io/docs/android-quickstart-manual.md - Flutter:
https://adapty.io/docs/flutter-quickstart-manual.md - React Native:
https://adapty.io/docs/react-native-quickstart-manual.md
Option 2: Apple side — print checklist:
- Create subscription products in App Store Connect with IDs:
<list ios_product_ids> - Adapty Dashboard → App Store Connect: upload In-App Purchase Key (.p8), enter Key ID, Issuer ID, Bundle ID, App Apple ID →
https://adapty.io/docs/app-store-connection-configuration.md - App Store Connect → Server Notifications V2: set URL from Adapty Dashboard →
https://adapty.io/docs/enable-app-store-server-notifications.md
Option 3: Google side — print checklist:
- Create subscription products in Google Play Console with IDs: , base plans:
<list android_product_ids><list base_plan_ids> - Adapty Dashboard → Google Play: upload service account JSON key, enter Package Name →
https://adapty.io/docs/google-play-store-connection-configuration.md - Google Play Console → RTDN: configure Pub/Sub topic from Adapty Dashboard →
https://adapty.io/docs/enable-real-time-developer-notifications-rtdn.md
Option 4: Paywall Builder — link to dashboard paywalls section and guide:
https://adapty.io/docs/adapty-paywall-builder.mdAfter showing any option's guide, loop back — ask "What's next?" again with the same AskUserQuestion (minus completed items if user indicates they're done with a step). Stop only when user picks "I'm done."
所有实体创建完成后,打印包含关键信息的简要汇总:
控制台地址: https://app.adapty.io
你的SDK密钥: <sdk_key from apps create>
展示位置开发者ID: <list of developer_ids>
访问级别SDK ID: <sdk_id from access level, e.g. "premium">然后使用AskUserQuestion询问用户下一步操作。在展示任何子引导内容后,重复此询问直到用户表示完成。 根据用户的设置答案动态生成选项:
你接下来想做什么?
- 将SDK集成到代码库中
- 在Apple端配置应用/产品 (仅当选择iOS平台时显示)
- 在Google端配置应用/产品 (仅当选择Android平台时显示)
- 使用Paywall Builder设计付费墙 (仅当选择Paywall Builder时显示)
- 我已完成当前操作
选项1:SDK集成 —— 打印对应平台和付费墙方案的快速开始链接,以及上述关键信息。使用Context7 MCP获取最新的SDK代码示例:
resolve-library-id: "adaptyteam/adapty-docs"
query-docs: topic="<platform> <feature>"Paywall Builder快速开始链接:
- iOS:
https://adapty.io/docs/ios-quickstart-paywalls.md - Android:
https://adapty.io/docs/android-quickstart-paywalls.md - Flutter:
https://adapty.io/docs/flutter-quickstart-paywalls.md - React Native:
https://adapty.io/docs/react-native-quickstart-paywalls.md
自定义付费墙快速开始链接:
- iOS:
https://adapty.io/docs/ios-quickstart-manual.md - Android:
https://adapty.io/docs/android-quickstart-manual.md - Flutter:
https://adapty.io/docs/flutter-quickstart-manual.md - React Native:
https://adapty.io/docs/react-native-quickstart-manual.md
选项2:Apple端配置 —— 打印检查清单:
- 使用以下ID在App Store Connect中创建订阅产品:
<list ios_product_ids> - Adapty控制台 → App Store Connect:上传应用内购买密钥(.p8),输入密钥ID、发行者ID、Bundle ID、应用Apple ID →
https://adapty.io/docs/app-store-connection-configuration.md - App Store Connect → 服务器通知V2:设置Adapty控制台提供的URL →
https://adapty.io/docs/enable-app-store-server-notifications.md
选项3:Google端配置 —— 打印检查清单:
- 使用以下ID在Google Play Console中创建订阅产品:,基础套餐:
<list android_product_ids><list base_plan_ids> - Adapty控制台 → Google Play:上传服务账户JSON密钥,输入包名 →
https://adapty.io/docs/google-play-store-connection-configuration.md - Google Play Console → RTDN:配置Adapty控制台提供的Pub/Sub主题 →
https://adapty.io/docs/enable-real-time-developer-notifications-rtdn.md
选项4:Paywall Builder —— 链接到控制台的付费墙板块和指南:
https://adapty.io/docs/adapty-paywall-builder.md展示任何选项的引导内容后,循环返回 —— 再次使用AskUserQuestion询问“下一步做什么?”(如果用户表示已完成某一步,可移除对应选项)。仅当用户选择“我已完成”时停止。
Mode: Manage (Existing Adapty Users)
模式:Manage(已有Adapty用户)
For users who already have an Adapty app and want to manage entities, see for the full command reference.
references/cli-commands.mdKey notes:
- All resource commands (except ) require
apps(UUID)--app <APP_ID> - and
apps get <app_id>use a positional arg (noapps update <app_id>flag)--app - All other /
getcommands use a positional arg for the resource ID plusupdateflag--app - All commands support
listand--page--page-size - All commands support
--json - Use (not
--title) for all entities--name - Use /
--apple-bundle-id(not ios/android)--google-bundle-id
对于已拥有Adapty应用并希望管理实体的用户,请查看获取完整命令参考。
references/cli-commands.md关键注意事项:
- 所有资源命令(除外)都需要
apps参数(UUID格式)--app <APP_ID> - 和
apps get <app_id>使用位置参数(无需apps update <app_id>标志)--app - 所有其他/
get命令使用资源ID的位置参数 加上update标志--app - 所有命令支持
list和--page参数--page-size - 所有命令支持参数
--json - 所有实体使用(而非
--title)参数--name - 使用/
--apple-bundle-id(而非ios/android)参数--google-bundle-id
Adapty Concepts
Adapty 核心概念
- Product — subscription or one-time purchase mapped to store product IDs. Has a period, grants an access level.
- Paywall — screen showing products. Can use Paywall Builder (visual editor) or remote config (custom JSON).
- Placement — location in app where paywall appears. Identified by . Links to one paywall per audience.
developer_id - Access Level — permission gate (e.g. "premium"). Products grant access levels on purchase. Identified by .
sdk_id - Audience — user segment. Different audiences at same placement can see different paywalls.
- Product(产品) —— 与商店产品ID关联的订阅或一次性购买项目。包含周期信息,购买后会授予访问级别。
- Paywall(付费墙) —— 展示产品的页面。可使用Paywall Builder(可视化编辑器)或远程配置(自定义JSON)。
- Placement(展示位置) —— 应用内展示付费墙的位置。通过标识。每个受众群体可关联一个付费墙。
developer_id - Access Level(访问级别) —— 权限控制入口(例如“premium”)。产品购买后会授予对应访问级别。通过标识。
sdk_id - Audience(受众) —— 用户细分群体。同一展示位置下的不同受众可能看到不同的付费墙。
Documentation
文档
- Full docs index:
https://adapty.io/docs/llms.txt - Individual pages:
https://adapty.io/docs/<slug>.md - SDK code examples: Context7 MCP with
adaptyteam/adapty-docs
- 完整文档索引:
https://adapty.io/docs/llms.txt - 单个文档页面:
https://adapty.io/docs/<slug>.md - SDK代码示例:使用Context7 MCP并指定
adaptyteam/adapty-docs