CLI Plan Summary Formatter (billing/planSummary.ts)

code-cli · src/billing/planSummary.ts · typescript · Apache-2.0
payments, cli, dev-tools, lang:typescript

Formats subscription tier and entitlement data for display in command line interfaces. Reuse to standardize billing plan presentations in terminal apps.

// Source: https://github.com/autohandai/code-cli | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * @license
 * Copyright 2025 Autohand AI LLC
 * SPDX-License-Identifier: Apache-2.0
 */

import { t } from '../i18n/index.js';

export type PlanInterval = 'month' | 'year' | null;

export interface PlanSummary {
  tier: string;
  label: string;
  interval: PlanInterval;
  accountName?: string;
}

const TIER_LABELS: Record<string, string> = {
  free: 'Free',
  lite: 'Lite',
  pro: 'Pro',
  pro_plus: 'Pro+',
  max: 'Max',
  team: 'Team',
  enterprise: 'Enterprise',
};

function labelForTier(tier: string): string {
  return TIER_LABELS[tier] ?? tier.charAt(0).toUpperCase() + tier.sl

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key