cli: Add WorkOS auth service models and expand dependency baseline#8
Merged
davidabram merged 18 commits intomainfrom Mar 11, 2026
Merged
cli: Add WorkOS auth service models and expand dependency baseline#8davidabram merged 18 commits intomainfrom
davidabram merged 18 commits intomainfrom
Conversation
Add secure file-based token storage with cross-platform path resolution, JSON serialization, and restrictive file permissions
Add complete OAuth 2.0 Device Authorization Flow (RFC 8628) runtime
Add `ensure_valid_token` to check token expiry and refresh expired access tokens via `/oauth/token` using `grant_type=refresh_token`. Include skew-guarded expiry evaluation, retry-wrapped refresh calls, and terminal OAuth error mapping with actionable "Try:" guidance.
Pure formatting change with no behavioral impact. Wraps lines exceeding style guide limits.
Add Auth command to clap schema with AuthSubcommand enum containing Login, Logout, and Status variants.
Add auth command parsing and dispatch
Move token deletion logic from auth_command into token_storage module, adding a public delete_tokens() function that returns true if a file was deleted, false if missing, and TokenStorageError on I/O failures.
Extend the config service to support auth-adjacent keys with deterministic env-over-config precedence. Implements workos_client_id as the first key.
Implement a generalized auth-config resolver supporting per-key precedence chains (env > config file > optional baked default). Migrate workos_client_id to use the new resolver with fallback to client_sce_default.
Move IntegrationTempDir, CommandResult, and SetupIntegrationHarness utilities from setup_integration.rs into a new cli/tests/support/mod.rs. Rename harness to BinaryIntegrationHarness and generalize visibility so config-precedence integration tests can reuse the same compiled- binary test infrastructure without duplication.
Add end-to-end tests validating the runtime configuration precedence (flags > env > config file > defaults) through compiled binary scenarios.
Add three integration tests verifying workos_client_id resolution through the precedence chain
Add flake app to run compiled-binary config precedence tests via nix run .#cli-config-precedence-integration-tests.
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.
No description provided.