commet-cli

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Commet CLI

Commet CLI

Generate TypeScript types from your Commet dashboard for autocomplete, scaffold new projects from billing templates, and manage organizations. Requires Node.js 18+.
从你的Commet控制面板生成TypeScript类型用于自动补全,基于计费模板脚手架生成新项目,以及管理组织。需要Node.js 18及以上版本。

Install

安装

bash
npm install -g commet
bash
npm install -g commet

Quick Start

快速开始

bash
commet login          # Authenticate in browser
commet link           # Link project to organization
commet pull           # Generate .commet/types.d.ts
After
commet pull
, SDK calls get autocomplete for
planCode
,
feature
, and
seatType
parameters:
typescript
await commet.usage.track({
  externalId: "user_123",
  feature: "api_calls",       // autocomplete from pulled types
});

await commet.subscriptions.create({
  externalId: "user_123",
  planCode: "pro",            // autocomplete from pulled types
});
bash
commet login          # 在浏览器中完成身份验证
commet link           # 将项目关联到组织
commet pull           # 生成 .commet/types.d.ts
执行
commet pull
之后,SDK调用时
planCode
feature
seatType
参数将支持自动补全:
typescript
await commet.usage.track({
  externalId: "user_123",
  feature: "api_calls",       // 基于拉取的类型自动补全
});

await commet.subscriptions.create({
  externalId: "user_123",
  planCode: "pro",            // 基于拉取的类型自动补全
});

Commands

命令

CommandDescription
commet login
Authenticate with Commet (opens browser)
commet logout
Remove credentials
commet whoami
Show auth status and current organization
commet link
Link project to an organization
commet unlink
Unlink project
commet switch
Switch to a different organization
commet info
Show project and auth status
commet pull
Generate
.commet/types.d.ts
commet list features
List features for the linked organization
commet list seats
List seat types
commet list plans
List plans
commet create [name]
Scaffold new project from a billing template
See references/commands.md for full details.
命令描述
commet login
通过Commet完成身份验证(将打开浏览器)
commet logout
移除登录凭据
commet whoami
显示认证状态和当前组织
commet link
将项目关联到某个组织
commet unlink
取消项目关联
commet switch
切换到其他组织
commet info
显示项目和认证状态
commet pull
生成
.commet/types.d.ts
commet list features
列出所关联组织的功能项
commet list seats
列出席位类型
commet list plans
列出套餐
commet create [name]
基于计费模板脚手架生成新项目
完整详情请查看references/commands.md

Templates

模板

Scaffold a complete Next.js project with billing pre-configured:
bash
commet create my-app
TemplateBilling Model
fixed
Fixed subscriptions with boolean features
seats
Per-seat billing for team collaboration
metered
Usage-based with included amounts and overage
credits
Credit-based consumption with packs and top-ups
balance-ai
AI product with automatic token cost tracking
balance-fixed
Prepaid balance with fixed unit prices
See references/templates.md for details on each template.
脚手架生成预配置了计费功能的完整Next.js项目:
bash
commet create my-app
模板计费模式
fixed
带布尔型功能项的固定订阅
seats
适用于团队协作的按席位计费
metered
基于用量计费,包含固定额度和超额费用
credits
基于点数消费,支持点数包和充值
balance-ai
支持自动token成本追踪的AI产品
balance-fixed
固定单价的预付费余额
每个模板的详情请查看references/templates.md

Key Gotchas

注意事项

  1. commet create
    is sandbox-only.
    Templates create plans and features in your sandbox organization. If you're logged into production, you need to
    commet logout
    and log back in to sandbox.
  2. Commit
    .commet/types.d.ts
    .
    The generated types file should be committed to your repo so the entire team gets autocomplete without each person running
    commet pull
    .
  3. Two environments, two logins. Sandbox (
    sandbox.commet.co
    ) and Production (
    commet.co
    ) are isolated. Switch by logging out and back in.
  4. Run
    commet pull
    after dashboard changes.
    When you add plans, features, or seat types in the dashboard, re-run
    commet pull
    to update the local types file.
  1. commet create
    仅适用于沙箱环境。
    模板会在你的沙箱组织中创建套餐和功能项。如果你登录的是生产环境,需要先执行
    commet logout
    再重新登录沙箱。
  2. 提交
    .commet/types.d.ts
    到代码仓库。
    生成的类型文件应该提交到你的代码仓库,这样整个团队无需每个人都运行
    commet pull
    就能获得自动补全能力。
  3. 两个环境两套登录凭证。 沙箱(
    sandbox.commet.co
    )和生产环境(
    commet.co
    )是相互隔离的。需要登出后重新登录来切换环境。
  4. 在控制面板修改配置后请运行
    commet pull
    当你在控制面板中新增套餐、功能项或席位类型时,请重新执行
    commet pull
    更新本地类型文件。

When to Load References

参考文档指引

  • Full command flags and details -> references/commands.md
  • Template descriptions and billing models -> references/templates.md
  • Step-by-step project setup -> references/setup-workflow.md
  • 完整命令参数和详情 -> references/commands.md
  • 模板说明和计费模式 -> references/templates.md
  • 分步项目设置指南 -> references/setup-workflow.md