Files
codebase-memory-mcp/graph-ui/src/components/ProjectCard.tsx
T
Martin Vogel 18fa9979ee Replace vmem with mimalloc global allocator, add extraction-phase prescan, fix __init__.py QN collision
Memory management:
- Vendor mimalloc v2.1.9 as global allocator (MI_OVERRIDE=1 in prod)
- New mem.h/mem.c: RSS-based budget tracking via mi_process_info()
- Remove vmem.c/vmem.h (mmap-based budget tracking)
- Remove slab tier2 bump allocator (~300 LOC); >64B goes to mimalloc
- Slab tier1 pages from malloc (= mimalloc) instead of vmem
- Arena blocks from malloc instead of vmem
- Budget raised from 35% to 50% RAM (no more untracked C++ heap)

Extraction-phase prescan (eliminates disk re-reads):
- HTTP call sites: keyword check + URL extraction during extraction
- HTTP routes: decorator + source-based extraction during extraction
- Config file refs: regex scan during extraction
- httplinks: 41.8s → 13ms on Linux kernel (3,212x faster)
- configlink: 41.4s → 0.8s on Linux kernel (54x faster)
- Linux kernel fast-mode total: 2m38s → 1m18s

Bug fixes:
- __init__.py Module QN no longer collides with Folder QN
- index.ts same fix for JS/TS packages
- 13 regression tests for QN collision at FQN + extraction layers
- search_graph/search_code default limit raised from 10 to 500k
- Resolve all clang-tidy, cppcheck, and clang-format warnings

Repo cleanup:
- tree-sitter-form, tree-sitter-magma moved to tools/
- .gitignore: build/, node_modules/, graph-ui/dist/, TEST_PLAN.md
2026-03-17 22:05:57 +01:00

71 lines
2.4 KiB
TypeScript

import type { Project, SchemaInfo } from "../lib/types";
import { colorForLabel } from "../lib/colors";
interface ProjectCardProps {
project: Project;
schema: SchemaInfo | null;
onSelect: (project: string) => void;
}
function formatNumber(n: number): string {
return n.toLocaleString();
}
export function ProjectCard({ project, schema, onSelect }: ProjectCardProps) {
const totalNodes = schema?.node_labels?.reduce((s, l) => s + l.count, 0) ?? 0;
const totalEdges = schema?.edge_types?.reduce((s, t) => s + t.count, 0) ?? 0;
return (
<div className="border border-white/10 rounded-lg p-4 hover:border-white/20 transition-colors">
<div className="flex items-start justify-between mb-3">
<div>
<h3 className="text-white font-medium">{project.name}</h3>
<p className="text-white/40 text-xs font-mono mt-0.5 truncate max-w-[300px]">
{project.root_path}
</p>
</div>
<button
onClick={() => onSelect(project.name)}
className="px-3 py-1 bg-cyan-500/20 hover:bg-cyan-500/30 text-cyan-300 rounded text-xs font-medium transition-colors"
>
View Graph
</button>
</div>
{schema && (
<>
<div className="flex gap-4 text-xs text-white/60 mb-3">
<span>{formatNumber(totalNodes)} nodes</span>
<span>{formatNumber(totalEdges)} edges</span>
</div>
{schema.node_labels && schema.node_labels.length > 0 && (
<div className="flex flex-wrap gap-1.5">
{schema.node_labels.map((l) => (
<span
key={l.label}
className="inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs"
style={{ backgroundColor: colorForLabel(l.label) + "20" }}
>
<span
className="w-1.5 h-1.5 rounded-full"
style={{ backgroundColor: colorForLabel(l.label) }}
/>
<span style={{ color: colorForLabel(l.label) }}>
{l.label}
</span>
<span className="text-white/40">{formatNumber(l.count)}</span>
</span>
))}
</div>
)}
</>
)}
{!schema && (
<p className="text-white/30 text-xs italic">Loading schema...</p>
)}
</div>
);
}