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
69 lines • 2.79 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CognitiveCanvasBase = void 0;
const neo4j_driver_1 = __importDefault(require("neo4j-driver"));
class CognitiveCanvasBase {
constructor(config, snapshotsDir = './snapshots') {
this.driver = neo4j_driver_1.default.driver(config.uri, neo4j_driver_1.default.auth.basic(config.username, config.password));
this.snapshotsDir = snapshotsDir;
}
async initializeSchema() {
const session = this.driver.session();
try {
const constraints = [
'CREATE CONSTRAINT project_id IF NOT EXISTS FOR (p:Project) REQUIRE p.id IS UNIQUE',
'CREATE CONSTRAINT task_id IF NOT EXISTS FOR (t:Task) REQUIRE t.id IS UNIQUE',
'CREATE CONSTRAINT agent_id IF NOT EXISTS FOR (a:Agent) REQUIRE a.id IS UNIQUE',
'CREATE CONSTRAINT pheromone_id IF NOT EXISTS FOR (ph:Pheromone) REQUIRE ph.id IS UNIQUE',
'CREATE CONSTRAINT contract_id IF NOT EXISTS FOR (c:Contract) REQUIRE c.id IS UNIQUE',
'CREATE CONSTRAINT code_module_id IF NOT EXISTS FOR (cm:CodeModule) REQUIRE cm.id IS UNIQUE',
'CREATE CONSTRAINT test_id IF NOT EXISTS FOR (t:Test) REQUIRE t.id IS UNIQUE'
];
await Promise.all(constraints.map(constraint => session.run(constraint)));
}
finally {
await session.close();
}
}
async executeQuery(query, params = {}, returnKey) {
const session = this.driver.session();
try {
const result = await session.run(query, params);
if (!returnKey)
return result;
if (result.records.length === 0)
return null;
return result.records[0].get(returnKey).properties;
}
finally {
await session.close();
}
}
async close() {
if (this.autoSaveInterval) {
clearInterval(this.autoSaveInterval);
}
await this.driver.close();
}
async startAutoSave(intervalMs = 60000) {
this.autoSaveInterval = setInterval(async () => {
try {
await this.createSnapshot();
}
catch (error) {
console.error('Auto-save failed:', error);
}
}, intervalMs);
}
async stopAutoSave() {
if (this.autoSaveInterval) {
clearInterval(this.autoSaveInterval);
this.autoSaveInterval = undefined;
}
}
}
exports.CognitiveCanvasBase = CognitiveCanvasBase;
//# sourceMappingURL=base.js.map