Skip to content

Lenses: recolor the city by churn / ownership / complexity (code-health overlays) #114

Description

@thalida

Recolor the same city by different metrics — toggleable "lenses" over one geometry — so codecity becomes a code-health dashboard, not just a map. Same buildings, many insights.

Lenses to explore

  • Churn — how often each file changes (from git log); busiest files glow as hotspots / tech-debt radar.
  • Ownership — dominant author per file via git blame; visualize bus-factor districts (files only one person touches = risk).
  • Age — last-modified recency (already the default hue axis, but as an explicit lens).
  • Complexity — a cheap proxy (lines, nesting, or a real metric via tree-sitter).
  • Test coverage — if a coverage report is present/uploaded.

What's already built (feasibility)

  • Buildings are colored per-instance via getBuildingColor (app/src/city/components/buildings/color.ts) and a per-instance color attribute rebuilt in buildings/index.ts — so a lens is just an alternate color provider + a UI toggle, no layout change.
  • The Settings/theme system + reactive rebuild give a clean place to hang a lens selector.

New data needed (backend)

  • Churn: per-file change count over the history window (git log --name-only aggregation) → new FileNode/stats field.
  • Ownership: per-file dominant author (git blame is expensive at scale — sample or cache; consider git log last-author as a cheap approximation first).
  • These extend the manifest → just gen-types + a cache-schema bump (that path is well-trodden now).

Design questions

  • Legend + UX: each lens needs its own legend (sequential for churn/age, categorical for ownership) — reuse the Info-tab Legend. Follow the dataviz conventions for sequential vs categorical palettes.
  • Theme-aware: lens palettes must hold contrast across the accent/surface presets (Theme switcher: pick accent + surface colors #87) and meet WCAG AA (Accessibility audit #79).
  • Interaction: a lens picker (segmented control?) with the default "extension + recency" view as one of the options.

Phasing

  1. Frontend lens framework: pluggable color providers + a picker + per-lens legend, using data already in the manifest (age, lines).
  2. Churn lens (new backend field, cheapest new data).
  3. Ownership lens (blame/last-author, the highest-value one).

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaSuggested feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions