@autobe/compiler
Version:
AI backend server code generator
82 lines • 4.6 kB
JavaScript
;
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 });
exports.AutoBeCompiler = void 0;
const AutoBeTypeScriptCompiler_1 = require("./AutoBeTypeScriptCompiler");
const AutoBeInterfaceCompiler_1 = require("./interface/AutoBeInterfaceCompiler");
const AutoBePrismaCompiler_1 = require("./prisma/AutoBePrismaCompiler");
const AutoBeCompilerCommonTemplate_1 = require("./raw/AutoBeCompilerCommonTemplate");
const AutoBeCompilerInterfaceTemplate_1 = require("./raw/AutoBeCompilerInterfaceTemplate");
const AutoBeCompilerRealizeTemplate_1 = require("./raw/AutoBeCompilerRealizeTemplate");
const AutoBeCompilerRealizeTemplateOfPostgres_1 = require("./raw/AutoBeCompilerRealizeTemplateOfPostgres");
const AutoBeCompilerRealizeTemplateOfSQLite_1 = require("./raw/AutoBeCompilerRealizeTemplateOfSQLite");
const AutoBeCompilerTestTemplate_1 = require("./raw/AutoBeCompilerTestTemplate");
const AutoBeRealizeCompiler_1 = require("./realize/AutoBeRealizeCompiler");
const AutoBeTestCompiler_1 = require("./test/AutoBeTestCompiler");
/**
* Comprehensive compilation infrastructure for the vibe coding pipeline.
*
* This class provides the three-tier compiler system that transforms AST
* structures into production-ready code across all development phases. The
* AutoBeCompiler integrates the custom Prisma compiler, Interface compiler, and
* official TypeScript compiler into a unified compilation infrastructure.
*
* The compilation system ensures 100% syntactic correctness and semantic
* integrity throughout the automated development workflow by operating on
* validated AST data and providing continuous validation feedback loops. This
* enables the revolutionary "structure first, validate continuously, generate
* deterministically" approach that guarantees generated applications work
* correctly on the first attempt.
*
* For high-performance scenarios with multiple concurrent users, individual
* compiler components can be separated into dedicated worker processes to
* prevent blocking during computationally intensive compilation operations
* while maintaining the same interface compatibility.
*
* @author Samchon
*/
class AutoBeCompiler {
constructor(listener) {
this.listener = listener;
this.prisma = new AutoBePrismaCompiler_1.AutoBePrismaCompiler();
this.interface = new AutoBeInterfaceCompiler_1.AutoBeInterfaceCompiler();
this.typescript = new AutoBeTypeScriptCompiler_1.AutoBeTypeScriptCompiler();
this.test = new AutoBeTestCompiler_1.AutoBeTestCompiler();
this.realize = new AutoBeRealizeCompiler_1.AutoBeRealizeCompiler(this.listener.realize);
}
getTemplate(options) {
return __awaiter(this, void 0, void 0, function* () {
const result = Object.assign({}, AutoBeCompilerCommonTemplate_1.AutoBeCompilerCommonTemplate);
const index = PHASES.indexOf(options.phase);
if (index >= OF_INTERFACE)
Object.assign(result, AutoBeCompilerInterfaceTemplate_1.AutoBeCompilerInterfaceTemplate);
if (index >= OF_TEST)
Object.assign(result, AutoBeCompilerTestTemplate_1.AutoBeCompilerTestTemplate);
if (index >= OF_REALIZE)
Object.assign(result, AutoBeCompilerRealizeTemplate_1.AutoBeCompilerRealizeTemplate, options.dbms === "postgres"
? AutoBeCompilerRealizeTemplateOfPostgres_1.AutoBeCompilerRealizeTemplateOfPostgres
: AutoBeCompilerRealizeTemplateOfSQLite_1.AutoBeCompilerRealizeTemplateOfSQLite);
return result;
});
}
}
exports.AutoBeCompiler = AutoBeCompiler;
const PHASES = [
"analyze",
"prisma",
"interface",
"test",
"realize",
];
const OF_INTERFACE = PHASES.indexOf("interface");
const OF_TEST = PHASES.indexOf("test");
const OF_REALIZE = PHASES.indexOf("realize");
//# sourceMappingURL=AutoBeCompiler.js.map