( prompter: Prompter, )
| 247 | ]; |
| 248 | |
| 249 | export async function stepPickDepth( |
| 250 | prompter: Prompter, |
| 251 | ): Promise< |
| 252 | | { kind: 'picked'; depth: 'quick' | 'standard' | 'deep' } |
| 253 | | { kind: 'cancelled'; reason: string } |
| 254 | > { |
| 255 | prompter.write(''); |
| 256 | prompter.write('Pick a depth:'); |
| 257 | prompter.write(''); |
| 258 | for (const [idx, opt] of DEPTH_OPTIONS.entries()) { |
| 259 | prompter.write(` ${idx + 1}) ${opt.label.padEnd(9)} ${opt.estimate}`); |
| 260 | } |
| 261 | prompter.write(''); |
| 262 | const answer = await prompter.ask('Pick a depth [1-3] (or press enter for quick): '); |
| 263 | if (answer === 'q' || answer === 'Q') { |
| 264 | return { kind: 'cancelled', reason: 'quit-at-depth' }; |
| 265 | } |
| 266 | if (answer === '') { |
| 267 | return { kind: 'picked', depth: 'quick' }; |
| 268 | } |
| 269 | const pick = parseIndex(answer, DEPTH_OPTIONS.length); |
| 270 | if (pick === null) { |
| 271 | return { kind: 'cancelled', reason: 'invalid-depth-pick' }; |
| 272 | } |
| 273 | return { kind: 'picked', depth: DEPTH_OPTIONS[pick]!.key }; |
| 274 | } |
| 275 | |
| 276 | // ── Step 5: pick node count ─────────────────────────────────────────────── |
| 277 |
no test coverage detected