Skip to content

feat(templates): add project_codebase preset — repo personality / analytics #164

Closed

Description

@unhappychoice

Tracks #41. Project-side companion to the home preset gallery (#77 / #96 / #150). Fills the project-context "what is this codebase" axis.

Status: shipped via #175 (merged)

The shipped layout diverges from the original Composition section below. See Final layout for what actually landed.

Final layout

Frame around a centred identity block, not the splash-y hero originally drafted:

  • Identity (centre) — git_repo_name figlet via text_ascii (blocks, quadrant) + git_age (Text, format = "full") + code_loc (Text) summary.
  • Top row — code_loc (Bars) list_ranking ("Lines of code") | git_age (Entries) grid_table ("Project age") | code_comments (Bars, unit = "loc") list_ranking ("Comment density"). All capped at 4 rows so the strip reads uniformly.
  • Title row sides — code_files (Bars) list_ranking left | figlet centre | code_largest_files (Bars) list_ranking right.
  • Bottom row — git_churn (Bars) list_ranking | code_todos (TextBlock) list_plain (location list, gets the wider 2/4 slot) | code_todos (Bars) list_ranking (TODO hotspots — same scan, per-file count).

Renderer improvements that landed alongside the preset to make tiles fill cells properly:

  • chart_bar exposes a new bar_gap option; horizontal bars default to bar_gap = 0 (was effectively 1, leaving blank rows between bars).
  • list_ranking stretches the label column to the cell width and truncates overlong labels with … so the value column never gets clipped.
  • grid_table sizes the key column to the widest key + Fill(1) for the value, and right-aligns values by default.

Deltas from original Composition

  • Hero — code_language_logo (image) dropped: the half-block fallback didn't read on terminals without sixel/kitty/iTerm2 image protocols, and the original spec's "figlet/ASCII fallback" never materialised in the fetcher (which was Image-only). Replaced with the project-name figlet which works everywhere.
  • chart_bar per-language LOC — replaced with list_ranking (text-first ranking; the bar visual added little in narrow tiles and Rust-dominant repos collapsed the other bars to invisible).
  • git_commits_activity heatmap — dropped: overlaps with project_github, which already covers commit cadence.
  • git_contributors — dropped: same reason — project_github covers it.
  • code_language_logo hero — see above.

The spec's body 5 — hotspots (code_largest_files + code_todos) survived, expanded into the title-row right side panel + bottom-row TODO list and TODO hotspots.

Definition of Done

Widgets

Flat status list — every widget the preset uses, shipped or not.

Out of scope

  • Publish-side stats (npm_downloads / crates_downloads / pypi_downloads / package_release / oss_*). Tracked under meta: fetcher roadmap - Coding & Build #64; not all repos publish a package, so they don't earn a preset slot. Power users add them per-dir as standalone widgets.
  • Smart preset behaviour (e.g. auto-add crates_downloads if Cargo.toml [package] exists). Out of scope for v1; preset is a static layout.
  • New renderer primitives. text_ascii / text_plain / chart_bar / grid_table / list_ranking / list_plain cover the layout.
  • rubygems_downloads (currently missing from meta: fetcher roadmap - Coding & Build #64 alongside the existing npm/cargo/pypi entries) — orthogonal gap, leave to a separate housekeeping pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featwidget

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions