Skip to content

Generalize visual-capture route-mapping to be per-repo configurable #3610

Description

@JSONbored

Part of #3607. Shares the review.visual .gittensory.yml namespace with #3609 (preview-URL config) —
design these together as one coherent config surface, not two disconnected knobs.

Motivation

mapFilesToRoutes (src/review/visual/capture.ts) hardcodes DEFAULT_ROUTE_FILE = /apps\/gittensory-ui\/src\/routes\/(.+?)\.(?:tsx|jsx)$/i and TanStack Router's file-based routing conventions (flat .-separated segments, _-prefixed pathless layouts, (group) route groups, $param dynamic segments). This only works for gittensory's own UI.

isVisualPath (src/review/visual/paths.ts), by contrast, is already mostly repo-generic — 2 of its 3 patterns (public/**, and the .tsx/.jsx/.css/.scss/.sass/.less/.html/.svg/.astro/.vue/.svelte/.mdx extension list) aren't gittensory-specific, so metagraphed's apps/ui/src/routes/*.tsx files already correctly classify as visual. Only the file-to-route MAPPING step needs generalizing.

Zero-config must still produce something useful. DEFAULT_ROUTES = ["/"] is already the fallback when no route-file pattern matches — keep that: a repo that configures nothing still gets a real homepage before/after, it just won't get smart per-route targeting until it opts in.

Requirements

  • Add review.visual.routes to the shared .gittensory.yml config block (see Generic per-repo preview-URL provider config (Cloudflare/Vercel/Netlify/manual template) #3609): either a route-file
    pattern + transform (for repos with conventional file-based routing), or — simpler and more robust for a
    first cut — an explicit list of routes to always screenshot, for repos with unusual/non-file-based routing.
  • Absent config stays byte-identical to today: gittensory-ui's own hardcoded pattern remains its default
    (or moves to being ITS OWN explicit config using the same mechanism, for consistency — either is fine as
    long as behavior doesn't change).
  • Identify metagraphed's actual apps/ui routing convention (check its router setup — do not assume it
    matches gittensory-ui's TanStack conventions) and configure it as the first real non-gittensory usage —
    an explicit fixed route list is an acceptable, even preferable, first cut if its conventions don't
    cleanly generalize to a pattern.
  • Make MAX_ROUTES (currently a hardcoded 2) a per-repo-overridable cap, not just a global constant.

Deliverables

  • review.visual.routes schema + parser + resolver (same PR/pattern as Generic per-repo preview-URL provider config (Cloudflare/Vercel/Netlify/manual template) #3609's review.visual.preview
    if convenient — one config parser for the whole review.visual block)
  • mapFilesToRoutes accepts the resolved per-repo config instead of only the hardcoded default
  • metagraphed's apps/ui routing convention identified and either mapped or explicitly configured
  • Tests: default behavior unchanged (byte-identical), a pattern-configured repo maps correctly, an
    explicit fixed-route-list repo always screenshots those routes regardless of changed files
  • .gittensory.yml.example documents the new knob with a generic (non-metagraphed-specific) example

Expected outcome

Any repo — not just gittensory's own UI — can get sensible before/after screenshots of the routes its PRs
actually touch, with zero config required to get a basic homepage shot and a few lines of YAML for real
per-route targeting.

Effort

M — a new config-as-code knob (well-established pattern in this codebase) plus the metagraphed
route-convention investigation.

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.roadmapOn the Wave-2 agent-layer roadmap board (project 9)visualUI/web visual work — owner-led, NOT for Gittensor contributors (extensions excepted)

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions