CLI Commands
Realanalytics CLI reference
Install or run with npx
# global
npm install -g realanalytics
# one-off
npx realanalytics <command>Available commands
| Command | Purpose |
|---|---|
login | Open browser login and exchange one-time token |
logout | Delete local auth file |
init | Create project + scaffold analytics files |
build | Compile analytics TS files to JSON |
deploy | Build and deploy events + dashboards |
lint | Validate analytics definitions |
whoami | Show authenticated user ID |
status | Show auth and local project status |
login
login opens /cli/auth in your browser. After signing in, copy the token shown on that page and paste it back into the terminal.
npx realanalytics login
# terminal prompt:
# Paste your token here: ...You can also skip browser open by passing a one-time token directly: npx realanalytics login --token <token>.
init
npx realanalytics initOptional project naming: npx realanalytics init --name my-project.
Creates project credentials and starter files:
analytics/events.tsanalytics/dashboards/overview.ts.realanalytics/credentials.json
build
npx realanalytics build
# custom output directory
npx realanalytics build --output dist/analyticsOutput files: events.json and dashboards.json.
deploy
npx realanalytics deployRuns build, then POSTs compiled JSON to the platform using your project secret key + CLI session token.
lint
npx realanalytics lintValidates your analytics definitions by checking event references, property references, naming conventions, and unused events. Exits with code 1 if errors are found.
See Governance for full details on what the linter checks.
whoami and status
npx realanalytics whoami
npx realanalytics statusTypical workflow
# one-time
npx realanalytics login
npx realanalytics init
# repeat for changes
npx realanalytics lint
npx realanalytics deployAutomation note
For CI/non-interactive deploys, set REALANALYTICS_TOKEN to a valid CLI access token and run npx realanalytics deploy.