Elffuss BraidHub

kikocis/VibeCodeViewer public

Changeset: 26da0d5e2201
26da0d5e2201 merge: feat/i18n-es-en into develop Sendery,
docs/
src/
tools/
vendor/
.gitignore41 B
README.en.md13.8 KiB
README.md20.6 KiB
code_ownership_files.en.md1.3 KiB
code_ownership_files.md1.4 KiB
index.html4.8 KiB
scan.mjs7.9 KiB
serve.shexecutable1.9 KiB

README.en.md

VibeCodeViewer — Crystal Metropolis

Español · English

A procedural glass-building city (Three.js) that visualizes a code repository as a sharp, nineties-hacker-style metropolis: cyan wireframes, a circuit-board floor, local-first folder scanning, Git/ownership layers, blast-radius analysis, and visual controls that increase drama without depending on HDR postprocessing.

Product presentation demo

VibeCodeViewer product presentation showing repository topology, navigation, search, Git, ownership, blast radius, themes and guided demo mode

GitHub README rendering is most reliable with animated GIF previews. Click the animation to open the optimized web MP4.

Language support

The application UI is available in Spanish and English.

  • Use the language selector in the left control stack.
  • The choice is stored in localStorage under vcc.language.v1.
  • You can force a language at startup with ?lang=es or ?lang=en.
  • User-facing HUD text, search placeholders, settings, loading progress, disabled-mode tooltips, stats, Git labels, and Blast legends are translated.

Highlighted capabilities

  • Repository-as-city topology: folders become districts, nested modules become buildings, and files become luminous cells.
  • Spatial architecture review: aerial, skyline, and guided camera views make hierarchy depth and dense areas readable at a glance.
  • File search and selection: matching files pulse across the city; selecting a file lights its path through building and district.
  • Git status layer: colors modified, new, renamed, and deleted files with repository-aware metadata.
  • Ownership layer: visualizes CODEOWNERS and metadata.owner conventions as owner-specific color regions.
  • Blast radius analysis: combines imports and symbol usage to show dependencies and downstream impact with animated beams.
  • Local-first scanning: opens a folder directly in Chrome/Edge and rebuilds the city locally without regenerating checked-in data.
  • Ignored-code basements: maps ignored files below the ground plane and can hide/reveal them with ground controls.
  • Themes and visual settings: switches themes and tunes exposure, contrast, edges, labels, glass, fog, ground, and experimental bloom.
  • Guided demo mode: chains topology, navigation, search, layers, themes, settings, legend, and final overview.

Repository → city mapping

  • Repository root → city.
  • First-level folders → districts.
  • Second-level folders → buildings.
  • Very deep or dense subtrees → developments inside the district; their subfolders become buildings recursively.
  • Interior nesting → floors → apartments → rooms → filing cabinets → drawers.
  • Files → luminous cells at any level.

Sizing rules:

  • Building width/depth is proportional to folder byte size using a logarithmic scale.
  • Height is proportional to recursive file count.
  • The file tree is printed onto the glass façade of each large building.
  • Selecting a file highlights its path on the façade.
  • Inside a drawer, files render as hanging vertical sheets; elsewhere they render as cube grids.

Hierarchical density lighting

Selecting a file (click or search) lights its cell at full intensity and the light decays level by level outward (×0.56 per hop):

file ▓▓▓▓▓▓ → drawer ▓▓▓▓ → cabinet ▓▓▓ → room ▓▓ → floor ▓ → building ░ → district ·

Lit interior levels receive a subtle volumetric fill. Buildings and districts only light edges and fresnel so the interior remains readable.

Anti-blur recipe

  1. Thin edges in one LineSegments object, with color and opacity tunable from Settings.
  2. Minimal-opacity fresnel glass (α ≈ 0.02 in the face center).
  3. No permanent additive volumes; fills exist only while a level is active.
  4. Direct render by default. The old HDR/bloom composer remains experimental via ?bloom=1 because some drivers produce black screen-space rectangles while orbiting.

Extras

  • Open Folder… (Chrome/Edge): scans any local folder with the File System Access API and rebuilds the city live without regenerating src/data.js.
  • Basements: files hidden by .gitignore, .dockerignore, or .npmignore are mapped below the circuit-board plane. The side tree shows them as folder · basement. Fully ignored folders become lower, more opaque bunker slabs.
  • Legend (L or button): district names are silkscreened onto the floor like circuit traces, and folder names appear on building roofs.
  • District pulse: the district containing the current selection remains slightly brighter and pulses softly.
  • Search suggestions: matching files blink in the city and are highlighted on their buildings' façades as you type.
  • Settings: modal panel under Reset View with visual presets and persistent sliders for exposure, brightness, contrast, saturation, edges, cells, glass, façades, labels, ground, and fog. Includes a Bloom HDR toggle that reloads with/without ?bloom=1.

Coloring modes

The top-center selector exposes Basic · Git · Owners · Blast. File color is attenuated through the hierarchy: drawer, room, floor, building, and district.

  • Basic: the original cyan palette.
  • Git: colors each file by Git status. The browser scanner parses .git/index directly for local folders; checked-in snapshots can also include git status and git diff --numstat metadata.
  • Owners: parses CODEOWNERS and package.yml files with metadata.owner. Each owner gets a color and appears in a legend with file counts. See Code Ownership reference.
  • Blast: estimates the impact of a change in two layers:
    1. Path imports (src/codeLinks.js) across JS/TS, C/C++, Python, CSS, HTML, and shell.
    2. Symbol index (src/codeIndex.js) for JS/TS(X), Python, Ruby, C/C++, and Bash.

When a file is selected in Blast mode:

  • Files that depend on it (downstream impact) light up with beamIn.
  • Its dependencies light up with beam.
  • Animated beams show propagation direction and the legend shows both counts.

The analysis is cached with key version|path|size|mtime: Node uses .cache/analysis.json; the browser uses IndexedDB. Re-scanning only reanalyzes changed files.

Color themes

The selector displays Theme · …. Full palettes live in src/themes.js; changing theme rebuilds only the city while keeping the model, camera, and selection.

  • Hacker — original cyan/purple on black.
  • Factorial — dark corporate palette with dominant red #E51943 and structural green #007C85; UI panels are light (uiLight).
  • Synthwave — magenta and sunset orange on deep purple.
  • Matrix — monochrome green phosphor on black.
  • Glaciar — ice blues and cool whites on navy.

The Opaque Ground button (G) hides basements by writing depth; translucent ground lets you glimpse them.

Visual settings and bloom

The Settings button opens four presets:

  • Safe: base values, direct render.
  • Neon: more saturation and brightness without using bloom.
  • Cinema: more contrast, denser fog, less dominant ground.
  • Intense: more exposure and stronger edges/cells; the most aggressive tested preset without black artifacts.

Sliders apply live and persist in localStorage under vcc.visualSettings.v1. The HUD shows whether you are using direct render or bloom ×N.

?bloom=1 enables EffectComposer + UnrealBloomPass. It is kept for experimentation but is not the default because some GPU/driver combinations show black rectangles during orbit. Remove bloom from the URL or uncheck Bloom HDR to return to stable mode.

GPU diagnostics

Detection uses the real WebGL renderer exposed by the browser (WEBGL_debug_renderer_info when available). On Windows/WSLg or virtualized layers it may show D3D12 virtual, Mesa, or Microsoft even when the host has an NVIDIA GPU. In that case the app treats it as hardware accelerated but cannot invent the hidden brand.

Useful debug overrides:

  • ?gpu=nvidia forces the NVIDIA label/profile when the host has NVIDIA but the browser reports a virtual layer.
  • ?msaa=N and ?pr=N force render-target multisampling and pixel ratio.
  • ?bloom=1 enables the experimental HDR composer.

Keyboard in the tree

With the tree focused:

  • ↑ / ↓: move cursor.
  • →: expand a folder or enter it.
  • ←: collapse or jump to parent.
  • PageDown / PageUp: move one page.
  • Enter / Space: select the item and fly the camera to it.

Large monorepos

Tested with a real monorepo of about 120k files and 42 first-level districts.

  • Developments: towers absorb up to 5 levels of interior nesting. Deeper or very dense subtrees become developments so the city spreads instead of compressing into one tower.
  • Large cities apply a smooth, uniform attenuation to edges, glass, and cells while keeping district and development perimeters bright.
  • The tree scan is complete and has no file-count limit.
  • Blast reads file contents only within a budget (20k files / 48 MB), ordered by priority, in resumable batches.
  • Edge LOD draws only the most relevant boxes; brightness is normalized per building.
  • Text façades are limited to the 250 largest buildings; roof labels to 400; slabs to 4000 floors.
  • The side tree is lazy: branches mount in the DOM only when expanded.
  • node_modules and .git/objects are always skipped.

Run

A static server is required because ES modules and import maps do not work from file://:

./serve.sh          # serves on all network interfaces and lists URLs
./serve.sh 9000     # alternate port
# or manually: python3 -m http.server 8137 --bind 0.0.0.0

The File System Access API (Open Folder…) requires a secure context. From another machine on the network use HTTPS or a tunnel; http://localhost works.

No build step is required: Three.js r160 is vendored in vendor/ for offline use.

Regenerate the repository snapshot (src/data.js):

node scan.mjs            # scans the parent folder
node scan.mjs /other/path # scans another tree

Automated visual verification

Use these tools to record orbits and detect black-frame regressions:

# 1. Start the app and a Chromium instance with remote DevTools.
./serve.sh 8137
chromium-browser --headless --disable-gpu-sandbox --no-sandbox \
  --remote-debugging-port=9223 --window-size=2048,1152 about:blank

# 2. Capture an orbit with a theme/preset.
node tools/capture-orbit.mjs \
  --url=http://localhost:8137/ \
  --out=/tmp/vcc-orbit \
  --frames=120 --width=2048 --height=1152 --port=9223 --theme=matrix \
  --visuals='{"exposure":1.24,"brightness":1.08,"contrast":1.28,"saturate":1.65,"lines":1.22,"files":1.35,"glass":1.16,"facades":1.12,"labels":1.45,"ground":1.08,"fog":0.92}'

# 3. Optionally generate a video.
ffmpeg -y -framerate 30 -i /tmp/vcc-orbit/frame-%04d.png \
  -pix_fmt yuv420p /tmp/vcc-orbit.mp4

# 4. Detect black rectangles in an orbit.
python3 tools/detect-black-rects.py /tmp/vcc-orbit

# 5. Detect the case of one screenshot, more sensitive to black windows.
python3 tools/detect-black-rects.py --scan-windows screenshot.png

# 6. Compare a candidate against a stable baseline.
python3 tools/compare-black-regressions.py /tmp/candidate /tmp/baseline

tools/detect-black-rects.py uses Pillow/NumPy instead of OpenCV to avoid new dependencies. It exits with code 1 when bad frames are found.

Test mode: ./serve.sh --test N M [K]

Generates deterministic synthetic src/data.js via tools/gentest.mjs for rendering tests with controlled geometry.

  • Without K: N independent chains; each file lives at the bottom of M nested folders.
  • With K (development mode): N files are grouped; each district contains an urb_g block with K development-level folders, each continuing to total depth M.

Examples:

./serve.sh --test 2 3
./serve.sh --test 500 8
./serve.sh --test 1000 8 250
./serve.sh --test 1000 4 250
./serve.sh --test 2500 3 2500
./serve.sh --test 9000 9 300
./serve.sh 8200 --test 100 10

Restore the real snapshot with git checkout -- src/data.js or rerun scan.mjs. ./serve.sh --help prints a summary.

Controls

  • Drag / wheel: orbit · zoom.
  • Click: select file or building; empty click clears selection.
  • Hover: highlights building under cursor.
  • F: fly mode with pointer lock; crosses walls.
  • W A S D / mouse: move · look in fly mode.
  • Space / E · C / Q: up · down · Shift turbo.
  • 1 2 3: Reset View · Aerial View · Building Height View.
  • L · G: legend · opaque ground.
  • X · /: clear selection · focus search.
  • Esc: exit fly mode / close search / close Settings.

Structure

index.html        HTML shell + importmap
scan.mjs          repository scanner → src/data.js
README.md         Spanish documentation
README.en.md      English documentation
src/
  data.js         tree snapshot (generated)
  i18n.js         Spanish/English UI strings and language persistence
  model.js        hierarchy + layout (nested boxes, urban packing)
  builder.js      scene: HDR edges, fresnel glass, façades, PCB ground
  controls.js     orbit + free flight + camera flights
  ui.js           side tree, search, path, stats, Settings, language selector
  main.js         hierarchical selection, raycast, render, visual settings
tools/
  capture-orbit.mjs             captures orbits via Chrome DevTools Protocol
  detect-black-rects.py         detects black rectangles in frames/screenshots
  compare-black-regressions.py  compares orbits against a visual baseline
vendor/           Three.js r160 + addons (offline)