CLI Overview
The Featsync CLI helps you manage feature flags from the command line. Scan your codebase for flag usage, list flags, and automatically clean up stale feature flag code.
Installation
Install the CLI globally:
npm install -g @featsync/cliOr use with npx (no install required):
npx @featsync/cli <command>Verify the installation:
featsync --helpAuthentication
-
Get your CLI API key
Go to your project in the dashboard, click API Keys, and create a CLI key (starts with
fs_cli_). -
Log in
Terminal window featsync loginPaste your CLI API key when prompted.
-
Verify authentication
Terminal window featsync listIf successful, you’ll see your project’s flags.
Project Setup
Initialize Featsync in your project directory:
cd your-projectfeatsync initThis creates a .featsync.json config file:
{ "projectId": "your-project-uuid", "environment": "production"}Quick Start
Once authenticated and initialized:
# List all flags in your projectfeatsync list
# Show only stale flags (enabled 100% for 14+ days)featsync list --stale
# Scan codebase for flag usagefeatsync scan
# Preview cleanup for a stale flagfeatsync cleanup my-old-flag --dry-runConfiguration Files
Auth Config
Stored at ~/.config/featsync/config.json:
{ "apiKey": "fs_cli_...", "baseUrl": "https://featsync.dev"}Project Config
Stored at .featsync.json in your project root:
{ "projectId": "uuid", "environment": "production"}Cleanup Config (Optional)
Create .featsyncrc to customize cleanup behavior:
{ "cleanup": { "exclude": ["**/legacy/**", "**/migrations/**"], "include": ["src/**/*.ts", "src/**/*.tsx"] }}Default Excluded Paths
The scanner automatically excludes:
node_modules/**dist/**,build/**,.next/**coverage/***.test.ts,*.spec.ts,__tests__/***.d.ts,generated/**
Resetting Configuration
# Clear authenticationrm -rf ~/.config/featsync
# Clear project configrm .featsync.jsonNext Steps
- View all CLI commands - Detailed reference for each command
- Learn about stale flags - What makes a flag stale