@stackmemoryai/stackmemory
Version:
Project-scoped memory for AI coding tools. Durable context across sessions with MCP integration, frames, smart retrieval, Claude Code skills, and automatic hooks.
43 lines (42 loc) • 1.52 kB
JavaScript
import { fileURLToPath as __fileURLToPath } from 'url';
import { dirname as __pathDirname } from 'path';
const __filename = __fileURLToPath(import.meta.url);
const __dirname = __pathDirname(__filename);
import { createClient } from "redis";
import dotenv from "dotenv";
function getEnv(key, defaultValue) {
const value = process.env[key];
if (value === void 0) {
if (defaultValue !== void 0) return defaultValue;
throw new Error(`Environment variable ${key} is required`);
}
return value;
}
function getOptionalEnv(key) {
return process.env[key];
}
dotenv.config();
async function checkRedis() {
const client = createClient({ url: process.env["REDIS_URL"] });
await client.connect();
const keys = await client.keys("trace:*");
console.log("Redis trace keys:", keys.length);
if (keys.length > 0) {
console.log("Sample keys:", keys.slice(0, 3));
const sample = await client.hGetAll(keys[0]);
console.log("Sample trace fields:", Object.keys(sample));
console.log("Sample trace data size:", sample.data?.length || 0, "bytes");
console.log(
"Sample trace compressed:",
sample.compressed === "true" ? "yes" : "no"
);
}
const scoreIndex = await client.zCard("traces:by_score");
const timeIndex = await client.zCard("traces:by_time");
console.log("Score index entries:", scoreIndex);
console.log("Time index entries:", timeIndex);
await client.quit();
}
checkRedis().catch(console.error);
//# sourceMappingURL=check-redis.js.map