npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

togglit-cli

v1.0.3

Published

ToggLit CLI – JSON config fallback and version management

Readme

ToggLit CLI

A command-line interface for managing your configuration using ToggLit — the JSON Config-as-a-Service platform.

🛑 Note: CLI access is restricted to premium users. Free-tier users will need to upgrade to use CLI features.

Installation

You can run it directly with npx:

npx togglit-cli login --api-key YOUR_API_KEY

Or install globally:

npm install -g togglit-cli
yarn global add togglit-cli
pnpm add -g togglit-cli

Quick Start

togglit login --api-key YOUR_API_KEY
togglit init --project YOUR_PROJECT_ID --env production
togglit pull

API Reference

login

Authenticate and store your API key for future CLI operations.

Parameters

| Parameter | Type | Required | Description | | ----------- | -------- | -------- | -------------------------------------------- | | --api-key | string | ✅ | Your Togglit API key | | --global | flag | ❌ | Save credentials globally (default: project) |

Example

# Login with project-specific credentials
togglit login --api-key tk_live_xxxxxxx

# Login with global credentials
togglit login --api-key tk_live_xxxxxxx --global

init

Initialize local project configuration and create a .togglit.json file.

Parameters

| Parameter | Type | Required | Description | | ----------- | -------- | -------- | ----------------------------------------- | | --project | string | ✅ | Your project identifier | | --env | string | ❌ | Environment name (default: 'development') |

Example

# Initialize with default development environment
togglit init --project togglit-demo

# Initialize with specific environment
togglit init --project togglit-demo --env production

pull

Pull configuration from Togglit and save it locally.

Parameters

| Parameter | Type | Required | Description | | ------------------ | -------- | -------- | ----------------------------------------------------- | | --project | string | ❌ | Your project identifier (uses config if not provided) | | --env | string | ❌ | Environment name (uses config if not provided) | | --config-version | number | ❌ | Specific configuration version to fetch | | --output | string | ❌ | Output file path (default: 'config.json') |

Example

# Pull latest configuration
togglit pull

# Pull specific version
togglit pull --config-version 2

# Pull to custom output file
togglit pull --output my-config.json

# Pull with explicit project and environment
togglit pull --project my-project --env production

rollback

Rollback to a previous configuration version.

Parameters

| Parameter | Type | Required | Description | | ------------------ | -------- | -------- | ----------------------------------------------------- | | --project | string | ❌ | Your project identifier (uses config if not provided) | | --env | string | ❌ | Environment name (uses config if not provided) | | --config-version | number | ✅ | Configuration version to rollback to |

Example

# Rollback to version 2
togglit rollback --config-version 2

# Rollback with explicit project and environment
togglit rollback --project my-project --env production --config-version 1

diff

Compare your local config with the latest remote version.

Parameters

| Parameter | Type | Required | Description | | ----------- | -------- | -------- | ----------------------------------------------------- | | --project | string | ❌ | Your project identifier (uses config if not provided) | | --env | string | ❌ | Environment name (uses config if not provided) | | --file | string | ❌ | Local config file to compare (default: 'config.json') |

Example

# Compare with default config.json
togglit diff

# Compare with custom file
togglit diff --file my-config.json

# Compare with explicit project and environment
togglit diff --project my-project --env production

generate-fallback

Generate a fallback config file for offline usage.

Parameters

| Parameter | Type | Required | Description | | ----------- | -------- | -------- | ----------------------------------------------------- | | --project | string | ❌ | Your project identifier (uses config if not provided) | | --env | string | ❌ | Environment name (uses config if not provided) |

Example

# Generate fallback for current project
togglit generate-fallback

# Generate fallback for specific project and environment
togglit generate-fallback --project my-project --env production

versions

List available config versions for your project.

Parameters

| Parameter | Type | Required | Description | | ----------- | -------- | -------- | ----------------------------------------------------- | | --project | string | ❌ | Your project identifier (uses config if not provided) | | --env | string | ❌ | Environment name (uses config if not provided) |

Example

# List versions for current project
togglit versions

# List versions for specific project and environment
togglit versions --project my-project --env production

status

View current configuration and validation status.

Example

# View current status
togglit status

logout

Remove your stored credentials.

Parameters

| Parameter | Type | Required | Description | | ---------- | ------ | -------- | -------------------------------------------- | | --global | flag | ❌ | Remove global credentials (default: project) |

Example

# Logout from project
togglit logout

# Logout globally
togglit logout --global

Features

  • Seamless Configuration Management: Pull, compare, and rollback configurations with simple commands
  • Version Control: Track and manage different versions of your configuration
  • Fallback Generation: Create offline fallback configurations for resilience
  • Global and Project-Specific Authentication: Flexible credential management
  • Real-time Comparison: Compare local and remote configurations with diff command

Configuration Priority

The CLI uses the following priority order when resolving configuration:

  1. CLI flags (--api-key, --project, --env, etc.)
  2. Local config (.togglit.json in current directory)
  3. Global config (~/.togglit/config.json)

Usage Examples

Basic Workflow

# 1. Login with your API key
togglit login --api-key tk_live_xxxxxxx

# 2. Initialize your project
togglit init --project my-app --env production

# 3. Pull the latest configuration
togglit pull

# 4. Check status
togglit status

Version Management

# List available versions
togglit versions

# Pull specific version
togglit pull --config-version 2

# Compare current config with remote
togglit diff

# Rollback to previous version
togglit rollback --config-version 1

Environment-Specific Operations

# Development environment
togglit init --project my-app --env development
togglit pull

# Production environment
togglit init --project my-app --env production
togglit pull --output prod-config.json

Fallback Configuration

# Generate fallback configuration
togglit generate-fallback

# This creates a fallback config file that can be used
# when the Togglit service is unavailable

Configuration File Structure

The .togglit.json file stores your project configuration:

{
  "project": "your-project-id",
  "env": "production",
  "apiKey": "your-api-key"
}

Error Handling

The CLI includes comprehensive error handling:

  • Authentication errors: Clear messages when API keys are invalid
  • Network errors: Graceful handling of connectivity issues
  • Configuration errors: Validation of project and environment parameters
  • File system errors: Proper error messages for file operations

Environment Configuration

The CLI connects to your Togglit instance. Make sure you have:

  • A valid API key (premium users only)
  • Proper network connectivity to Togglit servers
  • Appropriate file system permissions for config files

License

MIT

Support


Made with ❤️ by the Togglit team