Purpose: This CLI is a command-line tool in the Reflag (formerly Bucket) JavaScript SDK repository, used to complete workflow management related to feature flags in the terminal and to support AI-assisted development configuration.
Main capabilities:
- App and authentication management: log in, log out, list accessible apps (apps list), and support non-interactive authentication via API Key.
- Feature flag management: create flags (flags create), list the flags of the current app (flags list).
- Type generation: generate TypeScript types for the Node, React, and Vue SDK v2 (flags types), with the output file being flags.d.ts; CLI v2 targets SDK v2, so if you use SDK v1 you need to stay on CLI 1.x. Generated types read boolean flag headers and multivariate variants from the production environment; registered non-null default values are type-checked against the generated values, and multivariate flags without configured values retain JSON capability types.
- All-in-one initialization: reflag new combines init, flag creation, and type generation into one step; reflag init generates the reflag.config.json configuration file.
- AI-assisted development: the rules command adds project rules for Cursor (.cursor/rules/reflag.mdc) or GitHub Copilot (.github/copilot-instructions.md); the mcp command configures editors/AI clients to connect to Reflag's hosted remote MCP server, supporting cursor, vscode, claude, and windsurf, with a choice of global or project-level configuration.
Usage: Install the CLI as a development dependency in the project, and run reflag new in the project root to complete initialization, flag creation, and type generation; you can also run init, flags create, and flags types separately. Use reflag login for authentication, and in CI/CD use --api-key or the REFLAG_API_KEY environment variable. Common options include --debug, --base-url, --api-url, --api-key, --org-id, --help.
Migrating from Bucket: the command name changes from bucket to reflag; the types file changes from features.d.ts to flags.d.ts; the auth file changes from .bucket-auth to .reflag-auth; the config file changes from bucket.config.json to reflag.config.json; the features command changes to flags; the environment variable changes from BUCKET_API_KEY to REFLAG_API_KEY.
Use cases: feature flag management and type safety in frontend/Node projects; enabling models to understand project flags in AI development tools such as Cursor, VS Code, Claude Desktop, and Windsurf; CI/CD automation workflows.
Limitations: Requires Node.js >=18.0.0; when using --api-key, the login/logout commands are disabled, and an API Key is bound to only a single app; MCP configuration connects to the remote server through the mcp-remote compatibility layer, and if the editor supports HTTP Streaming and OAuth it can connect directly; generated types do not add nested runtime validation, so values must be regenerated after changes. License is MIT.