fix: Pick a session by endpoint in auth switch - #301
Merged
Merged
Conversation
When one email is signed in on two endpoints, such as production and staging, 'datumctl auth switch <email>' always opened the picker. With no terminal it failed with a hint to name the email and endpoint, but nothing accepted an endpoint, and the full session name was rejected too. Scripts and CI had no way to switch between the two. 'auth switch' now accepts the full session name and an --endpoint flag that takes the endpoint 'auth list' prints, with or without a scheme or trailing slash. An endpoint with no session fails and lists the endpoints that exist. Without a terminal, an ambiguous switch prints the exact command for each matching session, and the no-argument case no longer says "for this email". The 'ctx use' hint for a context in another session includes --endpoint when the email needs it. Fixes #277 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The hint listing signed-in endpoints read as if it scoped to one email even when no email was given, since the wording did not change for the all-accounts case. State plainly that the list spans any account when no email narrows it, and cover the case with a test. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
scotwells
marked this pull request as ready for review
September 25, 2026 19:06
scotwells
enabled auto-merge
September 25, 2026 19:06
ecv
approved these changes
Sep 25, 2026
4 tasks
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
When one email is signed in to production and staging, switching accounts always opened a picker, so a script, CI job or agent had no way to choose between them.
You can now name the environment with
--endpoint, using the valuedatumctl auth listprints, or pass the full session name:Without a terminal, an ambiguous switch tells you exactly what to run instead of failing with no way forward:
In a terminal the picker works as before, and when
datumctl ctx usepoints you at a context in your other environment, its suggested switch command now includes the endpoint.Test plan
Fixes #277
🤖 Generated with Claude Code