Skip to content

fix(cli): make auth login device-code UX consistent with create#3099

Open
jorgemoya wants to merge 2 commits into
canaryfrom
jorgemoya/ltrac-1092-make-auth-login-browserdevice-code-ux-consistent-with-create
Open

fix(cli): make auth login device-code UX consistent with create#3099
jorgemoya wants to merge 2 commits into
canaryfrom
jorgemoya/ltrac-1092-make-auth-login-browserdevice-code-ux-consistent-with-create

Conversation

@jorgemoya

Copy link
Copy Markdown
Contributor

Linear: LTRAC-1092

What/Why?

The device-code login flow diverged: auth login opened the browser immediately and made users copy the code by hand, while create waited for Enter. A user expected the code on their clipboard and got confused. All three commands (auth login, create, channel) already funnel through the shared login() in lib/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.ts shells out via the already-present execa to the platform-native utility (pbcopy/clip/wl-copy/xclip). It never throws — a copy failure can't interrupt login.

Testing

  • New login.spec.ts (4) and clipboard.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.
  • typecheck and lint pass.

Migration

None.

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>
@vercel

vercel Bot commented Jul 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
catalyst Ready Ready Preview, Comment Jul 10, 2026 4:19pm

Request Review

@changeset-bot

changeset-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ae2ea34

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst Patch

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

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Report

Comparing against baseline from 8d9f9a9 (2026-07-10).

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>
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Unlighthouse Performance Comparison — Vercel

Comparing PR preview deployment Unlighthouse scores vs production Unlighthouse scores.

Summary Score

Aggregate score across all categories as reported by Unlighthouse.

Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Score 90 92 92 95

Category Scores

Category Prod Desktop Prod Mobile Preview Desktop Preview Mobile
Performance 75 85 76 77
Accessibility 95 92 95 98
Best Practices 100 100 100 100
SEO 88 100 100 100

Core Web Vitals

Metric Prod Desktop Prod Mobile Preview Desktop Preview Mobile
LCP 3.7 s 4.4 s 3.7 s 6.5 s
CLS 0.04 0 0.001 0.011
FCP 1.2 s 1.1 s 1.2 s 1.2 s
TBT 0 ms 0 ms 0 ms 20 ms
Max Potential FID 50 ms 40 ms 40 ms 70 ms
Time to Interactive 3.7 s 4.4 s 3.7 s 6.5 s

Full Unlighthouse report →

@jorgemoya jorgemoya marked this pull request as ready for review July 10, 2026 18:00
@jorgemoya jorgemoya requested a review from a team as a code owner July 10, 2026 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant