@@ -92,20 +92,26 @@ protected function configure(): void {
9292 $ this ->setName ('install ' );
9393 $ this ->setDescription ('Install Vortex from remote or local repository. ' );
9494 $ this ->setHelp (<<<EOF
95- Interactively install Vortex from the latest stable release into the current directory:
96- php installer --destination=.
97-
98- Non-interactively install Vortex from the latest stable release into the specified directory:
99- php installer --no-interaction --destination=path/to/destination
100-
101- Install Vortex from the stable branch into the specified directory:
102- php installer --uri=https://github.com/drevops/vortex.git@stable --destination=path/to/destination
103-
104- Install Vortex from a specific release into the specified directory:
105- php installer --uri=https://github.com/drevops/vortex.git@1.2.3 --destination=path/to/destination
106-
107- Install Vortex from a specific commit into the specified directory:
108- php installer --uri=https://github.com/drevops/vortex.git@abcd123 --destination=path/to/destination
95+ <info>Interactively install Vortex from the latest stable release into the current directory:</info>
96+ php installer.php --destination=.
97+
98+ <info>Non-interactively install Vortex from the latest stable release into the specified directory:</info>
99+ php installer.php --no-interaction --destination=path/to/destination
100+
101+ <info>Install from the latest auto-discovered stable release (default behavior if --uri is specified):</info>
102+ php installer.php --uri=https://github.com/drevops/vortex.git
103+ php installer.php --uri=https://github.com/drevops/vortex.git#stable
104+
105+ <info>Install using repository URL with specific git ref after #:</info>
106+ php installer.php --uri=https://github.com/drevops/vortex.git#25.11.0
107+ php installer.php --uri=https://github.com/drevops/vortex.git#v1.2.3
108+ php installer.php --uri=https://github.com/drevops/vortex.git#main
109+
110+ <info>Copy GitHub URL directly from your browser:</info>
111+ php installer.php --uri=https://github.com/drevops/vortex/releases/tag/25.11.0
112+ php installer.php --uri=https://github.com/drevops/vortex/tree/1.2.3
113+ php installer.php --uri=https://github.com/drevops/vortex/tree/main
114+ php installer.php --uri=https://github.com/drevops/vortex/commit/abcd123
109115EOF
110116 );
111117 $ this ->addOption (static ::OPTION_DESTINATION , NULL , InputOption::VALUE_REQUIRED , 'Destination directory. Defaults to the current directory. ' );
@@ -138,6 +144,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int
138144
139145 $ this ->header ();
140146
147+ // Only validate if using custom repository or custom reference.
148+ if ($ this ->shouldValidateRepositoryAndRef ()) {
149+ Task::action (
150+ label: 'Validating repository and reference ' ,
151+ action: function (): string {
152+ $ repo = (string ) $ this ->config ->get (Config::REPO );
153+ $ ref = (string ) $ this ->config ->get (Config::REF );
154+ $ this ->getRepositoryDownloader ()->validate ($ repo , $ ref );
155+ return 'Repository and reference validated successfully ' ;
156+ },
157+ hint: fn (): string => sprintf ('Checking repository "%s" and reference "%s" ' , $ this ->config ->get (Config::REPO ), $ this ->config ->get (Config::REF )),
158+ success: fn (string $ return ): string => $ return
159+ );
160+ Tui::line ('' );
161+ }
162+
163+ Tui::line (Tui::dim ('Press any key to continue... ' ));
164+ Tui::getChar ();
165+
141166 $ this ->promptManager ->runPrompts ();
142167
143168 Tui::list ($ this ->promptManager ->getResponsesSummary (), 'Installation summary ' );
@@ -157,7 +182,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
157182 $ this ->config ->set (Config::VERSION , $ version );
158183 return $ version ;
159184 },
160- hint: fn (): string => sprintf ('Downloading from "%s" repository at commit "%s" ' , ...RepositoryDownloader:: parseUri ( $ this ->config ->get (Config::REPO ))),
185+ hint: fn (): string => sprintf ('Downloading from "%s" repository at ref "%s" ' , $ this ->config ->get (Config::REPO ), $ this -> config -> get (Config:: REF )),
161186 success: fn (string $ return ): string => sprintf ('Vortex downloaded (%s) ' , $ return )
162187 );
163188
@@ -301,7 +326,7 @@ protected function resolveOptions(array $arguments, array $options): void {
301326 Env::putFromDotenv ($ dest_env_file );
302327 }
303328
304- [$ repo , $ ref ] = RepositoryDownloader::parseUri ($ options [static ::OPTION_URI ] ?: ' https://github.com/drevops/vortex.git@ stable ' );
329+ [$ repo , $ ref ] = RepositoryDownloader::parseUri ($ options [static ::OPTION_URI ] ?: RepositoryDownloader:: DEFAULT_REPO . ' # stable ' );
305330 $ this ->config ->set (Config::REPO , $ repo );
306331 $ this ->config ->set (Config::REF , $ ref );
307332
@@ -548,9 +573,6 @@ protected function header(): void {
548573 }
549574
550575 Tui::box ($ content , $ title );
551-
552- Tui::line (Tui::dim ('Press any key to continue... ' ));
553- Tui::getChar ();
554576 }
555577
556578 public function footer (): void {
@@ -715,6 +737,28 @@ public function cleanup(): void {
715737 }
716738 }
717739
740+ /**
741+ * Check if repository and reference validation should be performed.
742+ *
743+ * Validation is skipped for default Vortex repo with stable/HEAD refs.
744+ * Validation is required for custom repositories or custom references.
745+ *
746+ * @return bool
747+ * TRUE if validation should be performed, FALSE otherwise.
748+ */
749+ protected function shouldValidateRepositoryAndRef (): bool {
750+ $ repo = $ this ->config ->get (Config::REPO );
751+ $ ref = $ this ->config ->get (Config::REF );
752+
753+ // Check if using default repository and default ref.
754+ $ default_repo_without_git = RepositoryDownloader::normalizeRepoUrl (RepositoryDownloader::DEFAULT_REPO );
755+ $ is_default_repo = ($ repo === RepositoryDownloader::DEFAULT_REPO || $ repo === $ default_repo_without_git );
756+ $ is_default_ref = ($ ref === RepositoryDownloader::REF_STABLE || $ ref === RepositoryDownloader::REF_HEAD );
757+
758+ // Skip validation only if both are default.
759+ return !($ is_default_repo && $ is_default_ref );
760+ }
761+
718762 /**
719763 * Get the repository downloader.
720764 *
0 commit comments