feat(auth): add DC_NO_BROWSER env var and IS_AI_AGENT to browser-auth gate#432
feat(auth): add DC_NO_BROWSER env var and IS_AI_AGENT to browser-auth gate#432bensonwong merged 4 commits intomainfrom
Conversation
- Extract canStartBrowserAuth() helper consolidating TTY/env checks - Respect DC_NO_BROWSER in openBrowser() and browser-auth gate - Wire IS_AI_AGENT into browser-auth decision - Improve non-interactive error message clarity - Fix tsconfig.jest.json ignoreDeprecations value (6.0 → 5.0) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Unit test: DC_NO_BROWSER=1 overrides MSYSTEM in canStartBrowserAuth - Scenario test: CLAUDE_CODE=1 (IS_AI_AGENT) triggers non-interactive path - Add clarifying comment on --browser vs DC_NO_BROWSER layering Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
Code ReviewOverall this is a clean, well-scoped PR. The Bug:
|
✅ Playwright Test ReportStatus: Tests passed 📊 Download Report & Snapshots (see Artifacts section) What's in the Visual SnapshotsThe gallery includes visual snapshots for:
Run ID: 24514073946 |
TypeScript 6.0 requires ignoreDeprecations "6.0" (not "5.0") to silence TS5107 for the node10 moduleResolution used by ts-jest/CommonJS. Also collapses a multi-line captureOutput call to satisfy biome format. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
DC_NO_BROWSERenv var: when set,openBrowser()returns early without callingexecFile, suppressing browser launch on all platformscanStartBrowserAuth(argv)helper that consolidates the duplicated TTY/env detection logic fromrequireAuth()andlogin()into one placeIS_AI_AGENTintocanStartBrowserAuth()so AI agent environments (Claude Code, Cursor, Codex, etc.) reliably skip browser OAuth without needingDC_NON_INTERACTIVE--browserflag remains a hard opt-in override — it bypassescanStartBrowserAuth()butDC_NO_BROWSERstill silences the actualexecFilecall (useful for headless testing)tsconfig.jest.jsonignoreDeprecationsvalue:"6.0"→"5.0"(correct value for suppressingmoduleResolution: node10deprecation in TS 5.x)Test plan
openBrowserunit test:DC_NO_BROWSER=1preventsexecFilecall (all platforms)DC_NO_BROWSER=1overridesMSYSTEMincanStartBrowserAuth— exits with non-interactive messageCLAUDE_CODE=1(IS_AI_AGENT=true) triggers non-interactive path inlogincliAuthScenarios.test.ts)npm test)