kikocis/VibeCodeViewer public
Changesets · Branches · Tags · Compare
| Changeset | 1a91a2a61b163dca1b1b2e41c874a38003ecc2741dca2930a6e85e6b5bdfe13d |
|---|---|
| Author | Sendery <sendery@gmail.com> · 2026-06-23 16:41 +02:00 |
| Committer | Sendery <sendery@gmail.com> · 2026-06-23 16:41 +02:00 |
| Parents | 26da0d5e2201 |
8 files changed
modified README.en.md +44 −267
| @@ -1,296 +1,73 @@ | ||
| 1 | -# VibeCodeViewer — Crystal Metropolis | |
| 1 | +# VibeCodeViewer | |
| 2 | 2 | |
| 3 | 3 | [Español](README.md) · **English** |
| 4 | 4 | |
| 5 | -A procedural **glass-building city** (Three.js) that visualizes a code repository | |
| 6 | -as a sharp, nineties-hacker-style metropolis: cyan wireframes, a circuit-board | |
| 7 | -floor, local-first folder scanning, Git/ownership layers, blast-radius analysis, | |
| 8 | -and visual controls that increase drama without depending on HDR postprocessing. | |
| 5 | +Visualize a repository as an interactive 3D city: folders become districts, modules become buildings, and files become luminous cells. | |
| 9 | 6 | |
| 10 | -## Product presentation demo | |
| 7 | +## Presentation | |
| 11 | 8 | |
| 12 | 9 | <p align="center"> |
| 13 | 10 | <a href="docs/assets/vibecodeviewer-hyperframes-presentation.web.mp4"> |
| 14 | - <img src="docs/assets/vibecodeviewer-hyperframes-presentation-readme.gif" alt="VibeCodeViewer product presentation showing repository topology, navigation, search, Git, ownership, blast radius, themes and guided demo mode" width="900"> | |
| 11 | + <img src="docs/assets/vibecodeviewer-hyperframes-presentation-readme.gif" alt="VibeCodeViewer presentation" width="900"> | |
| 15 | 12 | </a> |
| 16 | 13 | </p> |
| 17 | 14 | |
| 18 | -> GitHub README rendering is most reliable with animated GIF previews. Click the | |
| 19 | -> animation to open the optimized web MP4. | |
| 20 | - | |
| 21 | 15 | - [Watch optimized web MP4](docs/assets/vibecodeviewer-hyperframes-presentation.web.mp4) |
| 22 | 16 | - [Open static poster](docs/assets/vibecodeviewer-hyperframes-presentation-poster.png) |
| 23 | 17 | |
| 24 | -## Language support | |
| 25 | - | |
| 26 | -The application UI is available in **Spanish** and **English**. | |
| 27 | - | |
| 28 | -- Use the language selector in the left control stack. | |
| 29 | -- The choice is stored in `localStorage` under `vcc.language.v1`. | |
| 30 | -- You can force a language at startup with `?lang=es` or `?lang=en`. | |
| 31 | -- User-facing HUD text, search placeholders, settings, loading progress, | |
| 32 | - disabled-mode tooltips, stats, Git labels, and Blast legends are translated. | |
| 33 | - | |
| 34 | -## Highlighted capabilities | |
| 35 | - | |
| 36 | -- **Repository-as-city topology:** folders become districts, nested modules become buildings, and files become luminous cells. | |
| 37 | -- **Spatial architecture review:** aerial, skyline, and guided camera views make hierarchy depth and dense areas readable at a glance. | |
| 38 | -- **File search and selection:** matching files pulse across the city; selecting a file lights its path through building and district. | |
| 39 | -- **Git status layer:** colors modified, new, renamed, and deleted files with repository-aware metadata. | |
| 40 | -- **Ownership layer:** visualizes CODEOWNERS and `metadata.owner` conventions as owner-specific color regions. | |
| 41 | -- **Blast radius analysis:** combines imports and symbol usage to show dependencies and downstream impact with animated beams. | |
| 42 | -- **Local-first scanning:** opens a folder directly in Chrome/Edge and rebuilds the city locally without regenerating checked-in data. | |
| 43 | -- **Ignored-code basements:** maps ignored files below the ground plane and can hide/reveal them with ground controls. | |
| 44 | -- **Themes and visual settings:** switches themes and tunes exposure, contrast, edges, labels, glass, fog, ground, and experimental bloom. | |
| 45 | -- **Guided demo mode:** chains topology, navigation, search, layers, themes, settings, legend, and final overview. | |
| 46 | - | |
| 47 | -## Repository → city mapping | |
| 48 | - | |
| 49 | -- Repository root → city. | |
| 50 | -- First-level folders → districts. | |
| 51 | -- Second-level folders → buildings. | |
| 52 | -- Very deep or dense subtrees → **developments** inside the district; their | |
| 53 | - subfolders become buildings recursively. | |
| 54 | -- Interior nesting → floors → apartments → rooms → filing cabinets → drawers. | |
| 55 | -- Files → luminous cells at any level. | |
| 56 | - | |
| 57 | -Sizing rules: | |
| 58 | - | |
| 59 | -- Building width/depth is proportional to folder byte size using a logarithmic scale. | |
| 60 | -- Height is proportional to recursive file count. | |
| 61 | -- The file tree is printed onto the glass façade of each large building. | |
| 62 | -- Selecting a file highlights its path on the façade. | |
| 63 | -- Inside a drawer, files render as hanging vertical sheets; elsewhere they render as cube grids. | |
| 64 | - | |
| 65 | -## Hierarchical density lighting | |
| 66 | - | |
| 67 | -Selecting a file (click or search) lights its cell at full intensity and the | |
| 68 | -light decays level by level outward (`×0.56` per hop): | |
| 69 | - | |
| 70 | -```text | |
| 71 | -file ▓▓▓▓▓▓ → drawer ▓▓▓▓ → cabinet ▓▓▓ → room ▓▓ → floor ▓ → building ░ → district · | |
| 72 | -``` | |
| 73 | - | |
| 74 | -Lit interior levels receive a subtle volumetric fill. Buildings and districts | |
| 75 | -only light edges and fresnel so the interior remains readable. | |
| 76 | - | |
| 77 | -## Anti-blur recipe | |
| 78 | - | |
| 79 | -1. Thin edges in one `LineSegments` object, with color and opacity tunable from **Settings**. | |
| 80 | -2. Minimal-opacity **fresnel glass** (`α ≈ 0.02` in the face center). | |
| 81 | -3. No permanent additive volumes; fills exist only while a level is active. | |
| 82 | -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. | |
| 83 | - | |
| 84 | -## Extras | |
| 85 | - | |
| 86 | -- **Open Folder…** (Chrome/Edge): scans any local folder with the File System Access API and rebuilds the city live without regenerating `src/data.js`. | |
| 87 | -- **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. | |
| 88 | -- **Legend** (`L` or button): district names are silkscreened onto the floor like circuit traces, and folder names appear on building roofs. | |
| 89 | -- **District pulse:** the district containing the current selection remains slightly brighter and pulses softly. | |
| 90 | -- **Search suggestions:** matching files blink in the city and are highlighted on their buildings' façades as you type. | |
| 91 | -- **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`. | |
| 92 | - | |
| 93 | -## Coloring modes | |
| 94 | - | |
| 95 | -The top-center selector exposes **Basic · Git · Owners · Blast**. File color is | |
| 96 | -attenuated through the hierarchy: drawer, room, floor, building, and district. | |
| 97 | - | |
| 98 | -- **Basic:** the original cyan palette. | |
| 99 | -- **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. | |
| 100 | -- **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](code_ownership_files.en.md). | |
| 101 | -- **Blast:** estimates the impact of a change in two layers: | |
| 102 | - 1. Path imports (`src/codeLinks.js`) across JS/TS, C/C++, Python, CSS, HTML, and shell. | |
| 103 | - 2. Symbol index (`src/codeIndex.js`) for JS/TS(X), Python, Ruby, C/C++, and Bash. | |
| 104 | - | |
| 105 | -When a file is selected in Blast mode: | |
| 106 | - | |
| 107 | -- Files that depend on it (downstream impact) light up with `beamIn`. | |
| 108 | -- Its dependencies light up with `beam`. | |
| 109 | -- Animated beams show propagation direction and the legend shows both counts. | |
| 110 | - | |
| 111 | -The analysis is cached with key `version|path|size|mtime`: Node uses | |
| 112 | -`.cache/analysis.json`; the browser uses IndexedDB. Re-scanning only reanalyzes | |
| 113 | -changed files. | |
| 114 | - | |
| 115 | -## Color themes | |
| 116 | - | |
| 117 | -The selector displays `Theme · …`. Full palettes live in `src/themes.js`; changing | |
| 118 | -theme rebuilds only the city while keeping the model, camera, and selection. | |
| 119 | - | |
| 120 | -- **Hacker** — original cyan/purple on black. | |
| 121 | -- **Factorial** — dark corporate palette with dominant red `#E51943` and structural green `#007C85`; UI panels are light (`uiLight`). | |
| 122 | -- **Synthwave** — magenta and sunset orange on deep purple. | |
| 123 | -- **Matrix** — monochrome green phosphor on black. | |
| 124 | -- **Glaciar** — ice blues and cool whites on navy. | |
| 125 | - | |
| 126 | -The **Opaque Ground** button (`G`) hides basements by writing depth; translucent | |
| 127 | -ground lets you glimpse them. | |
| 128 | - | |
| 129 | -## Visual settings and bloom | |
| 130 | - | |
| 131 | -The **Settings** button opens four presets: | |
| 132 | - | |
| 133 | -- **Safe:** base values, direct render. | |
| 134 | -- **Neon:** more saturation and brightness without using bloom. | |
| 135 | -- **Cinema:** more contrast, denser fog, less dominant ground. | |
| 136 | -- **Intense:** more exposure and stronger edges/cells; the most aggressive tested preset without black artifacts. | |
| 137 | - | |
| 138 | -Sliders apply live and persist in `localStorage` under `vcc.visualSettings.v1`. | |
| 139 | -The HUD shows whether you are using direct render or `bloom ×N`. | |
| 140 | - | |
| 141 | -`?bloom=1` enables `EffectComposer` + `UnrealBloomPass`. It is kept for | |
| 142 | -experimentation but is not the default because some GPU/driver combinations show | |
| 143 | -black rectangles during orbit. Remove `bloom` from the URL or uncheck **Bloom HDR** | |
| 144 | -to return to stable mode. | |
| 145 | - | |
| 146 | -## GPU diagnostics | |
| 147 | - | |
| 148 | -Detection uses the real WebGL renderer exposed by the browser | |
| 149 | -(`WEBGL_debug_renderer_info` when available). On Windows/WSLg or virtualized | |
| 150 | -layers it may show `D3D12 virtual`, `Mesa`, or `Microsoft` even when the host has | |
| 151 | -an NVIDIA GPU. In that case the app treats it as hardware accelerated but cannot | |
| 152 | -invent the hidden brand. | |
| 153 | - | |
| 154 | -Useful debug overrides: | |
| 155 | - | |
| 156 | -- `?gpu=nvidia` forces the NVIDIA label/profile when the host has NVIDIA but the browser reports a virtual layer. | |
| 157 | -- `?msaa=N` and `?pr=N` force render-target multisampling and pixel ratio. | |
| 158 | -- `?bloom=1` enables the experimental HDR composer. | |
| 159 | - | |
| 160 | -## Keyboard in the tree | |
| 161 | - | |
| 162 | -With the tree focused: | |
| 163 | - | |
| 164 | -- `↑` / `↓`: move cursor. | |
| 165 | -- `→`: expand a folder or enter it. | |
| 166 | -- `←`: collapse or jump to parent. | |
| 167 | -- `PageDown` / `PageUp`: move one page. | |
| 168 | -- `Enter` / `Space`: select the item and fly the camera to it. | |
| 169 | - | |
| 170 | -## Large monorepos | |
| 171 | - | |
| 172 | -Tested with a real monorepo of about 120k files and 42 first-level districts. | |
| 173 | - | |
| 174 | -- **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. | |
| 175 | -- Large cities apply a smooth, uniform attenuation to edges, glass, and cells while keeping district and development perimeters bright. | |
| 176 | -- The tree scan is complete and has no file-count limit. | |
| 177 | -- Blast reads file contents only within a budget (20k files / 48 MB), ordered by priority, in resumable batches. | |
| 178 | -- Edge LOD draws only the most relevant boxes; brightness is normalized per building. | |
| 179 | -- Text façades are limited to the 250 largest buildings; roof labels to 400; slabs to 4000 floors. | |
| 180 | -- The side tree is lazy: branches mount in the DOM only when expanded. | |
| 181 | -- `node_modules` and `.git/objects` are always skipped. | |
| 182 | - | |
| 183 | -## Run | |
| 184 | - | |
| 185 | -A static server is required because ES modules and import maps do not work from | |
| 186 | -`file://`: | |
| 187 | - | |
| 188 | -```bash | |
| 189 | -./serve.sh # serves on all network interfaces and lists URLs | |
| 190 | -./serve.sh 9000 # alternate port | |
| 191 | -# or manually: python3 -m http.server 8137 --bind 0.0.0.0 | |
| 192 | -``` | |
| 193 | - | |
| 194 | -The File System Access API (**Open Folder…**) requires a secure context. From | |
| 195 | -another machine on the network use HTTPS or a tunnel; `http://localhost` works. | |
| 196 | - | |
| 197 | -No build step is required: Three.js r160 is vendored in `vendor/` for offline use. | |
| 198 | - | |
| 199 | -Regenerate the repository snapshot (`src/data.js`): | |
| 200 | - | |
| 201 | -```bash | |
| 202 | -node scan.mjs # scans the parent folder | |
| 203 | -node scan.mjs /other/path # scans another tree | |
| 204 | -``` | |
| 205 | - | |
| 206 | -## Automated visual verification | |
| 207 | - | |
| 208 | -Use these tools to record orbits and detect black-frame regressions: | |
| 209 | - | |
| 210 | -```bash | |
| 211 | -# 1. Start the app and a Chromium instance with remote DevTools. | |
| 212 | -./serve.sh 8137 | |
| 213 | -chromium-browser --headless --disable-gpu-sandbox --no-sandbox \ | |
| 214 | - --remote-debugging-port=9223 --window-size=2048,1152 about:blank | |
| 215 | - | |
| 216 | -# 2. Capture an orbit with a theme/preset. | |
| 217 | -node tools/capture-orbit.mjs \ | |
| 218 | - --url=http://localhost:8137/ \ | |
| 219 | - --out=/tmp/vcc-orbit \ | |
| 220 | - --frames=120 --width=2048 --height=1152 --port=9223 --theme=matrix \ | |
| 221 | - --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}' | |
| 222 | - | |
| 223 | -# 3. Optionally generate a video. | |
| 224 | -ffmpeg -y -framerate 30 -i /tmp/vcc-orbit/frame-%04d.png \ | |
| 225 | - -pix_fmt yuv420p /tmp/vcc-orbit.mp4 | |
| 18 | +## Features | |
| 226 | 19 | |
| 227 | -# 4. Detect black rectangles in an orbit. | |
| 228 | -python3 tools/detect-black-rects.py /tmp/vcc-orbit | |
| 20 | +- **Repository city map**: turns the folder structure into a navigable metropolis. | |
| 21 | +- **Visual search**: find files and locate them with pulses in the city and side tree. | |
| 22 | +- **Analysis layers**: Basic, Git, Owners, and Blast modes for status, ownership, and impact review. | |
| 23 | +- **Blast radius**: shows dependencies and downstream impact with animated beams. | |
| 24 | +- **Local scanning**: opens repositories directly from Chrome/Edge with the File System Access API. | |
| 25 | +- **Basements for ignored code**: renders files ignored by `.gitignore`, `.dockerignore`, or `.npmignore` below the ground plane. | |
| 26 | +- **Themes and visual settings**: switch palettes and tune exposure, contrast, glass, labels, ground, fog, and bloom. | |
| 27 | +- **Bilingual UI**: Spanish and English from the language selector or with `?lang=es` / `?lang=en`. | |
| 229 | 28 | |
| 230 | -# 5. Detect the case of one screenshot, more sensitive to black windows. | |
| 231 | -python3 tools/detect-black-rects.py --scan-windows screenshot.png | |
| 29 | +## How to use | |
| 232 | 30 | |
| 233 | -# 6. Compare a candidate against a stable baseline. | |
| 234 | -python3 tools/compare-black-regressions.py /tmp/candidate /tmp/baseline | |
| 235 | -``` | |
| 31 | +1. Serve the project: | |
| 236 | 32 | |
| 237 | -`tools/detect-black-rects.py` uses Pillow/NumPy instead of OpenCV to avoid new | |
| 238 | -dependencies. It exits with code 1 when bad frames are found. | |
| 33 | + ```bash | |
| 34 | + ./serve.sh | |
| 35 | + # or a custom port | |
| 36 | + ./serve.sh 9000 | |
| 37 | + ``` | |
| 239 | 38 | |
| 240 | -## Test mode: `./serve.sh --test N M [K]` | |
| 39 | +2. Open the app in your browser: | |
| 241 | 40 | |
| 242 | -Generates deterministic synthetic `src/data.js` via `tools/gentest.mjs` for | |
| 243 | -rendering tests with controlled geometry. | |
| 41 | + ```text | |
| 42 | + http://localhost:8137/ | |
| 43 | + ``` | |
| 244 | 44 | |
| 245 | -- **Without K:** N independent chains; each file lives at the bottom of M nested folders. | |
| 246 | -- **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. | |
| 45 | +3. To analyze local repositories, **always access the app through `localhost`** and use **Open Folder…**. | |
| 247 | 46 | |
| 248 | -Examples: | |
| 47 | + > Important: the browser folder-access API requires a secure context. `http://localhost` works; a LAN URL like `http://10.x.x.x:8137` may load the app, but it is not suitable for analyzing local repositories unless you use HTTPS or a secure tunnel. | |
| 249 | 48 | |
| 250 | -```bash | |
| 251 | -./serve.sh --test 2 3 | |
| 252 | -./serve.sh --test 500 8 | |
| 253 | -./serve.sh --test 1000 8 250 | |
| 254 | -./serve.sh --test 1000 4 250 | |
| 255 | -./serve.sh --test 2500 3 2500 | |
| 256 | -./serve.sh --test 9000 9 300 | |
| 257 | -./serve.sh 8200 --test 100 10 | |
| 258 | -``` | |
| 49 | +4. Pick a folder/repository and navigate: | |
| 259 | 50 | |
| 260 | -Restore the real snapshot with `git checkout -- src/data.js` or rerun `scan.mjs`. | |
| 261 | -`./serve.sh --help` prints a summary. | |
| 51 | + - Drag / wheel: orbit and zoom. | |
| 52 | + - `F`: fly mode. | |
| 53 | + - `/`: search files. | |
| 54 | + - `L`: legend. | |
| 55 | + - `G`: opaque ground. | |
| 56 | + - `1`, `2`, `3`: reset, aerial view, and height view. | |
| 262 | 57 | |
| 263 | -## Controls | |
| 58 | +## Documentation | |
| 264 | 59 | |
| 265 | -- Drag / wheel: orbit · zoom. | |
| 266 | -- Click: select file or building; empty click clears selection. | |
| 267 | -- Hover: highlights building under cursor. | |
| 268 | -- `F`: **fly mode** with pointer lock; crosses walls. | |
| 269 | -- `W A S D` / mouse: move · look in fly mode. | |
| 270 | -- `Space` / `E` · `C` / `Q`: up · down · `Shift` turbo. | |
| 271 | -- `1` `2` `3`: Reset View · Aerial View · Building Height View. | |
| 272 | -- `L` · `G`: legend · opaque ground. | |
| 273 | -- `X` · `/`: clear selection · focus search. | |
| 274 | -- `Esc`: exit fly mode / close search / close Settings. | |
| 60 | +- [Technical documentation](docs/technical-reference.en.md) | |
| 61 | +- [Code ownership](docs/code-ownership.en.md) | |
| 62 | +- [Documentación técnica en español](docs/technical-reference.md) | |
| 63 | +- [Code ownership en español](docs/code-ownership.md) | |
| 275 | 64 | |
| 276 | -## Structure | |
| 65 | +## Quick structure | |
| 277 | 66 | |
| 278 | 67 | ```text |
| 279 | -index.html HTML shell + importmap | |
| 280 | -scan.mjs repository scanner → src/data.js | |
| 281 | -README.md Spanish documentation | |
| 282 | -README.en.md English documentation | |
| 283 | -src/ | |
| 284 | - data.js tree snapshot (generated) | |
| 285 | - i18n.js Spanish/English UI strings and language persistence | |
| 286 | - model.js hierarchy + layout (nested boxes, urban packing) | |
| 287 | - builder.js scene: HDR edges, fresnel glass, façades, PCB ground | |
| 288 | - controls.js orbit + free flight + camera flights | |
| 289 | - ui.js side tree, search, path, stats, Settings, language selector | |
| 290 | - main.js hierarchical selection, raycast, render, visual settings | |
| 291 | -tools/ | |
| 292 | - capture-orbit.mjs captures orbits via Chrome DevTools Protocol | |
| 293 | - detect-black-rects.py detects black rectangles in frames/screenshots | |
| 294 | - compare-black-regressions.py compares orbits against a visual baseline | |
| 295 | -vendor/ Three.js r160 + addons (offline) | |
| 68 | +index.html main UI | |
| 69 | +src/ Three.js app and UI logic | |
| 70 | +docs/ technical docs and presentation assets | |
| 71 | +serve.sh local static server | |
| 72 | +scan.mjs snapshot generator for src/data.js | |
| 296 | 73 | ``` |
modified README.md +57 −388
| @@ -1,404 +1,73 @@ | ||
| 1 | -# VibeCodeViewer — Metrópolis de Cristal | |
| 1 | +# VibeCodeViewer | |
| 2 | 2 | |
| 3 | 3 | **Español** · [English](README.en.md) |
| 4 | 4 | |
| 5 | -Ciudad procedural de **edificios de cristal** (Three.js) que visualiza un | |
| 6 | -repositorio de código como una metrópolis estilo *hacker noventero*: wireframes | |
| 7 | -cian nítidos, suelo de placa de circuito impreso y controles visuales para | |
| 8 | -subir el dramatismo sin depender del postprocesado HDR. | |
| 5 | +Visualiza un repositorio como una ciudad 3D interactiva: carpetas como distritos, módulos como edificios y ficheros como celdas luminosas. | |
| 9 | 6 | |
| 10 | -## Demo de presentación del producto | |
| 7 | +## Presentación | |
| 11 | 8 | |
| 12 | 9 | <p align="center"> |
| 13 | 10 | <a href="docs/assets/vibecodeviewer-hyperframes-presentation.web.mp4"> |
| 14 | - <img src="docs/assets/vibecodeviewer-hyperframes-presentation-readme.gif" alt="Presentación de producto de VibeCodeViewer mostrando topología del repositorio, navegación, búsqueda, Git, ownership, radio de impacto, temas y modo demo guiado" width="900"> | |
| 11 | + <img src="docs/assets/vibecodeviewer-hyperframes-presentation-readme.gif" alt="Presentación de VibeCodeViewer" width="900"> | |
| 15 | 12 | </a> |
| 16 | 13 | </p> |
| 17 | 14 | |
| 18 | -> El renderizado del README de GitHub es más fiable con previsualizaciones GIF | |
| 19 | -> animadas. Haz clic en la animación para abrir el MP4 web optimizado. | |
| 20 | - | |
| 21 | 15 | - [Ver MP4 web optimizado](docs/assets/vibecodeviewer-hyperframes-presentation.web.mp4) |
| 22 | 16 | - [Abrir póster estático](docs/assets/vibecodeviewer-hyperframes-presentation-poster.png) |
| 23 | 17 | |
| 24 | -### Funcionalidades destacadas | |
| 25 | - | |
| 26 | -- **Topología repositorio-como-ciudad:** carpetas como distritos, módulos anidados como edificios y ficheros como celdas luminosas. | |
| 27 | -- **Revisión espacial de arquitectura:** vistas aérea, skyline y cámara guiada para entender profundidad jerárquica y zonas densas de un vistazo. | |
| 28 | -- **Búsqueda y selección de ficheros:** los ficheros coincidentes laten en la ciudad y el seleccionado ilumina toda su ruta por edificio y distrito. | |
| 29 | -- **Capa de estado Git:** colorea ficheros modificados, nuevos, renombrados y borrados con metadatos del repositorio. | |
| 30 | -- **Capa de ownership:** visualiza CODEOWNERS y convenciones `metadata.owner` como regiones de color por propietario. | |
| 31 | -- **Análisis de radio de impacto:** combina imports y uso de símbolos para mostrar dependencias e impacto descendente con haces animados. | |
| 32 | -- **Escaneo local-first:** abre una carpeta directamente en Chrome/Edge y reconstruye la ciudad localmente sin regenerar datos versionados. | |
| 33 | -- **Sótanos de código ignorado:** sitúa ficheros ignorados bajo el plano del suelo y permite ocultarlos/mostrarlos con los controles de suelo. | |
| 34 | -- **Temas y ajustes visuales:** cambia temas y ajusta exposición, contraste, aristas, rótulos, cristal, niebla, suelo y bloom experimental. | |
| 35 | -- **Modo demo guiado:** encadena topología, navegación, búsqueda, capas, temas, settings, leyenda y vista final. | |
| 36 | - | |
| 37 | -## Mapeo repo → ciudad | |
| 38 | - | |
| 39 | -| Repositorio | Ciudad | | |
| 40 | -| ----------------------------- | ------------------------------------------ | | |
| 41 | -| raíz | ciudad | | |
| 42 | -| carpetas de nivel 1 | distritos (plotas moradas en el suelo) | | |
| 43 | -| carpetas de nivel 2 | edificios | | |
| 44 | -| subárboles muy profundos/poblados | **urbanizaciones**: plotas dentro del distrito que agrupan sus subcarpetas como edificios (recursivo) | | |
| 45 | -| anidamiento interior | plantas → apartamentos → habitaciones → archivadores → cajones | | |
| 46 | -| archivos | celdas luminosas (en cualquier nivel) | | |
| 47 | - | |
| 48 | -- **Ancho/profundidad** del edificio ∝ tamaño en bytes de la carpeta (escala log). | |
| 49 | -- **Altura** ∝ número de ficheros contenidos (recursivo). | |
| 50 | -- Sobre la fachada de cristal se imprime el **árbol de ficheros** del edificio; | |
| 51 | - al seleccionar un fichero se resalta su ruta en la propia fachada. | |
| 52 | -- Dentro de un **cajón**, los ficheros se dibujan como carpetas colgantes | |
| 53 | - (láminas verticales); en el resto de niveles, como una rejilla de cubos. | |
| 54 | - | |
| 55 | -## Iluminación jerárquica de densidad | |
| 56 | - | |
| 57 | -Seleccionar un fichero (clic o buscador) enciende su celda al máximo y la luz | |
| 58 | -decae nivel a nivel hacia fuera (×0.56 por salto): | |
| 59 | - | |
| 60 | -``` | |
| 61 | -fichero ▓▓▓▓▓▓ → cajón ▓▓▓▓ → archivador ▓▓▓ → habitación ▓▓ → planta ▓ → edificio ░ → distrito · | |
| 62 | -``` | |
| 63 | - | |
| 64 | -Los niveles interiores encendidos reciben además un relleno volumétrico tenue; | |
| 65 | -el edificio y el distrito solo iluminan aristas y fresnel para no velar el | |
| 66 | -interior (la clave para que no se vea «difuminado»). | |
| 67 | - | |
| 68 | -## Receta anti-difuminado | |
| 69 | - | |
| 70 | -1. Aristas finas en un único `LineSegments` (rangos de color por nodo), con | |
| 71 | - color y opacidad ajustables desde **Settings**. | |
| 72 | -2. Cristal **fresnel** de opacidad mínima (α ≈ 0.02 en el centro de la cara). | |
| 73 | -3. Cero volúmenes aditivos permanentes: los rellenos solo existen mientras un | |
| 74 | - nivel está encendido (pool de 10 cajas reutilizables). | |
| 75 | -4. Render directo por defecto: el antiguo composer HDR/bloom queda como modo | |
| 76 | - experimental (`?bloom=1`) porque algunos drivers producen rectángulos | |
| 77 | - negros screen-space al orbitar. | |
| 78 | - | |
| 79 | -## Extras | |
| 80 | - | |
| 81 | -- **Idioma / Language**: el selector de idioma de la columna izquierda cambia | |
| 82 | - toda la interfaz entre **español** e **inglés**. La preferencia se guarda en | |
| 83 | - `localStorage` (`vcc.language.v1`) y también se puede fijar con `?lang=es` o | |
| 84 | - `?lang=en`. | |
| 85 | -- **Abrir Carpeta…** (Chrome/Edge): escanea cualquier carpeta local con la | |
| 86 | - File System Access API y reconstruye la ciudad al vuelo, sin regenerar | |
| 87 | - `src/data.js`. | |
| 88 | -- **Sótanos**: los ficheros que caen bajo `.gitignore` / `.dockerignore` / | |
| 89 | - `.npmignore` se mapean bajo el plano de circuitos, con el mismo patrón de | |
| 90 | - segmentación pero creciendo hacia abajo (el suelo es semitransparente y en | |
| 91 | - modo vuelo puedes bajar a recorrerlos). En el árbol lateral aparecen en | |
| 92 | - ámbar como `carpeta · sótano` en español o `folder · basement` en inglés. Si una carpeta no tiene **nada** en | |
| 93 | - superficie (todo su contenido está ignorado), en vez de torre se dibuja un | |
| 94 | - **búnker**: una losa baja y más opaca que señala que la información está | |
| 95 | - bajo el suelo. | |
| 96 | -- **Leyenda** (botón o tecla `L`): nombres de los barrios serigrafiados en el | |
| 97 | - suelo como pistas de circuito y nombre de la carpeta en el tejado de cada | |
| 98 | - edificio. | |
| 99 | -- **Pulse de barrio**: el distrito de la selección queda algo más iluminado y | |
| 100 | - late suavemente. | |
| 101 | -- **Sugerencias de búsqueda**: mientras escribes, todos los ficheros que | |
| 102 | - casan parpadean en la ciudad y se resaltan en las fachadas de sus edificios. | |
| 103 | -- **Settings**: panel modal bajo `Reset Vista` con presets visuales y sliders | |
| 104 | - persistentes para exposición, brillo, contraste, saturación, aristas, | |
| 105 | - celdas, cristal, fachadas, rótulos, suelo y niebla. Incluye un toggle | |
| 106 | - explícito para probar **Bloom HDR**; al cambiarlo recarga con/sin | |
| 107 | - `?bloom=1`. | |
| 108 | - | |
| 109 | -## Modos de coloreado | |
| 110 | - | |
| 111 | -Selector arriba al centro (Básico · Git · Owners). El color del fichero se | |
| 112 | -propaga atenuado a toda su jerarquía: cajón, habitación, planta, edificio y | |
| 113 | -barrio se tiñen según lo que contienen. | |
| 114 | - | |
| 115 | -- **Básico**: la paleta cian original. | |
| 116 | -- **Git**: cada fichero según su estado (`scan.mjs` recoge `git status` y | |
| 117 | - `git diff --numstat`): ámbar = modificado, verde = nuevo/sin seguimiento, | |
| 118 | - azul = renombrado. El árbol lateral muestra además un icono de estado y las | |
| 119 | - líneas añadidas/borradas (`+a −d`). Deshabilitado si el snapshot no | |
| 120 | - proviene de un repo git (p. ej. al usar **Abrir Carpeta…**). | |
| 121 | -- **Owners**: parsea `CODEOWNERS` (en cualquier nivel) y los `package.yml` | |
| 122 | - con `metadata.owner` (convención descrita en `code_ownership_files.md`). | |
| 123 | - Cada owner recibe un color (hues en ángulo áureo) y aparece en una leyenda | |
| 124 | - sobre el panel de navegación con su recuento de ficheros. La semántica es | |
| 125 | - la de CODEOWNERS: la última regla que casa gana. Deshabilitado si no se | |
| 126 | - encuentra ninguna regla. | |
| 127 | -- **Blast**: análisis estático en dos capas para estimar el **impacto de un | |
| 128 | - cambio**. (1) Imports por ruta (`src/codeLinks.js`): `import`/`export | |
| 129 | - from`/`require`/`import()` en JS/TS, `#include` en C/C++, `import`/`from` | |
| 130 | - en Python, `@import`/`url()` en CSS, `src`/`href` en HTML, `source` en | |
| 131 | - shell. (2) **Índice de símbolos** (`src/codeIndex.js`) para JS/TS(X), | |
| 132 | - Python, Ruby, C/C++ y Bash: extrae definiciones (funciones, clases, | |
| 133 | - interfaces, types, enums, módulos, constantes, `attr_accessor`/`scope`, | |
| 134 | - `#define`/`typedef`/`using`, funciones bash…) y las cruza con los | |
| 135 | - identificadores usados en los demás ficheros — con filtros anti-ruido: | |
| 136 | - en JS/TS solo cuenta lo exportado, en Python solo el nivel de módulo, | |
| 137 | - stopwords, y los símbolos definidos en >3 ficheros se descartan por | |
| 138 | - ambiguos (máx. 40 aristas/fichero, las menos ambiguas primero). | |
| 139 | - | |
| 140 | - Al seleccionar un fichero: **los que dependen de él** (su impacto: | |
| 141 | - lo importan o usan sus símbolos) se encienden en el color `beamIn` del | |
| 142 | - tema, y **sus dependencias** en `beam`, con haces cuyo pulso viaja en el | |
| 143 | - sentido de la propagación (hacia fuera en impactos, hacia dentro en | |
| 144 | - dependencias). La leyenda muestra ambos recuentos. | |
| 145 | - | |
| 146 | - El análisis por fichero se **cachea** (clave `versión|ruta|tamaño|mtime`): | |
| 147 | - en node en `.cache/analysis.json` y en el navegador en IndexedDB, de modo | |
| 148 | - que re-escanear solo reanaliza lo que cambió. Las definiciones quedan | |
| 149 | - guardadas en `REPO_META.codeIndex.defs` para futuros análisis. Las specs | |
| 150 | - se resuelven contra el árbol real (rutas relativas, `/index.*`, sufijos de | |
| 151 | - paquete tipo `three/addons/...` y nombres sueltos si son únicos). | |
| 152 | - | |
| 153 | -Con **Abrir Carpeta…** el estado git se estima parseando `.git/index` | |
| 154 | -(v2/v3) directamente en el navegador: mismo tamaño y mtime → limpio; difiere | |
| 155 | -→ modificado; ausente del índice → sin seguimiento (sin stats `+/−`, que | |
| 156 | -requieren `git diff`). El análisis Blast y el ownership también se calculan | |
| 157 | -en el navegador, así que los cuatro modos funcionan sobre carpetas locales. | |
| 158 | - | |
| 159 | -## Temas de color | |
| 160 | - | |
| 161 | -Selector «Tema · …» en la columna de botones. Toda la paleta (escena, suelo | |
| 162 | -de circuitos, fachadas, leyendas y variables CSS de la interfaz) vive en | |
| 163 | -`src/themes.js`; cambiar de tema reconstruye solo la ciudad, conservando | |
| 164 | -modelo, cámara y selección. | |
| 165 | - | |
| 166 | -- **Hacker** — el cian/morado original sobre negro. | |
| 167 | -- **Factorial** — corporativo en oscuro con rojo dominante `#E51943` | |
| 168 | - (edificios, celdas, selección) y verde `#007C85` estructural (distritos, | |
| 169 | - serigrafías). Los paneles de la interfaz van en claro (`uiLight`). | |
| 170 | -- **Synthwave** — magenta y naranja atardecer sobre púrpura profundo. | |
| 171 | -- **Matrix** — fósforo verde monocromo sobre negro. | |
| 172 | -- **Glaciar** — azules de hielo y blancos fríos sobre azul marino. | |
| 173 | - | |
| 174 | -Más botones de vista: **Suelo Opaco** (tecla `G`) — translúcido deja intuir | |
| 175 | -los sótanos; opaco escribe profundidad y los **oculta de verdad** (desde | |
| 176 | -debajo, en modo vuelo, se siguen viendo). | |
| 177 | - | |
| 178 | -## Ajustes visuales y bloom | |
| 179 | - | |
| 180 | -El botón **Settings** abre un panel con cuatro presets: | |
| 181 | - | |
| 182 | -- **Seguro**: valores base, render directo. | |
| 183 | -- **Neón**: más saturación y brillo, recomendado para recuperar impacto sin | |
| 184 | - pasar por bloom. | |
| 185 | -- **Cine**: más contraste, niebla algo más densa y suelo menos dominante. | |
| 186 | -- **Intenso**: mayor exposición y potencia de aristas/celdas; es el preset más | |
| 187 | - agresivo probado sin artefactos negros. | |
| 188 | - | |
| 189 | -Los sliders se aplican en caliente y se guardan en `localStorage` bajo | |
| 190 | -`vcc.visualSettings.v1`. El HUD indica si estás en `render directo` o en | |
| 191 | -`bloom ×N`. | |
| 192 | - | |
| 193 | -`?bloom=1` activa el pipeline `EffectComposer` + `UnrealBloomPass`. Se conserva | |
| 194 | -para experimentación, pero no es el modo por defecto: en algunas GPUs/drivers | |
| 195 | -ese render target HDR genera cuadros negros alineados a pantalla durante la | |
| 196 | -órbita. Para volver al modo estable, quita `bloom` de la URL o desmarca | |
| 197 | -**Bloom HDR** en Settings. | |
| 198 | - | |
| 199 | -## Diagnóstico GPU | |
| 200 | - | |
| 201 | -La detección se basa en el renderer WebGL real que entrega el navegador | |
| 202 | -(`WEBGL_debug_renderer_info` cuando está disponible). En Windows/WSLg o capas | |
| 203 | -virtualizadas puede aparecer como `D3D12 virtual`, `Mesa` o `Microsoft` aunque | |
| 204 | -el host tenga una NVIDIA; en ese caso la app lo trata como hardware acelerado, | |
| 205 | -pero no puede inventar la marca si WebGL la oculta. | |
| 206 | - | |
| 207 | -El arranque escribe en consola algo como: | |
| 18 | +## Features | |
| 19 | + | |
| 20 | +- **Mapa ciudad del repositorio**: estructura de carpetas convertida en una metrópolis navegable. | |
| 21 | +- **Búsqueda visual**: busca ficheros y localízalos con pulsos en la ciudad y en el árbol lateral. | |
| 22 | +- **Capas de análisis**: modos Basic, Git, Owners y Blast para revisar estado, propiedad e impacto. | |
| 23 | +- **Blast radius**: muestra dependencias e impacto descendente con haces animados. | |
| 24 | +- **Escaneo local**: abre repositorios directamente desde Chrome/Edge con File System Access API. | |
| 25 | +- **Sótanos para código ignorado**: representa ficheros ignorados por `.gitignore`, `.dockerignore` o `.npmignore` bajo el suelo. | |
| 26 | +- **Temas y ajustes visuales**: cambia paletas y ajusta exposición, contraste, cristal, rótulos, suelo, niebla y bloom. | |
| 27 | +- **Interfaz bilingüe**: español e inglés desde el selector de idioma o con `?lang=es` / `?lang=en`. | |
| 28 | + | |
| 29 | +## Cómo se usa | |
| 30 | + | |
| 31 | +1. Sirve el proyecto: | |
| 32 | + | |
| 33 | + ```bash | |
| 34 | + ./serve.sh | |
| 35 | + # o un puerto concreto | |
| 36 | + ./serve.sh 9000 | |
| 37 | + ``` | |
| 38 | + | |
| 39 | +2. Abre la app en el navegador: | |
| 40 | + | |
| 41 | + ```text | |
| 42 | + http://localhost:8137/ | |
| 43 | + ``` | |
| 44 | + | |
| 45 | +3. Para analizar repositorios locales, entra **siempre con `localhost`** y usa **Abrir Carpeta…**. | |
| 46 | + | |
| 47 | + > Importante: la API de acceso a carpetas del navegador requiere un contexto seguro. `http://localhost` funciona; una URL LAN tipo `http://10.x.x.x:8137` puede cargar la app, pero no sirve para analizar repositorios locales salvo que uses HTTPS o un túnel seguro. | |
| 48 | + | |
| 49 | +4. Selecciona una carpeta/repositorio y navega: | |
| 50 | + | |
| 51 | + - Arrastrar / rueda: orbitar y zoom. | |
| 52 | + - `F`: modo vuelo. | |
| 53 | + - `/`: buscar ficheros. | |
| 54 | + - `L`: leyenda. | |
| 55 | + - `G`: suelo opaco. | |
| 56 | + - `1`, `2`, `3`: reset, vista aérea y vista de altura. | |
| 57 | + | |
| 58 | +## Documentación | |
| 59 | + | |
| 60 | +- [Documentación técnica](docs/technical-reference.md) | |
| 61 | +- [Code ownership](docs/code-ownership.md) | |
| 62 | +- [Technical documentation in English](docs/technical-reference.en.md) | |
| 63 | +- [Code ownership in English](docs/code-ownership.en.md) | |
| 64 | + | |
| 65 | +## Estructura rápida | |
| 208 | 66 | |
| 209 | 67 | ```text |
| 210 | -[gpu] NVIDIA · nivel alta · renderer "ANGLE (...)" · vendor "..." | |
| 211 | -``` | |
| 212 | - | |
| 213 | -Overrides útiles para depurar: | |
| 214 | - | |
| 215 | -- `?gpu=nvidia` fuerza etiqueta/perfil NVIDIA cuando el host sí tiene NVIDIA | |
| 216 | - pero el navegador solo reporta una capa virtual. | |
| 217 | -- `?msaa=N` y `?pr=N` fuerzan multisampling de render target y pixel ratio. | |
| 218 | -- `?bloom=1` activa el composer HDR experimental. | |
| 219 | - | |
| 220 | -## Teclado en el árbol | |
| 221 | - | |
| 222 | -Con el árbol enfocado (clic sobre él): `↑`/`↓` mueven el cursor, `→` | |
| 223 | -despliega una carpeta (o entra en ella), `←` la pliega (o salta al padre), | |
| 224 | -`AvPág`/`RePág` saltan una página y `Enter`/`Espacio` seleccionan el | |
| 225 | -elemento (con vuelo de cámara). | |
| 226 | - | |
| 227 | -## Monorepos grandes | |
| 228 | - | |
| 229 | -Probado con un monorepo real de ~120k ficheros y 42 distritos de primer | |
| 230 | -nivel (vía `tools/tree2data.mjs`, que convierte una salida de `tree` en | |
| 231 | -snapshot para pruebas): | |
| 232 | - | |
| 233 | -- **Urbanizaciones**: un edificio absorbe 5 niveles de anidamiento | |
| 234 | - (planta→…→cajón); cuando una carpeta es más profunda (y tiene >200 | |
| 235 | - ficheros) o simplemente enorme (>2000 ficheros), se convierte en una | |
| 236 | - plota dentro del distrito y sus subcarpetas pasan a ser edificios — de | |
| 237 | - forma recursiva, así la profundidad sobrante se despliega por la ciudad | |
| 238 | - en vez de comprimirse dentro de una torre. Tienen su propio serigrafiado | |
| 239 | - de suelo en la leyenda y se seleccionan desde el árbol como cualquier | |
| 240 | - nivel. | |
| 241 | -- En ciudades con miles de edificios se aplica además una atenuación | |
| 242 | - global suave y **uniforme** a aristas, cristal y celdas (todos los | |
| 243 | - edificios conservan el mismo aspecto entre sí); los perímetros de | |
| 244 | - distritos y urbanizaciones quedan siempre a brillo pleno. | |
| 245 | -- El escaneo del árbol es **completo y sin límite de ficheros**. El análisis | |
| 246 | - Blast lee contenidos solo hasta un presupuesto (20k ficheros / 48 MB), | |
| 247 | - gastado por prioridad (ficheros clave primero, ver `src/filePriority.js`), | |
| 248 | - en lotes con checkpoints reanudables y con la ciudad ya cargada. | |
| 249 | -- **LOD por presupuesto**: solo dibujan aristas las ~12k cajas más | |
| 250 | - relevantes (distritos y edificios siempre); el brillo de aristas y celdas | |
| 251 | - se normaliza **por edificio** (presupuesto de luz constante), de modo que | |
| 252 | - un rascacielos con 50k ficheros no se quema en blanco y un chalet con 20 | |
| 253 | - se ve igual que antes. | |
| 254 | -- Las fachadas con texto se limitan a los 250 edificios mayores, las | |
| 255 | - etiquetas de tejado a 400, y los forjados a 4000 plantas. | |
| 256 | -- El **árbol lateral es perezoso**: las ramas se montan en el DOM al | |
| 257 | - expandirlas (con 150k filas el navegador no sobrevive). La selección | |
| 258 | - sincronizada las expande automáticamente. | |
| 259 | -- `node_modules` y `.git/objects` se omiten siempre. | |
| 260 | - | |
| 261 | -Con **Abrir Carpeta…** sobre un monorepo así, el escaneo tarda un rato | |
| 262 | -(lee el tamaño de cada fichero); el botón muestra el progreso. | |
| 263 | - | |
| 264 | -## Ejecutar | |
| 265 | - | |
| 266 | -Necesita un servidor estático (módulos ES + importmap no funcionan en `file://`): | |
| 267 | - | |
| 268 | -```bash | |
| 269 | -./serve.sh # sirve en todas las interfaces de red y lista las URLs | |
| 270 | -./serve.sh 9000 # puerto alternativo | |
| 271 | -# o a mano: python3 -m http.server 8137 --bind 0.0.0.0 | |
| 272 | -``` | |
| 273 | - | |
| 274 | -Nota: la File System Access API (**Abrir Carpeta…**) requiere contexto | |
| 275 | -seguro; desde otra máquina de la red usa HTTPS o un túnel — en | |
| 276 | -`http://localhost` siempre funciona. | |
| 277 | - | |
| 278 | -Sin build: Three.js r160 vendorizado en `vendor/` (funciona offline). | |
| 279 | - | |
| 280 | -Para regenerar el snapshot del repo (`src/data.js`): | |
| 281 | - | |
| 282 | -```bash | |
| 283 | -node scan.mjs # escanea la carpeta padre | |
| 284 | -node scan.mjs /otra/ruta # o cualquier otro árbol | |
| 285 | -``` | |
| 286 | - | |
| 287 | -## Verificación visual automatizada | |
| 288 | - | |
| 289 | -Hay tres herramientas para grabar órbitas y detectar regresiones de cuadros | |
| 290 | -negros: | |
| 291 | - | |
| 292 | -```bash | |
| 293 | -# 1. Levanta la app y un Chromium con DevTools remoto. | |
| 294 | -./serve.sh 8137 | |
| 295 | -chromium-browser --headless --disable-gpu-sandbox --no-sandbox \ | |
| 296 | - --remote-debugging-port=9223 --window-size=2048,1152 about:blank | |
| 297 | - | |
| 298 | -# 2. Captura una órbita con un tema/preset. | |
| 299 | -node tools/capture-orbit.mjs \ | |
| 300 | - --url=http://localhost:8137/ \ | |
| 301 | - --out=/tmp/vcc-orbit \ | |
| 302 | - --frames=120 --width=2048 --height=1152 --port=9223 --theme=matrix \ | |
| 303 | - --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}' | |
| 304 | - | |
| 305 | -# 3. Genera un vídeo opcional. | |
| 306 | -ffmpeg -y -framerate 30 -i /tmp/vcc-orbit/frame-%04d.png \ | |
| 307 | - -pix_fmt yuv420p /tmp/vcc-orbit.mp4 | |
| 308 | - | |
| 309 | -# 4. Detecta cuadros negros en una órbita. | |
| 310 | -python3 tools/detect-black-rects.py /tmp/vcc-orbit | |
| 311 | - | |
| 312 | -# 5. Detecta el caso de una captura suelta, más sensible a ventanas negras. | |
| 313 | -python3 tools/detect-black-rects.py --scan-windows captura.png | |
| 314 | - | |
| 315 | -# 6. Compara un candidato contra un baseline estable. | |
| 316 | -python3 tools/compare-black-regressions.py /tmp/candidato /tmp/baseline | |
| 317 | -``` | |
| 318 | - | |
| 319 | -`tools/detect-black-rects.py` usa Pillow/NumPy en lugar de OpenCV para no | |
| 320 | -añadir dependencias nuevas. Devuelve código 1 cuando encuentra frames malos. | |
| 321 | - | |
| 322 | -## Modo test: `./serve.sh --test N M [K]` | |
| 323 | - | |
| 324 | -Genera un `src/data.js` sintético y determinista (`tools/gentest.mjs`) para | |
| 325 | -depurar el renderizado con geometría controlada — glitches en interiores | |
| 326 | -profundos, urbanizaciones y serigrafiado de nombres en fachadas/techos. | |
| 327 | - | |
| 328 | -**Sin K**: N cadenas independientes; cada fichero queda al fondo de M | |
| 329 | -carpetas anidadas (`folder_i/folder_i_1/…/file_i`). Cada cadena es un | |
| 330 | -distrito con un único edificio cuyo interior se subdivide M niveles. | |
| 331 | - | |
| 332 | -**Con K (modo urbanización)**: los N ficheros se agrupan; cada distrito | |
| 333 | -`folder_g` contiene un bloque `urb_g` que crea **K carpetas en el nivel de | |
| 334 | -urbanización** (`folder_g_1…folder_g_K`), y cada una continúa su cadena | |
| 335 | -hasta profundidad M total. (El bloque intermedio es necesario: las carpetas | |
| 336 | -de primer nivel son siempre distritos, y la urbanización solo se interpone | |
| 337 | -en los bloques *dentro* de un distrito.) | |
| 338 | - | |
| 339 | -### Cómo decide el modelo cuándo hay urbanización | |
| 340 | - | |
| 341 | -Un edificio absorbe como máximo **5 niveles** de anidamiento interior | |
| 342 | -(planta → apartamento → habitación → archivador → cajón; `URB_DEPTH` en | |
| 343 | -`src/model.js`). Cuando una carpeta excede lo que cabe en una torre, se | |
| 344 | -interpone una **urbanización**: una plota dentro del distrito cuyas | |
| 345 | -subcarpetas pasan a ser edificios (recursivo). Los umbrales (`needsUrb`): | |
| 346 | - | |
| 347 | -- más de **2000 ficheros** en el subárbol (`URB_MAX_FILES`), a cualquier | |
| 348 | - profundidad, o | |
| 349 | -- más de **200 ficheros** (`URB_MIN_FILES`) **y** subárbol de profundidad | |
| 350 | - mayor que 5 — con el generador, M ≥ 8 (el subárbol bajo `urb_g` tiene | |
| 351 | - profundidad M−2). | |
| 352 | - | |
| 353 | -### Ejemplos por profundidad y distribución (verificados contra `buildModel`) | |
| 354 | - | |
| 355 | -```bash | |
| 356 | -./serve.sh --test 2 3 # mínimo: 2 cadenas de 3 carpetas (el ejemplo del header) | |
| 357 | -./serve.sh --test 500 8 # 500 torres de interior profundo (sin urbanizaciones) | |
| 358 | -./serve.sh --test 1000 8 250 # 4 grupos × 250 carpetas, M−2=6 > 5 → 4 urbanizaciones | |
| 359 | -./serve.sh --test 1000 4 250 # mismos grupos pero poco profundos (4−2 ≤ 5) → 4 torres densas | |
| 360 | -./serve.sh --test 2500 3 2500 # 1 grupo de 2500 (> 2000) → urbanización aunque sea plano | |
| 361 | -./serve.sh --test 9000 9 300 # 30 urbanizaciones profundas: estrés de LOD + serigrafiado | |
| 362 | -./serve.sh 8200 --test 100 10 # puerto alternativo + test | |
| 363 | -``` | |
| 364 | - | |
| 365 | -El generador avisa al ejecutarse de si la combinación N/M/K elegida supera | |
| 366 | -o no los umbrales de urbanización. | |
| 367 | - | |
| 368 | -Restaurar el snapshot real: `git checkout -- src/data.js` o relanzar | |
| 369 | -`scan.mjs`. `./serve.sh --help` muestra este resumen. | |
| 370 | - | |
| 371 | -## Controles | |
| 372 | - | |
| 373 | -| Entrada | Acción | | |
| 374 | -| ------------------ | --------------------------------------------- | | |
| 375 | -| arrastrar / rueda | orbitar · zoom | | |
| 376 | -| clic | seleccionar fichero o edificio · vacío = limpiar | | |
| 377 | -| hover | resalta el edificio bajo el cursor | | |
| 378 | -| `F` | **modo vuelo** (pointer-lock, atraviesa paredes) | | |
| 379 | -| `W A S D` / ratón | mover · mirar (en vuelo) | | |
| 380 | -| `Space`/`E` · `C`/`Q` | subir · bajar · `Shift` turbo | | |
| 381 | -| `1` `2` `3` | Reset Vista · Vista Aérea · Vista Altura Edificios | | |
| 382 | -| `L` · `G` | leyenda · suelo opaco | | |
| 383 | -| `X` · `/` | limpiar selección · enfocar el buscador | | |
| 384 | -| `Esc` | salir del vuelo / cerrar buscador / cerrar Settings | | |
| 385 | - | |
| 386 | -## Estructura | |
| 387 | - | |
| 388 | -``` | |
| 389 | -index.html marco HTML + importmap | |
| 390 | -scan.mjs escáner del repo → src/data.js | |
| 391 | -src/ | |
| 392 | - data.js snapshot del árbol (generado) | |
| 393 | - i18n.js textos de UI español/inglés y persistencia de idioma | |
| 394 | - model.js jerarquía + layout (cajas anidadas, empaquetado urbano) | |
| 395 | - builder.js escena: aristas HDR, cristal fresnel, fachadas, suelo PCB | |
| 396 | - controls.js órbita + vuelo libre + vuelos de cámara | |
| 397 | - ui.js árbol lateral, buscador, ruta, stats, Settings | |
| 398 | - main.js selección jerárquica, raycast, render y ajustes visuales | |
| 399 | -tools/ | |
| 400 | - capture-orbit.mjs captura órbitas vía Chrome DevTools Protocol | |
| 401 | - detect-black-rects.py detector de cuadros negros en frames/capturas | |
| 402 | - compare-black-regressions.py compara órbitas contra baseline visual | |
| 403 | -vendor/ Three.js r160 + addons (offline) | |
| 68 | +index.html interfaz principal | |
| 69 | +src/ aplicación Three.js y lógica de UI | |
| 70 | +docs/ documentación técnica y assets de presentación | |
| 71 | +serve.sh servidor estático local | |
| 72 | +scan.mjs generador de snapshot para src/data.js | |
| 404 | 73 | ``` |
deleted code_ownership_files.en.md +0 −52
| @@ -1,52 +0,0 @@ | ||
| 1 | -# Code Ownership — Reference | |
| 2 | - | |
| 3 | -[Español](code_ownership_files.md) · **English** | |
| 4 | - | |
| 5 | -VibeCodeViewer can visualize repository ownership in **Owners** mode by parsing | |
| 6 | -two sources. | |
| 7 | - | |
| 8 | -## 1. CODEOWNERS | |
| 9 | - | |
| 10 | -The standard GitHub/GitLab file. Each line maps a path pattern to one or more | |
| 11 | -owners: | |
| 12 | - | |
| 13 | -```text | |
| 14 | -/src/ @org/frontend-team | |
| 15 | -/backend/ @org/backend-team | |
| 16 | -*.md @org/docs | |
| 17 | -``` | |
| 18 | - | |
| 19 | -The last matching rule wins, following GitHub semantics. VibeCodeViewer parses | |
| 20 | -this in `src/ownership.js`. | |
| 21 | - | |
| 22 | -## 2. `package.yml` with `metadata.owner` | |
| 23 | - | |
| 24 | -A common monorepo convention: each component declares its owner in a | |
| 25 | -`package.yml` file: | |
| 26 | - | |
| 27 | -```yaml | |
| 28 | -metadata: | |
| 29 | - domain: YourDomain | |
| 30 | - owner: '@org/your_team' | |
| 31 | - reviewers: [] | |
| 32 | -``` | |
| 33 | - | |
| 34 | -VibeCodeViewer scans all `package.yml` files in the tree and extracts | |
| 35 | -`metadata.owner` as the owner of the folder that contains it. | |
| 36 | - | |
| 37 | -## Query ownership | |
| 38 | - | |
| 39 | -```bash | |
| 40 | -# Owner of a file according to CODEOWNERS | |
| 41 | -git check-attr CODEOWNERS path/to/your/file.rb | |
| 42 | - | |
| 43 | -# List files for a team | |
| 44 | -grep "@org/team-name" CODEOWNERS | awk '{print $1}' | |
| 45 | -``` | |
| 46 | - | |
| 47 | -## Visualization | |
| 48 | - | |
| 49 | -In **Owners** mode, each owner receives a color (hues distributed with the | |
| 50 | -golden angle) and appears in a legend above the navigation panel with its file | |
| 51 | -count. The color is attenuated through the full hierarchy: drawer, room, floor, | |
| 52 | -building, and district are tinted according to the files they contain. |
deleted code_ownership_files.md +0 −52
| @@ -1,52 +0,0 @@ | ||
| 1 | -# Code Ownership — Referencia | |
| 2 | - | |
| 3 | -**Español** · [English](code_ownership_files.en.md) | |
| 4 | - | |
| 5 | -VibeCodeViewer puede visualizar el ownership de un repositorio (modo **Owners**) | |
| 6 | -parseando dos fuentes: | |
| 7 | - | |
| 8 | -## 1. CODEOWNERS | |
| 9 | - | |
| 10 | -Fichero estándar de GitHub/GitLab. Cada línea asocia un patrón de ruta a uno | |
| 11 | -o más propietarios: | |
| 12 | - | |
| 13 | -``` | |
| 14 | -/src/ @org/frontend-team | |
| 15 | -/backend/ @org/backend-team | |
| 16 | -*.md @org/docs | |
| 17 | -``` | |
| 18 | - | |
| 19 | -La última regla que casa gana (semántica GitHub). VibeCodeViewer lo parsea en | |
| 20 | -`src/ownership.js`. | |
| 21 | - | |
| 22 | -## 2. package.yml con metadata.owner | |
| 23 | - | |
| 24 | -Convención habitual en monorepos: cada componente declara su propietario en un | |
| 25 | -`package.yml`: | |
| 26 | - | |
| 27 | -```yaml | |
| 28 | -metadata: | |
| 29 | - domain: YourDomain | |
| 30 | - owner: '@org/your_team' | |
| 31 | - reviewers: [] | |
| 32 | -``` | |
| 33 | - | |
| 34 | -VibeCodeViewer escanea todos los `package.yml` del árbol y extrae | |
| 35 | -`metadata.owner` como owner de la carpeta que lo contiene. | |
| 36 | - | |
| 37 | -## Consultar ownership | |
| 38 | - | |
| 39 | -```bash | |
| 40 | -# Propietario de un fichero según CODEOWNERS | |
| 41 | -git check-attr CODEOWNERS ruta/a/tu/archivo.rb | |
| 42 | - | |
| 43 | -# Listar ficheros de un equipo | |
| 44 | -grep "@org/team-name" CODEOWNERS | awk '{print $1}' | |
| 45 | -``` | |
| 46 | - | |
| 47 | -## Visualización | |
| 48 | - | |
| 49 | -En el modo **Owners**, cada owner recibe un color (hues en ángulo áureo) y | |
| 50 | -aparece en una leyenda sobre el panel de navegación con su recuento de ficheros. | |
| 51 | -El color se propaga atenuado a toda la jerarquía: cajón, habitación, planta, | |
| 52 | -edificio y barrio se tiñen según lo que contienen. |
added docs/code-ownership.en.md +52 −0
| @@ -0,0 +1,52 @@ | ||
| 1 | +# Code Ownership — Reference | |
| 2 | + | |
| 3 | +[Home](../README.en.md) / [Technical reference](technical-reference.en.md) / Code ownership · [Español](code-ownership.md) | |
| 4 | + | |
| 5 | +VibeCodeViewer can visualize repository ownership in **Owners** mode by parsing | |
| 6 | +two sources. | |
| 7 | + | |
| 8 | +## 1. CODEOWNERS | |
| 9 | + | |
| 10 | +The standard GitHub/GitLab file. Each line maps a path pattern to one or more | |
| 11 | +owners: | |
| 12 | + | |
| 13 | +```text | |
| 14 | +/src/ @org/frontend-team | |
| 15 | +/backend/ @org/backend-team | |
| 16 | +*.md @org/docs | |
| 17 | +``` | |
| 18 | + | |
| 19 | +The last matching rule wins, following GitHub semantics. VibeCodeViewer parses | |
| 20 | +this in `src/ownership.js`. | |
| 21 | + | |
| 22 | +## 2. `package.yml` with `metadata.owner` | |
| 23 | + | |
| 24 | +A common monorepo convention: each component declares its owner in a | |
| 25 | +`package.yml` file: | |
| 26 | + | |
| 27 | +```yaml | |
| 28 | +metadata: | |
| 29 | + domain: YourDomain | |
| 30 | + owner: '@org/your_team' | |
| 31 | + reviewers: [] | |
| 32 | +``` | |
| 33 | + | |
| 34 | +VibeCodeViewer scans all `package.yml` files in the tree and extracts | |
| 35 | +`metadata.owner` as the owner of the folder that contains it. | |
| 36 | + | |
| 37 | +## Query ownership | |
| 38 | + | |
| 39 | +```bash | |
| 40 | +# Owner of a file according to CODEOWNERS | |
| 41 | +git check-attr CODEOWNERS path/to/your/file.rb | |
| 42 | + | |
| 43 | +# List files for a team | |
| 44 | +grep "@org/team-name" CODEOWNERS | awk '{print $1}' | |
| 45 | +``` | |
| 46 | + | |
| 47 | +## Visualization | |
| 48 | + | |
| 49 | +In **Owners** mode, each owner receives a color (hues distributed with the | |
| 50 | +golden angle) and appears in a legend above the navigation panel with its file | |
| 51 | +count. The color is attenuated through the full hierarchy: drawer, room, floor, | |
| 52 | +building, and district are tinted according to the files they contain. |
added docs/code-ownership.md +52 −0
| @@ -0,0 +1,52 @@ | ||
| 1 | +# Code Ownership — Referencia | |
| 2 | + | |
| 3 | +[Inicio](../README.md) / [Referencia técnica](technical-reference.md) / Code ownership · [English](code-ownership.en.md) | |
| 4 | + | |
| 5 | +VibeCodeViewer puede visualizar el ownership de un repositorio (modo **Owners**) | |
| 6 | +parseando dos fuentes: | |
| 7 | + | |
| 8 | +## 1. CODEOWNERS | |
| 9 | + | |
| 10 | +Fichero estándar de GitHub/GitLab. Cada línea asocia un patrón de ruta a uno | |
| 11 | +o más propietarios: | |
| 12 | + | |
| 13 | +``` | |
| 14 | +/src/ @org/frontend-team | |
| 15 | +/backend/ @org/backend-team | |
| 16 | +*.md @org/docs | |
| 17 | +``` | |
| 18 | + | |
| 19 | +La última regla que casa gana (semántica GitHub). VibeCodeViewer lo parsea en | |
| 20 | +`src/ownership.js`. | |
| 21 | + | |
| 22 | +## 2. package.yml con metadata.owner | |
| 23 | + | |
| 24 | +Convención habitual en monorepos: cada componente declara su propietario en un | |
| 25 | +`package.yml`: | |
| 26 | + | |
| 27 | +```yaml | |
| 28 | +metadata: | |
| 29 | + domain: YourDomain | |
| 30 | + owner: '@org/your_team' | |
| 31 | + reviewers: [] | |
| 32 | +``` | |
| 33 | + | |
| 34 | +VibeCodeViewer escanea todos los `package.yml` del árbol y extrae | |
| 35 | +`metadata.owner` como owner de la carpeta que lo contiene. | |
| 36 | + | |
| 37 | +## Consultar ownership | |
| 38 | + | |
| 39 | +```bash | |
| 40 | +# Propietario de un fichero según CODEOWNERS | |
| 41 | +git check-attr CODEOWNERS ruta/a/tu/archivo.rb | |
| 42 | + | |
| 43 | +# Listar ficheros de un equipo | |
| 44 | +grep "@org/team-name" CODEOWNERS | awk '{print $1}' | |
| 45 | +``` | |
| 46 | + | |
| 47 | +## Visualización | |
| 48 | + | |
| 49 | +En el modo **Owners**, cada owner recibe un color (hues en ángulo áureo) y | |
| 50 | +aparece en una leyenda sobre el panel de navegación con su recuento de ficheros. | |
| 51 | +El color se propaga atenuado a toda la jerarquía: cajón, habitación, planta, | |
| 52 | +edificio y barrio se tiñen según lo que contienen. |
added docs/technical-reference.en.md +296 −0
| @@ -0,0 +1,296 @@ | ||
| 1 | +# VibeCodeViewer — Technical reference | |
| 2 | + | |
| 3 | +[Home](../README.en.md) / Technical reference · [Español](technical-reference.md) | |
| 4 | + | |
| 5 | +A procedural **glass-building city** (Three.js) that visualizes a code repository | |
| 6 | +as a sharp, nineties-hacker-style metropolis: cyan wireframes, a circuit-board | |
| 7 | +floor, local-first folder scanning, Git/ownership layers, blast-radius analysis, | |
| 8 | +and visual controls that increase drama without depending on HDR postprocessing. | |
| 9 | + | |
| 10 | +## Product presentation demo | |
| 11 | + | |
| 12 | +<p align="center"> | |
| 13 | + <a href="assets/vibecodeviewer-hyperframes-presentation.web.mp4"> | |
| 14 | + <img src="assets/vibecodeviewer-hyperframes-presentation-readme.gif" alt="VibeCodeViewer product presentation showing repository topology, navigation, search, Git, ownership, blast radius, themes and guided demo mode" width="900"> | |
| 15 | + </a> | |
| 16 | +</p> | |
| 17 | + | |
| 18 | +> GitHub README rendering is most reliable with animated GIF previews. Click the | |
| 19 | +> animation to open the optimized web MP4. | |
| 20 | + | |
| 21 | +- [Watch optimized web MP4](assets/vibecodeviewer-hyperframes-presentation.web.mp4) | |
| 22 | +- [Open static poster](assets/vibecodeviewer-hyperframes-presentation-poster.png) | |
| 23 | + | |
| 24 | +## Language support | |
| 25 | + | |
| 26 | +The application UI is available in **Spanish** and **English**. | |
| 27 | + | |
| 28 | +- Use the language selector in the left control stack. | |
| 29 | +- The choice is stored in `localStorage` under `vcc.language.v1`. | |
| 30 | +- You can force a language at startup with `?lang=es` or `?lang=en`. | |
| 31 | +- User-facing HUD text, search placeholders, settings, loading progress, | |
| 32 | + disabled-mode tooltips, stats, Git labels, and Blast legends are translated. | |
| 33 | + | |
| 34 | +## Highlighted capabilities | |
| 35 | + | |
| 36 | +- **Repository-as-city topology:** folders become districts, nested modules become buildings, and files become luminous cells. | |
| 37 | +- **Spatial architecture review:** aerial, skyline, and guided camera views make hierarchy depth and dense areas readable at a glance. | |
| 38 | +- **File search and selection:** matching files pulse across the city; selecting a file lights its path through building and district. | |
| 39 | +- **Git status layer:** colors modified, new, renamed, and deleted files with repository-aware metadata. | |
| 40 | +- **Ownership layer:** visualizes CODEOWNERS and `metadata.owner` conventions as owner-specific color regions. | |
| 41 | +- **Blast radius analysis:** combines imports and symbol usage to show dependencies and downstream impact with animated beams. | |
| 42 | +- **Local-first scanning:** opens a folder directly in Chrome/Edge and rebuilds the city locally without regenerating checked-in data. | |
| 43 | +- **Ignored-code basements:** maps ignored files below the ground plane and can hide/reveal them with ground controls. | |
| 44 | +- **Themes and visual settings:** switches themes and tunes exposure, contrast, edges, labels, glass, fog, ground, and experimental bloom. | |
| 45 | +- **Guided demo mode:** chains topology, navigation, search, layers, themes, settings, legend, and final overview. | |
| 46 | + | |
| 47 | +## Repository → city mapping | |
| 48 | + | |
| 49 | +- Repository root → city. | |
| 50 | +- First-level folders → districts. | |
| 51 | +- Second-level folders → buildings. | |
| 52 | +- Very deep or dense subtrees → **developments** inside the district; their | |
| 53 | + subfolders become buildings recursively. | |
| 54 | +- Interior nesting → floors → apartments → rooms → filing cabinets → drawers. | |
| 55 | +- Files → luminous cells at any level. | |
| 56 | + | |
| 57 | +Sizing rules: | |
| 58 | + | |
| 59 | +- Building width/depth is proportional to folder byte size using a logarithmic scale. | |
| 60 | +- Height is proportional to recursive file count. | |
| 61 | +- The file tree is printed onto the glass façade of each large building. | |
| 62 | +- Selecting a file highlights its path on the façade. | |
| 63 | +- Inside a drawer, files render as hanging vertical sheets; elsewhere they render as cube grids. | |
| 64 | + | |
| 65 | +## Hierarchical density lighting | |
| 66 | + | |
| 67 | +Selecting a file (click or search) lights its cell at full intensity and the | |
| 68 | +light decays level by level outward (`×0.56` per hop): | |
| 69 | + | |
| 70 | +```text | |
| 71 | +file ▓▓▓▓▓▓ → drawer ▓▓▓▓ → cabinet ▓▓▓ → room ▓▓ → floor ▓ → building ░ → district · | |
| 72 | +``` | |
| 73 | + | |
| 74 | +Lit interior levels receive a subtle volumetric fill. Buildings and districts | |
| 75 | +only light edges and fresnel so the interior remains readable. | |
| 76 | + | |
| 77 | +## Anti-blur recipe | |
| 78 | + | |
| 79 | +1. Thin edges in one `LineSegments` object, with color and opacity tunable from **Settings**. | |
| 80 | +2. Minimal-opacity **fresnel glass** (`α ≈ 0.02` in the face center). | |
| 81 | +3. No permanent additive volumes; fills exist only while a level is active. | |
| 82 | +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. | |
| 83 | + | |
| 84 | +## Extras | |
| 85 | + | |
| 86 | +- **Open Folder…** (Chrome/Edge): scans any local folder with the File System Access API and rebuilds the city live without regenerating `src/data.js`. | |
| 87 | +- **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. | |
| 88 | +- **Legend** (`L` or button): district names are silkscreened onto the floor like circuit traces, and folder names appear on building roofs. | |
| 89 | +- **District pulse:** the district containing the current selection remains slightly brighter and pulses softly. | |
| 90 | +- **Search suggestions:** matching files blink in the city and are highlighted on their buildings' façades as you type. | |
| 91 | +- **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`. | |
| 92 | + | |
| 93 | +## Coloring modes | |
| 94 | + | |
| 95 | +The top-center selector exposes **Basic · Git · Owners · Blast**. File color is | |
| 96 | +attenuated through the hierarchy: drawer, room, floor, building, and district. | |
| 97 | + | |
| 98 | +- **Basic:** the original cyan palette. | |
| 99 | +- **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. | |
| 100 | +- **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](code-ownership.en.md). | |
| 101 | +- **Blast:** estimates the impact of a change in two layers: | |
| 102 | + 1. Path imports (`src/codeLinks.js`) across JS/TS, C/C++, Python, CSS, HTML, and shell. | |
| 103 | + 2. Symbol index (`src/codeIndex.js`) for JS/TS(X), Python, Ruby, C/C++, and Bash. | |
| 104 | + | |
| 105 | +When a file is selected in Blast mode: | |
| 106 | + | |
| 107 | +- Files that depend on it (downstream impact) light up with `beamIn`. | |
| 108 | +- Its dependencies light up with `beam`. | |
| 109 | +- Animated beams show propagation direction and the legend shows both counts. | |
| 110 | + | |
| 111 | +The analysis is cached with key `version|path|size|mtime`: Node uses | |
| 112 | +`.cache/analysis.json`; the browser uses IndexedDB. Re-scanning only reanalyzes | |
| 113 | +changed files. | |
| 114 | + | |
| 115 | +## Color themes | |
| 116 | + | |
| 117 | +The selector displays `Theme · …`. Full palettes live in `src/themes.js`; changing | |
| 118 | +theme rebuilds only the city while keeping the model, camera, and selection. | |
| 119 | + | |
| 120 | +- **Hacker** — original cyan/purple on black. | |
| 121 | +- **Factorial** — dark corporate palette with dominant red `#E51943` and structural green `#007C85`; UI panels are light (`uiLight`). | |
| 122 | +- **Synthwave** — magenta and sunset orange on deep purple. | |
| 123 | +- **Matrix** — monochrome green phosphor on black. | |
| 124 | +- **Glaciar** — ice blues and cool whites on navy. | |
| 125 | + | |
| 126 | +The **Opaque Ground** button (`G`) hides basements by writing depth; translucent | |
| 127 | +ground lets you glimpse them. | |
| 128 | + | |
| 129 | +## Visual settings and bloom | |
| 130 | + | |
| 131 | +The **Settings** button opens four presets: | |
| 132 | + | |
| 133 | +- **Safe:** base values, direct render. | |
| 134 | +- **Neon:** more saturation and brightness without using bloom. | |
| 135 | +- **Cinema:** more contrast, denser fog, less dominant ground. | |
| 136 | +- **Intense:** more exposure and stronger edges/cells; the most aggressive tested preset without black artifacts. | |
| 137 | + | |
| 138 | +Sliders apply live and persist in `localStorage` under `vcc.visualSettings.v1`. | |
| 139 | +The HUD shows whether you are using direct render or `bloom ×N`. | |
| 140 | + | |
| 141 | +`?bloom=1` enables `EffectComposer` + `UnrealBloomPass`. It is kept for | |
| 142 | +experimentation but is not the default because some GPU/driver combinations show | |
| 143 | +black rectangles during orbit. Remove `bloom` from the URL or uncheck **Bloom HDR** | |
| 144 | +to return to stable mode. | |
| 145 | + | |
| 146 | +## GPU diagnostics | |
| 147 | + | |
| 148 | +Detection uses the real WebGL renderer exposed by the browser | |
| 149 | +(`WEBGL_debug_renderer_info` when available). On Windows/WSLg or virtualized | |
| 150 | +layers it may show `D3D12 virtual`, `Mesa`, or `Microsoft` even when the host has | |
| 151 | +an NVIDIA GPU. In that case the app treats it as hardware accelerated but cannot | |
| 152 | +invent the hidden brand. | |
| 153 | + | |
| 154 | +Useful debug overrides: | |
| 155 | + | |
| 156 | +- `?gpu=nvidia` forces the NVIDIA label/profile when the host has NVIDIA but the browser reports a virtual layer. | |
| 157 | +- `?msaa=N` and `?pr=N` force render-target multisampling and pixel ratio. | |
| 158 | +- `?bloom=1` enables the experimental HDR composer. | |
| 159 | + | |
| 160 | +## Keyboard in the tree | |
| 161 | + | |
| 162 | +With the tree focused: | |
| 163 | + | |
| 164 | +- `↑` / `↓`: move cursor. | |
| 165 | +- `→`: expand a folder or enter it. | |
| 166 | +- `←`: collapse or jump to parent. | |
| 167 | +- `PageDown` / `PageUp`: move one page. | |
| 168 | +- `Enter` / `Space`: select the item and fly the camera to it. | |
| 169 | + | |
| 170 | +## Large monorepos | |
| 171 | + | |
| 172 | +Tested with a real monorepo of about 120k files and 42 first-level districts. | |
| 173 | + | |
| 174 | +- **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. | |
| 175 | +- Large cities apply a smooth, uniform attenuation to edges, glass, and cells while keeping district and development perimeters bright. | |
| 176 | +- The tree scan is complete and has no file-count limit. | |
| 177 | +- Blast reads file contents only within a budget (20k files / 48 MB), ordered by priority, in resumable batches. | |
| 178 | +- Edge LOD draws only the most relevant boxes; brightness is normalized per building. | |
| 179 | +- Text façades are limited to the 250 largest buildings; roof labels to 400; slabs to 4000 floors. | |
| 180 | +- The side tree is lazy: branches mount in the DOM only when expanded. | |
| 181 | +- `node_modules` and `.git/objects` are always skipped. | |
| 182 | + | |
| 183 | +## Run | |
| 184 | + | |
| 185 | +A static server is required because ES modules and import maps do not work from | |
| 186 | +`file://`: | |
| 187 | + | |
| 188 | +```bash | |
| 189 | +./serve.sh # serves on all network interfaces and lists URLs | |
| 190 | +./serve.sh 9000 # alternate port | |
| 191 | +# or manually: python3 -m http.server 8137 --bind 0.0.0.0 | |
| 192 | +``` | |
| 193 | + | |
| 194 | +The File System Access API (**Open Folder…**) requires a secure context. From | |
| 195 | +another machine on the network use HTTPS or a tunnel; `http://localhost` works. | |
| 196 | + | |
| 197 | +No build step is required: Three.js r160 is vendored in `vendor/` for offline use. | |
| 198 | + | |
| 199 | +Regenerate the repository snapshot (`src/data.js`): | |
| 200 | + | |
| 201 | +```bash | |
| 202 | +node scan.mjs # scans the parent folder | |
| 203 | +node scan.mjs /other/path # scans another tree | |
| 204 | +``` | |
| 205 | + | |
| 206 | +## Automated visual verification | |
| 207 | + | |
| 208 | +Use these tools to record orbits and detect black-frame regressions: | |
| 209 | + | |
| 210 | +```bash | |
| 211 | +# 1. Start the app and a Chromium instance with remote DevTools. | |
| 212 | +./serve.sh 8137 | |
| 213 | +chromium-browser --headless --disable-gpu-sandbox --no-sandbox \ | |
| 214 | + --remote-debugging-port=9223 --window-size=2048,1152 about:blank | |
| 215 | + | |
| 216 | +# 2. Capture an orbit with a theme/preset. | |
| 217 | +node tools/capture-orbit.mjs \ | |
| 218 | + --url=http://localhost:8137/ \ | |
| 219 | + --out=/tmp/vcc-orbit \ | |
| 220 | + --frames=120 --width=2048 --height=1152 --port=9223 --theme=matrix \ | |
| 221 | + --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}' | |
| 222 | + | |
| 223 | +# 3. Optionally generate a video. | |
| 224 | +ffmpeg -y -framerate 30 -i /tmp/vcc-orbit/frame-%04d.png \ | |
| 225 | + -pix_fmt yuv420p /tmp/vcc-orbit.mp4 | |
| 226 | + | |
| 227 | +# 4. Detect black rectangles in an orbit. | |
| 228 | +python3 tools/detect-black-rects.py /tmp/vcc-orbit | |
| 229 | + | |
| 230 | +# 5. Detect the case of one screenshot, more sensitive to black windows. | |
| 231 | +python3 tools/detect-black-rects.py --scan-windows screenshot.png | |
| 232 | + | |
| 233 | +# 6. Compare a candidate against a stable baseline. | |
| 234 | +python3 tools/compare-black-regressions.py /tmp/candidate /tmp/baseline | |
| 235 | +``` | |
| 236 | + | |
| 237 | +`tools/detect-black-rects.py` uses Pillow/NumPy instead of OpenCV to avoid new | |
| 238 | +dependencies. It exits with code 1 when bad frames are found. | |
| 239 | + | |
| 240 | +## Test mode: `./serve.sh --test N M [K]` | |
| 241 | + | |
| 242 | +Generates deterministic synthetic `src/data.js` via `tools/gentest.mjs` for | |
| 243 | +rendering tests with controlled geometry. | |
| 244 | + | |
| 245 | +- **Without K:** N independent chains; each file lives at the bottom of M nested folders. | |
| 246 | +- **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. | |
| 247 | + | |
| 248 | +Examples: | |
| 249 | + | |
| 250 | +```bash | |
| 251 | +./serve.sh --test 2 3 | |
| 252 | +./serve.sh --test 500 8 | |
| 253 | +./serve.sh --test 1000 8 250 | |
| 254 | +./serve.sh --test 1000 4 250 | |
| 255 | +./serve.sh --test 2500 3 2500 | |
| 256 | +./serve.sh --test 9000 9 300 | |
| 257 | +./serve.sh 8200 --test 100 10 | |
| 258 | +``` | |
| 259 | + | |
| 260 | +Restore the real snapshot with `git checkout -- src/data.js` or rerun `scan.mjs`. | |
| 261 | +`./serve.sh --help` prints a summary. | |
| 262 | + | |
| 263 | +## Controls | |
| 264 | + | |
| 265 | +- Drag / wheel: orbit · zoom. | |
| 266 | +- Click: select file or building; empty click clears selection. | |
| 267 | +- Hover: highlights building under cursor. | |
| 268 | +- `F`: **fly mode** with pointer lock; crosses walls. | |
| 269 | +- `W A S D` / mouse: move · look in fly mode. | |
| 270 | +- `Space` / `E` · `C` / `Q`: up · down · `Shift` turbo. | |
| 271 | +- `1` `2` `3`: Reset View · Aerial View · Building Height View. | |
| 272 | +- `L` · `G`: legend · opaque ground. | |
| 273 | +- `X` · `/`: clear selection · focus search. | |
| 274 | +- `Esc`: exit fly mode / close search / close Settings. | |
| 275 | + | |
| 276 | +## Structure | |
| 277 | + | |
| 278 | +```text | |
| 279 | +index.html HTML shell + importmap | |
| 280 | +scan.mjs repository scanner → src/data.js | |
| 281 | +README.md Spanish documentation | |
| 282 | +README.en.md English documentation | |
| 283 | +src/ | |
| 284 | + data.js tree snapshot (generated) | |
| 285 | + i18n.js Spanish/English UI strings and language persistence | |
| 286 | + model.js hierarchy + layout (nested boxes, urban packing) | |
| 287 | + builder.js scene: HDR edges, fresnel glass, façades, PCB ground | |
| 288 | + controls.js orbit + free flight + camera flights | |
| 289 | + ui.js side tree, search, path, stats, Settings, language selector | |
| 290 | + main.js hierarchical selection, raycast, render, visual settings | |
| 291 | +tools/ | |
| 292 | + capture-orbit.mjs captures orbits via Chrome DevTools Protocol | |
| 293 | + detect-black-rects.py detects black rectangles in frames/screenshots | |
| 294 | + compare-black-regressions.py compares orbits against a visual baseline | |
| 295 | +vendor/ Three.js r160 + addons (offline) | |
| 296 | +``` |
added docs/technical-reference.md +404 −0
| @@ -0,0 +1,404 @@ | ||
| 1 | +# VibeCodeViewer — Referencia técnica | |
| 2 | + | |
| 3 | +[Inicio](../README.md) / Referencia técnica · [English](technical-reference.en.md) | |
| 4 | + | |
| 5 | +Ciudad procedural de **edificios de cristal** (Three.js) que visualiza un | |
| 6 | +repositorio de código como una metrópolis estilo *hacker noventero*: wireframes | |
| 7 | +cian nítidos, suelo de placa de circuito impreso y controles visuales para | |
| 8 | +subir el dramatismo sin depender del postprocesado HDR. | |
| 9 | + | |
| 10 | +## Demo de presentación del producto | |
| 11 | + | |
| 12 | +<p align="center"> | |
| 13 | + <a href="assets/vibecodeviewer-hyperframes-presentation.web.mp4"> | |
| 14 | + <img src="assets/vibecodeviewer-hyperframes-presentation-readme.gif" alt="Presentación de producto de VibeCodeViewer mostrando topología del repositorio, navegación, búsqueda, Git, ownership, radio de impacto, temas y modo demo guiado" width="900"> | |
| 15 | + </a> | |
| 16 | +</p> | |
| 17 | + | |
| 18 | +> El renderizado del README de GitHub es más fiable con previsualizaciones GIF | |
| 19 | +> animadas. Haz clic en la animación para abrir el MP4 web optimizado. | |
| 20 | + | |
| 21 | +- [Ver MP4 web optimizado](assets/vibecodeviewer-hyperframes-presentation.web.mp4) | |
| 22 | +- [Abrir póster estático](assets/vibecodeviewer-hyperframes-presentation-poster.png) | |
| 23 | + | |
| 24 | +### Funcionalidades destacadas | |
| 25 | + | |
| 26 | +- **Topología repositorio-como-ciudad:** carpetas como distritos, módulos anidados como edificios y ficheros como celdas luminosas. | |
| 27 | +- **Revisión espacial de arquitectura:** vistas aérea, skyline y cámara guiada para entender profundidad jerárquica y zonas densas de un vistazo. | |
| 28 | +- **Búsqueda y selección de ficheros:** los ficheros coincidentes laten en la ciudad y el seleccionado ilumina toda su ruta por edificio y distrito. | |
| 29 | +- **Capa de estado Git:** colorea ficheros modificados, nuevos, renombrados y borrados con metadatos del repositorio. | |
| 30 | +- **Capa de ownership:** visualiza CODEOWNERS y convenciones `metadata.owner` como regiones de color por propietario. | |
| 31 | +- **Análisis de radio de impacto:** combina imports y uso de símbolos para mostrar dependencias e impacto descendente con haces animados. | |
| 32 | +- **Escaneo local-first:** abre una carpeta directamente en Chrome/Edge y reconstruye la ciudad localmente sin regenerar datos versionados. | |
| 33 | +- **Sótanos de código ignorado:** sitúa ficheros ignorados bajo el plano del suelo y permite ocultarlos/mostrarlos con los controles de suelo. | |
| 34 | +- **Temas y ajustes visuales:** cambia temas y ajusta exposición, contraste, aristas, rótulos, cristal, niebla, suelo y bloom experimental. | |
| 35 | +- **Modo demo guiado:** encadena topología, navegación, búsqueda, capas, temas, settings, leyenda y vista final. | |
| 36 | + | |
| 37 | +## Mapeo repo → ciudad | |
| 38 | + | |
| 39 | +| Repositorio | Ciudad | | |
| 40 | +| ----------------------------- | ------------------------------------------ | | |
| 41 | +| raíz | ciudad | | |
| 42 | +| carpetas de nivel 1 | distritos (plotas moradas en el suelo) | | |
| 43 | +| carpetas de nivel 2 | edificios | | |
| 44 | +| subárboles muy profundos/poblados | **urbanizaciones**: plotas dentro del distrito que agrupan sus subcarpetas como edificios (recursivo) | | |
| 45 | +| anidamiento interior | plantas → apartamentos → habitaciones → archivadores → cajones | | |
| 46 | +| archivos | celdas luminosas (en cualquier nivel) | | |
| 47 | + | |
| 48 | +- **Ancho/profundidad** del edificio ∝ tamaño en bytes de la carpeta (escala log). | |
| 49 | +- **Altura** ∝ número de ficheros contenidos (recursivo). | |
| 50 | +- Sobre la fachada de cristal se imprime el **árbol de ficheros** del edificio; | |
| 51 | + al seleccionar un fichero se resalta su ruta en la propia fachada. | |
| 52 | +- Dentro de un **cajón**, los ficheros se dibujan como carpetas colgantes | |
| 53 | + (láminas verticales); en el resto de niveles, como una rejilla de cubos. | |
| 54 | + | |
| 55 | +## Iluminación jerárquica de densidad | |
| 56 | + | |
| 57 | +Seleccionar un fichero (clic o buscador) enciende su celda al máximo y la luz | |
| 58 | +decae nivel a nivel hacia fuera (×0.56 por salto): | |
| 59 | + | |
| 60 | +``` | |
| 61 | +fichero ▓▓▓▓▓▓ → cajón ▓▓▓▓ → archivador ▓▓▓ → habitación ▓▓ → planta ▓ → edificio ░ → distrito · | |
| 62 | +``` | |
| 63 | + | |
| 64 | +Los niveles interiores encendidos reciben además un relleno volumétrico tenue; | |
| 65 | +el edificio y el distrito solo iluminan aristas y fresnel para no velar el | |
| 66 | +interior (la clave para que no se vea «difuminado»). | |
| 67 | + | |
| 68 | +## Receta anti-difuminado | |
| 69 | + | |
| 70 | +1. Aristas finas en un único `LineSegments` (rangos de color por nodo), con | |
| 71 | + color y opacidad ajustables desde **Settings**. | |
| 72 | +2. Cristal **fresnel** de opacidad mínima (α ≈ 0.02 en el centro de la cara). | |
| 73 | +3. Cero volúmenes aditivos permanentes: los rellenos solo existen mientras un | |
| 74 | + nivel está encendido (pool de 10 cajas reutilizables). | |
| 75 | +4. Render directo por defecto: el antiguo composer HDR/bloom queda como modo | |
| 76 | + experimental (`?bloom=1`) porque algunos drivers producen rectángulos | |
| 77 | + negros screen-space al orbitar. | |
| 78 | + | |
| 79 | +## Extras | |
| 80 | + | |
| 81 | +- **Idioma / Language**: el selector de idioma de la columna izquierda cambia | |
| 82 | + toda la interfaz entre **español** e **inglés**. La preferencia se guarda en | |
| 83 | + `localStorage` (`vcc.language.v1`) y también se puede fijar con `?lang=es` o | |
| 84 | + `?lang=en`. | |
| 85 | +- **Abrir Carpeta…** (Chrome/Edge): escanea cualquier carpeta local con la | |
| 86 | + File System Access API y reconstruye la ciudad al vuelo, sin regenerar | |
| 87 | + `src/data.js`. | |
| 88 | +- **Sótanos**: los ficheros que caen bajo `.gitignore` / `.dockerignore` / | |
| 89 | + `.npmignore` se mapean bajo el plano de circuitos, con el mismo patrón de | |
| 90 | + segmentación pero creciendo hacia abajo (el suelo es semitransparente y en | |
| 91 | + modo vuelo puedes bajar a recorrerlos). En el árbol lateral aparecen en | |
| 92 | + ámbar como `carpeta · sótano` en español o `folder · basement` en inglés. Si una carpeta no tiene **nada** en | |
| 93 | + superficie (todo su contenido está ignorado), en vez de torre se dibuja un | |
| 94 | + **búnker**: una losa baja y más opaca que señala que la información está | |
| 95 | + bajo el suelo. | |
| 96 | +- **Leyenda** (botón o tecla `L`): nombres de los barrios serigrafiados en el | |
| 97 | + suelo como pistas de circuito y nombre de la carpeta en el tejado de cada | |
| 98 | + edificio. | |
| 99 | +- **Pulse de barrio**: el distrito de la selección queda algo más iluminado y | |
| 100 | + late suavemente. | |
| 101 | +- **Sugerencias de búsqueda**: mientras escribes, todos los ficheros que | |
| 102 | + casan parpadean en la ciudad y se resaltan en las fachadas de sus edificios. | |
| 103 | +- **Settings**: panel modal bajo `Reset Vista` con presets visuales y sliders | |
| 104 | + persistentes para exposición, brillo, contraste, saturación, aristas, | |
| 105 | + celdas, cristal, fachadas, rótulos, suelo y niebla. Incluye un toggle | |
| 106 | + explícito para probar **Bloom HDR**; al cambiarlo recarga con/sin | |
| 107 | + `?bloom=1`. | |
| 108 | + | |
| 109 | +## Modos de coloreado | |
| 110 | + | |
| 111 | +Selector arriba al centro (Básico · Git · Owners). El color del fichero se | |
| 112 | +propaga atenuado a toda su jerarquía: cajón, habitación, planta, edificio y | |
| 113 | +barrio se tiñen según lo que contienen. | |
| 114 | + | |
| 115 | +- **Básico**: la paleta cian original. | |
| 116 | +- **Git**: cada fichero según su estado (`scan.mjs` recoge `git status` y | |
| 117 | + `git diff --numstat`): ámbar = modificado, verde = nuevo/sin seguimiento, | |
| 118 | + azul = renombrado. El árbol lateral muestra además un icono de estado y las | |
| 119 | + líneas añadidas/borradas (`+a −d`). Deshabilitado si el snapshot no | |
| 120 | + proviene de un repo git (p. ej. al usar **Abrir Carpeta…**). | |
| 121 | +- **Owners**: parsea `CODEOWNERS` (en cualquier nivel) y los `package.yml` | |
| 122 | + con `metadata.owner` (convención descrita en [Code ownership](code-ownership.md)). | |
| 123 | + Cada owner recibe un color (hues en ángulo áureo) y aparece en una leyenda | |
| 124 | + sobre el panel de navegación con su recuento de ficheros. La semántica es | |
| 125 | + la de CODEOWNERS: la última regla que casa gana. Deshabilitado si no se | |
| 126 | + encuentra ninguna regla. | |
| 127 | +- **Blast**: análisis estático en dos capas para estimar el **impacto de un | |
| 128 | + cambio**. (1) Imports por ruta (`src/codeLinks.js`): `import`/`export | |
| 129 | + from`/`require`/`import()` en JS/TS, `#include` en C/C++, `import`/`from` | |
| 130 | + en Python, `@import`/`url()` en CSS, `src`/`href` en HTML, `source` en | |
| 131 | + shell. (2) **Índice de símbolos** (`src/codeIndex.js`) para JS/TS(X), | |
| 132 | + Python, Ruby, C/C++ y Bash: extrae definiciones (funciones, clases, | |
| 133 | + interfaces, types, enums, módulos, constantes, `attr_accessor`/`scope`, | |
| 134 | + `#define`/`typedef`/`using`, funciones bash…) y las cruza con los | |
| 135 | + identificadores usados en los demás ficheros — con filtros anti-ruido: | |
| 136 | + en JS/TS solo cuenta lo exportado, en Python solo el nivel de módulo, | |
| 137 | + stopwords, y los símbolos definidos en >3 ficheros se descartan por | |
| 138 | + ambiguos (máx. 40 aristas/fichero, las menos ambiguas primero). | |
| 139 | + | |
| 140 | + Al seleccionar un fichero: **los que dependen de él** (su impacto: | |
| 141 | + lo importan o usan sus símbolos) se encienden en el color `beamIn` del | |
| 142 | + tema, y **sus dependencias** en `beam`, con haces cuyo pulso viaja en el | |
| 143 | + sentido de la propagación (hacia fuera en impactos, hacia dentro en | |
| 144 | + dependencias). La leyenda muestra ambos recuentos. | |
| 145 | + | |
| 146 | + El análisis por fichero se **cachea** (clave `versión|ruta|tamaño|mtime`): | |
| 147 | + en node en `.cache/analysis.json` y en el navegador en IndexedDB, de modo | |
| 148 | + que re-escanear solo reanaliza lo que cambió. Las definiciones quedan | |
| 149 | + guardadas en `REPO_META.codeIndex.defs` para futuros análisis. Las specs | |
| 150 | + se resuelven contra el árbol real (rutas relativas, `/index.*`, sufijos de | |
| 151 | + paquete tipo `three/addons/...` y nombres sueltos si son únicos). | |
| 152 | + | |
| 153 | +Con **Abrir Carpeta…** el estado git se estima parseando `.git/index` | |
| 154 | +(v2/v3) directamente en el navegador: mismo tamaño y mtime → limpio; difiere | |
| 155 | +→ modificado; ausente del índice → sin seguimiento (sin stats `+/−`, que | |
| 156 | +requieren `git diff`). El análisis Blast y el ownership también se calculan | |
| 157 | +en el navegador, así que los cuatro modos funcionan sobre carpetas locales. | |
| 158 | + | |
| 159 | +## Temas de color | |
| 160 | + | |
| 161 | +Selector «Tema · …» en la columna de botones. Toda la paleta (escena, suelo | |
| 162 | +de circuitos, fachadas, leyendas y variables CSS de la interfaz) vive en | |
| 163 | +`src/themes.js`; cambiar de tema reconstruye solo la ciudad, conservando | |
| 164 | +modelo, cámara y selección. | |
| 165 | + | |
| 166 | +- **Hacker** — el cian/morado original sobre negro. | |
| 167 | +- **Factorial** — corporativo en oscuro con rojo dominante `#E51943` | |
| 168 | + (edificios, celdas, selección) y verde `#007C85` estructural (distritos, | |
| 169 | + serigrafías). Los paneles de la interfaz van en claro (`uiLight`). | |
| 170 | +- **Synthwave** — magenta y naranja atardecer sobre púrpura profundo. | |
| 171 | +- **Matrix** — fósforo verde monocromo sobre negro. | |
| 172 | +- **Glaciar** — azules de hielo y blancos fríos sobre azul marino. | |
| 173 | + | |
| 174 | +Más botones de vista: **Suelo Opaco** (tecla `G`) — translúcido deja intuir | |
| 175 | +los sótanos; opaco escribe profundidad y los **oculta de verdad** (desde | |
| 176 | +debajo, en modo vuelo, se siguen viendo). | |
| 177 | + | |
| 178 | +## Ajustes visuales y bloom | |
| 179 | + | |
| 180 | +El botón **Settings** abre un panel con cuatro presets: | |
| 181 | + | |
| 182 | +- **Seguro**: valores base, render directo. | |
| 183 | +- **Neón**: más saturación y brillo, recomendado para recuperar impacto sin | |
| 184 | + pasar por bloom. | |
| 185 | +- **Cine**: más contraste, niebla algo más densa y suelo menos dominante. | |
| 186 | +- **Intenso**: mayor exposición y potencia de aristas/celdas; es el preset más | |
| 187 | + agresivo probado sin artefactos negros. | |
| 188 | + | |
| 189 | +Los sliders se aplican en caliente y se guardan en `localStorage` bajo | |
| 190 | +`vcc.visualSettings.v1`. El HUD indica si estás en `render directo` o en | |
| 191 | +`bloom ×N`. | |
| 192 | + | |
| 193 | +`?bloom=1` activa el pipeline `EffectComposer` + `UnrealBloomPass`. Se conserva | |
| 194 | +para experimentación, pero no es el modo por defecto: en algunas GPUs/drivers | |
| 195 | +ese render target HDR genera cuadros negros alineados a pantalla durante la | |
| 196 | +órbita. Para volver al modo estable, quita `bloom` de la URL o desmarca | |
| 197 | +**Bloom HDR** en Settings. | |
| 198 | + | |
| 199 | +## Diagnóstico GPU | |
| 200 | + | |
| 201 | +La detección se basa en el renderer WebGL real que entrega el navegador | |
| 202 | +(`WEBGL_debug_renderer_info` cuando está disponible). En Windows/WSLg o capas | |
| 203 | +virtualizadas puede aparecer como `D3D12 virtual`, `Mesa` o `Microsoft` aunque | |
| 204 | +el host tenga una NVIDIA; en ese caso la app lo trata como hardware acelerado, | |
| 205 | +pero no puede inventar la marca si WebGL la oculta. | |
| 206 | + | |
| 207 | +El arranque escribe en consola algo como: | |
| 208 | + | |
| 209 | +```text | |
| 210 | +[gpu] NVIDIA · nivel alta · renderer "ANGLE (...)" · vendor "..." | |
| 211 | +``` | |
| 212 | + | |
| 213 | +Overrides útiles para depurar: | |
| 214 | + | |
| 215 | +- `?gpu=nvidia` fuerza etiqueta/perfil NVIDIA cuando el host sí tiene NVIDIA | |
| 216 | + pero el navegador solo reporta una capa virtual. | |
| 217 | +- `?msaa=N` y `?pr=N` fuerzan multisampling de render target y pixel ratio. | |
| 218 | +- `?bloom=1` activa el composer HDR experimental. | |
| 219 | + | |
| 220 | +## Teclado en el árbol | |
| 221 | + | |
| 222 | +Con el árbol enfocado (clic sobre él): `↑`/`↓` mueven el cursor, `→` | |
| 223 | +despliega una carpeta (o entra en ella), `←` la pliega (o salta al padre), | |
| 224 | +`AvPág`/`RePág` saltan una página y `Enter`/`Espacio` seleccionan el | |
| 225 | +elemento (con vuelo de cámara). | |
| 226 | + | |
| 227 | +## Monorepos grandes | |
| 228 | + | |
| 229 | +Probado con un monorepo real de ~120k ficheros y 42 distritos de primer | |
| 230 | +nivel (vía `tools/tree2data.mjs`, que convierte una salida de `tree` en | |
| 231 | +snapshot para pruebas): | |
| 232 | + | |
| 233 | +- **Urbanizaciones**: un edificio absorbe 5 niveles de anidamiento | |
| 234 | + (planta→…→cajón); cuando una carpeta es más profunda (y tiene >200 | |
| 235 | + ficheros) o simplemente enorme (>2000 ficheros), se convierte en una | |
| 236 | + plota dentro del distrito y sus subcarpetas pasan a ser edificios — de | |
| 237 | + forma recursiva, así la profundidad sobrante se despliega por la ciudad | |
| 238 | + en vez de comprimirse dentro de una torre. Tienen su propio serigrafiado | |
| 239 | + de suelo en la leyenda y se seleccionan desde el árbol como cualquier | |
| 240 | + nivel. | |
| 241 | +- En ciudades con miles de edificios se aplica además una atenuación | |
| 242 | + global suave y **uniforme** a aristas, cristal y celdas (todos los | |
| 243 | + edificios conservan el mismo aspecto entre sí); los perímetros de | |
| 244 | + distritos y urbanizaciones quedan siempre a brillo pleno. | |
| 245 | +- El escaneo del árbol es **completo y sin límite de ficheros**. El análisis | |
| 246 | + Blast lee contenidos solo hasta un presupuesto (20k ficheros / 48 MB), | |
| 247 | + gastado por prioridad (ficheros clave primero, ver `src/filePriority.js`), | |
| 248 | + en lotes con checkpoints reanudables y con la ciudad ya cargada. | |
| 249 | +- **LOD por presupuesto**: solo dibujan aristas las ~12k cajas más | |
| 250 | + relevantes (distritos y edificios siempre); el brillo de aristas y celdas | |
| 251 | + se normaliza **por edificio** (presupuesto de luz constante), de modo que | |
| 252 | + un rascacielos con 50k ficheros no se quema en blanco y un chalet con 20 | |
| 253 | + se ve igual que antes. | |
| 254 | +- Las fachadas con texto se limitan a los 250 edificios mayores, las | |
| 255 | + etiquetas de tejado a 400, y los forjados a 4000 plantas. | |
| 256 | +- El **árbol lateral es perezoso**: las ramas se montan en el DOM al | |
| 257 | + expandirlas (con 150k filas el navegador no sobrevive). La selección | |
| 258 | + sincronizada las expande automáticamente. | |
| 259 | +- `node_modules` y `.git/objects` se omiten siempre. | |
| 260 | + | |
| 261 | +Con **Abrir Carpeta…** sobre un monorepo así, el escaneo tarda un rato | |
| 262 | +(lee el tamaño de cada fichero); el botón muestra el progreso. | |
| 263 | + | |
| 264 | +## Ejecutar | |
| 265 | + | |
| 266 | +Necesita un servidor estático (módulos ES + importmap no funcionan en `file://`): | |
| 267 | + | |
| 268 | +```bash | |
| 269 | +./serve.sh # sirve en todas las interfaces de red y lista las URLs | |
| 270 | +./serve.sh 9000 # puerto alternativo | |
| 271 | +# o a mano: python3 -m http.server 8137 --bind 0.0.0.0 | |
| 272 | +``` | |
| 273 | + | |
| 274 | +Nota: la File System Access API (**Abrir Carpeta…**) requiere contexto | |
| 275 | +seguro; desde otra máquina de la red usa HTTPS o un túnel — en | |
| 276 | +`http://localhost` siempre funciona. | |
| 277 | + | |
| 278 | +Sin build: Three.js r160 vendorizado en `vendor/` (funciona offline). | |
| 279 | + | |
| 280 | +Para regenerar el snapshot del repo (`src/data.js`): | |
| 281 | + | |
| 282 | +```bash | |
| 283 | +node scan.mjs # escanea la carpeta padre | |
| 284 | +node scan.mjs /otra/ruta # o cualquier otro árbol | |
| 285 | +``` | |
| 286 | + | |
| 287 | +## Verificación visual automatizada | |
| 288 | + | |
| 289 | +Hay tres herramientas para grabar órbitas y detectar regresiones de cuadros | |
| 290 | +negros: | |
| 291 | + | |
| 292 | +```bash | |
| 293 | +# 1. Levanta la app y un Chromium con DevTools remoto. | |
| 294 | +./serve.sh 8137 | |
| 295 | +chromium-browser --headless --disable-gpu-sandbox --no-sandbox \ | |
| 296 | + --remote-debugging-port=9223 --window-size=2048,1152 about:blank | |
| 297 | + | |
| 298 | +# 2. Captura una órbita con un tema/preset. | |
| 299 | +node tools/capture-orbit.mjs \ | |
| 300 | + --url=http://localhost:8137/ \ | |
| 301 | + --out=/tmp/vcc-orbit \ | |
| 302 | + --frames=120 --width=2048 --height=1152 --port=9223 --theme=matrix \ | |
| 303 | + --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}' | |
| 304 | + | |
| 305 | +# 3. Genera un vídeo opcional. | |
| 306 | +ffmpeg -y -framerate 30 -i /tmp/vcc-orbit/frame-%04d.png \ | |
| 307 | + -pix_fmt yuv420p /tmp/vcc-orbit.mp4 | |
| 308 | + | |
| 309 | +# 4. Detecta cuadros negros en una órbita. | |
| 310 | +python3 tools/detect-black-rects.py /tmp/vcc-orbit | |
| 311 | + | |
| 312 | +# 5. Detecta el caso de una captura suelta, más sensible a ventanas negras. | |
| 313 | +python3 tools/detect-black-rects.py --scan-windows captura.png | |
| 314 | + | |
| 315 | +# 6. Compara un candidato contra un baseline estable. | |
| 316 | +python3 tools/compare-black-regressions.py /tmp/candidato /tmp/baseline | |
| 317 | +``` | |
| 318 | + | |
| 319 | +`tools/detect-black-rects.py` usa Pillow/NumPy en lugar de OpenCV para no | |
| 320 | +añadir dependencias nuevas. Devuelve código 1 cuando encuentra frames malos. | |
| 321 | + | |
| 322 | +## Modo test: `./serve.sh --test N M [K]` | |
| 323 | + | |
| 324 | +Genera un `src/data.js` sintético y determinista (`tools/gentest.mjs`) para | |
| 325 | +depurar el renderizado con geometría controlada — glitches en interiores | |
| 326 | +profundos, urbanizaciones y serigrafiado de nombres en fachadas/techos. | |
| 327 | + | |
| 328 | +**Sin K**: N cadenas independientes; cada fichero queda al fondo de M | |
| 329 | +carpetas anidadas (`folder_i/folder_i_1/…/file_i`). Cada cadena es un | |
| 330 | +distrito con un único edificio cuyo interior se subdivide M niveles. | |
| 331 | + | |
| 332 | +**Con K (modo urbanización)**: los N ficheros se agrupan; cada distrito | |
| 333 | +`folder_g` contiene un bloque `urb_g` que crea **K carpetas en el nivel de | |
| 334 | +urbanización** (`folder_g_1…folder_g_K`), y cada una continúa su cadena | |
| 335 | +hasta profundidad M total. (El bloque intermedio es necesario: las carpetas | |
| 336 | +de primer nivel son siempre distritos, y la urbanización solo se interpone | |
| 337 | +en los bloques *dentro* de un distrito.) | |
| 338 | + | |
| 339 | +### Cómo decide el modelo cuándo hay urbanización | |
| 340 | + | |
| 341 | +Un edificio absorbe como máximo **5 niveles** de anidamiento interior | |
| 342 | +(planta → apartamento → habitación → archivador → cajón; `URB_DEPTH` en | |
| 343 | +`src/model.js`). Cuando una carpeta excede lo que cabe en una torre, se | |
| 344 | +interpone una **urbanización**: una plota dentro del distrito cuyas | |
| 345 | +subcarpetas pasan a ser edificios (recursivo). Los umbrales (`needsUrb`): | |
| 346 | + | |
| 347 | +- más de **2000 ficheros** en el subárbol (`URB_MAX_FILES`), a cualquier | |
| 348 | + profundidad, o | |
| 349 | +- más de **200 ficheros** (`URB_MIN_FILES`) **y** subárbol de profundidad | |
| 350 | + mayor que 5 — con el generador, M ≥ 8 (el subárbol bajo `urb_g` tiene | |
| 351 | + profundidad M−2). | |
| 352 | + | |
| 353 | +### Ejemplos por profundidad y distribución (verificados contra `buildModel`) | |
| 354 | + | |
| 355 | +```bash | |
| 356 | +./serve.sh --test 2 3 # mínimo: 2 cadenas de 3 carpetas (el ejemplo del header) | |
| 357 | +./serve.sh --test 500 8 # 500 torres de interior profundo (sin urbanizaciones) | |
| 358 | +./serve.sh --test 1000 8 250 # 4 grupos × 250 carpetas, M−2=6 > 5 → 4 urbanizaciones | |
| 359 | +./serve.sh --test 1000 4 250 # mismos grupos pero poco profundos (4−2 ≤ 5) → 4 torres densas | |
| 360 | +./serve.sh --test 2500 3 2500 # 1 grupo de 2500 (> 2000) → urbanización aunque sea plano | |
| 361 | +./serve.sh --test 9000 9 300 # 30 urbanizaciones profundas: estrés de LOD + serigrafiado | |
| 362 | +./serve.sh 8200 --test 100 10 # puerto alternativo + test | |
| 363 | +``` | |
| 364 | + | |
| 365 | +El generador avisa al ejecutarse de si la combinación N/M/K elegida supera | |
| 366 | +o no los umbrales de urbanización. | |
| 367 | + | |
| 368 | +Restaurar el snapshot real: `git checkout -- src/data.js` o relanzar | |
| 369 | +`scan.mjs`. `./serve.sh --help` muestra este resumen. | |
| 370 | + | |
| 371 | +## Controles | |
| 372 | + | |
| 373 | +| Entrada | Acción | | |
| 374 | +| ------------------ | --------------------------------------------- | | |
| 375 | +| arrastrar / rueda | orbitar · zoom | | |
| 376 | +| clic | seleccionar fichero o edificio · vacío = limpiar | | |
| 377 | +| hover | resalta el edificio bajo el cursor | | |
| 378 | +| `F` | **modo vuelo** (pointer-lock, atraviesa paredes) | | |
| 379 | +| `W A S D` / ratón | mover · mirar (en vuelo) | | |
| 380 | +| `Space`/`E` · `C`/`Q` | subir · bajar · `Shift` turbo | | |
| 381 | +| `1` `2` `3` | Reset Vista · Vista Aérea · Vista Altura Edificios | | |
| 382 | +| `L` · `G` | leyenda · suelo opaco | | |
| 383 | +| `X` · `/` | limpiar selección · enfocar el buscador | | |
| 384 | +| `Esc` | salir del vuelo / cerrar buscador / cerrar Settings | | |
| 385 | + | |
| 386 | +## Estructura | |
| 387 | + | |
| 388 | +``` | |
| 389 | +index.html marco HTML + importmap | |
| 390 | +scan.mjs escáner del repo → src/data.js | |
| 391 | +src/ | |
| 392 | + data.js snapshot del árbol (generado) | |
| 393 | + i18n.js textos de UI español/inglés y persistencia de idioma | |
| 394 | + model.js jerarquía + layout (cajas anidadas, empaquetado urbano) | |
| 395 | + builder.js escena: aristas HDR, cristal fresnel, fachadas, suelo PCB | |
| 396 | + controls.js órbita + vuelo libre + vuelos de cámara | |
| 397 | + ui.js árbol lateral, buscador, ruta, stats, Settings | |
| 398 | + main.js selección jerárquica, raycast, render y ajustes visuales | |
| 399 | +tools/ | |
| 400 | + capture-orbit.mjs captura órbitas vía Chrome DevTools Protocol | |
| 401 | + detect-black-rects.py detector de cuadros negros en frames/capturas | |
| 402 | + compare-black-regressions.py compara órbitas contra baseline visual | |
| 403 | +vendor/ Three.js r160 + addons (offline) | |
| 404 | +``` |