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

Show choices for agent upgrade prompt (#99727)

show choice for upgrade prompt

| Before | After |
| --- | --- |
| <img
src="https://github.com/devjiwonchoi/next.js/raw/604a56efdcbf2ead22d16c3098ae695eaff7558b/before.png"
alt="Upgrade prompts before: answered prompts show only the question,
hint and a blank gap" width="480"> | <img
src="https://github.com/devjiwonchoi/next.js/raw/604a56efdcbf2ead22d16c3098ae695eaff7558b/after.png"
alt="Upgrade prompts after: each answered prompt shows the confirmed
choice" width="480"> |
parent 3fff1aef
......@@ -124,7 +124,11 @@ async function chooseOption(
valueRenderer: (value: string, selected: boolean) =>
selected ? cyan(bold(value)) : value,
})
return typeof id === 'string' ? id : undefined
if (typeof id === 'string') {
Log.bootstrap(` ${cyan('❯')} ${cyan(bold(values[id]))}`)
return id
}
return undefined
} catch (error) {
if (error !== undefined) {
throw error
......
......@@ -614,6 +614,13 @@ describe('agentic upgrade prompts', () => {
const questions = jest
.mocked(Log.bootstrap)
.mock.calls.map(([value]) => String(value))
expect(questions.filter((value) => value.startsWith(' ❯ '))).toEqual([
` ❯ Continue with ${agent === 'codex' ? 'Codex' : 'Claude Code'}`,
` ❯ ${modelMenu.values[model]}`,
` ❯ ${effort}`,
' ❯ Yes',
' ❯ No',
])
expect(
questions.findIndex((value) => value.includes('model should run'))
).toBeLessThan(
......@@ -649,6 +656,7 @@ describe('agentic upgrade prompts', () => {
await handoffUpgrade('Upgrade prompt', '/workspace/app', null)
expect(Log.bootstrap).toHaveBeenCalledWith(' ❯ Model default')
expect(crossSpawn).toHaveBeenCalledWith(
expectedHarnessPath('codex'),
['--model', 'gpt-5.6-terra', '--approve-for-me', 'Upgrade prompt'],
......@@ -996,6 +1004,22 @@ describe('agentic upgrade prompts', () => {
).toHaveLength(1)
expect(jest.mocked(cliSelect).mock.calls[7][0].defaultValue).toBe(1)
expect(jest.mocked(cliSelect).mock.calls[9][0].defaultValue).toBe(0)
expect(
jest
.mocked(Log.bootstrap)
.mock.calls.map(([value]) => String(value))
.filter((value) => value.startsWith(' ❯ '))
).toEqual([
' ❯ Continue with Codex',
' ❯ GPT-5.6-Terra',
' ❯ high',
' ❯ Yes',
' ❯ No, ask for approval',
' ❯ GPT-6-Astra',
' ❯ ultra',
' ❯ Yes',
' ❯ No',
])
expect(crossSpawn).toHaveBeenCalledWith(
expectedHarnessPath('codex'),
[
......
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