UNPKG

context-forge

Version:

AI orchestration platform with autonomous teams, enhancement planning, migration tools, 25+ slash commands, checkpoints & hooks. Multi-IDE: Claude, Cursor, Windsurf, Cline, Copilot

54 lines 2.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProgressStepTracker = void 0; exports.executeWithProgress = executeWithProgress; const progressTracker_1 = require("../services/progressTracker"); async function executeWithProgress(fn, options) { const progressTracker = new progressTracker_1.ProgressTracker(); let operationId; try { // Start progress tracking operationId = await progressTracker.startOperation(options.command, options.operation, options.metadata); // Execute the function const result = await fn(progressTracker, operationId); // Mark as completed await progressTracker.completeOperation(operationId, 'completed'); return result; } catch (error) { // Mark as failed if (operationId) { await progressTracker.completeOperation(operationId, 'failed', { errors: [error.message], }); } // Call custom error handler if provided if (options.onError && operationId) { await options.onError(error, operationId); } throw error; } } class ProgressStepTracker { constructor(progressTracker, operationId) { this.progressTracker = progressTracker; this.operationId = operationId; } async startStep(name, description) { if (this.currentStepId) { await this.completeCurrentStep(); } this.currentStepId = await this.progressTracker.addStep(this.operationId, name, description); } async completeCurrentStep(status = 'completed', metadata) { if (this.currentStepId) { await this.progressTracker.completeStep(this.operationId, this.currentStepId, status, metadata); this.currentStepId = undefined; } } async failCurrentStep(metadata) { await this.completeCurrentStep('failed', metadata); } } exports.ProgressStepTracker = ProgressStepTracker; //# sourceMappingURL=progressUtils.js.map