@@ -6,7 +6,6 @@ import { theme } from "../../../packages/terminal-core/src/theme.js";
66import { formatAuthChoiceChoicesForCli } from "../../commands/auth-choice-options.js" ;
77import type { GatewayDaemonRuntime } from "../../commands/daemon-runtime.js" ;
88import { CORE_ONBOARD_AUTH_FLAGS } from "../../commands/onboard-core-auth-flags.js" ;
9- import { rejectOnboardingOption } from "../../commands/onboard-options.js" ;
109import type {
1110 AuthChoice ,
1211 GatewayAuthChoice ,
@@ -45,18 +44,19 @@ const MODERN_ONBOARD_OPTION_KEYS = new Set([
4544 "json" ,
4645] ) ;
4746
48- function validateRecommendationParentOptions (
47+ async function validateRecommendationParentOptions (
4948 command : Command ,
5049 runtime : RuntimeEnv ,
5150 json = false ,
52- ) : boolean {
51+ ) : Promise < boolean > {
5352 const unsupported = listExplicitOptionFlagsExcept (
5453 command ,
5554 json ? RECOMMENDATION_READ_PARENT_OPTIONS : NO_RECOMMENDATION_PARENT_OPTIONS ,
5655 ) ;
5756 if ( unsupported . length === 0 ) {
5857 return true ;
5958 }
59+ const { rejectOnboardingOption } = await import ( "../../commands/onboard-options.js" ) ;
6060 return rejectOnboardingOption (
6161 { json } ,
6262 runtime ,
@@ -227,12 +227,13 @@ function pickOnboardAuthOptionValues(opts: Record<string, unknown>): Partial<Onb
227227 } ;
228228}
229229
230- export function resolveOnboardCommandOptions (
230+ export async function resolveOnboardCommandOptions (
231231 opts : Record < string , unknown > ,
232232 command : Command ,
233233 runtime : RuntimeEnv ,
234- ) : OnboardOptions | false {
234+ ) : Promise < OnboardOptions | false > {
235235 if ( opts . customImageInput === true && opts . customTextInput === true ) {
236+ const { rejectOnboardingOption } = await import ( "../../commands/onboard-options.js" ) ;
236237 const message = "Use either --custom-image-input or --custom-text-input, not both." ;
237238 return rejectOnboardingOption ( { json : opts . json === true } , runtime , message ) ;
238239 }
@@ -321,7 +322,7 @@ export function registerOnboardCommand(program: Command): void {
321322 const { defaultRuntime } = await import ( "../../runtime.js" ) ;
322323 await runCommandWithRuntime ( defaultRuntime , async ( ) => {
323324 const json = Boolean ( opts . json || recommendationsCommand . parent ?. opts ( ) . json ) ;
324- if ( ! validateRecommendationParentOptions ( command , defaultRuntime , json ) ) {
325+ if ( ! ( await validateRecommendationParentOptions ( command , defaultRuntime , json ) ) ) {
325326 return ;
326327 }
327328 const { onboardRecommendationsCommand } =
@@ -338,8 +339,8 @@ export function registerOnboardCommand(program: Command): void {
338339 const { defaultRuntime } = await import ( "../../runtime.js" ) ;
339340 await runCommandWithRuntime ( defaultRuntime , async ( ) => {
340341 if (
341- ! validateRecommendationParentOptions ( command , defaultRuntime ) ||
342- ! validateRecommendationParentOptions ( recommendations , defaultRuntime )
342+ ! ( await validateRecommendationParentOptions ( command , defaultRuntime ) ) ||
343+ ! ( await validateRecommendationParentOptions ( recommendations , defaultRuntime ) )
343344 ) {
344345 return ;
345346 }
@@ -356,8 +357,8 @@ export function registerOnboardCommand(program: Command): void {
356357 const { defaultRuntime } = await import ( "../../runtime.js" ) ;
357358 await runCommandWithRuntime ( defaultRuntime , async ( ) => {
358359 if (
359- ! validateRecommendationParentOptions ( command , defaultRuntime ) ||
360- ! validateRecommendationParentOptions ( recommendations , defaultRuntime )
360+ ! ( await validateRecommendationParentOptions ( command , defaultRuntime ) ) ||
361+ ! ( await validateRecommendationParentOptions ( recommendations , defaultRuntime ) )
361362 ) {
362363 return ;
363364 }
@@ -370,6 +371,7 @@ export function registerOnboardCommand(program: Command): void {
370371 command . action ( async ( opts , commandRuntime : Command ) => {
371372 const { defaultRuntime } = await import ( "../../runtime.js" ) ;
372373 await runCommandWithRuntime ( defaultRuntime , async ( ) => {
374+ const { rejectOnboardingOption } = await import ( "../../commands/onboard-options.js" ) ;
373375 const rejectOption = ( message : string ) =>
374376 rejectOnboardingOption ( { json : Boolean ( opts . json ) } , defaultRuntime , message ) ;
375377 if ( opts . modern ) {
@@ -416,7 +418,7 @@ export function registerOnboardCommand(program: Command): void {
416418 ) ;
417419 return ;
418420 }
419- const onboardingOptions = resolveOnboardCommandOptions (
421+ const onboardingOptions = await resolveOnboardCommandOptions (
420422 opts as Record < string , unknown > ,
421423 commandRuntime ,
422424 defaultRuntime ,
0 commit comments