Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 6s
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🩺 Health Check (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🧪 QA (push) Has been cancelled
Build & Deploy / 🏗️ Build (push) Has been cancelled
36 lines
1.1 KiB
TypeScript
36 lines
1.1 KiB
TypeScript
import { AiBlogPostOrchestrator } from "@mintel/content-engine";
|
|
import { config } from "../content-engine.config.js";
|
|
|
|
async function main() {
|
|
const OPENROUTER_KEY = process.env.OPENROUTER_KEY || process.env.OPENROUTER_API_KEY;
|
|
const REPLICATE_KEY = process.env.REPLICATE_API_KEY;
|
|
|
|
if (!OPENROUTER_KEY) {
|
|
console.error("❌ Error: OPENROUTER_KEY or OPENROUTER_API_KEY not found in environment.");
|
|
process.exit(1);
|
|
}
|
|
|
|
const args = process.argv.slice(2);
|
|
const targetFile = args.find(arg => !arg.startsWith('--'));
|
|
const shouldRename = args.includes('--rename');
|
|
|
|
if (!targetFile) {
|
|
console.error("❌ Usage: pnpm optimize-blog <file> [--rename]");
|
|
process.exit(1);
|
|
}
|
|
|
|
const orchestrator = new AiBlogPostOrchestrator({
|
|
apiKey: OPENROUTER_KEY,
|
|
replicateApiKey: REPLICATE_KEY,
|
|
model: 'google/gemini-3-flash-preview'
|
|
});
|
|
|
|
await orchestrator.optimizeFile(targetFile, {
|
|
contextDir: config.contextDir,
|
|
availableComponents: config.components,
|
|
shouldRename
|
|
});
|
|
}
|
|
|
|
main().catch(console.error);
|