scai
Version:
> AI-powered CLI tool for commit messages **and** pull request reviews — using local models.
25 lines (24 loc) • 892 B
JavaScript
export async function runModulePipeline(modules, input) {
let current = input;
// Add flag or condition for logging (optional)
const isDebug = false;
if (isDebug) {
console.log('Input: ', input);
}
let response = { content: '' };
for (const mod of modules) {
try {
response = await mod.run(current);
if (isDebug) {
console.log(`⚙️ Running: ${mod.name}`);
console.log("Current: ", response.content);
}
}
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 response; // Ensure the return type matches PromptOutput
}