JSPM

  • Created
  • Published
  • Downloads 676
  • Score
    100M100P100Q108831F
  • License MIT

Commet CLI - Manage your billing platform from the command line

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (commet) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    commet

    CLI tool for Commet billing platform - authentication, project linking, and type generation.

    Installation

    npm install -g commet
    # or
    pnpm add -g commet
    # or
    yarn global add commet

    Quick Start

    # 1. Authenticate with Commet
    commet login
    
    # 2. Link your project to an organization
    commet link
    
    # 3. Generate TypeScript types
    commet pull

    Commands

    Authentication

    commet login

    Authenticate with Commet using OAuth device flow.

    commet login

    Opens your browser to authenticate. Creates ~/.commet/auth.json with your credentials.

    commet logout

    Log out and remove stored credentials.

    commet logout

    commet whoami

    Display current authentication and project status.

    commet whoami

    Project Management

    Link the current directory to a Commet organization.

    commet link

    Creates .commet file in the current directory with organization configuration.

    Unlink the current directory from Commet.

    commet unlink

    commet switch

    Switch to a different organization or environment.

    commet switch

    commet info

    Display detailed information about the current project.

    commet info

    Type Generation

    commet pull

    Generate TypeScript type definitions from your Commet configuration.

    commet pull
    # or specify output file
    commet pull -o types/commet.d.ts

    Creates .commet.d.ts with your event and seat types:

    // .commet.d.ts
    export type CommetEventType = "api_call" | "email_sent" | "payment_processed";
    export type CommetSeatType = "admin" | "editor" | "viewer";

    Use with the SDK:

    import { Commet } from '@commet/node';
    import type { CommetEventType, CommetSeatType } from './.commet';
    
    const commet = new Commet({ apiKey: '...' });
    
    // Type-safe event tracking
    await commet.usage.events.create<CommetEventType>({
      customerId: 'cus_123',
      eventType: 'api_call', // Autocomplete works!
      timestamp: new Date().toISOString(),
    });
    
    // Type-safe seat management
    await commet.seats.add<CommetSeatType>('cus_123', 'admin', 5);

    Type Inspection

    commet list events

    List all event types in your organization.

    commet list events

    commet list seats

    List all seat types in your organization.

    commet list seats

    Configuration Files

    Global Config (~/.commet/auth.json)

    Stores authentication credentials. Created by commet login.

    {
      "token": "...",
      "refreshToken": "...",
      "expiresAt": 1234567890
    }

    Project Config (.commet)

    Stores project-specific configuration. Created by commet link.

    {
      "orgId": "org_123",
      "orgName": "My Organization",
      "environment": "sandbox"
    }

    Note: Add .commet to .gitignore if different developers use different organizations.

    Environments

    Commet supports two environments:

    • Sandbox: Development and testing (default)
    • Production: Live billing operations

    Select environment during commet link or commet switch.

    Workflow

    Typical development workflow:

    # 1. One-time setup
    commet login
    commet link
    
    # 2. Generate types when you add/change event or seat types
    commet pull
    
    # 3. Use types in your code with autocomplete
    # (see TypeScript examples above)
    
    # 4. Switch environments when needed
    commet switch  # Select production

    Troubleshooting

    "Not authenticated"

    Run commet login to authenticate.

    "Project not linked"

    Run commet link to connect your project to an organization.

    "No types found"

    Create event types and seat types in your Commet dashboard first, then run commet pull.

    Authentication expired

    Run commet login again. Tokens expire after a certain period.

    License

    MIT