import Process from "process";
import { Header } from "./header.js";
import { Arguments as CLI } from "./arguments.js";
const Factory = await import("../commands/factory/index.js");
const Main = async () => {
    Process.stdout.write(Header + "\n");
    const Arguments = async () => {
        const Commands = {
            cwd: async (input) => (await import("../commands/environment/cwd.js")).CWD(input),
            input: async (input) => (await import("../commands/test-input.js")).Input(input),
            version: (await import("../commands/version.js")).Version,
            factory: {
                deploy: async (input) => await Factory.Deploy(input),
                build: async (input) => await Factory.Build(input),
                initialize: async (input) => await Factory.Initialize(input),
                configuration: async (input) => await Factory.Configuration(input),
            }
        };
        return await CLI(Process.argv.splice(2))
            .scriptName("factory").wrap(80)
            /*** Version */
            .version(...Commands.version)
            .alias("version", "v")
            .describe("version", "Show Version Number")
            /*** Global Usage Text */
            .usage("Usage: npm run start [...]")
            /*** Global Help Command */
            .help("help")
            .alias("help", "h")
            .describe("help", "Display Additional Information & Usage Command(s)")
            .showHelpOnFail(true, "[Error]: Invalid Input")
            /*** Current Working Directory */
            .command("cwd", "Current Working Directory", (async ($) => {
            return await Commands.cwd($);
        }))
            /*** Test-Input */
            .command("test-input", "Arbitrary User-Input (Testing Purposes Only)", (async ($) => {
            return await Commands.input($);
        }))
            /*** CDFK Configuration */
            .command("cdfk", "(WIP) Construct Development Factory Kit", (async ($) => {
            $.command("initialize", "(WIP) CDFK Package Initialization", (async ($) => {
                return await Commands.factory.initialize($);
            }));
            $.command("build", "(WIP) Synthesize Target Resource(s)", (async ($) => {
                return await Commands.factory.build($);
            }));
            $.command("deploy", "(WIP) CDFK Stack Deployment", (async ($) => {
                return await Commands.factory.deploy($);
            }));
            $.command("configuration", "(WIP) Construct Factory Configuration", (async ($) => {
                return await Commands.factory.configuration($);
            }));
        }))
            .parseAsync();
    };
    const Input = await Arguments();
};
export { Main };
export default Main;
