feat!: move login/logout to auth subcommand, add auth status#84
Merged
feat!: move login/logout to auth subcommand, add auth status#84
Conversation
BREAKING CHANGE: `workos login` and `workos logout` are now `workos auth login` and `workos auth logout`. New `workos auth status` command shows current auth state: - Logged in email/userId - Token expiry (time remaining or how long ago it expired) - Refresh token presence - Active environment name and type - Supports --json for machine-readable output All error messages referencing `workos login` updated to `workos auth login`.
Writes timestamped entries to ~/.workos/audit.log for every credential mutation: SAVE_CREDENTIALS, CLEAR_CREDENTIALS, UPDATE_TOKENS, and GET_CREDENTIALS (when returning null). Logs only non-sensitive metadata: email, userId, token expiry, refresh token presence, storage backend, and caller stack frame. Never logs tokens or API keys. Disabled automatically in test environments (VITEST).
When forceInsecureStorage is true, all keyring read/write/delete operations are now no-ops. Previously, deleteFromKeyring() would still hit the real system keychain even in insecure-storage mode, meaning tests using setInsecureStorage(true) could wipe real credentials from the keychain. This was the root cause of credentials mysteriously vanishing after running tests.
This reverts commit e8b74d1.
This reverts commit 2d78cf5.
3480260 to
cb34b07
Compare
- bin.ts: use isJsonMode() instead of hasJsonFlag to suppress update notice in all JSON contexts (including non-TTY auto-detection) - ensure-auth.ts: fix missed workos login → workos auth login at line 94 - version-check.ts: fix double blank line (console.log already adds \n) - Update CLAUDE.md, DEVELOPMENT.md, SKILL.md references
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Groups auth-related commands under
workos authand adds a newstatussubcommand for inspecting current authentication state.Breaking Change
workos loginandworkos logoutare removed as top-level commands. Use:workos auth login— Authenticate with WorkOS via browser-based OAuthworkos auth logout— Remove stored WorkOS credentials and tokensNew:
workos auth statusShows current authentication state at a glance:
When not logged in:
Supports
--jsonfor machine-readable output:{ "authenticated": true, "email": "nick@nisi.org", "userId": "user_01JA4BG95WJA49X1DXKSDET8PC", "tokenExpired": false, "tokenExpiresAt": "2026-03-05T19:43:04.155Z", "tokenExpiresIn": "4m 32s", "hasRefreshToken": true, "activeEnvironment": { "name": "staging", "type": "sandbox" } }String reference updates
All error messages across the codebase referencing
workos loginorworkos logouthave been updated toworkos auth login/workos auth logout(15 files, ~20 locations).Implementation
env,organization) usingregisterSubcommand()utilityworkos authwith no subcommand shows help listing all three subcommandsauth statusreads from credential-store and config-store — no API calls, no side effectshelp-json.tsupdated for agent-facing command discovery