ai-expert-workflow-mcp
Version:
Enhanced AI Expert Workflow MCP Server with structured conversation flow, topic tracking, and optional Task Master integration
34 lines (33 loc) • 1.42 kB
JavaScript
;
// Workflow state management for AI Expert Workflow
Object.defineProperty(exports, "__esModule", { value: true });
exports.initialState = void 0;
exports.calculateProgress = calculateProgress;
const experts_1 = require("../experts");
// Initialize with default state
exports.initialState = {
currentStage: experts_1.EXPERT_WORKFLOW_STAGES.PRODUCT_DEFINITION,
completedStages: [],
stageData: {
[experts_1.EXPERT_WORKFLOW_STAGES.PRODUCT_DEFINITION]: {
completed: false,
completedTopics: [],
}
}
};
// Calculate overall progress percentage
function calculateProgress(state) {
const totalStages = Object.keys(experts_1.EXPERT_WORKFLOW_STAGES).length;
const completedStages = state.completedStages.length;
// If current stage is in progress, calculate its progress
let currentStageProgress = 0;
if (state.stageData[state.currentStage]) {
const stageData = state.stageData[state.currentStage];
const requiredTopics = experts_1.STAGE_COMPLETION_CRITERIA[state.currentStage];
if (requiredTopics && requiredTopics.length > 0) {
currentStageProgress = stageData.completedTopics.length / requiredTopics.length;
}
}
// Overall progress: completed stages + progress of current stage
return Math.min(100, Math.round(((completedStages + currentStageProgress) / totalStages) * 100));
}