#!/usr/bin/env php
<?php

use HydraForge\VulcanCli\Commands\NewProject;
use Symfony\Component\Console\Application;

// Dynamically locate the autoload file
$autoloadPaths = [
    __DIR__ . '/../vendor/autoload.php',       // Path when running locally
    __DIR__ . '/../../../autoload.php',       // Path when installed as a global Composer package
];

$autoloadFound = false;
foreach ($autoloadPaths as $autoloadPath) {
    if (file_exists($autoloadPath)) {
        require $autoloadPath;
        $autoloadFound = true;
        break;
    }
}

if (!$autoloadFound) {
    fwrite(STDERR, "Error: Could not find autoload.php. Please ensure dependencies are installed.\n");
    exit(1);
}

$app = new Application();
$app->addCommands([
    (new NewProject()),
]);
$app->run();
