scai
Version:
> AI-powered CLI tools for smart commit messages, auto generated comments, and readme files — all powered by local models.
24 lines (23 loc) • 859 B
JavaScript
export async function runPromptPipeline(modules, input) {
let current = input;
// Add flag or condition for logging (optional)
const isDebug = true;
if (isDebug) {
console.log('Input: ', input);
}
for (const mod of modules) {
try {
current = await mod.run(current);
if (isDebug) {
console.log(`⚙️ Running: ${mod.name}`);
console.log("Current: ", current);
}
}
catch (error) {
console.error(`❌ Error in ${mod.name}:`, error instanceof Error ? error.message : error);
throw new Error(`Pipeline failed at module ${mod.name}`);
}
}
// Return the output, assuming 'code' holds the relevant transformed content
return { code: current.code }; // Ensure the return type matches PromptOutput
}