UNPKG

task-master-neo-sdlc

Version:

Enhanced task management system with Neo SDLC agents and MCP tools for comprehensive, AI-driven software development lifecycle management.

221 lines (187 loc) 6.38 kB
import { KnowledgeGraph } from '../knowledge-graph'; import { AgentWorkflowSystem } from '../agent-workflow'; export class UXDesignerAgent { constructor(knowledgeGraph, workflow) { this.knowledgeGraph = knowledgeGraph; this.workflow = workflow; } async conductUserResearch(type, parameters) { const research = { id: `research_${Date.now()}`, type, data: parameters, insights: [], recommendations: [] }; // Add research to knowledge graph await this.knowledgeGraph.addNode({ id: `research:${research.id}`, type: 'user_research', data: research }); return research; } async createWireframe(name, description) { const wireframe = { id: `wireframe_${Date.now()}`, name, description, components: [], interactions: [] }; // Add wireframe to knowledge graph await this.knowledgeGraph.addNode({ id: `wireframe:${wireframe.id}`, type: 'wireframe', data: wireframe }); return wireframe; } async addComponentToWireframe(wireframeId, component) { const wireframe = await this.knowledgeGraph.findNodes({ type: 'wireframe', id: `wireframe:${wireframeId}` })[0]; if (!wireframe) { throw new Error(`Wireframe ${wireframeId} not found`); } wireframe.data.components.push(component); await this.knowledgeGraph.updateContext({ id: wireframe.id, data: wireframe.data }); } async addInteractionToWireframe(wireframeId, interaction) { const wireframe = await this.knowledgeGraph.findNodes({ type: 'wireframe', id: `wireframe:${wireframeId}` })[0]; if (!wireframe) { throw new Error(`Wireframe ${wireframeId} not found`); } wireframe.data.interactions.push(interaction); await this.knowledgeGraph.updateContext({ id: wireframe.id, data: wireframe.data }); } async validateWireframe(wireframeId) { const wireframe = await this.knowledgeGraph.findNodes({ type: 'wireframe', id: `wireframe:${wireframeId}` })[0]; if (!wireframe) { return { valid: false, errors: ['Wireframe not found'] }; } const errors = []; // Validate components exist if (wireframe.data.components.length === 0) { errors.push('Wireframe must have at least one component'); } // Validate component positions for (const component of wireframe.data.components) { if (!component.position || !component.size) { errors.push(`Component ${component.id} missing position or size`); } } // Validate interactions reference valid components for (const interaction of wireframe.data.interactions) { const sourceExists = wireframe.data.components.some( c => c.id === interaction.sourceId ); const targetExists = wireframe.data.components.some( c => c.id === interaction.targetId ); if (!sourceExists || !targetExists) { errors.push( `Interaction references non-existent component: ${interaction.sourceId} -> ${interaction.targetId}` ); } } return { valid: errors.length === 0, errors }; } /** * Creates a user journey map. * @param {string} name - Name of the journey map. * @param {string} personaId - ID of the associated user persona node. * @param {Array<object>} stages - Stages of the journey (e.g., { name, description, actions, touchpoints, painPoints }). * @returns {Promise<object>} The created journey map node data. */ async createJourneyMap(name, personaId, stages) { console.log(`Creating journey map: ${name} for persona ${personaId}`); const mapId = `journeyMap:${name.toLowerCase().replace(/\s+/g, '-')}_${Date.now()}`; // Validate persona exists (optional, addNode might handle implicitly) const personaNode = await this.knowledgeGraph.findNodes({ id: personaId, type: 'user_persona' }).then(n => n[0]); if (!personaNode) { console.warn(`Persona ${personaId} not found for journey map ${name}. Creating map anyway.`); // Or throw new Error(`Persona ${personaId} not found.`); } const journeyMapData = { id: mapId, name, personaId, stages, createdAt: new Date().toISOString() }; await this.knowledgeGraph.addNode({ id: mapId, type: 'journey_map', data: journeyMapData, edges: personaNode ? [{ target: personaId, relationship: 'describes_journey_of' }] : [] }); console.log(`Journey map ${mapId} created.`); return journeyMapData; } /** * Creates a site map document. * @param {string} name - Name of the site map (e.g., 'Main Website v1'). * @param {object} structure - Hierarchical structure of the site (e.g., nested objects with { name, path, children }). * @returns {Promise<object>} The created site map node data. */ async createSiteMap(name, structure) { console.log(`Creating site map: ${name}`); const mapId = `siteMap:${name.toLowerCase().replace(/\s+/g, '-')}_${Date.now()}`; const siteMapData = { id: mapId, name, structure, version: 1, createdAt: new Date().toISOString() }; await this.knowledgeGraph.addNode({ id: mapId, type: 'site_map', data: siteMapData }); console.log(`Site map ${mapId} created.`); return siteMapData; } /** * Creates an Object-Oriented UX (OOUX) template or model. * @param {string} name - Name of the OOUX model (e.g., 'Product Catalog'). * @param {Array<object>} objects - Core objects (e.g., { name, attributes, relationships }). * @param {Array<object>} ctas - Calls to action associated with objects. * @returns {Promise<object>} The created OOUX model node data. */ async createOOUXTemplate(name, objects, ctas) { console.log(`Creating OOUX template: ${name}`); const templateId = `oouxTemplate:${name.toLowerCase().replace(/\s+/g, '-')}_${Date.now()}`; const oouxData = { id: templateId, name, objects, ctas, createdAt: new Date().toISOString() }; await this.knowledgeGraph.addNode({ id: templateId, type: 'ooux_template', data: oouxData }); console.log(`OOUX template ${templateId} created.`); return oouxData; } }