feat: auto-trigger login when not authenticated#5
Merged
tonychang04 merged 1 commit intomainfrom Feb 26, 2026
Merged
Conversation
Instead of throwing an error telling users to run `insforge login`, commands now seamlessly start the OAuth login flow inline and continue after authentication. Extracts reusable performOAuthLogin() into auth.ts and makes requireAuth() async with auto-login fallback. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
CarmenDou
added a commit
that referenced
this pull request
May 2, 2026
- --json mode: print authorize URL to stderr instead of stdout so the final JSON result stays parseable; browser still opens and polling still runs (review #1). - spawn wizard with stdio: 'ignore' on all three streams in --json mode so unconsumed pipes can't block on long wizard output (review #5). - fetchPosthogConnection accepts an optional AbortSignal so polling can cancel a hung request when the deadline or user signal fires (review #3). - All three posthog API fetches go through a fetchWithTimeout helper that gives each request a 30s timeout and respects an optional caller signal (reviews #6, #7).
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
performOAuthLogin()intosrc/lib/auth.tsfrom the duplicated OAuth logic inlogin.tsrequireAuth()async — if no credentials exist, it seamlessly starts the browser OAuth flow instead of throwing an errorawait requireAuth()Test plan
npm run buildpassesinsforge loginstill works standalone with intro/outro messaginginsforge login --emailstill works for email/password flow🤖 Generated with Claude Code