@@ -881,18 +881,29 @@ async function installFleetbaseCommand(options) {
881881 console . log ( ` HTTPS: ${ useHttps } ` ) ;
882882
883883 // Check if directory exists and has Fleetbase files
884- if ( ! await fs . pathExists ( directory ) ) {
885- console . error ( `\n✖ Directory does not exist: ${ directory } ` ) ;
886- console . log ( '\nℹ️ Please clone the Fleetbase repository first:' ) ;
887- console . log ( ' git clone https://github.com/fleetbase/fleetbase.git' ) ;
888- process . exit ( 1 ) ;
889- }
890-
891884 const dockerComposePath = path . join ( directory , 'docker-compose.yml' ) ;
892- if ( ! await fs . pathExists ( dockerComposePath ) ) {
893- console . error ( `\n✖ docker-compose.yml not found in ${ directory } ` ) ;
894- console . log ( '\nℹ️ Please ensure you are in the Fleetbase root directory.' ) ;
895- process . exit ( 1 ) ;
885+ const needsClone = ! await fs . pathExists ( dockerComposePath ) ;
886+
887+ if ( needsClone ) {
888+ console . log ( '\n⏳ Fleetbase repository not found, cloning...' ) ;
889+
890+ // Ensure parent directory exists
891+ await fs . ensureDir ( directory ) ;
892+
893+ // Clone the repository
894+ const { execSync } = require ( 'child_process' ) ;
895+ try {
896+ execSync ( 'git clone https://github.com/fleetbase/fleetbase.git .' , {
897+ cwd : directory ,
898+ stdio : 'inherit'
899+ } ) ;
900+ console . log ( '✔ Repository cloned successfully' ) ;
901+ } catch ( error ) {
902+ console . error ( '\n✖ Failed to clone repository:' , error . message ) ;
903+ console . log ( '\nℹ️ You can manually clone with:' ) ;
904+ console . log ( ' git clone https://github.com/fleetbase/fleetbase.git' ) ;
905+ process . exit ( 1 ) ;
906+ }
896907 }
897908
898909 // Generate APP_KEY
0 commit comments