UNPKG

cortexweaver

Version:

CortexWeaver is a command-line interface (CLI) tool that orchestrates a swarm of specialized AI agents, powered by Claude Code and Gemini CLI, to assist in software development. It transforms a high-level project plan (plan.md) into a series of coordinate

125 lines 4.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GeneralAgentIntegration = void 0; /** * General Agent Integration Operations * Handles common operations shared across multiple agents */ class GeneralAgentIntegration { constructor(driver) { this.driver = driver; } /** * Get project context (for various agents) */ async getProjectContext(projectId) { const session = this.driver.session(); try { const result = await session.run(` MATCH (p:Project {id: $projectId}) OPTIONAL MATCH (p)-[:CONTAINS]->(t:Task) OPTIONAL MATCH (p)-[:HAS_ARCHITECTURE]->(ad:ArchitecturalDecision) OPTIONAL MATCH (p)-[:HAS_CONTRACT]->(c:Contract) RETURN p, collect(DISTINCT t) as tasks, collect(DISTINCT ad) as architecturalDecisions, collect(DISTINCT c) as contracts `, { projectId }); if (result.records.length === 0) { return null; } const record = result.records[0]; return { project: record.get('p').properties, tasks: record.get('tasks').map((t) => t.properties), architecturalDecisions: record.get('architecturalDecisions').map((ad) => ad.properties), contracts: record.get('contracts').map((c) => c.properties) }; } finally { await session.close(); } } /** * Create knowledge entry (for general knowledge management) */ async createKnowledgeEntry(projectId, entryData) { const id = `knowledge-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`; const session = this.driver.session(); try { await session.run('CREATE (k:KnowledgeEntry {id: $id, type: $type, data: $data, projectId: $projectId, createdAt: $createdAt})', { id, type: entryData.type, data: JSON.stringify(entryData.data || {}), projectId, createdAt: entryData.timestamp.toISOString() }); } finally { await session.close(); } } /** * Get knowledge entries by type */ async getKnowledgeEntriesByType(projectId, type) { const session = this.driver.session(); try { const result = await session.run('MATCH (k:KnowledgeEntry {projectId: $projectId, type: $type}) RETURN k ORDER BY k.createdAt', { projectId, type }); return result.records.map((record) => { const props = record.get('k').properties; return { ...props, data: JSON.parse(props.data || '{}') }; }); } finally { await session.close(); } } /** * Get knowledge entries by query with filtering */ async getKnowledgeEntriesByQuery(projectId, query) { let cypher = 'MATCH (k:KnowledgeEntry {projectId: $projectId'; const params = { projectId }; if (query.type) { cypher += ', type: $type'; params.type = query.type; } cypher += '}) RETURN k ORDER BY k.createdAt'; const session = this.driver.session(); try { const result = await session.run(cypher, params); let entries = result.records.map((record) => { const props = record.get('k').properties; return { ...props, data: JSON.parse(props.data || '{}') }; }); // Apply additional filtering if provided if (query.filter) { entries = entries.filter((entry) => { return Object.entries(query.filter).every(([key, value]) => { const keyPath = key.split('.'); let current = entry; for (const segment of keyPath) { current = current[segment]; if (current === undefined) return false; } return Array.isArray(current) ? current.includes(value) : current === value; }); }); } return entries; } finally { await session.close(); } } } exports.GeneralAgentIntegration = GeneralAgentIntegration; //# sourceMappingURL=agent-integration-general.js.map