UNPKG

@benyue1978/soloflow-mcp

Version:

A Model Context Protocol (MCP) server for project document management with 32 comprehensive prompts covering the complete software development lifecycle

34 lines 1.22 kB
import { validateProjectRoot, validateDocType, getDocumentPath, ensureSoloflowDirectory } from '../context.js'; /** * Update document content by type */ export async function updateHandler(args) { const { projectRoot, type, content } = args; // Validate project root const rootValidation = validateProjectRoot(projectRoot); if (!rootValidation.isValid) { throw new Error(rootValidation.error); } // Validate document type const typeValidation = validateDocType(type); if (!typeValidation.isValid) { throw new Error(typeValidation.error); } // Validate content is not empty if (!content || content.trim().length === 0) { throw new Error('Document content cannot be empty'); } try { // Ensure .soloflow directory exists await ensureSoloflowDirectory(projectRoot); const documentPath = getDocumentPath(projectRoot, type); const fs = await import('fs/promises'); // Write content to file await fs.writeFile(documentPath, content, 'utf-8'); return { ok: true }; } catch (error) { throw new Error(`Error updating document: ${error}`); } } //# sourceMappingURL=update.js.map