๐ณ Knowledge Tree v0.3.0
๐ก AI-powered interactive D3 topic visualizer (Production-Ready)
๐ ๏ธ Stack: Vanilla JS (ESM), D3.js v7, Python dev server (server.py) with LLM proxy, html2canvas, jsPDF, Groq / OpenRouter. No build step.
๐ Layout:
index.htmlโ Entry point & CSPstart.commandโ Quick launch scriptserver.pyโ Python dev server & LLM proxy (port51808)src/scripts/:main.js(Init/Nav),tree.js(D3),ui.js(Panels),api.js(LLM),settings.js(LocalStorage),debugLog.js(Logs),utils.js(Helpers)src/styles/:main.css(Core),themes.css(Themes),components.css(UI styles)
๐ Quick Start:
- Copy
.env.exampleto.envin the root:cp .env.example .env - Set API keys (
API_KEY_GROQ,API_KEY_OPENROUTER) in.env. - Start the dev server:
python3 server.py(or double-click./start.commandon macOS). - Visit
http://localhost:51808.
โ Features:
- ๐ณ D3 Tree: Interactive zoom/pan, folding memory, and NaN/Infinity bounds safety.
- ๐ฌ AI Panels: Preset generations (Creative/Balanced/Precise/Factual), LLM metrics, and redacted observability logs.
- ๐พ State & I/O: LocalStorage config, drag-and-drop JSON import (merge/replace), and PNG/PDF/JSON/MD exports.
- โจ๏ธ UX & Accessibility: Undo/Redo (
โZ/โโงZ), keyboard nav, DOM-safe escaping, event listeners (no inline onclick), and dark mode. - โฟ A11y & Focus: Unified focus-trap model (Escape closes, loops focus, restores on close) for Node, Confirm, Debug, and Import panels. Normalised WCAG 2.2 SC 2.5.8 compliant target sizes (
24x24pxwith spacing,44x44pxfor coarse pointers). - ๐๏ธ Perf-UX: Reduced-motion fallback animation support; prevented transform shifts on mobile debug drawer; skeleton loader states during async AI generation.
๐จ Security:
- ๐ DOM Safety: DOM API +
escapeText()formatting only. No inline handlers. - ๐ก๏ธ CSP: Requires
unsafe-eval(D3) &unsafe-inline(Google Fonts). - ๐๏ธ Secrets Protection: Keys live only in
.env(never committed or exposed).
๐ฏ Done:
- P1: Focus-trap architecture for modals/drawers (Node, Confirm, Debug, Import) ๐งฏ
- P2: Export menu keyboard navigation and ARIA semantics ๐
- P3: Collapsible settings intent groups and Reset-to-Defaults โ๏ธ
- P4: Screen-reader helpers, contrast checks, and tab-order validation โฟ
- P5: Skeleton states and redraw optimization for frequent debug updates ๐๏ธ
๐ฎ Roadmap:
- ๐งช Unit tests for API/settings modules.
- ๐ Real-time node search and filter panel.
- โก Virtualized D3 tree layout for massive datasets.
- ๐ฆ Offline PWA support with local cache.
โจ๏ธ Shortcuts:
| Scope | Key | Action |
|---|---|---|
| Global | โZ / โโงZ (or โY) | Undo / Redo |
โE / โO | Export / Import dialog | |
โ, / Esc | Settings panel / Close panels | |
| Node | โ / โ | Navigate tree levels |
โ / โ | Navigate siblings | |
Tab / โงTab | Go to first child / Go to parent | |
Enter / โงEnter | Fold/unfold (or extend) / Force extend | |
Space / โN | Open node panel / Extend children | |
โH / โI / โโซ | Toggle visibility / Generate insights / Delete |
โ๏ธ Config Notes:
- ๐ API keys live in
.envat the project root (API_KEY_GROQ,API_KEY_OPENROUTER). The retiredconfig.jsis deprecated and moved toobsolete/. - ๐ The Python server (
server.py) defaults to port51808to proxy LLM requests and load ES modules. - ๐พ Settings persist in
localStoragewith XOR validation and range clamping. - ๐ Debug logs are written to the serverโs filesystem under
logs/debug-{today}.jsonl.
๐ Hosting & DNS:
- App URL:
https://tree.loca.zone(reverse proxies to loopback port51808) - Wiki URL:
https://wiki.tree.loca.zone(static Quartz site) - Direct diagnostic URL:
http://routa.loca.zone:51808/(Knowledge Tree listener, not a separate Routa app) - Reverse Proxy (Nginx):
server_name tree.loca.zone; location / { proxy_pass http://127.0.0.1:51808; } - Smoke Checks:
(Expect 200 on all checks)curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:51808/ curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:51808/api/config curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:51808/src/scripts/main.js