$_tuish

CLI Reference

Tuish CLI usage and headless JSON mode

CLI Reference

Use the Tuish CLI to manage your developer account or manage end-user licenses. It supports a headless JSON mode for automation and tests.

Installation

npm install -g tuish
pip install tuish-cli

Status: Preview

Two Modes

The CLI serves two audiences:

ModePurposeAuthentication
DeveloperManage products, view analytics, configure StripeAPI key (tuish login)
End-UserCheck license, activate, purchaseProduct ID + public key

End-User Commands (License Management)

For users of Tuish-licensed applications:

Check License Status

tuish license status \
  --product-id prod_xxx \
  --public-key MCow... \
  --json

Activate a License Key

tuish license activate \
  --product-id prod_xxx \
  --public-key MCow... \
  --license-key lic_xxx \
  --json

Purchase a License

Opens browser for checkout:

tuish license purchase \
  --product-id prod_xxx \
  --public-key MCow... \
  --json

Clear Stored License

tuish license deactivate \
  --product-id prod_xxx \
  --public-key MCow... \
  --json

Required Flags

FlagDescription
--product-idProduct ID from the developer
--public-keyEd25519 public key (SPKI base64 format)
--license-keyLicense key (activate only)
--jsonOutput JSON (required for headless mode)

Developer Commands

Create Developer Account

tuish signup --email you@example.com --name "Your Name"

Authenticate

tuish login --api-key tuish_sk_...

Connect Stripe

tuish connect

Check Stripe Connection

tuish connect status

List Products

tuish products list

Create Product

tuish products create \
  --name "My CLI" \
  --slug "my-cli" \
  --price 29.99 \
  --billing one_time

Get Product Details

Note: The products get command is planned but not yet implemented. Use products list to see all products.

# Coming soon:
# tuish products get --id prod_xxx

Headless JSON Mode

Add --json (or -j) to any command to emit machine-readable output:

  • Success JSON prints to stdout
  • Error JSON prints to stderr as {"error":"..."}
  • Exit code is 0 on success, non-zero on error

Success Example

tuish login --api-key tuish_sk_test --json

Output:

{ "success": true, "message": "API key stored successfully" }

Error Example

tuish products list --json

Output (stderr):

{ "error": "No API key found; run tuish login" }

License Status Output

tuish license status --product-id prod_xxx --public-key MCow... --json

Valid license:

{
  "valid": true,
  "license": {
    "id": "lic_abc123",
    "productId": "prod_xxx",
    "features": ["pro"],
    "status": "active",
    "expiresAt": 1735689600000
  },
  "offlineVerified": true
}

No license:

{
  "valid": false,
  "reason": "not_found"
}

Not Implemented Placeholders

If a command is not wired to the API yet, --json returns:

{
  "status": "not_implemented",
  "title": "Products",
  "message": "Listing products will be added once the API is available."
}

Environment Variables

VariableDescription
TUISH_DEVWhen set, uses local development API (http://localhost:8787)
TUISH_LICENSE_KEYGeneric license key fallback for any product
TUISH_LICENSE_KEY_{PRODUCT_ID}Product-specific license key (highest priority)
TUISH_DEBUGEnables verbose stderr output during checkout polling

License Key Resolution

When checking for a license key, the SDK searches in this order:

  1. Product-specific env var: TUISH_LICENSE_KEY_{PRODUCT_ID} where the product ID is normalized (e.g., TUISH_LICENSE_KEY_MY_COOL_CLI for prod_my-cool-cli)
  2. Generic env var: TUISH_LICENSE_KEY
  3. Local file cache: Product-specific cache file in storage directory
  4. Global storage: Shared license storage

Note: API keys for developer commands are stored via tuish login. Custom API URLs can be set via the SDK configuration.

Exit Codes

CodeMeaning
0Success
1Error (check stderr for details)

Note: The CLI uses string error codes in JSON output (e.g., NOT_AUTHENTICATED, API_ERROR, MISSING_REQUIRED) rather than numeric exit codes for detailed error classification.

Spec and Test Vectors

The JSON contract is defined in oss/spec/cli.md with shared vectors in oss/spec/tests/vectors/cli.json.