fix(cli): make auth login device-code UX consistent with create#3099
Open
jorgemoya wants to merge 2 commits into
Open
fix(cli): make auth login device-code UX consistent with create#3099jorgemoya wants to merge 2 commits into
jorgemoya wants to merge 2 commits into
Conversation
The device-code login flow behaved differently across commands: `auth login` opened the browser immediately and asked the user to copy the code by hand, while `create` waited for Enter first. Users expected the code on their clipboard and got confused. Consolidate the flow in `lib/login.ts` so `auth login`, `create`, and the channel commands all share one path: print the one-time code, wait for the user to press Enter before opening the browser, and best-effort copy the code to the clipboard (still printing it as a fallback). A new `lib/clipboard.ts` helper shells out to the platform-native utility (pbcopy/clip/wl-copy/xclip) and degrades gracefully — a copy failure never interrupts login. Non-TTY/CI runs skip the Enter prompt and clipboard copy and open directly. Refs LTRAC-1092 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: ae2ea34 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Bundle Size ReportComparing against baseline from No bundle size changes detected. |
The `input` prompt returns a CancelablePromise, so mocking it with an implementation that returns a plain Promise failed `tsc` in CI. Assert the "browser opens only after Enter" ordering via invocationCallOrder with a mockResolvedValueOnce instead, which is type-safe and satisfies the repo's no-type-assertions lint rule. Refs LTRAC-1092 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Unlighthouse Performance Comparison — VercelComparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores. Summary ScoreAggregate score across all categories as reported by Unlighthouse.
Category Scores
Core Web Vitals
|
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.
Linear: LTRAC-1092
What/Why?
The device-code login flow diverged:
auth loginopened the browser immediately and made users copy the code by hand, whilecreatewaited for Enter. A user expected the code on their clipboard and got confused. All three commands (auth login,create, channel) already funnel through the sharedlogin()inlib/login.ts, so this fixes it in one place: print the one-time code, wait for Enter before opening the browser, and best-effort copy the code to the clipboard (still printed as a fallback). Non-TTY/CI runs skip the Enter prompt and clipboard copy and open directly.No new dependencies: a small
lib/clipboard.tsshells out via the already-presentexecato the platform-native utility (pbcopy/clip/wl-copy/xclip). It never throws — a copy failure can't interrupt login.Testing
login.spec.ts(4) andclipboard.spec.ts(6): browser not opened before Enter; clipboard copied on proceed; clipboard failure non-fatal with code still printed; non-interactive skips Enter/clipboard and opens directly; per-platform command selection.typecheckandlintpass.Migration
None.