← back to The Ai Factory
scripts/run.js
24 lines
#!/usr/bin/env node
// CLI entry: node scripts/run.js "build me a foo"
const prompt = process.argv.slice(2).join(' ').trim();
if (!prompt) {
console.error('Usage: node scripts/run.js "<prompt>"');
process.exit(1);
}
const ORCH = `http://127.0.0.1:${process.env.ORCHESTRATOR_PORT || 9890}`;
(async () => {
const res = await fetch(`${ORCH}/runs`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ prompt })
});
const data = await res.json();
console.log(JSON.stringify(data, null, 2));
})().catch(err => {
console.error('Orchestrator unreachable:', err.message);
process.exit(2);
});