- Auth: Login/Register con creacion de clinica - Dashboard: KPIs reales, graficas recharts - Pacientes: CRUD completo con busqueda - Agenda: FullCalendar, drag-and-drop, vista recepcion - Expediente: Notas SOAP, signos vitales, CIE-10 - Facturacion: Facturas con IVA, campos CFDI SAT - Inventario: Productos, stock, movimientos, alertas - Configuracion: Clinica, equipo, catalogo servicios - Supabase self-hosted: 18 tablas con RLS multi-tenant - Docker + Nginx para produccion Co-Authored-By: claude-flow <ruv@ruv.net>
84 lines
1.8 KiB
JavaScript
84 lines
1.8 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Claude Flow Memory Helper
|
|
* Simple key-value memory for cross-session context
|
|
*/
|
|
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const MEMORY_DIR = path.join(process.cwd(), '.claude-flow', 'data');
|
|
const MEMORY_FILE = path.join(MEMORY_DIR, 'memory.json');
|
|
|
|
function loadMemory() {
|
|
try {
|
|
if (fs.existsSync(MEMORY_FILE)) {
|
|
return JSON.parse(fs.readFileSync(MEMORY_FILE, 'utf-8'));
|
|
}
|
|
} catch (e) {
|
|
// Ignore
|
|
}
|
|
return {};
|
|
}
|
|
|
|
function saveMemory(memory) {
|
|
fs.mkdirSync(MEMORY_DIR, { recursive: true });
|
|
fs.writeFileSync(MEMORY_FILE, JSON.stringify(memory, null, 2));
|
|
}
|
|
|
|
const commands = {
|
|
get: (key) => {
|
|
const memory = loadMemory();
|
|
const value = key ? memory[key] : memory;
|
|
console.log(JSON.stringify(value, null, 2));
|
|
return value;
|
|
},
|
|
|
|
set: (key, value) => {
|
|
if (!key) {
|
|
console.error('Key required');
|
|
return;
|
|
}
|
|
const memory = loadMemory();
|
|
memory[key] = value;
|
|
memory._updated = new Date().toISOString();
|
|
saveMemory(memory);
|
|
console.log(`Set: ${key}`);
|
|
},
|
|
|
|
delete: (key) => {
|
|
if (!key) {
|
|
console.error('Key required');
|
|
return;
|
|
}
|
|
const memory = loadMemory();
|
|
delete memory[key];
|
|
saveMemory(memory);
|
|
console.log(`Deleted: ${key}`);
|
|
},
|
|
|
|
clear: () => {
|
|
saveMemory({});
|
|
console.log('Memory cleared');
|
|
},
|
|
|
|
keys: () => {
|
|
const memory = loadMemory();
|
|
const keys = Object.keys(memory).filter(k => !k.startsWith('_'));
|
|
console.log(keys.join('\n'));
|
|
return keys;
|
|
},
|
|
};
|
|
|
|
// CLI
|
|
const [,, command, key, ...valueParts] = process.argv;
|
|
const value = valueParts.join(' ');
|
|
|
|
if (command && commands[command]) {
|
|
commands[command](key, value);
|
|
} else {
|
|
console.log('Usage: memory.js <get|set|delete|clear|keys> [key] [value]');
|
|
}
|
|
|
|
module.exports = commands;
|