next.js
55ff2d23 - docs (Skills): stop assuming app/ at the root and port 3000 (#96696)

Commit
4 days ago
docs (Skills): stop assuming app/ at the root and port 3000 (#96696) ### What? Two Skills assumed a default project layout, and both failed silently when it didn't hold. - `next-cache-components-adoption` hardcoded `./app` for the `cache-components-instant-false` codemod, and checked its work under `app/` too. It now resolves the app directory from `next.config.*` and reads the file count the codemod reports. - `next-dev-loop` probed `/_next/mcp` in preflight, but `NEXT_MCP_URL` for a non-default port was only mentioned much later. The port is now resolved before the first probe. The same `./app` argument is documented for both 16.3 codemods, so the two guides and the codemods reference get a matching Good to know. ### Why? On a `src/app` project the codemod matched nothing and no gate caught it. A path that doesn't exist isn't an error for jscodeshift: it prints `No files selected, nothing to do`, reports `0 ok`, and exits `0`. The root-layout check looked in the same wrong place, and if the app's routes were prerenderable the build passed too, so a repo the migration never touched came out green. On a dev server bound to another port, the preflight probe read "unreachable" and refused to verify while `next dev` was running. Both are silent failures, which is the worst case for instructions an agent runs top to bottom. ### How? - Anchor on `next.config.*` so an agent invoked from a subdirectory doesn't test for `app/` against the wrong `cwd`. - When `app/` and `src/app/` both exist, say so: Next.js builds `app/` and never reads `src/app/`, so those routes are shadowed and unbuilt. Ask which tree to migrate. - Treat `0 ok` as a wrong path rather than a finished run. - Move the `NEXT_MCP_URL` resolution into the `next-dev-loop` preflight. The transforms are fine. Their path regexes match `src/app/...`, and pointed at `./src/app` they convert every segment. `remove-partial-prefetch` has the same shape and hardcoded path, so it's covered here too. Fixes #96649 --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Author
Parents
Loading