chore: add graphify knowledge graph outputs
Add generated knowledge graph (538 nodes, 664 edges) for codebase navigation. Outputs are committed for portability across devices; cache and cost tracking are gitignored. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
620c6598cf
commit
646fcd558a
6 files changed
+13675
No files matched your search
@@ -0,0 +1,242 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>graphify - graphify-out/graph.html</title>
|
||||
<script src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>
|
||||
<style>
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body { background: #0f0f1a; color: #e0e0e0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: flex; height: 100vh; overflow: hidden; }
|
||||
#graph { flex: 1; }
|
||||
#sidebar { width: 280px; background: #1a1a2e; border-left: 1px solid #2a2a4e; display: flex; flex-direction: column; overflow: hidden; }
|
||||
#search-wrap { padding: 12px; border-bottom: 1px solid #2a2a4e; }
|
||||
#search { width: 100%; background: #0f0f1a; border: 1px solid #3a3a5e; color: #e0e0e0; padding: 7px 10px; border-radius: 6px; font-size: 13px; outline: none; }
|
||||
#search:focus { border-color: #4E79A7; }
|
||||
#search-results { max-height: 140px; overflow-y: auto; padding: 4px 12px; border-bottom: 1px solid #2a2a4e; display: none; }
|
||||
.search-item { padding: 4px 6px; cursor: pointer; border-radius: 4px; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
.search-item:hover { background: #2a2a4e; }
|
||||
#info-panel { padding: 14px; border-bottom: 1px solid #2a2a4e; min-height: 140px; }
|
||||
#info-panel h3 { font-size: 13px; color: #aaa; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
|
||||
#info-content { font-size: 13px; color: #ccc; line-height: 1.6; }
|
||||
#info-content .field { margin-bottom: 5px; }
|
||||
#info-content .field b { color: #e0e0e0; }
|
||||
#info-content .empty { color: #555; font-style: italic; }
|
||||
.neighbor-link { display: block; padding: 2px 6px; margin: 2px 0; border-radius: 3px; cursor: pointer; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid #333; }
|
||||
.neighbor-link:hover { background: #2a2a4e; }
|
||||
#neighbors-list { max-height: 160px; overflow-y: auto; margin-top: 4px; }
|
||||
#legend-wrap { flex: 1; overflow-y: auto; padding: 12px; }
|
||||
#legend-wrap h3 { font-size: 13px; color: #aaa; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
|
||||
.legend-item { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; border-radius: 4px; font-size: 12px; }
|
||||
.legend-item:hover { background: #2a2a4e; padding-left: 4px; }
|
||||
.legend-item.dimmed { opacity: 0.35; }
|
||||
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
|
||||
.legend-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.legend-count { color: #666; font-size: 11px; }
|
||||
#stats { padding: 10px 14px; border-top: 1px solid #2a2a4e; font-size: 11px; color: #555; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="graph"></div>
|
||||
<div id="sidebar">
|
||||
<div id="search-wrap">
|
||||
<input id="search" type="text" placeholder="Search nodes..." autocomplete="off">
|
||||
<div id="search-results"></div>
|
||||
</div>
|
||||
<div id="info-panel">
|
||||
<h3>Node Info</h3>
|
||||
<div id="info-content"><span class="empty">Click a node to inspect it</span></div>
|
||||
</div>
|
||||
<div id="legend-wrap">
|
||||
<h3>Communities</h3>
|
||||
<div id="legend"></div>
|
||||
</div>
|
||||
<div id="stats">538 nodes · 664 edges · 71 communities</div>
|
||||
</div>
|
||||
<script>
|
||||
const RAW_NODES = [{"id": "vite_config", "label": "vite.config.ts", "color": {"background": "#FF9DA7", "border": "#FF9DA7", "highlight": {"background": "#ffffff", "border": "#FF9DA7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "vite.config.ts", "community": 47, "community_name": "Vite Config", "source_file": "vite.config.ts", "file_type": "code", "degree": 0}, {"id": "drizzle_config", "label": "drizzle.config.ts", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "drizzle.config.ts", "community": 48, "community_name": "Drizzle Config", "source_file": "drizzle.config.ts", "file_type": "code", "degree": 0}, {"id": "playwright_config", "label": "playwright.config.ts", "color": {"background": "#BAB0AC", "border": "#BAB0AC", "highlight": {"background": "#ffffff", "border": "#BAB0AC"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "playwright.config.ts", "community": 49, "community_name": "Playwright Config", "source_file": "playwright.config.ts", "file_type": "code", "degree": 0}, {"id": "drizzle_pg_config", "label": "drizzle-pg.config.ts", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 10.0, "font": {"size": 0, "color": "#ffffff"}, "title": "drizzle-pg.config.ts", "community": 50, "community_name": "Drizzle PG Config", "source_file": "drizzle-pg.config.ts", "file_type": "code", "degree": 0}, {"id": "index", "label": "index.tsx", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 38.7, "font": {"size": 12, "color": "#ffffff"}, "title": "index.tsx", "community": 0, "community_name": "Candidate Card UI", "source_file": "src/client/routes/threads/$threadId/index.tsx", "file_type": "code", "degree": 22}, {"id": "params", "label": "params.ts", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 12.6, "font": {"size": 0, "color": "#ffffff"}, "title": "params.ts", "community": 8, "community_name": "MCP Category & Item Tools", "source_file": "src/server/lib/params.ts", "file_type": "code", "degree": 2}, {"id": "params_parseid", "label": "parseId()", "color": {"background": "#9C755F", "border": "#9C755F", "highlight": {"background": "#ffffff", "border": "#9C755F"}}, "size": 11.3, "font": {"size": 0, "color": "#ffffff"}, "title": "parseId()", "community": 8, "community_name": "MCP Category & Item Tools", "source_file": "src/server/lib/params.ts", "file_type": "code", "degree": 1}, {"id": "storage_service", "label": "storage.service.ts", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 20.4, "font": {"size": 12, "color": "#ffffff"}, "title": "storage.service.ts", "community": 10, "community_name": "Image Service & MCP Tools", "source_file": "src/server/services/storage.service.ts", "file_type": "code", "degree": 8}, {"id": "storage_service_uploadimage", "label": "uploadImage()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 11.3, "font": {"size": 0, "color": "#ffffff"}, "title": "uploadImage()", "community": 10, "community_name": "Image Service & MCP Tools", "source_file": "src/server/services/storage.service.ts", "file_type": "code", "degree": 1}, {"id": "storage_service_deleteimage", "label": "deleteImage()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 11.3, "font": {"size": 0, "color": "#ffffff"}, "title": "deleteImage()", "community": 10, "community_name": "Image Service & MCP Tools", "source_file": "src/server/services/storage.service.ts", "file_type": "code", "degree": 1}, {"id": "storage_service_getimageurl", "label": "getImageUrl()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 12.6, "font": {"size": 0, "color": "#ffffff"}, "title": "getImageUrl()", "community": 10, "community_name": "Image Service & MCP Tools", "source_file": "src/server/services/storage.service.ts", "file_type": "code", "degree": 2}, {"id": "storage_service_withimageurl", "label": "withImageUrl()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size": 12.6, "font": {"size": 0, "color": "#ffffff"}, "title": "withImageUrl()", "community": 10, "community_name": "Image Service & MCP Tools", "source_file": "src/server/services/storage.service.ts", "file_type": "code", "degree": 2}, {"id": "storage_service_withimageurls", "label": "withImageUrls()", "color": {"background": "#4E79A7", "border": "#4E79A7", "highlight": {"background": "#ffffff", "border": "#4E79A7"}}, "size":Line truncated
|
||||
const RAW_EDGES = [{"from": "index", "to": "index_createmcpserver", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "routetree_gen", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "dashboardcard", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "useformatters", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "usesetups", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "usethreads", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "usetotals", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "globalitemcard", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "useglobalitems", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "collectionview", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "planningview", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "setupsview", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "candidatecard", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "candidatelistitem", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "categorypicker", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "comparisontable", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "imageupload", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "setupimpactselector", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "usecandidates", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "useimpactdeltas", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "icondata", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "index", "to": "uistore", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "params", "to": "params_parseid", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "params", "to": "params_test", "label": "imports_from", "title": "imports_from [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "storage_service", "to": "storage_service_uploadimage", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "storage_service", "to": "storage_service_deleteimage", "label": "contains", "title": "contains [EXTRACTED]", "dashes": false, "width": 2, "color": {"opacity": 0.7}, "confidence": "EXTRACTED"}, {"from": "storage_service", "to": "storage_service_getimageurl", "label": "contains", "title": "containLine truncated
|
||||
const LEGEND = [{"cid": 0, "color": "#4E79A7", "label": "Candidate Card UI", "count": 76}, {"cid": 1, "color": "#F28E2B", "label": "Collection Forms & Pickers", "count": 45}, {"cid": 2, "color": "#E15759", "label": "Thread Modal Workflows", "count": 42}, {"cid": 3, "color": "#76B7B2", "label": "Auth Documentation", "count": 33}, {"cid": 4, "color": "#59A14F", "label": "Auth Services & Middleware", "count": 30}, {"cid": 5, "color": "#EDC948", "label": "Architecture Overview (CLAUDE.md)", "count": 26}, {"cid": 6, "color": "#B07AA1", "label": "Formatters & Icon Picker", "count": 25}, {"cid": 7, "color": "#FF9DA7", "label": "Dialogs & FAB Menu", "count": 22}, {"cid": 8, "color": "#9C755F", "label": "MCP Category & Item Tools", "count": 20}, {"cid": 9, "color": "#BAB0AC", "label": "REST API Endpoints", "count": 20}, {"cid": 10, "color": "#4E79A7", "label": "Image Service & MCP Tools", "count": 14}, {"cid": 11, "color": "#F28E2B", "label": "Codebase Improvement Plans", "count": 12}, {"cid": 12, "color": "#E15759", "label": "Thread Service Layer", "count": 11}, {"cid": 13, "color": "#76B7B2", "label": "Thread Creation UI", "count": 11}, {"cid": 14, "color": "#59A14F", "label": "Testing & Component Plans", "count": 11}, {"cid": 15, "color": "#EDC948", "label": "Setup Service Layer", "count": 9}, {"cid": 16, "color": "#B07AA1", "label": "Rate Limiting", "count": 8}, {"cid": 17, "color": "#FF9DA7", "label": "Item Service Layer", "count": 7}, {"cid": 18, "color": "#9C755F", "label": "CSV Import/Export", "count": 7}, {"cid": 19, "color": "#BAB0AC", "label": "DB Schema & Seeding", "count": 6}, {"cid": 20, "color": "#4E79A7", "label": "SQLite\u2192Postgres Migration", "count": 6}, {"cid": 21, "color": "#F28E2B", "label": "Global Item Service Tests", "count": 5}, {"cid": 22, "color": "#E15759", "label": "v1.4 Feature Specs", "count": 5}, {"cid": 23, "color": "#76B7B2", "label": "Public Profile Service", "count": 4}, {"cid": 24, "color": "#59A14F", "label": "OAuth Flow", "count": 4}, {"cid": 25, "color": "#EDC948", "label": "Global Items Route Tests", "count": 4}, {"cid": 26, "color": "#B07AA1", "label": "Thread Route Tests", "count": 4}, {"cid": 27, "color": "#FF9DA7", "label": "Setup Route Tests", "count": 4}, {"cid": 28, "color": "#9C755F", "label": "Global Item Search", "count": 3}, {"cid": 29, "color": "#BAB0AC", "label": "Totals Aggregation", "count": 3}, {"cid": 30, "color": "#4E79A7", "label": "Global Item Seeding", "count": 3}, {"cid": 31, "color": "#F28E2B", "label": "Profile Route Tests", "count": 3}, {"cid": 32, "color": "#E15759", "label": "OAuth Route Tests", "count": 3}, {"cid": 33, "color": "#76B7B2", "label": "Tag Service", "count": 2}, {"cid": 34, "color": "#59A14F", "label": "Collection Summary", "count": 2}, {"cid": 35, "color": "#EDC948", "label": "Dev Seed Display Names", "count": 2}, {"cid": 36, "color": "#B07AA1", "label": "Dev Seed Runner", "count": 2}, {"cid": 37, "color": "#FF9DA7", "label": "Thread Tab Navigation", "count": 2}, {"cid": 38, "color": "#9C755F", "label": "Item Service Tests", "count": 2}, {"cid": 39, "color": "#BAB0AC", "label": "Image Service Tests", "count": 2}, {"cid": 40, "color": "#4E79A7", "label": "Thread Service Tests", "count": 2}, {"cid": 41, "color": "#F28E2B", "label": "Storage Service Tests", "count": 2}, {"cid": 42, "color": "#E15759", "label": "OAuth Service Tests", "count": 2}, {"cid": 43, "color": "#76B7B2", "label": "MCP Tools Tests", "count": 2}, {"cid": 44, "color": "#59A14F", "label": "Item Route Tests", "count": 2}, {"cid": 45, "color": "#EDC948", "label": "Tag Route Tests", "count": 2}, {"cid": 46, "color": "#B07AA1", "label": "Category Route Tests", "count": 2}, {"cid": 47, "color": "#FF9DA7", "label": "Vite Config", "count": 1}, {"cid": 48, "color": "#9C755F", "label": "Drizzle Config", "count": 1}, {"cid": 49, "color": "#BAB0AC", "label": "Playwright Config", "count": 1}, {"cid": 50, "color": "#4E79A7", "label": "Drizzle PG Config", "count": 1}, {"cid": 51, "color": "#F28E2B", "label": "Totals Route", "count": 1}, {"cid": 52, "color": "#E15759", "label": "Tags Route", "count": 1}, {"cid": 53, "color": "#76B7B2", "label": "Global Items Route", "count": 1}, {"cid": 54, "color": "#59A14F", "label": "Profiles Route", "count": 1}, {"cid": 55, "color": "#EDC948", "label": "Zod Schemas", "count": 1}, {"cid": 56, "color": "#B07AA1", "label": "Migration Runner", "count": 1}, {"cid": 57, "color": "#FF9DA7", "label": "Category Service Tests", "count": 1}, {"cid": 58, "color": "#9C755F", "label": "Auth Service Tests", "count": 1}, {"cid": 59, "color": "#BAB0AC", "label": "CSV Service Tests", "count": 1}, {"cid": 60, "color": "#4E79A7", "label": "Tag Service Tests", "count": 1}, {"cid": 61, "color": "#F28E2B", "label": "Setup Service Tests", "count": 1}, {"cid": 62, "color": "#E15759", "label": "Totals Route Tests", "count": 1}, {"cid": 63, "color": "#76B7B2", "label": "Profile Service Tests", "count": 1}, {"cid": 64, "color": "#59A14F", "label": "Images Route Tests",Line truncated
|
||||
|
||||
// Build vis datasets
|
||||
const nodesDS = new vis.DataSet(RAW_NODES.map(n => ({
|
||||
id: n.id, label: n.label, color: n.color, size: n.size,
|
||||
font: n.font, title: n.title,
|
||||
_community: n.community, _community_name: n.community_name,
|
||||
_source_file: n.source_file, _file_type: n.file_type, _degree: n.degree,
|
||||
})));
|
||||
|
||||
const edgesDS = new vis.DataSet(RAW_EDGES.map((e, i) => ({
|
||||
id: i, from: e.from, to: e.to,
|
||||
label: '',
|
||||
title: e.title,
|
||||
dashes: e.dashes,
|
||||
width: e.width,
|
||||
color: e.color,
|
||||
arrows: { to: { enabled: true, scaleFactor: 0.5 } },
|
||||
})));
|
||||
|
||||
const container = document.getElementById('graph');
|
||||
const network = new vis.Network(container, { nodes: nodesDS, edges: edgesDS }, {
|
||||
physics: {
|
||||
enabled: true,
|
||||
solver: 'forceAtlas2Based',
|
||||
forceAtlas2Based: {
|
||||
gravitationalConstant: -60,
|
||||
centralGravity: 0.005,
|
||||
springLength: 120,
|
||||
springConstant: 0.08,
|
||||
damping: 0.4,
|
||||
avoidOverlap: 0.8,
|
||||
},
|
||||
stabilization: { iterations: 200, fit: true },
|
||||
},
|
||||
interaction: {
|
||||
hover: true,
|
||||
tooltipDelay: 100,
|
||||
hideEdgesOnDrag: true,
|
||||
navigationButtons: false,
|
||||
keyboard: false,
|
||||
},
|
||||
nodes: { shape: 'dot', borderWidth: 1.5 },
|
||||
edges: { smooth: { type: 'continuous', roundness: 0.2 }, selectionWidth: 3 },
|
||||
});
|
||||
|
||||
network.once('stabilizationIterationsDone', () => {
|
||||
network.setOptions({ physics: { enabled: false } });
|
||||
});
|
||||
|
||||
function showInfo(nodeId) {
|
||||
const n = nodesDS.get(nodeId);
|
||||
if (!n) return;
|
||||
const neighborIds = network.getConnectedNodes(nodeId);
|
||||
const neighborItems = neighborIds.map(nid => {
|
||||
const nb = nodesDS.get(nid);
|
||||
const color = nb ? nb.color.background : '#555';
|
||||
return `<span class="neighbor-link" style="border-left-color:${color}" onclick="focusNode('${nid}')">${nb ? nb.label : nid}</span>`;
|
||||
}).join('');
|
||||
document.getElementById('info-content').innerHTML = `
|
||||
<div class="field"><b>${n.label}</b></div>
|
||||
<div class="field">Type: ${n._file_type || 'unknown'}</div>
|
||||
<div class="field">Community: ${n._community_name}</div>
|
||||
<div class="field">Source: ${n._source_file || '-'}</div>
|
||||
<div class="field">Degree: ${n._degree}</div>
|
||||
${neighborIds.length ? `<div class="field" style="margin-top:8px;color:#aaa;font-size:11px">Neighbors (${neighborIds.length})</div><div id="neighbors-list">${neighborItems}</div>` : ''}
|
||||
`;
|
||||
}
|
||||
|
||||
function focusNode(nodeId) {
|
||||
network.focus(nodeId, { scale: 1.4, animation: true });
|
||||
network.selectNodes([nodeId]);
|
||||
showInfo(nodeId);
|
||||
}
|
||||
|
||||
network.on('click', params => {
|
||||
if (params.nodes.length > 0) showInfo(params.nodes[0]);
|
||||
else document.getElementById('info-content').innerHTML = '<span class="empty">Click a node to inspect it</span>';
|
||||
});
|
||||
|
||||
const searchInput = document.getElementById('search');
|
||||
const searchResults = document.getElementById('search-results');
|
||||
searchInput.addEventListener('input', () => {
|
||||
const q = searchInput.value.toLowerCase().trim();
|
||||
searchResults.innerHTML = '';
|
||||
if (!q) { searchResults.style.display = 'none'; return; }
|
||||
const matches = RAW_NODES.filter(n => n.label.toLowerCase().includes(q)).slice(0, 20);
|
||||
if (!matches.length) { searchResults.style.display = 'none'; return; }
|
||||
searchResults.style.display = 'block';
|
||||
matches.forEach(n => {
|
||||
const el = document.createElement('div');
|
||||
el.className = 'search-item';
|
||||
el.textContent = n.label;
|
||||
el.style.borderLeft = `3px solid ${n.color.background}`;
|
||||
el.style.paddingLeft = '8px';
|
||||
el.onclick = () => {
|
||||
network.focus(n.id, { scale: 1.5, animation: true });
|
||||
network.selectNodes([n.id]);
|
||||
showInfo(n.id);
|
||||
searchResults.style.display = 'none';
|
||||
searchInput.value = '';
|
||||
};
|
||||
searchResults.appendChild(el);
|
||||
});
|
||||
});
|
||||
document.addEventListener('click', e => {
|
||||
if (!searchResults.contains(e.target) && e.target !== searchInput)
|
||||
searchResults.style.display = 'none';
|
||||
});
|
||||
|
||||
const hiddenCommunities = new Set();
|
||||
const legendEl = document.getElementById('legend');
|
||||
LEGEND.forEach(c => {
|
||||
const item = document.createElement('div');
|
||||
item.className = 'legend-item';
|
||||
item.innerHTML = `<div class="legend-dot" style="background:${c.color}"></div>
|
||||
<span class="legend-label">${c.label}</span>
|
||||
<span class="legend-count">${c.count}</span>`;
|
||||
item.onclick = () => {
|
||||
if (hiddenCommunities.has(c.cid)) {
|
||||
hiddenCommunities.delete(c.cid);
|
||||
item.classList.remove('dimmed');
|
||||
} else {
|
||||
hiddenCommunities.add(c.cid);
|
||||
item.classList.add('dimmed');
|
||||
}
|
||||
const updates = RAW_NODES
|
||||
.filter(n => n.community === c.cid)
|
||||
.map(n => ({ id: n.id, hidden: hiddenCommunities.has(c.cid) }));
|
||||
nodesDS.update(updates);
|
||||
};
|
||||
legendEl.appendChild(item);
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
// Render hyperedges as shaded regions
|
||||
const hyperedges = [{"id": "auth_dual_mode", "label": "Dual Auth Mode: API Key + OAuth Bearer for MCP", "nodes": ["auth_api_keys", "spec_mcp_oauth_flow", "mcp_server_doc", "claude_oauth_endpoints"], "relation": "participate_in", "confidence": "EXTRACTED", "confidence_score": 0.9, "source_file": "CLAUDE.md"}, {"id": "research_thread_workflow", "label": "Research Thread Workflow: create\u2192add\u2192compare\u2192resolve", "nodes": ["mcp_research_workflow", "api_thread_resolve", "claude_thread_resolution", "mcp_tools_threads"], "relation": "implement", "confidence": "INFERRED", "confidence_score": 0.88, "source_file": "docs/mcp-server.md"}, {"id": "server_hardening_bundle", "label": "Server Hardening: DB Middleware + Params + Error Handler + Rate Limit", "nodes": ["plan_codebase_db_middleware", "plan_codebase_params", "plan_codebase_error_handler", "plan_codebase_rate_limit"], "relation": "participate_in", "confidence": "EXTRACTED", "confidence_score": 0.92, "source_file": "docs/superpowers/plans/2026-04-03-codebase-improvements.md"}];
|
||||
function drawHyperedges() {
|
||||
const canvas = network.canvas.frame.canvas;
|
||||
const ctx = canvas.getContext('2d');
|
||||
hyperedges.forEach(h => {
|
||||
const positions = h.nodes
|
||||
.map(nid => network.getPositions([nid])[nid])
|
||||
.filter(p => p !== undefined);
|
||||
if (positions.length < 2) return;
|
||||
// Draw convex hull as filled polygon
|
||||
ctx.save();
|
||||
ctx.globalAlpha = 0.12;
|
||||
ctx.fillStyle = '#6366f1';
|
||||
ctx.strokeStyle = '#6366f1';
|
||||
ctx.lineWidth = 2;
|
||||
ctx.beginPath();
|
||||
const scale = network.getScale();
|
||||
const offset = network.getViewPosition();
|
||||
const toCanvas = (p) => ({
|
||||
x: (p.x - offset.x) * scale + canvas.width / 2,
|
||||
y: (p.y - offset.y) * scale + canvas.height / 2
|
||||
});
|
||||
const pts = positions.map(toCanvas);
|
||||
// Expand hull slightly
|
||||
const cx = pts.reduce((s, p) => s + p.x, 0) / pts.length;
|
||||
const cy = pts.reduce((s, p) => s + p.y, 0) / pts.length;
|
||||
const expanded = pts.map(p => ({
|
||||
x: cx + (p.x - cx) * 1.15,
|
||||
y: cy + (p.y - cy) * 1.15
|
||||
}));
|
||||
ctx.moveTo(expanded[0].x, expanded[0].y);
|
||||
expanded.slice(1).forEach(p => ctx.lineTo(p.x, p.y));
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
ctx.globalAlpha = 0.4;
|
||||
ctx.stroke();
|
||||
// Label
|
||||
ctx.globalAlpha = 0.8;
|
||||
ctx.fillStyle = '#4f46e5';
|
||||
ctx.font = 'bold 11px sans-serif';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.fillText(h.label, cx, cy - 5);
|
||||
ctx.restore();
|
||||
});
|
||||
}
|
||||
network.on('afterDrawing', drawHyperedges);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user