Plan: three commits, dependency-ordered.
Commit 1 — fix(desktop/windows): replace import.meta.url with __dirname for CJS bundle
apps/desktop/src/main/windows/factory.ts
- Pre-existing Vite 8 / CJS bundling regression that crashed Electron boot. Unblocks dev runtime.
Commit 2 — fix(app/proxy): allow /api/desktop/* through Clerk middleware
apps/app/src/proxy.ts
- One-line addition matching
/api/cli/(.*). Without it, the new desktop routes 307 to /sign-in.
Commit 3 — feat(desktop): custom URL scheme + PKCE sign-in flow
apps/app/src/app/api/desktop/auth/lib/code-store.ts (new)
apps/app/src/app/api/desktop/auth/code/route.ts (new) + test
apps/app/src/app/api/desktop/auth/exchange/route.ts (new) + test
apps/app/src/app/(app)/(user)/(pending-not-allowed)/_components/client-auth-bridge.tsx + test
apps/app/src/app/(app)/(user)/(pending-not-allowed)/desktop/auth/_components/desktop-auth-client.tsx
apps/desktop/forge.config.ts
apps/desktop/src/main/auth-flow.ts
apps/desktop/src/main/protocol.ts (new) + test
apps/desktop/src/main/__tests__/auth-flow.test.ts (rewrite)
apps/desktop/src/main/index.ts
apps/desktop/src/preload/preload.ts
apps/desktop/src/shared/ipc.ts
.agents/skills/lightfast-desktop-signin/SKILL.md (new)
thoughts/shared/plans/2026-04-25-desktop-auth-url-scheme-pkce.md (new)
Replaces the loopback HTTP server with an OAuth 2.0 Authorization Code + PKCE flow over lightfast(-dev)://, removes ~150 LoC of CORS/server plumbing, and adds a structured stdout JSON event grammar (auth_signin_url / auth_signed_in / auth_already_signed_in / auth_signin_failed) so agent harnesses can drive sign-in deterministically without log-grepping or CDP attach.
Excluded (untouched by this session, pre-existing dirty): lightfast-clerk/SKILL.md, implement_plan.md, packages/app-remotion/*, the other thoughts/plans, AGENTS.md, etc.
Shall I proceed?