@@ -536,23 +536,33 @@ function buildMutationHandler(
536536 // For create: field is required only if it has no default value
537537 // For update: all fields are optional (user only updates what they want)
538538 const isRequired = operation === 'create' && ! fieldsWithDefaults . has ( field . name ) ;
539- questions . push (
540- t . objectExpression ( [
541- t . objectProperty ( t . identifier ( 'type' ) , t . stringLiteral ( 'text' ) ) ,
542- t . objectProperty (
543- t . identifier ( 'name' ) ,
544- t . stringLiteral ( field . name ) ,
545- ) ,
546- t . objectProperty (
547- t . identifier ( 'message' ) ,
548- t . stringLiteral ( field . name ) ,
549- ) ,
539+ const hasDefault = fieldsWithDefaults . has ( field . name ) ;
540+ const questionProps = [
541+ t . objectProperty ( t . identifier ( 'type' ) , t . stringLiteral ( 'text' ) ) ,
542+ t . objectProperty (
543+ t . identifier ( 'name' ) ,
544+ t . stringLiteral ( field . name ) ,
545+ ) ,
546+ t . objectProperty (
547+ t . identifier ( 'message' ) ,
548+ t . stringLiteral ( field . name ) ,
549+ ) ,
550+ t . objectProperty (
551+ t . identifier ( 'required' ) ,
552+ t . booleanLiteral ( isRequired ) ,
553+ ) ,
554+ ] ;
555+ // Skip prompting for fields with backend-managed defaults.
556+ // The field still appears in man pages and can be overridden via CLI flags.
557+ if ( hasDefault ) {
558+ questionProps . push (
550559 t . objectProperty (
551- t . identifier ( 'required ' ) ,
552- t . booleanLiteral ( isRequired ) ,
560+ t . identifier ( 'skipPrompt ' ) ,
561+ t . booleanLiteral ( true ) ,
553562 ) ,
554- ] ) ,
555- ) ;
563+ ) ;
564+ }
565+ questions . push ( t . objectExpression ( questionProps ) ) ;
556566 }
557567 }
558568
0 commit comments