UNPKG

scai

Version:

> AI-powered CLI tool for commit messages **and** pull request reviews — using local models.

25 lines (24 loc) 853 B
import chalk from 'chalk'; export async function runModulePipeline(modules, input) { let current = input; const isDebug = false; for (const mod of modules) { try { const response = await mod.run(current); console.log(`⚙️ Running: ${mod.name}`); if (isDebug) { console.log(chalk.yellow('➡️ Output:', response.content)); } // Safeguard if originalContent is overwritten by module current = { ...response, originalContent: current.originalContent }; } catch (error) { console.error(`❌ Error in ${mod.name}:`, error instanceof Error ? error.message : error); throw new Error(`Pipeline failed at module ${mod.name}`); } } return current; }