CLI
Compass has a CLI to help devs run a few scripts locally.
bun run cli --help
Primary file:
packages/scripts/src/cli.ts
Commands To Know
| Command | Implementation | Notes |
|---|---|---|
bun run cli purge-user --email <address> [--apply] [--out report.json] | packages/scripts/src/commands/purge-user.ts | Deletes one user's API, Sync, and SuperTokens data. Defaults to dry-run. |
bun run cli backfill-billing [--apply] [--batch-size 500] [--cutoff ISO] | packages/scripts/src/commands/backfill-billing.ts | Places existing accounts without billing status into awaiting_checkout. Defaults to dry-run. |
bun run cli backfill-identities [--apply] [--batch-size 500] | packages/scripts/src/commands/backfill-identities.ts | Copies google.googleId into identities[] for users that still only have the legacy Google slot. Defaults to dry-run. Staging and production runs are a founder task. |
bun run cli backfill-meeting-types [--apply] [--batch-size 500] | packages/scripts/src/commands/backfill-meeting-types.ts | Stores the default meeting type (from durationMinutes) on booking pages saved before meeting types. Reads already derive it, so this is optional. Defaults to dry-run. Run on staging first. |
bun run cli purge-corrupt-sync-events [--apply] | packages/scripts/src/commands/purge-corrupt-sync-events.ts | Deletes invalid Sync event documents. Defaults to dry-run. |
bun run cli refresh-connection-states [--apply] | packages/scripts/src/commands/refresh-connection-states.ts | Re-derives Sync connection state. Defaults to dry-run. |
bun run cli encrypt-credentials [--apply] [--batch-size 200] | packages/scripts/src/commands/encrypt-credentials.ts | Encrypts legacy plaintext OAuth refresh tokens in Sync credentials. Defaults to dry-run. |
bun run cli connection-report [--json] [--api-mongo-uri <uri>] | packages/scripts/src/commands/connection-report.ts | Read-only inventory of Sync connections grouped by provider, state, and stateReason, with 30/90-day activity from lastSeenAt. Lists importing connections older than one hour by id. Prints "activity unavailable" when the API database cannot be read. |
bun run cli manage-failed-jobs <list|clear|requeue> … | packages/scripts/src/commands/manage-failed-jobs.ts | Operator tooling for Sync jobs that exhausted the self-heal requeue budget. Defaults to dry-run; pass --apply to persist. |
Encrypt OAuth refresh tokens at rest
Requires SYNC_MONGO_URI or sync.mongoUri, and SYNC_CREDENTIAL_ENCRYPTION_KEY or sync.credentialEncryptionKey.
export SYNC_MONGO_URI='…'
export SYNC_CREDENTIAL_ENCRYPTION_KEY='…'
# Inventory plaintext rows (JSON to stdout)
bun run cli encrypt-credentials
# Write encrypted rows
bun run cli encrypt-credentials --apply
Run on staging, confirm the report shows zero matched rows, then run on production before deploying a sync release that rejects plaintext OAuth rows at startup.