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

76 lines 3.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CodeOperations = void 0; const base_1 = require("./base"); const validators_1 = require("./validators"); class CodeOperations extends base_1.CognitiveCanvasBase { // Code Module Management async createCodeModule(moduleData) { validators_1.CognitiveCanvasValidators.validateCodeModuleData(moduleData); const result = await this.executeQuery('CREATE (cm:CodeModule {id: $id, name: $name, filePath: $filePath, type: $type, language: $language, projectId: $projectId, createdAt: $createdAt}) RETURN cm', moduleData, 'cm'); if (!result) { throw new Error('Failed to create code module'); } return result; } async getCodeModule(id) { return this.executeQuery('MATCH (cm:CodeModule {id: $id}) RETURN cm', { id }, 'cm'); } async updateCodeModule(id, updates) { const updateData = { ...updates, id, updatedAt: new Date().toISOString() }; const result = await this.executeQuery('MATCH (cm:CodeModule {id: $id}) SET cm += $updates RETURN cm', { id, updates: updateData }, 'cm'); if (!result) { throw new Error(`Code module with id ${id} not found`); } return result; } async getCodeModulesByProject(projectId) { const result = await this.executeQuery('MATCH (cm:CodeModule {projectId: $projectId}) RETURN cm ORDER BY cm.createdAt', { projectId }); if (!result || !result.records) return []; return result.records.map((record) => record.get('cm').properties); } async deleteCodeModule(id) { await this.executeQuery('MATCH (cm:CodeModule {id: $id}) DETACH DELETE cm', { id }); } // Test Management async createTest(testData) { validators_1.CognitiveCanvasValidators.validateTestData(testData); const result = await this.executeQuery('CREATE (t:Test {id: $id, name: $name, filePath: $filePath, type: $type, framework: $framework, projectId: $projectId, createdAt: $createdAt}) RETURN t', testData, 't'); if (!result) { throw new Error('Failed to create test'); } return result; } async getTest(id) { return this.executeQuery('MATCH (t:Test {id: $id}) RETURN t', { id }, 't'); } async updateTest(id, updates) { const updateData = { ...updates, id, updatedAt: new Date().toISOString() }; const result = await this.executeQuery('MATCH (t:Test {id: $id}) SET t += $updates RETURN t', { id, updates: updateData }, 't'); if (!result) { throw new Error(`Test with id ${id} not found`); } return result; } async getTestsByProject(projectId) { const result = await this.executeQuery('MATCH (t:Test {projectId: $projectId}) RETURN t ORDER BY t.createdAt', { projectId }); if (!result || !result.records) return []; return result.records.map((record) => record.get('t').properties); } async deleteTest(id) { await this.executeQuery('MATCH (t:Test {id: $id}) DETACH DELETE t', { id }); } // Code Module to Test relationships async linkCodeModuleToTest(codeModuleId, testId) { await this.executeQuery('MATCH (cm:CodeModule {id: $codeModuleId}), (t:Test {id: $testId}) CREATE (t)-[r:TESTS {linkedAt: $linkedAt}]->(cm) RETURN r', { codeModuleId, testId, linkedAt: new Date().toISOString() }); } // Create snapshot method implementation (required by base class) async createSnapshot() { // This will be implemented in the main class throw new Error('createSnapshot must be implemented in the main CognitiveCanvas class'); } } exports.CodeOperations = CodeOperations; //# sourceMappingURL=code-operations.js.map