#1 Persistent memory for AI coding agents based on real-world benchmarks
TypeScript agentmemoryagentsaiclaudeclaudecodecodexcopilotcursorgenaiharnesshermesmemoryompopenclawopencodepi
fix(website/meta): address CodeRabbit review on auto-derived counts
Rohit Ghumare9520a9f5643e
diff --git a/website/components/Features.tsx b/website/components/Features.tsxindex 357705ce..d6245807 100644--- a/website/components/Features.tsx+++ b/website/components/Features.tsx@@ -1,16 +1,12 @@import styles from "./Features.module.css";interface Props {- hooks?: number;- mcpTools?: number;- restEndpoints?: number;+ hooks: number;+ mcpTools: number;+ restEndpoints: number;}-export function Features({- hooks = 12,- mcpTools = 44,- restEndpoints = 49,-}: Props) {+export function Features({ hooks, mcpTools, restEndpoints }: Props) {const FEATURES = [{k: `${hooks}`,diff --git a/website/components/LiveTerminal.tsx b/website/components/LiveTerminal.tsxindex 0ddef1e8..71ea7325 100644--- a/website/components/LiveTerminal.tsx+++ b/website/components/LiveTerminal.tsx@@ -57,11 +57,11 @@ function classFor(type: SegType) {}export function LiveTerminal({- mcpTools = 44,- hooks = 12,+ mcpTools,+ hooks,}: {- mcpTools?: number;- hooks?: number;+ mcpTools: number;+ hooks: number;}) {const termRef = useRef<HTMLElement>(null);const [status, setStatus] = useState("IDLE");diff --git a/website/components/Stats.tsx b/website/components/Stats.tsxindex 69cd3f13..1a326d38 100644--- a/website/components/Stats.tsx+++ b/website/components/Stats.tsx@@ -11,13 +11,13 @@ interface StatItem {}export function Stats({- mcpTools = 44,- hooks = 12,- testsPassing = 777,+ mcpTools,+ hooks,+ testsPassing,}: {- mcpTools?: number;- hooks?: number;- testsPassing?: number;+ mcpTools: number;+ hooks: number;+ testsPassing: number;}) {const rootRef = useRef<HTMLDivElement>(null);@@ -32,6 +32,13 @@ export function Stats({useEffect(() => {if (!rootRef.current) return;+ const root = rootRef.current;++ // Reset per-element done flag so deps changing (e.g. a new meta snapshot+ // at build) replays the count animation against the new target.+ root+ .querySelectorAll<HTMLDivElement>("[data-num]")+ .forEach((el) => delete el.dataset.done);const count = (el: HTMLDivElement) => {const target = Number(el.dataset.target);@@ -71,7 +78,7 @@ export function Stats({{ threshold: 0.5 },);- rootRef.current+ root.querySelectorAll<HTMLDivElement>("[data-stat]").forEach((el) => io.observe(el));diff --git a/website/lib/meta.ts b/website/lib/meta.tsindex 92a27f4e..4ac6c77a 100644--- a/website/lib/meta.ts+++ b/website/lib/meta.ts@@ -1,5 +1,5 @@import "server-only";-import { readFileSync } from "node:fs";+import { readFileSync, readdirSync } from "node:fs";import { join, dirname } from "node:path";import { fileURLToPath } from "node:url";@@ -11,25 +11,75 @@ export interface ProjectMeta {testsPassing: number;}+export const DEFAULT_META: Omit<ProjectMeta, "version"> = {+ mcpTools: 44,+ hooks: 12,+ restEndpoints: 49,+ testsPassing: 777,+};+const here = dirname(fileURLToPath(import.meta.url));const repoRoot = join(here, "..", "..");+function readFileSafe(path: string): string {+ try {+ return readFileSync(path, "utf-8");+ } catch {+ return "";+ }+}+function safeReadJson<T>(path: string): T | null {+ const txt = readFileSafe(path);+ if (!txt) return null;try {- return JSON.parse(readFileSync(path, "utf-8")) as T;+ return JSON.parse(txt) as T;} catch {return null;}}function safeCountMatches(path: string, pattern: RegExp): number {+ const txt = readFileSafe(path);+ if (!txt) return 0;+ const m = txt.match(pattern);+ return m ? m.length : 0;+}++function countHookTypes(typesPath: string): number {+ const txt = readFileSafe(typesPath);+ if (!txt) return 0;+ const union = txt.match(/export type HookType[\s\S]*?;/);+ if (!union) return 0;+ const body = union[0].replace(/export type HookType\s*=/, "").replace(/;$/, "");+ const members = body+ .split("|")+ .map((s) => s.trim())+ .filter((s) => /^["'`]/.test(s));+ return members.length;+}++function countTestCases(testDir: string): number {+ let total = 0;+ let entries: import("node:fs").Dirent[];try {- const txt = readFileSync(path, "utf-8");- const m = txt.match(pattern);- return m ? m.length : 0;+ entries = readdirSync(testDir, { withFileTypes: true });} catch {return 0;}+ for (const entry of entries) {+ const full = join(testDir, entry.name);+ if (entry.isDirectory()) {+ total += countTestCases(full);+ continue;+ }+ if (!/\.test\.[jt]sx?$/.test(entry.name)) continue;+ const txt = readFileSafe(full);+ if (!txt) continue;+ const m = txt.match(/(?:^|\s)(?:it|test)(?:\.\w+)?\s*\(/g);+ if (m) total += m.length;+ }+ return total;}export function getProjectMeta(): ProjectMeta {@@ -37,39 +87,31 @@ export function getProjectMeta(): ProjectMeta {join(repoRoot, "package.json"),);- // REST endpoints: count api_path declarations in src/triggers/api.ts+ // REST endpoints: registerTrigger entries in src/triggers/api.ts with an+ // api_path config. The tight regex matches the exact declaration shape the+ // codebase uses; loose forms (comments, example strings) are not counted.const restEndpoints = safeCountMatches(join(repoRoot, "src", "triggers", "api.ts"),- /api_path:/g,+ /config:\s*\{\s*api_path:\s*"/g,);- // MCP tools: count name: entries in tools-registry- const mcpTools =- safeCountMatches(- join(repoRoot, "src", "mcp", "tools-registry.ts"),- /name:\s*"memory_/g,- ) || 44;-- // Hooks: count HookType union members- const hookUnionFile = readFileSafe(join(repoRoot, "src", "types.ts"));- const hookUnion = hookUnionFile.match(- /export type HookType[\s\S]*?;(?=\s*\n)/,+ // MCP tools: count memory_* entries in the tools registry.+ const mcpTools = safeCountMatches(+ join(repoRoot, "src", "mcp", "tools-registry.ts"),+ /name:\s*"memory_/g,);- const hooks = hookUnion ? (hookUnion[0].match(/"/g)?.length ?? 0) / 2 : 12;++ // Hooks: count actual members of the HookType union, not quote characters.+ const hooks = countHookTypes(join(repoRoot, "src", "types.ts"));++ // Tests: walk the test/ tree, count it()/test() call sites.+ const testsPassing = countTestCases(join(repoRoot, "test"));return {version: pkg?.version ?? "0.0.0",- mcpTools: mcpTools || 44,- hooks: hooks || 12,- restEndpoints: restEndpoints || 49,- testsPassing: 777,+ mcpTools: mcpTools || DEFAULT_META.mcpTools,+ hooks: hooks || DEFAULT_META.hooks,+ restEndpoints: restEndpoints || DEFAULT_META.restEndpoints,+ testsPassing: testsPassing || DEFAULT_META.testsPassing,};}--function readFileSafe(path: string): string {- try {- return readFileSync(path, "utf-8");- } catch {- return "";- }-}