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
66 lines • 3.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContractOperations = void 0;
const base_1 = require("./base");
const validators_1 = require("./validators");
class ContractOperations extends base_1.CognitiveCanvasBase {
async createContract(contractData) {
validators_1.CognitiveCanvasValidators.validateContractData(contractData);
const result = await this.executeQuery('CREATE (c:Contract {id: $id, name: $name, type: $type, version: $version, specification: $specification, description: $description, projectId: $projectId, createdAt: $createdAt}) RETURN c', contractData, 'c');
if (!result) {
throw new Error('Failed to create contract');
}
return result;
}
async getContract(id) {
return this.executeQuery('MATCH (c:Contract {id: $id}) RETURN c', { id }, 'c');
}
async updateContract(id, updates) {
const updateData = { ...updates, id, updatedAt: new Date().toISOString() };
const result = await this.executeQuery('MATCH (c:Contract {id: $id}) SET c += $updates RETURN c', { id, updates: updateData }, 'c');
if (!result) {
throw new Error(`Contract with id ${id} not found`);
}
return result;
}
async getContractsByProject(projectId) {
const result = await this.executeQuery('MATCH (c:Contract {projectId: $projectId}) RETURN c ORDER BY c.createdAt', { projectId });
if (!result || !result.records)
return [];
return result.records.map((record) => record.get('c').properties);
}
async deleteContract(id) {
await this.executeQuery('MATCH (c:Contract {id: $id}) DETACH DELETE c', { id });
}
async listContracts() {
const result = await this.executeQuery('MATCH (c:Contract) RETURN c ORDER BY c.createdAt DESC');
if (!result || !result.records)
return [];
return result.records.map((record) => record.get('c').properties);
}
// Architectural Decisions
async storeArchitecturalDecision(decisionData) {
validators_1.CognitiveCanvasValidators.validateArchitecturalDecisionData(decisionData);
const result = await this.executeQuery('CREATE (ad:ArchitecturalDecision {id: $id, title: $title, description: $description, rationale: $rationale, status: $status, projectId: $projectId, createdAt: $createdAt}) RETURN ad', decisionData, 'ad');
if (!result) {
throw new Error('Failed to store architectural decision');
}
return result;
}
async getArchitecturalDecision(id) {
return this.executeQuery('MATCH (ad:ArchitecturalDecision {id: $id}) RETURN ad', { id }, 'ad');
}
async getArchitecturalDecisionsByProject(projectId) {
const result = await this.executeQuery('MATCH (ad:ArchitecturalDecision {projectId: $projectId}) RETURN ad ORDER BY ad.createdAt', { projectId });
if (!result || !result.records)
return [];
return result.records.map((record) => record.get('ad').properties);
}
// 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.ContractOperations = ContractOperations;
//# sourceMappingURL=contract-operations.js.map