Unverified Commit ae91b476 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

Improve agent upgrade failure message for missing app (#99117)

### Why?

The missing-app error tells users to pass an app path without showing
where it belongs in the command.

### How?

Add `next upgrade [directory] --ai=<supplied value>` to the error,
preserving the supplied AI upgrade type or bare `--ai` so users can
retry with an explicit directory.

<!-- NEXT_JS_LLM -->
parent f4a68604
......@@ -224,7 +224,8 @@ export async function spawnNextUpgrade(
// A workspace root must not launch an upgrade for an unspecified app.
if (!findDir(baseDir, 'app') && !findDir(baseDir, 'pages')) {
throw new Error(
'No Next.js app found in this directory. Run the command from an app directory or pass its path.'
'No Next.js app found in this directory. Run the command from an app directory or pass its path:\n\n' +
`next upgrade [directory] --ai${typeof options.ai === 'string' ? `=${options.ai}` : ''}`
)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment