JSPM

@jawkit.cc/cli

0.1.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 23
    • Score
      100M100P100Q48932F
    • License SEE LICENSE IN LICENSE

    CLI toolkit for installing AI coding assistant configurations

    Package Exports

    • @jawkit.cc/cli

    Readme

    JawKit CLI

    CLI toolkit for installing AI coding assistant configurations (Claude Code, GitHub Copilot).

    Features

    • Multi-agent support: Claude Code, GitHub Copilot
    • Tiered content: Free and Professional ($99)
    • Secure delivery: Signed URLs for premium content
    • Offline support: Free tier bundled in npm package

    Quick Start

    # Install globally
    npm install -g @jawkit/cli
    
    # Initialize in your project (free tier - no auth needed)
    jawkit init
    
    # For premium content, purchase at jawkit.dev and activate:
    jawkit auth activate JAWKIT_YOUR_LICENSE_KEY
    
    # Check license status
    jawkit auth status

    Technical Stack

    CLI (Node.js)

    Component Technology Purpose
    Runtime Node.js 18+ ES Modules
    CLI Framework Commander.js Command parsing
    Build tsup ES Module bundling
    HTTP Client ofetch API requests
    Prompts @inquirer/prompts Interactive CLI
    Archive tar (+ built-in zlib) tar.gz extraction
    Logging chalk + ora Colors, spinners
    Secure Storage keytar OS keychain for tokens

    Backend Services

    Service Technology Purpose
    Payments Paddle Checkout, subscriptions
    License Data Cloudflare D1 License keys, payments, invitations
    Content Storage Cloudflare R2 Content bundles (tar.gz)
    API Gateway Cloudflare Workers License validation, signed URLs, webhooks
    Email Resend License delivery emails

    Architecture Overview

    ┌─────────────────────────────────────────────────────────────────────────────┐
    │                              JawKit CLI System                               │
    ├─────────────────────────────────────────────────────────────────────────────┤
    │                                                                              │
    │  User's Machine                              Cloud Infrastructure            │
    │  ┌─────────────────┐                        ┌─────────────────────────────┐ │
    │  │   jawkit CLI    │                        │          Paddle             │ │
    │  │   (@jawkit/cli) │                        │  ┌───────────────────────┐  │ │
    │  │                 │                        │  │ • Checkout            │  │ │
    │  │  • init         │                        │  │ • Payment processing  │  │ │
    │  │  • auth activate│                        │  └───────────┬───────────┘  │ │
    │  │  • upgrade      │                        │              │ Webhook      │ │
    │  │  • version      │                        └──────────────┼──────────────┘ │
    │  └────────┬────────┘                                       ▼                │
    │           │                                 ┌─────────────────────────────┐ │
    │           │  Validate license               │    Cloudflare Workers       │ │
    │           │◄────────────────────────────────┤  ┌───────────────────────┐  │ │
    │           │  Download content               │  │ • Paddle webhook      │  │ │
    │           │  (signed URLs for premium)      │  │ • License validation  │  │ │
    │           │                                 │  │ • Signed URL gen      │  │ │
    │           │                                 │  │ • D1 Database         │  │ │
    │           │                                 │  └───────────────────────┘  │ │
    │           │                                 └──────────────┬──────────────┘ │
    │           │                                        │       │                │
    │           │                                        ▼       ▼                │
    │           │                                 ┌─────────┐ ┌─────────────────┐ │
    │           └─────────────────────────────────┤   R2    │ │       D1        │ │
    │               Direct download (free tier)   │ Content │ │  license_keys   │ │
    │                                             └─────────┘ │  payments       │ │
    │  ┌─────────────────┐                                    │  invitations    │ │
    │  │  Local Storage  │                                    └─────────────────┘ │
    │  │  ~/.jawkit/     │                        ┌─────────────────────────────┐ │
    │  │  • license      │◄───────────────────────│         Resend              │ │
    │  │  • config.json  │                        │  License delivery email     │ │
    │  │  • cache/       │                        └─────────────────────────────┘ │
    │  └─────────────────┘                                                        │
    └─────────────────────────────────────────────────────────────────────────────┘

    Project Structure

    jawkit-cli/
    ├── src/                        # CLI source code
    │   ├── cli.ts                  # Entry point (Commander setup)
    │   ├── index.ts                # Library exports
    │   ├── commands/               # CLI commands
    │   │   ├── auth.ts             # auth activate/redeem/deactivate/status
    │   │   ├── init.ts             # Initialize content
    │   │   ├── upgrade.ts          # Upgrade content
    │   │   └── version.ts          # Show versions
    │   ├── auth/                   # Authentication module
    │   │   ├── auth.service.ts     # License activation, validation
    │   │   ├── license-storage.ts  # Keytar + file fallback for license
    │   │   └── types.ts            # TierLevel, StoredLicense, etc.
    │   ├── content/                # Content management module
    │   │   ├── content.service.ts  # Download orchestration
    │   │   ├── remote-provider.ts  # R2 + Worker API client
    │   │   ├── cache-manager.ts    # Local disk cache
    │   │   ├── bundled-content.ts  # Offline fallback
    │   │   └── extractor.ts        # tar.gz extraction
    │   ├── agents/                 # Agent adapters
    │   │   ├── base-agent.ts       # Abstract base class
    │   │   ├── registry.ts         # Agent registry
    │   │   ├── claude-code/        # Claude Code adapter
    │   │   └── github-copilot/     # GitHub Copilot adapter
    │   └── lib/                    # Utilities
    │       ├── config.ts           # Configuration persistence
    │       ├── errors.ts           # Error classes
    │       ├── promo.ts            # Promotional messages
    │       └── logger.ts           # Console output
    ├── cloudflare/
    │   └── workers/
    │       └── jawkit-api/         # Cloudflare Worker
    │           ├── src/
    │           │   ├── index.ts    # Router
    │           │   ├── db/         # D1 repositories
    │           │   │   ├── license-repository.ts
    │           │   │   ├── payment-repository.ts
    │           │   │   └── invitation-repository.ts
    │           │   └── routes/
    │           │       ├── license.ts       # License validation
    │           │       ├── invitation.ts    # Invitation management
    │           │       ├── paddle-webhook.ts # Paddle webhooks
    │           │       └── download.ts      # Signed URL generation
    │           ├── migrations/     # D1 schema migrations
    │           └── public/         # Pricing page static files
    ├── content-source/             # Source content by tier
    ├── content/                    # Built bundles (generated)
    ├── scripts/
    │   ├── bundle-content.ts       # Build content bundles
    │   ├── migrate-to-d1.ts        # Data migration helper
    │   └── local-r2-server.ts      # Local development server
    └── docs/
        ├── PRD.md                  # Product Requirements
        ├── PRP-*.md                # Technical specifications
        └── setup/                  # Setup guides

    Development Setup

    Prerequisites

    • Node.js 18+
    • Cloudflare account (Workers paid plan for D1)
    • npm or pnpm

    Step 1: Clone and Install

    git clone https://github.com/jawkit/cli.git
    cd jawkit-cli
    npm install

    Step 2: Set Up Cloudflare D1 Database

    cd cloudflare/workers/jawkit-api
    
    # Create D1 database
    npx wrangler d1 create jawkit-licenses
    # Copy the database_id to wrangler.toml
    
    # Apply migrations
    npx wrangler d1 migrations apply jawkit-licenses --local

    Step 3: Configure Cloudflare Worker

    Create .dev.vars in cloudflare/workers/jawkit-api/:

    URL_SIGNING_SECRET=local-dev-secret-change-in-prod
    PADDLE_WEBHOOK_SECRET=pdl_xxx
    PADDLE_API_KEY=your-paddle-api-key
    RESEND_API_KEY=re_xxx
    ADMIN_KEY=local-admin-key

    Step 4: Build and Test

    # Build CLI
    npm run build
    
    # Test CLI commands
    node dist/cli.js version
    node dist/cli.js init --dry-run

    Step 5: Start Worker for Local Testing

    cd cloudflare/workers/jawkit-api
    npx wrangler dev
    # Worker runs at http://localhost:8787

    Available Scripts

    Root Project

    npm run dev           # Watch mode build
    npm run build         # Production build
    npm run bundle-content # Build content bundles
    npm run serve:local   # Start local R2 simulation server
    npm run test          # Run tests (watch)
    npm run test:run      # Run tests (single)
    npm run typecheck     # Type checking only
    npm run lint          # ESLint

    Cloudflare Worker

    cd cloudflare/workers/jawkit-api
    npx wrangler dev           # Start dev server (localhost:8787)
    npx wrangler deploy        # Deploy to Cloudflare
    npx wrangler d1 migrations apply jawkit-licenses --local   # Apply migrations locally
    npx wrangler d1 migrations apply jawkit-licenses --remote  # Apply to production

    Environment Variables

    CLI (built-in defaults for production)

    Variable Description Default
    JAWKIT_API_URL API URL for license validation https://jawkit-api.xxx.workers.dev
    R2_PUBLIC_URL Content CDN URL https://content.jawkit.dev

    Cloudflare Worker Secrets

    Variable Type Description
    URL_SIGNING_SECRET secret HMAC secret for signed URLs
    PADDLE_WEBHOOK_SECRET secret Paddle webhook signature verification
    PADDLE_API_KEY secret Paddle API for customer lookup
    RESEND_API_KEY secret Resend API for license emails
    ADMIN_KEY secret Admin endpoint authentication

    Tier System

    Tier Level Price Content
    free 0 $0 Basic commands and skills (no auth required)
    professional 1 $99 one-time All content including agents, advanced commands, skills

    Professional tier includes all free tier content. Purchased via Paddle checkout.


    API Endpoints

    Cloudflare Worker

    Method Endpoint Description
    GET /health Health check
    POST /license/validate Validate license key, returns tier info
    POST /invitation/create Create invitation (admin)
    POST /invitation/redeem Redeem invitation code
    GET /invitation/check/:code Check invitation validity
    GET /invitation/list List invitations (admin)
    POST /webhook/paddle Paddle payment webhook handler
    GET /manifests/latest.json Get content manifest
    GET /bundles/:agent/:version/free.tar.gz Download free bundle
    POST /get-download-url Get signed URL for premium bundle
    GET /download/:path Download with signature verification
    GET / Pricing page (static)
    GET /success.html Post-purchase success page

    Documentation

    Setup Guides

    Guide Description
    Cloudflare Setup D1, Worker, and R2 deployment
    Development Workflow Day-to-day development
    Content Authoring Creating content bundles
    Content Pipeline End-to-end content flow
    Init Command Flow Detailed init flow
    Tier Management Adding/modifying tiers
    CLI Reference Complete workflow reference
    Local Testing Testing without cloud

    Technical Specifications

    Document Description
    PRD.md Product Requirements Document
    PRP-001 CLI Core Architecture
    PRP-002 Authentication System
    PRP-003 Agent Adapter System
    PRP-004 Content Management
    PRP-005 Version Management

    Maintainer Guide

    Key Files for Common Changes

    Task Files to Modify
    Add CLI command src/commands/, src/cli.ts
    Add agent adapter src/agents/, src/agents/registry.ts
    Modify auth flow src/auth/auth.service.ts, Worker /routes/license.ts
    Change tier system src/auth/types.ts, Worker, D1 migrations
    Update content schema src/content/types.ts, scripts/bundle-content.ts

    Security Notes

    1. License Keys: Stored in OS keychain (keytar) with file fallback (0600 permissions)
    2. Signed URLs: HMAC-SHA256, 1-hour expiry, served through Worker
    3. Webhook Security: Paddle signature verification (HMAC-SHA256)
    4. Tier Access: Server-side license validation in Cloudflare Worker

    Testing Checklist

    • npm run typecheck - No type errors
    • npm run lint - No lint errors
    • npm run test:run - All tests pass
    • npm run build - Builds successfully
    • Manual test: jawkit init --dry-run works

    License

    Proprietary - All rights reserved. This software is confidential and proprietary to JawKit.