Skip to content

feat(dev): one-click dev auto-login + quieter npm run dev#3009

Open
cqnykamp wants to merge 6 commits into
Doenet:mainfrom
cqnykamp:dev-autologin
Open

feat(dev): one-click dev auto-login + quieter npm run dev#3009
cqnykamp wants to merge 6 commits into
Doenet:mainfrom
cqnykamp:dev-autologin

Conversation

@cqnykamp

@cqnykamp cqnykamp commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

What this does

Makes local development smoother in two ways:

  • One-click sign-in. npm run dev prints a link you can click to sign straight into the app as a dev user — no more copying the mock magic-link out of the console. Logging out and refreshing keeps you logged out, as expected.
  • Quieter npm run dev. Trimmed the startup/reload noise so the terminal is much easier to scan.

Both are local-dev conveniences only — there's no change to how the app behaves in production.

🤖 Generated with Claude Code

cqnykamp and others added 6 commits July 17, 2026 20:54
Adds a dev-only sign-in shortcut so `npm run dev` no longer requires
hunting the mock magic-link out of the API console.

- apps/app: opening `/?autologin=true` on the local dev server signs in
  as a fixed dev user (dev@doenet.org), then strips the param so a
  refresh doesn't re-fire it and logout stays sticky. Gated on
  `import.meta.env.MODE === "development"` (not `DEV`, which is false here
  because the dev script forces NODE_ENV=production), so it is stripped
  from every real build.
- scripts/dev-ready-banner.js: prints the worktree-correct auto-login URL
  once the API port is listening.
- api: harden the test-auth bypass guard behind it. New
  isTestAuthBypassEnabled() fails closed (requires flag === "true") and is
  never enabled when NODE_ENV === "production", with unit tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Three sources of noise in the concurrently-driven dev stack:

- Cryptic [0]/[1] index prefixes -> label processes with short colored
  names (shared/api/app/web) via concurrently -n/-c.
- Per-workspace `> pkg@ver dev` / command echoes -> npm --silent on each
  workspace dev command (and the shared prebuild).
- The `[vite] page reload .../shared/dist/*.js` flood and info lines ->
  Vite logLevel "warn", scoped to `command === "serve"` so `vite build`
  and CI output are unchanged. Our banner already prints the app URL.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
getTextEncoder() fell back to `await import("util")` when TextEncoder was
undefined — only reachable on Node < 11. TextEncoder is a global in all
browsers and in Node >= 11, and this repo requires Node 24, so the branch
was dead code. It also put a Node builtin in the browser module graph,
producing a spurious "util has been externalized" Vite dev warning.

Use the global TextEncoder directly. Behavior is unchanged; the dev
warning is removed at its source (no @vite-ignore suppression needed).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Quieting Vite removed the app's own "Local:" line, so the app URL only
appeared in the banner while api/web each printed their own URL in their
own format. List all three (app/api/web) in the banner instead, aligned
and with the app marked as the clickable auto-login link, so there is one
consistent place to read them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@cqnykamp
cqnykamp requested a review from dqnykamp July 18, 2026 02:24
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