# CLI quickstart

Source: https://www.sheepit.ai/docs/cli

The sheepit command. Generates typed flag constants for your codebase and manages flags, rollouts and releases from your terminal or CI.

- Package: [@sheepit-ai/cli](https://www.npmjs.com/package/@sheepit-ai/cli)
- Runs on: Node 20+

## 1. Create an account

Don't have an account yet? [Create one, free](https://www.sheepit.ai/signup). There is no key to copy: the next step signs you in through your browser.

## 2. Install

```bash
npm install -D @sheepit-ai/cli
```

## 3. Sign in and generate flag constants

```bash
# Sign in through the browser (add --host https://<your-install> when self-hosted)
npx sheepit login

# Write sheepit.config.json for this repo
npx sheepit init

# Generate typed flag constants from your live flags
npx sheepit codegen
```

## 4. Run it in CI

```bash
# CI: a dev key is read-only. Both variables are required.
export SHEEPIT_API_KEY=lp_dev_...
export SHEEPIT_API_URL=https://api.sheepit.ai
npx sheepit codegen
```

## 5. Check that it worked

Run npx sheepit whoami to see which account and project you're signed in to, and look for the generated flag constants in your repo.

## Worth knowing

- codegen turns flag names into typed constants, so a typo becomes a compile error instead of a feature that silently stays off.
- In CI, use a dev key (read-only) and set SHEEPIT_API_URL too. The CLI refuses a key without an explicit URL.
- Prefer a global install? npm install -g sheepit-ai gives you the same sheepit command.
- Self-hosted install: sign in with sheepit login --host https://<your-install>.
