kist
Version:
Package Pipeline Processor
59 lines (58 loc) • 2.78 kB
JavaScript
;
// ============================================================================
// Imports
// ============================================================================
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const ArgumentParser_1 = require("./cli/ArgumentParser");
const ConfigLoader_1 = require("./core/config/ConfigLoader");
const ConfigStore_1 = require("./core/config/ConfigStore");
const kist_1 = require("./kist");
// ============================================================================
// Main Entry Point
// ============================================================================
/**
* The entry point for the Kist CLI application. Sets up the runtime
* environment, loads configuration, and invokes the Kist class.
*/
(() => __awaiter(void 0, void 0, void 0, function* () {
try {
// console.log("Raw arguments:", process.argv);
// Initialize CLI argument parser
const parser = new ArgumentParser_1.ArgumentParser();
const cliOptions = parser.getAllFlags();
// console.log(cliOptions)
// Initialize ConfigStore
const configStore = ConfigStore_1.ConfigStore.getInstance();
// Initialize ConfigStore and load configuration
const configLoader = new ConfigLoader_1.ConfigLoader();
yield configLoader.initialize();
const fileConfig = yield configLoader.loadConfig();
// Merge Configs
// configStore.print()
configStore.merge(fileConfig); // Merge file-based config
// configStore.print()
configStore.merge({ options: cliOptions }); // Merge CLI options
// configStore.print()
// Create a Kist instance and execute the workflow
const kist = new kist_1.Kist();
yield kist.run();
}
catch (error) {
console.error(`[CLI] An unexpected error occurred:`, error);
process.exit(1);
}
}))();
/**
* Note: The `#!/usr/bin/env node` shebang ensures that the script can be executed
* directly as a Node.js script on compatible systems.
*/