Problem
Two small DX papercuts, each of which cost a moment of confusion while building crisp and which an AI is prone to trip over:
(a) redirect() defaults to HTTP 307. A gating/post-action redirect like redirect('/login') returns 307 (Temporary Redirect, method-preserving), whereas the convention people/agents reach for is 302 (Found). Not wrong, but surprising — and method-preserving 307 on what's usually a GET-to-GET navigation is an odd default. An AI emits redirect('/login') assuming 302-ish behavior.
(b) A bare webjs dev silently skips the npm predev hook. The scaffold's dev script is webjs dev, and npm run dev runs predev (prisma generate) first. But invoking webjs dev directly (easy to do, and tempting for an AI/CLI) skips predev, so the dev server crashes on an ungenerated Prisma client with no hint that the canonical command is npm run dev. (This also bit the crisp work on the sandbox side earlier — a bare webjs dev vs npm run dev was a real source of "why won't it start".)
Design / approach
(a) Reconsider 302 as redirect()'s default (or, if 307 is intentional, document it prominently in the recipe with how to pass an explicit status).
(b) Have webjs dev detect a missing/stale generated Prisma client (or, more generally, a missing predev artifact) and either generate it or print a clear, actionable hint ("Prisma client not generated — run via npm run dev (which runs prisma generate first), or run webjs db generate"). Even just the hint turns a confusing crash into a one-line fix. Docs should name npm run dev as the canonical command and say why.
Acceptance criteria
Problem
Two small DX papercuts, each of which cost a moment of confusion while building crisp and which an AI is prone to trip over:
(a)
redirect()defaults to HTTP 307. A gating/post-action redirect likeredirect('/login')returns 307 (Temporary Redirect, method-preserving), whereas the convention people/agents reach for is 302 (Found). Not wrong, but surprising — and method-preserving 307 on what's usually a GET-to-GET navigation is an odd default. An AI emitsredirect('/login')assuming 302-ish behavior.(b) A bare
webjs devsilently skips the npmpredevhook. The scaffold'sdevscript iswebjs dev, andnpm run devrunspredev(prisma generate) first. But invokingwebjs devdirectly (easy to do, and tempting for an AI/CLI) skipspredev, so the dev server crashes on an ungenerated Prisma client with no hint that the canonical command isnpm run dev. (This also bit the crisp work on the sandbox side earlier — a barewebjs devvsnpm run devwas a real source of "why won't it start".)Design / approach
(a) Reconsider 302 as
redirect()'s default (or, if 307 is intentional, document it prominently in the recipe with how to pass an explicit status).(b) Have
webjs devdetect a missing/stale generated Prisma client (or, more generally, a missing predev artifact) and either generate it or print a clear, actionable hint ("Prisma client not generated — run vianpm run dev(which runsprisma generatefirst), or runwebjs db generate"). Even just the hint turns a confusing crash into a one-line fix. Docs should namenpm run devas the canonical command and say why.Acceptance criteria
redirect()'s default status is documented; 302-vs-307 default reconsidered.webjs devgives a clear, actionable message (or self-heals) when the Prisma client isn't generated, instead of a raw crash.npm run devas the canonical dev command and the predev (prisma generate) reason.