Skip to content

Commit c2cc7f5

Browse files
authored
docs: update CLI README for clarity and migration instructions (#480)
- Revised installation instructions to specify installing the CLI as a development dependency. - Enhanced clarity in the migration section from Bucket CLI, detailing changes in command names, file names, and environment variables. - Improved overall readability by consolidating and rephrasing sentences for better understanding. - Added emphasis on updating scripts and configuration files to reflect the new changes.
1 parent 445631d commit c2cc7f5

File tree

1 file changed

+32
-42
lines changed

1 file changed

+32
-42
lines changed

packages/cli/README.md

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ you can streamline your flagging workflow directly from your terminal.
66

77
## Installation
88

9-
Get started by installing the CLI locally in your project:
9+
Install the CLI as a development dependency in your project:
1010

1111
```bash
1212
# npm
@@ -16,8 +16,7 @@ npm install --save-dev @reflag/cli
1616
yarn add --dev @reflag/cli
1717
```
1818

19-
Then running the `new` command from your project's root directory,
20-
initializing the CLI, creating a flag, and generating the types all at once:
19+
Run the `new` command from your project's root directory to initialize the CLI, create a flag, and generate TypeScript types in one step:
2120

2221
```bash
2322
# npm
@@ -29,20 +28,20 @@ yarn reflag new
2928

3029
## Migrating from Bucket SDK
3130

32-
If you have been using the Bucket CLI, the following list will help you migrate to Reflag CLI:
31+
If you're migrating from the Bucket CLI, here are the key changes to be aware of:
3332

34-
- The command has been renamed from `bucket` to `reflag`
35-
- The default name of the file that contains the type definitions has been renamed to `flags.d.ts` from `features.d.ts`. You will need to manually remove `features.d.ts` if it was checked into the repository
36-
- The name of the file that stores personal authentication details has been changed to `.reflag-auth` from `.bucket-auth`. You will need to rename or remove `.bucket-auth`
37-
- The name of the file that stores CLI configuration has been changed to `reflag.config.json` from `bucket.config.json`. You will need to rename or remove `bucket.config.json`
38-
- The `features` command has been renamed to `flags`
39-
- The API key should now be supplied through `REFLAG_API_KEY` environment variable instead of `BUCKET_API_KEY`
33+
- **Command name**: Changed from `bucket` to `reflag`
34+
- **Type definitions file**: Renamed from `features.d.ts` to `flags.d.ts` (manually remove the old file if it was committed)
35+
- **Authentication file**: Changed from `.bucket-auth` to `.reflag-auth` (rename or remove the old file)
36+
- **Configuration file**: Changed from `bucket.config.json` to `reflag.config.json` (rename or remove the old file)
37+
- **Command**: `features` command is now `flags`
38+
- **Environment variable**: Use `REFLAG_API_KEY` instead of `BUCKET_API_KEY`
4039

41-
Do not forget to update your scripts, build steps and `.gitignore` patterns
40+
**Important**: Update your scripts, build steps, and `.gitignore` patterns to reflect these changes.
4241

43-
### Individual commands
42+
### Individual Commands
4443

45-
Instead of running `new` you can call each step individually.
44+
For more control, you can run each command individually:
4645

4746
```bash
4847
# Initialize Reflag in your project (if not already setup)
@@ -57,12 +56,11 @@ npx reflag flags types
5756

5857
## Configuration
5958

60-
The CLI creates a `reflag.config.json` file in your project directory when you run `reflag init`.
61-
This file contains all the necessary settings for your Reflag integration.
59+
The CLI creates a `reflag.config.json` file in your project directory when you run `reflag init`. This file contains all the necessary settings for your Reflag integration.
6260

6361
### Configuration File Structure
6462

65-
Here's a comprehensive list of configuration options available in the `reflag.config.json` file:
63+
Here are all the configuration options available in the `reflag.config.json` file:
6664

6765
```json
6866
{
@@ -93,8 +91,7 @@ You can override these settings using command-line options for individual comman
9391

9492
### `reflag init`
9593

96-
Initialize a new Reflag configuration in your project.
97-
This creates a `reflag.config.json` file with your settings and prompts for any required information not provided via options.
94+
Initialize a new Reflag configuration in your project. This creates a `reflag.config.json` file with your settings and prompts for any required information not provided via options.
9895

9996
```bash
10097
npx reflag init [--overwrite]
@@ -108,8 +105,7 @@ Options:
108105

109106
### `reflag new [flagName]`
110107

111-
All-in-one command to get started quickly. This command combines `init`, flag creation,
112-
and type generation in a single step. Use this for the fastest way to get up and running with Reflag.
108+
All-in-one command to get started quickly. This command combines `init`, flag creation, and type generation in a single step. Use this for the fastest way to get up and running with Reflag.
113109

114110
```bash
115111
npx reflag new "My Flag" [--app-id ap123456789] [--key my-flag] [--key-format custom] [--out gen/flags.ts] [--format react]
@@ -127,28 +123,27 @@ If you prefer more control over each step, you can use the individual commands (
127123

128124
### `reflag login`
129125

130-
Log in to your Reflag account. This will authenticate your CLI for subsequent operations and store credentials securely.
126+
Authenticate with your Reflag account. This stores your credentials securely for subsequent operations.
131127

132128
```bash
133129
npx reflag login
134130
```
135131

136132
### `reflag logout`
137133

138-
Log out from your Reflag account, removing stored credentials.
134+
Sign out from your Reflag account and remove stored credentials.
139135

140136
```bash
141137
npx reflag logout
142138
```
143139

144140
### `reflag flags`
145141

146-
Manage your Reflag flags with the following subcommands.
142+
Manage your Reflag flags with these subcommands:
147143

148144
#### `reflag flags create [flagName]`
149145

150-
Create a new flag in your Reflag app.
151-
The command guides you through the flag creation process with interactive prompts if options are not provided.
146+
Create a new flag in your Reflag app. The command guides you through the flag creation process with interactive prompts if options are not provided.
152147

153148
```bash
154149
npx reflag flags create "My Flag" [--app-id ap123456789] [--key my-flag] [--key-format custom]
@@ -162,8 +157,7 @@ Options:
162157

163158
#### `reflag flags list`
164159

165-
List all flags for the current app.
166-
This helps you visualize what flags are available and their current configurations.
160+
List all flags for the current app. This helps you visualize what flags are available and their current configurations.
167161

168162
```bash
169163
npx reflag flags list [--app-id ap123456789]
@@ -175,8 +169,7 @@ Options:
175169

176170
#### `reflag flags types`
177171

178-
Generate TypeScript types for your flags.
179-
This ensures type safety when using Reflag flags in your TypeScript/JavaScript applications.
172+
Generate TypeScript types for your flags. This ensures type safety when using Reflag flags in your TypeScript/JavaScript applications.
180173

181174
```bash
182175
npx reflag flags types [--app-id ap123456789] [--out gen/flags.ts] [--format react]
@@ -204,11 +197,11 @@ These options can be used with any command:
204197

205198
## AI-Assisted Development
206199

207-
Reflag provides powerful AI-assisted development capabilities through rules and Model Context Protocol (MCP). These flags help your AI development tools better understand your flags and provide more accurate assistance.
200+
Reflag provides powerful AI-assisted development capabilities through rules and Model Context Protocol (MCP). These features help your AI development tools better understand your flags and provide more accurate assistance.
208201

209202
### Reflag Rules (Recommended)
210203

211-
The `rules` command helps you set up AI-specific rules for your project. These rules enable AI tools to better understand how to work with Reflag and flags and how they should be used in your codebase.
204+
The `rules` command helps you set up AI-specific rules for your project. These rules enable AI tools to better understand how to work with Reflag flags and how they should be used in your codebase.
212205

213206
```bash
214207
npx reflag rules [--format <cursor|copilot>] [--yes]
@@ -221,11 +214,11 @@ Options:
221214
- `copilot`: Adds rules to `.github/copilot-instructions.md` for GitHub Copilot integration.
222215
- `--yes`: Skip confirmation prompts and overwrite existing files without asking.
223216

224-
This command will add rules to your project that provide AI tools with context about how to setup and use Reflag flags. For the copilot format, the rules will be added to a dedicated section in the file, allowing you to maintain other copilot instructions alongside Reflag's rules.
217+
This command adds rules to your project that provide AI tools with context about how to set up and use Reflag flags. For the copilot format, the rules are added to a dedicated section in the file, allowing you to maintain other copilot instructions alongside Reflag's rules.
225218

226219
## Model Context Protocol
227220

228-
The Model Context Protocol (MCP) is an open protocol that provides a standardized way to connect AI models to different data sources and tools. In the context of Reflag, MCP enables your code editor to understand your flags, their states, and their relationships within your codebase. This creates a seamless bridge between your flag management workflow and AI-powered development tools. The MCP server is hosted by Reflag, so it's very easy to get started.
221+
The Model Context Protocol (MCP) is an open protocol that provides a standardized way to connect AI models to different data sources and tools. In the context of Reflag, MCP enables your code editor to understand your flags, their states, and their relationships within your codebase. This creates a seamless bridge between your flag management workflow and AI-powered development tools. The MCP server is hosted by Reflag, making it easy to get started.
229222

230223
_\*\*Note: The Reflag `mcp` CLI command was previously used for a \_local_ server. However, in recent versions of the Reflag CLI, the `mcp` command has been repurposed to help you connect to the new remote MCP server.\*\*\_
231224

@@ -234,12 +227,11 @@ _\*\*Note: The Reflag `mcp` CLI command was previously used for a \_local_ serve
234227
The `mcp` command helps you configure your editor or AI client to connect with Reflag's remote MCP server. This allows your AI tools to understand your flags and provide more contextual assistance.
235228

236229
```bash
237-
npx reflag mcp [--app-id <id>] [--editor <editor>] [--scope <local|global>]
230+
npx reflag mcp [--editor <editor>] [--scope <local|global>]
238231
```
239232

240233
Options:
241234

242-
- `--app-id`: App ID to use for the MCP connection.
243235
- `--editor`: The editor/client to configure:
244236
- `cursor`: [Cursor IDE](https://www.cursor.com/)
245237
- `vscode`: [Visual Studio Code](https://code.visualstudio.com/)
@@ -258,8 +250,7 @@ _**Note: The setup uses [mcp-remote](https://github.com/geelen/mcp-remote) as a
258250

259251
## Using in CI/CD Pipelines (Beta)
260252

261-
The Reflag CLI is designed to work seamlessly in CI/CD pipelines. For automated environments where interactive login is not possible, use the `--api-key` option,
262-
or specify the API key in `REFLAG_API_KEY` environment variable.
253+
The Reflag CLI is designed to work seamlessly in CI/CD pipelines. For automated environments where interactive login is not possible, use the `--api-key` option or specify the API key in the `REFLAG_API_KEY` environment variable.
263254

264255
```bash
265256
# Generate types in CI/CD
@@ -268,11 +259,10 @@ npx reflag apps list --api-key $REFLAG_API_KEY
268259

269260
**Important restrictions:**
270261

271-
- When using `--api-key`, the `login` and `logout` commands are disabled.
272-
- API keys bypass all interactive authentication flows.
273-
- Only _read-only_ access to Reflag API is granted at the moment.
274-
- API keys are bound to one app only. Commands such as `apps list` will only return the bound app.
275-
- Store API keys securely using your CI/CD platform's secret management.
262+
- When using `--api-key`, the `login` and `logout` commands are disabled
263+
- API keys bypass all interactive authentication flows
264+
- API keys are bound to one app only. Commands such as `apps list` will only return the bound app
265+
- Store API keys securely using your CI/CD platform's secret management
276266

277267
Example CI workflow:
278268

0 commit comments

Comments
 (0)