A command-line interface for managing your configuration using ToggLit.
CLI access is restricted to premium users. Free-tier users will need to upgrade to use CLI features.
You can run it directly with npx or install globally:
# Run directly with npx
npx togglit-cli login --api-key YOUR_API_KEY# Install globally
npm install -g togglit-cliyarn global add togglit-clipnpm add -g togglit-clitogglit login --api-key YOUR_API_KEY
togglit init --project YOUR_PROJECT_ID --env production
togglit pullloginAuthenticate and store your API key for future CLI operations.
| Parameter | Type | Required | Description |
|---|---|---|---|
| --api-key | string | ✅ | Your Togglit API key |
| --global | flag | ❌ | Save credentials globally (default: project) |
Login with project-specific credentials
togglit login --api-key tk_live_xxxxxxxLogin with global credentials
togglit login --api-key tk_live_xxxxxxx --globalinitInitialize local project configuration and create a .togglit.json file.
| Parameter | Type | Required | Description |
|---|---|---|---|
| --project | string | ✅ | Your project identifier |
| --env | string | ❌ | Environment name (default: 'development') |
Initialize with default development environment
togglit init --project togglit-demoInitialize with specific environment
togglit init --project togglit-demo --env productionpullPull configuration from Togglit and save it locally.
| 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') |
Pull latest configuration
togglit pullPull specific version
togglit pull --config-version 2Pull to custom output file
togglit pull --output my-config.jsonPull with explicit project and environment
togglit pull --project my-project --env productionrollbackRollback to a previous configuration version.
| 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 |
Rollback to version 2
togglit rollback --config-version 2Rollback with explicit project and environment
togglit rollback --project my-project --env production --config-version 1diffCompare your local config with the latest remote version.
| 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') |
Compare with default config.json
togglit diffCompare with custom file
togglit diff --file my-config.jsonCompare with explicit project and environment
togglit diff --project my-project --env productiongenerate-fallbackGenerate a fallback config file for offline usage.
| Parameter | Type | Required | Description |
|---|---|---|---|
| --project | string | ❌ | Your project identifier (uses config if not provided) |
| --env | string | ❌ | Environment name (uses config if not provided) |
Generate fallback for current project
togglit generate-fallbackGenerate fallback for specific project and environment
togglit generate-fallback --project my-project --env productionversionsList available config versions for your project.
| Parameter | Type | Required | Description |
|---|---|---|---|
| --project | string | ❌ | Your project identifier (uses config if not provided) |
| --env | string | ❌ | Environment name (uses config if not provided) |
List versions for current project
togglit versionsList versions for specific project and environment
togglit versions --project my-project --env productionstatusView current configuration and validation status.
View current status
togglit statuslogoutRemove your stored credentials.
| Parameter | Type | Required | Description |
|---|---|---|---|
| --global | flag | ❌ | Remove global credentials (default: project) |
Logout from project
togglit logoutLogout globally
togglit logout --global# 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# 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# 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.jsonThe CLI uses the following priority order when resolving configuration:
The .togglit.json file stores your project configuration:
{
"project": "your-project-id",
"env": "production",
"apiKey": "your-api-key"
}