Link to the code that reproduces this issue
https://codesandbox.io/p/sandbox/optimistic-star-2nq57m
To Reproduce
Run npx @next/codemod@canary agents-md --output AGENTS.md in a repo with a range provided for next.
Current vs. Expected behavior
If I run npx @next/codemod@canary agents-md --output AGENTS.md in a repo using ^16 for next, the code detects version 16 and tries to download it, which is both incorrect and does not work:
$ npx @next/codemod@canary agents-md --output AGENTS.md
Downloading Next.js 16 documentation to .next-docs...
Failed to pull docs: Could not find documentation for Next.js v16. This version may not exist on GitHub yet.
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #12-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 9 20:46:52 UTC 2026
Available memory (MB): 31021
Available CPU cores: 22
Binaries:
Node: 24.12.0
npm: 11.6.2
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 16.1.6 // Latest available version is detected (16.1.6).
eslint-config-next: N/A
react: 19.2.4
react-dom: 19.2.4
typescript: 5.9.3
Next.js Config:
output: standalone
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
Link to the code that reproduces this issue
https://codesandbox.io/p/sandbox/optimistic-star-2nq57m
To Reproduce
Run
npx @next/codemod@canary agents-md --output AGENTS.mdin a repo with a range provided for next.Current vs. Expected behavior
If I run
npx @next/codemod@canary agents-md --output AGENTS.mdin a repo using^16for next, the code detects version 16 and tries to download it, which is both incorrect and does not work:Provide environment information
Operating System: Platform: linux Arch: x64 Version: #12-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 9 20:46:52 UTC 2026 Available memory (MB): 31021 Available CPU cores: 22 Binaries: Node: 24.12.0 npm: 11.6.2 Yarn: N/A pnpm: N/A Relevant Packages: next: 16.1.6 // Latest available version is detected (16.1.6). eslint-config-next: N/A react: 19.2.4 react-dom: 19.2.4 typescript: 5.9.3 Next.js Config: output: standaloneWhich area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response