feat!: consolidate and rename CLI environment variables#180
Conversation
Reduce env-var sprawl in the CLI: - Derive the LLM gateway and CLI telemetry URLs from WORKOS_API_URL instead of separate WORKOS_LLM_GATEWAY_URL / WORKOS_TELEMETRY_URL vars, so api.workos.com is no longer hardcoded in multiple places. - Remove the redundant WORKOS_NO_PROMPT alias; WORKOS_MODE=agent is the single, self-documenting way to force agent interaction + JSON output. - Standardize the INSTALLER_* prefix to WORKOS_* (WORKOS_DEV, WORKOS_DISABLE_PROXY). - Fix the rotted `workos debug env` catalog (it was missing several vars) and add a test that scans src/ for WORKOS_* env reads and fails if any is missing from the catalog, preventing future drift. BREAKING CHANGE: WORKOS_LLM_GATEWAY_URL and WORKOS_TELEMETRY_URL are removed (derived from WORKOS_API_URL); WORKOS_NO_PROMPT is removed (use WORKOS_MODE=agent); INSTALLER_DEV is renamed to WORKOS_DEV and INSTALLER_DISABLE_PROXY to WORKOS_DISABLE_PROXY.
Greptile SummaryThis PR consolidates and renames the CLI's environment-variable surface:
Confidence Score: 4/5Safe to merge after fixing the README table entry — one row still says The code changes are correct and well-tested throughout. The only concrete defect is the README environment-variables table listing README.md — the env-vars table in the Agent Interface section needs the Important Files Changed
|
Address code review on the env-var cleanup: - Move getLlmGatewayUrl/getTelemetryUrl from settings.ts into urls.ts so the derived endpoints sit next to their base (getWorkOSApiUrl). This removes the backwards settings->urls import and makes urls.ts a dependency-free leaf that is the single home for WorkOS endpoint resolution. getAuthkitDomain stays in settings.ts since it's config-backed, not API-host-derived. - Normalize the trailing slash once inside getWorkOSApiUrl instead of repeating the strip at each derivation site. - Scope the env-var-catalog guard test's claim to dot-access reads and document the forms it doesn't cover (bracket access, destructuring). - Fix a stale docstring on getCliAuthClientId (it is not env-overridable).
What & why
The CLI's environment-variable surface had grown large and inconsistent. This consolidates it.
Removed (derived instead)
WORKOS_LLM_GATEWAY_URL→ derived as${WORKOS_API_URL}/llm-gatewayWORKOS_TELEMETRY_URL→ derived as${WORKOS_API_URL}/cliBoth endpoints live under the WorkOS API host, so they're now derived from the single
WORKOS_API_URLbase.api.workos.comis no longer hardcoded in three places, and settingWORKOS_API_URLalone reroutes the API, gateway, and telemetry together.Removed (redundant)
WORKOS_NO_PROMPT→ useWORKOS_MODE=agentIt was a legacy alias that mapped to agent interaction + JSON output.
WORKOS_MODE=agentalready does exactly that (JSON is forced viaresolveEffectiveOutputMode), and it's self-documenting —NO_PROMPTdescribed one side effect and hid the other.Renamed (prefix consistency)
INSTALLER_DEV→WORKOS_DEVINSTALLER_DISABLE_PROXY→WORKOS_DISABLE_PROXYAnti-drift guard
The
workos debug envcatalog had already rotted (missingWORKOS_AGENT,WORKOS_SECRET_KEY,WORKOS_CLIENT_ID, and others). Fixed it, and added a test that scanssrc/forprocess.env.WORKOS_*/ destructuredenv.WORKOS_*reads and fails if any isn't cataloged — so the list can't silently drift again.Breaking change
feat!:→ release-please will cut0.18.0(minor, perbump-minor-pre-major) with a BREAKING CHANGES changelog entry. Real-world risk is low: 4 of the 5 vars are internal/developer-only, andWORKOS_NO_PROMPTis largely redundant with non-TTY auto-detection.Verification
pnpm typecheck✅pnpm test✅ (2092 passing)pnpm build✅process.env.Xand destructuredenv.Xreads.