@softlaunch/cli
v0.1.0
Published
Softlaunch command-line interface — manage feature flags, environments, and evaluate flags from the terminal
Readme
@softlaunch/cli
The Softlaunch command-line interface — manage feature flags, environments, and evaluate flags from the terminal.
npx @softlaunch/cli login
# or install globally
npm i -g @softlaunch/cli
softlaunch --helpRequires Node 22+.
Commands
| Command | What it does |
| --------------------------------------------------------- | ------------------------------------------- |
| softlaunch login [--email <email>] | Authenticate via an email magic code |
| softlaunch logout | Remove stored credentials |
| softlaunch whoami | Show the current identity and selected org |
| softlaunch orgs list | List organizations you belong to |
| softlaunch orgs use <org-id> | Select the active organization |
| softlaunch flags list | List flags with per-environment status |
| softlaunch flags get <key> | Show a flag's variations and per-env config |
| softlaunch flags create --name <n> --key <k> --type <t> | Create a flag |
| softlaunch flags toggle <key> on\|off --env <env> | Enable/disable a flag and recompile |
| softlaunch envs list | List environments and their SDK keys |
| softlaunch eval <key> --subject <id> [--attr k=v]… | Evaluate a flag locally |
Every command accepts --json (machine-readable output) and --no-color.
Configuration
Resolution precedence for the active org: --org flag → SOFTLAUNCH_ORG →
softlaunch orgs use.
| Env var | Purpose |
| ------------------------------- | --------------------------------------------------- |
| SOFTLAUNCH_ENV | production (default), staging, or development |
| SOFTLAUNCH_API_URL | Override the dashboard API base URL |
| SOFTLAUNCH_ORG | Default organization id |
| SOFTLAUNCH_SDK_KEY | Default SDK key for eval |
| NO_COLOR / STRICLI_NO_COLOR | Disable colored output |
Credentials and the selected org are stored per-environment in
~/.softlaunch/state.json (mode 0600).
How it works
The CLI is a thin, typed HTTP client of the dashboard API. Reads and writes both go through the audited, role-checked backend — InstantDB's client SDK is browser-only (it disables itself in Node), so all data access is server-side:
- Auth —
loginruns an InstantDB magic-code flow (its public HTTP endpoints) against the platform app and stores the refresh token. - Reads (
orgs,flags list/get,envs) callGETroutes that query each org's app server-side via the admin SDK, after a Bearer + role check. - Writes (
flags create,flags toggle) go through the same audited, role-checked routes;togglealso recompiles the affected environment. evalposts to a login-less route — the SDK key is the credential; the server resolves the (already public) config blob and runs the same evaluation engine the SDKs use.
Responses are validated against the shared @softlaunch/shared-types contract,
so the CLI is type-checked against the exact schema the server emits.
Exit codes
0 success · 1 failure · 2 usage · 3 auth required · 4 forbidden ·
5 conflict · 6 not found.
Development
pnpm --filter @softlaunch/cli build # bundle to dist/bin.js
pnpm --filter @softlaunch/cli typecheck
pnpm --filter @softlaunch/cli test
node packages/cli/dist/bin.js --helpAdding a command: write it with buildCommand in src/commands/, then add it to
a route map in src/app.ts. Commands receive the context (config, credentials,
output) as this and are pure functions of (flags, context) — see existing
commands for the pattern.
