@@ -82,7 +82,6 @@ interface CliOptions {
8282 autoSync ? : boolean ;
8383 selectBuckets ? : boolean ;
8484 // New schema/constant CLI flags
85- generateSchemas ? : boolean ;
8685 schemaFormat ? : string ;
8786 schemaOutDir ? : string ;
8887 constantsInclude ? : string ;
@@ -384,7 +383,7 @@ const argv = yargs(hideBin(process.argv))
384383 description : "Prefer loading from appwrite.config.json instead of config.yaml" ,
385384 } )
386385 . option ( "it" , {
387- alias : [ "interactive" , "i" ] ,
386+ alias : [ "interactive" ] ,
388387 type : "boolean" ,
389388 description : "Launch interactive CLI mode with guided prompts" ,
390389 } )
@@ -610,10 +609,6 @@ const argv = yargs(hideBin(process.argv))
610609 description :
611610 "Comma-separated categories to include: databases,collections,buckets,functions" ,
612611 } )
613- . option ( "generateSchemas" , {
614- type : "boolean" ,
615- description : "Generate schemas/models without interactive prompts" ,
616- } )
617612 . option ( "schemaFormat" , {
618613 type : "string" ,
619614 description :
@@ -750,6 +745,15 @@ async function main() {
750745 MessageFormatter . info ( "Debug logging enabled (helpers logs → console at debug level)" , { prefix : "CLI" } ) ;
751746 }
752747
748+ if ( ( argv . schemaFormat || argv . schemaOutDir ) && ! argv . generate ) {
749+ MessageFormatter . error (
750+ "--schemaFormat / --schemaOutDir require --generate" ,
751+ undefined ,
752+ { prefix : "CLI" }
753+ ) ;
754+ process . exit ( 1 ) ;
755+ }
756+
753757 if ( argv . it ) {
754758 const cli = new InteractiveCLI ( process . cwd ( ) , {
755759 useSession : argv . useSession ,
@@ -785,7 +789,7 @@ async function main() {
785789 if ( error instanceof AuthenticationError ) {
786790 // --init / --upgradeConfig / --passthrough can legitimately run without a fully wired config.
787791 // Defer auth handling to those flows; otherwise surface the error and exit.
788- if ( ! argv . init && ! argv . upgradeConfig && ! argv . passthrough && ! argv . regen && ! argv . syncExtensions && ! argv . pullSelective ) {
792+ if ( ! argv . init && ! argv . upgradeConfig && ! argv . passthrough && ! argv . regen && ! argv . syncExtensions && ! argv . pullSelective && ! argv . generate ) {
789793 MessageFormatter . error ( error . getFormattedMessage ( ) , undefined , { prefix : "Auth" } ) ;
790794 process . exit ( 1 ) ;
791795 }
@@ -870,8 +874,10 @@ async function main() {
870874 return ;
871875 }
872876
873- // After init, check if we have a valid config (from file OR CLI overrides)
874- if ( ! controller . config ) {
877+ // After init, check if we have a valid config (from file OR CLI overrides).
878+ // --generate is allowed through with no controller.config; controller.generateSchemas()
879+ // lazy-loads via ConfigManager so local schema generation works without Appwrite creds.
880+ if ( ! controller . config && ! argv . generate ) {
875881 MessageFormatter . error ( "No Appwrite configuration available" , undefined , { prefix : "CLI" } ) ;
876882 MessageFormatter . info ( "Provide credentials via CLI flags (--endpoint, --projectId, --apiKey or --session)" , { prefix : "CLI" } ) ;
877883 MessageFormatter . info ( "Or create a config file using --setup" , { prefix : "CLI" } ) ;
@@ -1157,6 +1163,8 @@ async function main() {
11571163 buildSpec as Specification ,
11581164 runtimeSpec as Specification
11591165 ) ;
1166+ operationStats . updatedFunctionSpec = 1 ;
1167+ return ;
11601168 }
11611169
11621170 // Add default databases if not specified (only if we need them for operations)
0 commit comments