feat: migrate npm registry from Verdaccio to Gitea Packages
Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 1s
Monorepo Pipeline / 🧹 Lint (push) Failing after 35s
Monorepo Pipeline / 🧪 Test (push) Failing after 35s
Monorepo Pipeline / 🏗️ Build (push) Failing after 12s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Image Processor (push) Has been skipped
Monorepo Pipeline / 🐳 Build Directus (Base) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
Some checks failed
Monorepo Pipeline / ⚡ Prioritize Release (push) Successful in 1s
Monorepo Pipeline / 🧹 Lint (push) Failing after 35s
Monorepo Pipeline / 🧪 Test (push) Failing after 35s
Monorepo Pipeline / 🏗️ Build (push) Failing after 12s
Monorepo Pipeline / 🚀 Release (push) Has been skipped
Monorepo Pipeline / 🐳 Build Image Processor (push) Has been skipped
Monorepo Pipeline / 🐳 Build Directus (Base) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Gatekeeper (Product) (push) Has been skipped
Monorepo Pipeline / 🐳 Build Build-Base (push) Has been skipped
Monorepo Pipeline / 🐳 Build Production Runtime (push) Has been skipped
This commit is contained in:
78
packages/estimation-engine/src/cli.ts
Normal file
78
packages/estimation-engine/src/cli.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env node
|
||||
// ============================================================================
|
||||
// @mintel/estimation-engine — CLI Entry Point
|
||||
// ============================================================================
|
||||
|
||||
import { Command } from "commander";
|
||||
import * as path from "node:path";
|
||||
import * as fs from "node:fs/promises";
|
||||
import { existsSync } from "node:fs";
|
||||
import { config as dotenvConfig } from "dotenv";
|
||||
import { EstimationPipeline } from "./pipeline.js";
|
||||
import type { ProjectConcept } from "@mintel/concept-engine";
|
||||
|
||||
// Load .env from monorepo root
|
||||
dotenvConfig({ path: path.resolve(process.cwd(), "../../.env") });
|
||||
dotenvConfig({ path: path.resolve(process.cwd(), ".env") });
|
||||
|
||||
const program = new Command();
|
||||
|
||||
program
|
||||
.name("estimate")
|
||||
.description("AI-powered project estimation engine")
|
||||
.version("1.0.0");
|
||||
|
||||
program
|
||||
.command("run")
|
||||
.description("Run the financial estimation pipeline from a concept file")
|
||||
.argument("<concept-file>", "Path to the ProjectConcept JSON file")
|
||||
.option("--budget <budget>", "Budget constraint (e.g. '15.000 €')")
|
||||
.option("--output <dir>", "Output directory", "../../out/estimations")
|
||||
.action(async (conceptFile: string, options: any) => {
|
||||
const openrouterKey = process.env.OPENROUTER_API_KEY || process.env.OPENROUTER_KEY;
|
||||
if (!openrouterKey) {
|
||||
console.error("❌ OPENROUTER_API_KEY not found in environment.");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const filePath = path.resolve(process.cwd(), conceptFile);
|
||||
if (!existsSync(filePath)) {
|
||||
console.error(`❌ Concept file not found: ${filePath}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`📄 Loading concept from: ${filePath}`);
|
||||
const rawConcept = await fs.readFile(filePath, "utf8");
|
||||
const concept = JSON.parse(rawConcept) as ProjectConcept;
|
||||
|
||||
const pipeline = new EstimationPipeline(
|
||||
{
|
||||
openrouterKey,
|
||||
outputDir: path.resolve(process.cwd(), options.output),
|
||||
crawlDir: "" // No longer needed here
|
||||
},
|
||||
{
|
||||
onStepStart: (id, name) => { },
|
||||
onStepComplete: (id, result) => { },
|
||||
},
|
||||
);
|
||||
|
||||
try {
|
||||
const result = await pipeline.run({
|
||||
concept,
|
||||
budget: options.budget,
|
||||
});
|
||||
|
||||
console.log("\n✨ Estimation complete!");
|
||||
|
||||
if (result.validationResult && !result.validationResult.passed) {
|
||||
console.log(`\n⚠️ ${result.validationResult.errors.length} validation issues found.`);
|
||||
console.log(" Review the output JSON and re-run problematic steps.");
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`\n❌ Pipeline failed: ${(err as Error).message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
program.parse();
|
||||
Reference in New Issue
Block a user