next.js
bd2383f6 - [agents-md] Hard-fail `next build` the same way `next dev` does

Commit
31 days ago
[agents-md] Hard-fail `next build` the same way `next dev` does `warnIfMissingAgentRules` collapses into a single `checkAgentRules(dir, mode)` helper shared between dev and build. Build now aborts with the same rationale-heavy fatal message and exit code 1 as dev, before any bundling work kicks off, so an agent-driven build doesn't burn minutes on artifacts the developer is about to throw away. Safe to fail hard on build because `detectAgent()` only inspects env vars set by AI coding tools — CI pipelines don't set them, so the gate never fires on a real build server, only when a developer is running `next build` from inside an agent session. `mode` picks the lead label: `Fatal: Dev Server exited.` for dev, `Fatal: Build aborted.` for build. Both are pattern-matched by agents as terminal failures, which is exactly the framing we want.
Author
Parents
Loading