adapty-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Adapty CLI Skill

Adapty CLI 技能

Installation

安装

sh
npm install -g adapty
Or run without installing:
sh
npx adapty@latest

Two 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:
PlatformGlob pattern
iOS/Swift
**/*.swift
,
**/Package.swift
,
*.xcodeproj
Android/Kotlin
**/*.kt
,
**/build.gradle.kts
Flutter
**/pubspec.yaml
(look for
flutter:
key)
React Native
**/react-native.config.js
,
**/app.json
with RN deps
Unity
**/ProjectSettings/ProjectSettings.asset
Capacitor
**/capacitor.config.ts
,
**/capacitor.config.json
KMP
**/build.gradle.kts
with
kotlin("multiplatform")
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. Both
Products: 1. Monthly (
monthly
) / 2. Annual (
annual
) / 3. Monthly + Annual / 4. Weekly (
weekly
) / 5. Lifetime (
lifetime
) / 6. Custom
Valid
--period
values:
weekly
,
monthly
,
two_months
,
trimonthly
,
semiannual
,
annual
,
lifetime
. Do NOT use
month
,
year
,
yearly
, or any other aliases — use these exact API values. Product name prefix: [suggest based on app name, e.g. "Premium"]
After this answer, you have enough to generate store product IDs. Pre-fill them using the convention
<bundle_id>.<prefix>.<period>
and include in the next question.
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.monthly
    /
    com.example.app.premium.annual
  • Android product ID:
    premium_monthly
    / base plan:
    monthly-base
    (if Android)
If 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 (
onboarding
) / 2. Settings (
settings
) / 3. Feature gate (
feature_gate
) / 4. All of the above / 5. Custom
Paywall UI: 1. Paywall Builder (visual editor, no UI code) / 2. Custom (your own UI)
在创建任何内容之前,先检测平台,然后通过交互式问答收集所有数据。
重要提示:所有问答环节必须使用AskUserQuestion工具。 不要以普通文本形式输出问题。每个问题都必须作为单独的AskUserQuestion工具调用,以便用户获得交互式输入提示。每收到一个答案后,再进行下一个AskUserQuestion调用。这是硬性要求。
步骤1:检测平台 —— 自动扫描代码库:
平台Glob 匹配模式
iOS/Swift
**/*.swift
,
**/Package.swift
,
*.xcodeproj
Android/Kotlin
**/*.kt
,
**/build.gradle.kts
Flutter
**/pubspec.yaml
(查找
flutter:
关键字)
React Native
**/react-native.config.js
,
**/app.json
包含RN依赖
Unity
**/ProjectSettings/ProjectSettings.asset
Capacitor
**/capacitor.config.ts
,
**/capacitor.config.json
KMP
**/build.gradle.kts
包含
kotlin("multiplatform")
步骤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. 月度(
monthly
) / 2. 年度(
annual
) / 3. 月度+年度 / 4. 周度(
weekly
) / 5. 终身(
lifetime
) / 6. 自定义
有效的
--period
参数值:
weekly
,
monthly
,
two_months
,
trimonthly
,
semiannual
,
annual
,
lifetime
。请勿使用
month
year
yearly
或其他别名 —— 请严格使用这些标准API值。 产品名称前缀:[基于应用名称建议,例如“Premium”]
收到此问题的答案后,你将获得足够信息来生成商店产品ID。使用
<bundle_id>.<prefix>.<period>
的规则预填充这些ID,并将其包含在下一个问题中。
AskUserQuestion 2:商店ID + 展示位置 + 付费墙方案 —— 确认生成的ID并收集剩余信息:
商店产品ID —— 这些ID必须与你在App Store Connect / Google Play Console中创建(或将要创建)的ID完全匹配。 确认或编辑建议的ID:
  • iOS:
    com.example.app.premium.monthly
    /
    com.example.app.premium.annual
  • Android产品ID:
    premium_monthly
    / 基础套餐:
    monthly-base
    (如果是Android平台)
如果你的iOS和Android ID不同,请分别输入(例如:“iOS: com.app.monthly, Android: monthly_sub / 基础套餐: monthly-bp”)。 如果你还未在商店中创建产品,这些建议值完全可用 —— 后续在App Store Connect / Google Play Console中设置时使用相同ID即可。
展示位置:1. 新手引导(
onboarding
) / 2. 设置页面(
settings
) / 3. 功能入口(
feature_gate
) / 4. 全部选上 / 5. 自定义
付费墙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):
  1. adapty auth login
    (if not already authenticated, check with
    adapty auth whoami
    )
  2. adapty apps create --title "..." --platform ... --apple-bundle-id/--google-bundle-id ...
    → save output:
    id
    (use as
    --app
    ),
    sdk_key
    (use in SDK), plus the default access level
    id
    and
    sdk_id
    printed after creation
  3. For each product:
    adapty products create --app <APP_ID> --title "..." --period ... --access-level-id <DEFAULT_AL_ID> --ios-product-id/--android-product-id ... [--android-base-plan-id ...]
    → save product IDs. Android subscriptions (non-lifetime) require
    --android-base-plan-id
    .
  4. adapty paywalls create --app <APP_ID> --title "..." --product-id <ID1> --product-id <ID2> ...
    → save paywall ID
  5. 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的确认环节至关重要。
执行顺序(每一步都依赖上一步的输出):
  1. adapty auth login
    (如果尚未认证,先使用
    adapty auth whoami
    检查状态)
  2. adapty apps create --title "..." --platform ... --apple-bundle-id/--google-bundle-id ...
    → 保存输出内容中的
    id
    (用作
    --app
    参数)、
    sdk_key
    (在SDK中使用),以及创建完成后显示的默认访问级别
    id
    sdk_id
  3. 针对每个产品:
    adapty products create --app <APP_ID> --title "..." --period ... --access-level-id <DEFAULT_AL_ID> --ios-product-id/--android-product-id ... [--android-base-plan-id ...]
    → 保存产品ID。Android订阅(非终身类型)需要
    --android-base-plan-id
    参数。
  4. adapty paywalls create --app <APP_ID> --title "..." --product-id <ID1> --product-id <ID2> ...
    → 保存付费墙ID
  5. 针对每个展示位置:
    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?
  1. Integrate SDK into the codebase
  2. Configure app/products on Apple side (only if iOS)
  3. Configure app/products on Google side (only if Android)
  4. Design paywall in Paywall Builder (only if they chose Paywall Builder)
  5. 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:
    <list android_product_ids>
    , base plans:
    <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.md
After 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询问用户下一步操作。在展示任何子引导内容后,重复此询问直到用户表示完成。 根据用户的设置答案动态生成选项:
你接下来想做什么?
  1. 将SDK集成到代码库中
  2. 在Apple端配置应用/产品 (仅当选择iOS平台时显示)
  3. 在Google端配置应用/产品 (仅当选择Android平台时显示)
  4. 使用Paywall Builder设计付费墙 (仅当选择Paywall Builder时显示)
  5. 我已完成当前操作
选项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
references/cli-commands.md
for the full command reference.
Key notes:
  • All resource commands (except
    apps
    ) require
    --app <APP_ID>
    (UUID)
  • apps get <app_id>
    and
    apps update <app_id>
    use a positional arg (no
    --app
    flag)
  • All other
    get
    /
    update
    commands use a positional arg for the resource ID plus
    --app
    flag
  • All
    list
    commands support
    --page
    and
    --page-size
  • All commands support
    --json
  • Use
    --title
    (not
    --name
    ) for all entities
  • Use
    --apple-bundle-id
    /
    --google-bundle-id
    (not ios/android)

对于已拥有Adapty应用并希望管理实体的用户,请查看
references/cli-commands.md
获取完整命令参考。
关键注意事项:
  • 所有资源命令(除
    apps
    外)都需要
    --app <APP_ID>
    参数(UUID格式)
  • apps get <app_id>
    apps update <app_id>
    使用位置参数(无需
    --app
    标志)
  • 所有其他
    get
    /
    update
    命令使用资源ID的位置参数 加上
    --app
    标志
  • 所有
    list
    命令支持
    --page
    --page-size
    参数
  • 所有命令支持
    --json
    参数
  • 所有实体使用
    --title
    (而非
    --name
    )参数
  • 使用
    --apple-bundle-id
    /
    --google-bundle-id
    (而非ios/android)参数

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
    developer_id
    . Links to one paywall per audience.
  • 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