Repository navigation
feat(render): layout border-sides + renderer option polish for 0.x presets - #86
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 11 minutes and 17 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR implements renderer option schemas and option-driven rendering across ~25 renderers, adds Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (4)
src/render/gauge_circle.rs (1)
11-26: Schemas advertise options with no runtime effect.Both
ring_thicknessandlabel_positionare accepted but therender()method still uses_opts, so neither has any behavior. The description text honestly calls them "reserved/no visible effect" — that's defensible for forward-compat, but it means generated docs will list two knobs that do nothing today. Consider either (a) wiringlabel_position = "below"now (it's achievable with a two-row split + a text line) or (b) dropping these schemas until there's an implementation, to avoid expanding the public config surface with dead keys.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/gauge_circle.rs` around lines 11 - 26, OPTION_SCHEMAS currently advertises ring_thickness and label_position but render() never reads them (it still uses _opts), so either remove these dead keys from the public schema or actually implement their behavior; to fix quickly remove the OptionSchema entries for "ring_thickness" and "label_position" from OPTION_SCHEMAS so the docs don't expose no-op options, or implement wiring by reading _opts.label_position and _opts.ring_thickness in render(), branching on label_position == "below" to split the widget into two rows and draw the label on the second row and applying ring_thickness when drawing the circular gauge; reference OPTION_SCHEMAS, render(), ring_thickness, label_position, and _opts to locate the relevant code.src/render/grid_calendar.rs (1)
17-32: Both new schemas are no-ops today.
week_startandmarkerare accepted but neither is read inrender_calendar(ratatui'sMonthlywidget is always Sun-first, and event cells are style-only). The descriptions do call this out, so users can discover it from docs, but generated reference pages will still list two knobs that do nothing. Fine as forward-compat scaffolding; just flagging that this pattern (schema-without-implementation) is now applied to several renderers and may accumulate config-surface debt if the Ratatui upgrades never arrive.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/grid_calendar.rs` around lines 17 - 32, OPTION_SCHEMAS currently exposes two no-op options (week_start and marker) that aren’t used by render_calendar (Monthly widget is Sun-first and event cells are style-only); remove the misleading config surface by deleting the OptionSchema entries for "week_start" and "marker" from OPTION_SCHEMAS in src/render/grid_calendar.rs so generated docs no longer advertise unused knobs, and ensure any code that iterates OPTION_SCHEMAS still behaves correctly after those entries are removed (refer to OPTION_SCHEMAS, the "week_start" and "marker" OptionSchema items, and render_calendar/Monthly).src/render/figlet_fonts/standard.flf (1)
1-2237: Bundled FIGlet font asset — no code review applicable.Standard is by Glenn Chappell & Ian Chai (1993), with Latin-2/3/4/5 additions by John Cowan and the 0xCA0 addition by patorjk. In-file credits are preserved. If your distribution requires top-level attribution, add these credits to a NOTICE or THIRD_PARTY file. Note: This file lacks a trailing newline, which some tools (including
cargo fmt) may attempt to normalize.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/figlet_fonts/standard.flf` around lines 1 - 2237, The file "src/render/figlet_fonts/standard.flf" ends without a trailing newline (look for the header "Standard by Glenn Chappell & Ian Chai 3/93" and the final glyph block "0xCA0 KANNADA LETTER TTHA"); fix by adding a single newline character at EOF (do not alter any font lines or in-file credits), and if your distribution needs top-level attribution also add the provided credits to your NOTICE/THIRD_PARTY file.src/render/grid_table.rs (1)
92-111: Minor: prefer iterator composition over the index loop.Per the repo's Rust guideline ("Prefer
map/filter/reduceover imperative loops"),render_inlinecan be expressed as aflat_mapwith areduce-style separator without changing behaviour. Not blocking.Sketch
let spans: Vec<Span> = data.items.iter().enumerate().flat_map(|(i, entry)| { let row_style = entry.status .map(|s| Style::default().fg(super::status_badge::status_color(s, theme))) .unwrap_or(text); let sep = (i > 0).then(|| Span::styled(" · ", dim)); let value = entry.value.as_deref().map(|v| { [Span::styled(": ", row_style), Span::styled(v.to_string(), row_style)] }); sep.into_iter() .chain(std::iter::once(Span::styled(entry.key.clone(), row_style))) .chain(value.into_iter().flatten()) }).collect();As per coding guidelines: "Prefer
map/filter/reduceover imperative loops in Rust code".🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/grid_table.rs` around lines 92 - 111, The render_inline function currently builds spans with an imperative indexed loop; refactor it to use iterator composition (e.g., data.items.iter().enumerate().flat_map(...).collect::<Vec<Span>>()) so the separator and optional value are produced via .then()/.into_iter()/chain() instead of manual i checks and pushes, preserving the row_style computation (using entry.status.map(...).unwrap_or(text)) and the use of super::status_badge::status_color to pick colors; keep the final call frame.render_widget(Paragraph::new(Line::from(spans)).style(text), area) unchanged so behavior remains identical.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.splashboard/config.toml:
- Around line 29-33: The recent_commits widget (id "recent_commits", fetcher
"git_recent_commits") requests 10 entries via format = "10" but the bordered row
only has 8 usable content rows, so reduce the requested items to fit the
renderer or increase the row height; change format from "10" to "8" (or adjust
the render row height/padding in the render block) and apply the same adjustment
for any other widgets that use format = "10" (e.g., the other timeline widgets
mentioned) so items are not clipped.
In `@src/fetcher/clock/ratio.rs`:
- Around line 98-123: The denominator granularity in total_units is inconsistent
(seconds for Day/Hour produce ugly fractions); change Period::Day from 86_400 to
24 and Period::Hour from 3_600 to 60 so fractions render as "hours of 24" and
"minutes of 60" (keep return type u64), update the doc-comment to state "hours
for day, minutes for hour, days for week/month/quarter/year", and leave the
Month/Quarter/Year/Week logic unchanged (function: total_units).
In `@src/render/animated_postfx.rs`:
- Around line 24-38: The OptionSchema for "effect" is out of sync with
build_effect: update the schema (the OptionSchema with name "effect") so its
type_hint and documented variants match the actual arms in build_effect (include
sweep_in_right/sweep_in_down/sweep_in_up and
slide_in_right/slide_in_down/slide_in_up and omit "glitch" unless you implement
a "glitch" arm in build_effect), and ensure the default remains a valid variant
(e.g., "fade_in"); alternatively, if you prefer to support "glitch", add a
corresponding "glitch" arm in build_effect that behaves consistently with other
effects.
In `@src/render/chart_scatter.rs`:
- Around line 20-34: The docs for the "marker" OptionSchema advertise values
("dot", "cross", "plus", or any single char") that do not match the actual
parser; update either the parser or the schema: either 1) extend
parse_marker(...) to accept and map the advertised names ("cross", "plus", etc.)
to the existing rendering modes ("block", "bar", "braille", "half_block",
"dot"), or 2) change the OptionSchema entry for name = "marker" to list the
exact supported tokens parsed by parse_marker (e.g., "block", "bar", "braille",
"half_block", "dot") and adjust the description text accordingly; locate the
parser by the function parse_marker and the schema by
OPTION_SCHEMAS/OptionSchema in chart_scatter.rs to make the consistent change.
In `@src/render/figlet_fonts/big.flf`:
- Around line 1-2204: Add repo-level attribution for the FIGlet fonts by adding
a NOTICE or a "Third-Party Licenses" section in the README (and updating the
LICENSE if required) that names the fonts and authors referenced in this diff:
"Big by Glenn Chappell (4/93)" and "Greek characters by Bruce Jakeway", and also
list the other bundled FIGlet fonts (Big, Small, Banner, Standard) plus the
figlet-rs library; include the font header text (the attribution lines present
in big.flf) or a short citation, state the font redistribution permission, and
link to the original FIGlet/font source or project so reviewers can verify
licensing.
In `@src/render/grid_heatmap.rs`:
- Around line 132-134: cell_glyph currently returns the full &str so
multi-codepoint inputs like "ab" paint multiple columns; change it to return a
single visual glyph (first grapheme) and update callsites (paint_cells and the
set_symbol invocation) to accept &str/owned String accordingly: implement
cell_glyph to pick the first grapheme using UnicodeSegmentation
(graphemes(true).next()) and fall back to CELL_GLYPH when None or empty, return
an owned String (or &'static str when falling back), and adjust paint_cells
signature/callsite to accept &str (or String) so set_symbol always receives
exactly one visible glyph.
In `@src/render/mod.rs`:
- Around line 146-148: Update the gauge_line/value_format docs to reflect that
fraction output now uses RatioData.denominator (and renders as "118 of 365")
instead of parsing a label like "fraction:n/d"; mention the new denominator
field on the RatioData struct and show the updated example format ("both" ->
`32% (118 of 365)` or "fraction" -> `118 of 365`) and that it falls back to
percent if denominator is missing. Reference gauge_line/value_format and
RatioData.denominator in the doc update.
---
Nitpick comments:
In `@src/render/figlet_fonts/standard.flf`:
- Around line 1-2237: The file "src/render/figlet_fonts/standard.flf" ends
without a trailing newline (look for the header "Standard by Glenn Chappell &
Ian Chai 3/93" and the final glyph block "0xCA0 KANNADA LETTER TTHA"); fix by
adding a single newline character at EOF (do not alter any font lines or in-file
credits), and if your distribution needs top-level attribution also add the
provided credits to your NOTICE/THIRD_PARTY file.
In `@src/render/gauge_circle.rs`:
- Around line 11-26: OPTION_SCHEMAS currently advertises ring_thickness and
label_position but render() never reads them (it still uses _opts), so either
remove these dead keys from the public schema or actually implement their
behavior; to fix quickly remove the OptionSchema entries for "ring_thickness"
and "label_position" from OPTION_SCHEMAS so the docs don't expose no-op options,
or implement wiring by reading _opts.label_position and _opts.ring_thickness in
render(), branching on label_position == "below" to split the widget into two
rows and draw the label on the second row and applying ring_thickness when
drawing the circular gauge; reference OPTION_SCHEMAS, render(), ring_thickness,
label_position, and _opts to locate the relevant code.
In `@src/render/grid_calendar.rs`:
- Around line 17-32: OPTION_SCHEMAS currently exposes two no-op options
(week_start and marker) that aren’t used by render_calendar (Monthly widget is
Sun-first and event cells are style-only); remove the misleading config surface
by deleting the OptionSchema entries for "week_start" and "marker" from
OPTION_SCHEMAS in src/render/grid_calendar.rs so generated docs no longer
advertise unused knobs, and ensure any code that iterates OPTION_SCHEMAS still
behaves correctly after those entries are removed (refer to OPTION_SCHEMAS, the
"week_start" and "marker" OptionSchema items, and render_calendar/Monthly).
In `@src/render/grid_table.rs`:
- Around line 92-111: The render_inline function currently builds spans with an
imperative indexed loop; refactor it to use iterator composition (e.g.,
data.items.iter().enumerate().flat_map(...).collect::<Vec<Span>>()) so the
separator and optional value are produced via .then()/.into_iter()/chain()
instead of manual i checks and pushes, preserving the row_style computation
(using entry.status.map(...).unwrap_or(text)) and the use of
super::status_badge::status_color to pick colors; keep the final call
frame.render_widget(Paragraph::new(Line::from(spans)).style(text), area)
unchanged so behavior remains identical.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 002bfd23-d66a-4380-b7b1-356b959d7466
📒 Files selected for processing (31)
.splashboard/config.tomlsrc/config.rssrc/fetcher/clock/ratio.rssrc/fetcher/read_store.rssrc/fetcher/system.rssrc/layout.rssrc/payload.rssrc/render/animated_postfx.rssrc/render/animated_typewriter.rssrc/render/chart_bar.rssrc/render/chart_line.rssrc/render/chart_pie.rssrc/render/chart_scatter.rssrc/render/chart_sparkline.rssrc/render/figlet_fonts/banner.flfsrc/render/figlet_fonts/big.flfsrc/render/figlet_fonts/small.flfsrc/render/figlet_fonts/standard.flfsrc/render/gauge_circle.rssrc/render/gauge_line.rssrc/render/grid_calendar.rssrc/render/grid_heatmap.rssrc/render/grid_table.rssrc/render/list_plain.rssrc/render/list_timeline.rssrc/render/media_image.rssrc/render/mod.rssrc/render/status_badge.rssrc/render/text_ascii.rssrc/samples.rssrc/theme/mod.rs
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.splashboard/config.toml (1)
97-103:⚠️ Potential issue | 🟡 MinorSubtitle row has zero slack for longer descriptions.
list_plainrenders one line perTextBlockentry, soprojectemits exactly 3 lines (slug / description / license). The row is alsolength = 3, which fits perfectly today but leaves no room if the description wraps within the 70-cell column, or if a futureprojectpayload adds a field. A longer description on a narrow terminal will visually clip the license line.Consider
height = { length = 4 }(ormin = 3) for a small safety margin, or documenting the 70-cell width as a hard assumption.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.splashboard/config.toml around lines 97 - 103, The subtitle row currently fixes its height to exactly 3 lines (height = { length = 3 }) which leaves no slack if the description wraps in the 70-cell width; update the [[row]] entry that contains [[row.child]] with widget = "subtitle" to allow extra room by changing height to a safer default (e.g., height = { length = 4 }) or use a minimum (e.g., height = { min = 3 }) so wrapped descriptions won’t clip the license line, and/or add a comment documenting the 70-cell width assumption.
🧹 Nitpick comments (2)
src/render/grid_table.rs (1)
99-129: Extract inline span construction out ofrender_inline.
render_inlinenow both assembles every span and renders the widget, making it longer than the local Rust guideline and relying on a mutable push loop. Consider moving span construction into a small iterator-based helper.♻️ Proposed refactor
fn render_inline( frame: &mut Frame, area: Rect, data: &EntriesData, opts: &RenderOptions, theme: &Theme, ) { let text = Style::default().fg(theme.text); - let dim = Style::default().fg(theme.text_dim); - let mut spans: Vec<Span> = Vec::new(); - for (i, entry) in data.items.iter().enumerate() { - if i > 0 { - spans.push(Span::styled(" · ", dim)); - } - let row_style = entry - .status - .map(|s| Style::default().fg(super::status_badge::status_color(s, theme))) - .unwrap_or(text); - spans.push(Span::styled(entry.key.clone(), row_style)); - if let Some(v) = entry.value.as_deref() { - spans.push(Span::styled(": ", row_style)); - spans.push(Span::styled(v.to_string(), row_style)); - } - } + let spans = inline_spans(data, text, theme); frame.render_widget( Paragraph::new(Line::from(spans)) .style(text) .alignment(parse_align(opts.align.as_deref())), area, ); } + +fn inline_spans(data: &EntriesData, text: Style, theme: &Theme) -> Vec<Span<'static>> { + let dim = Style::default().fg(theme.text_dim); + + data.items + .iter() + .enumerate() + .flat_map(|(i, entry)| { + let row_style = entry + .status + .map(|s| Style::default().fg(super::status_badge::status_color(s, theme))) + .unwrap_or(text); + + [ + (i > 0).then_some(Span::styled(" · ", dim)), + Some(Span::styled(entry.key.clone(), row_style)), + entry.value.as_ref().map(|_| Span::styled(": ", row_style)), + entry + .value + .as_ref() + .map(|value| Span::styled(value.clone(), row_style)), + ] + .into_iter() + .flatten() + }) + .collect() +}As per coding guidelines,
**/*.rs: “Prefermap/filter/reduceover imperative loops in Rust code” and “Keep functions small (~10–15 lines) and maintain single responsibility in Rust code.”🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/grid_table.rs` around lines 99 - 129, The render_inline function mixes span construction and rendering and uses an imperative push loop; extract the span-building logic into a small helper (e.g., fn build_inline_spans(data: &EntriesData, theme: &Theme) -> Vec<Span>) that uses iterator combinators (map/flat_map/enumerate) instead of mutable pushes to produce the Vec<Span> (or impl Iterator<Item=Span>), then have render_inline call that helper and keep only the Paragraph creation/rendering there (preserve parse_align(opts.align.as_deref()) and the status color lookup via super::status_badge::status_color).src/fetcher/project.rs (1)
100-124: Consider treating auth / API failures as placeholders too.Repo-resolution errors are caught and rendered as a friendly
⚠ …placeholder (Line 103), but any failure fromrest_get— missing token, rate limiting,404 Not Found, network blip — propagates via?and becomes a generic fetch error. The two failure modes are equally user-correctable (missing auth, private repo) and would benefit from the same actionable placeholder treatment for a polished preset.Optional: unify error handling
- let info: RepoInfo = rest_get(&format!("/repos/{}/{}", slug.owner, slug.name)).await?; + let info: RepoInfo = match rest_get::<RepoInfo>(&format!( + "/repos/{}/{}", + slug.owner, slug.name + )) + .await + { + Ok(i) => i, + Err(e) => return Ok(placeholder(&e.to_string())), + };🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fetcher/project.rs` around lines 100 - 124, In fetch (async fn fetch) unify error handling so failures from rest_get are returned as the same user-facing placeholder as resolve_repo does: instead of propagating the rest_get ? error, catch the Result/any error from rest_get(&format!("/repos/{}/{}", slug.owner, slug.name)).await and on Err(e) return Ok(placeholder(&e.to_string())), then continue building Metadata and Body as before; keep resolve_repo handling unchanged and ensure the placeholder contains the error string for actionable feedback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In @.splashboard/config.toml:
- Around line 97-103: The subtitle row currently fixes its height to exactly 3
lines (height = { length = 3 }) which leaves no slack if the description wraps
in the 70-cell width; update the [[row]] entry that contains [[row.child]] with
widget = "subtitle" to allow extra room by changing height to a safer default
(e.g., height = { length = 4 }) or use a minimum (e.g., height = { min = 3 }) so
wrapped descriptions won’t clip the license line, and/or add a comment
documenting the 70-cell width assumption.
---
Nitpick comments:
In `@src/fetcher/project.rs`:
- Around line 100-124: In fetch (async fn fetch) unify error handling so
failures from rest_get are returned as the same user-facing placeholder as
resolve_repo does: instead of propagating the rest_get ? error, catch the
Result/any error from rest_get(&format!("/repos/{}/{}", slug.owner,
slug.name)).await and on Err(e) return Ok(placeholder(&e.to_string())), then
continue building Metadata and Body as before; keep resolve_repo handling
unchanged and ensure the placeholder contains the error string for actionable
feedback.
In `@src/render/grid_table.rs`:
- Around line 99-129: The render_inline function mixes span construction and
rendering and uses an imperative push loop; extract the span-building logic into
a small helper (e.g., fn build_inline_spans(data: &EntriesData, theme: &Theme)
-> Vec<Span>) that uses iterator combinators (map/flat_map/enumerate) instead of
mutable pushes to produce the Vec<Span> (or impl Iterator<Item=Span>), then have
render_inline call that helper and keep only the Paragraph creation/rendering
there (preserve parse_align(opts.align.as_deref()) and the status color lookup
via super::status_badge::status_color).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ab0cd55d-87cc-417d-84fd-dcf8cd9aced1
📒 Files selected for processing (5)
.splashboard/config.tomlsrc/fetcher/github/mod.rssrc/fetcher/mod.rssrc/fetcher/project.rssrc/render/grid_table.rs
…esets Closes #79. Closes out the 0.x renderer / option polish pass so the preset work (#77) can lean on real primitives instead of static- divider hacks. ## Layout - `BorderSpec::Top` (config + layout): paints only the top edge, with `title = "..."` hanging off the rule. Enables section dividers as `border = "top"` + `title` on any row or child, instead of a dummy static widget per divider. ## text_ascii - Bundles four FIGlet fonts (standard / small / big / banner) as `include_str!` assets; `font = "banner"` switches between them. - `color = "<theme token>"` lets blocks + figlet styles pick any `[theme]` key (e.g. `"panel_title"`); unknown names fall back to `text`. - Plumbing: new `theme::token_color()` resolves any single-colour token by its TOML name. ## media_image - `align` + `fit` ("contain" / "cover" / "stretch" → `Resize::Fit` / `Crop` / `Scale`) + `max_width` / `max_height` + `padding`. ## gauge_line - Rewritten as an inline composition (`year: ▓▓▓▓░░░░ 32% (118 of 365)`). `label` option (falls back to `RatioData.label`) + `value_format = "percent" | "fraction" | "both"`. ## grid_table - `layout = "inline"` (`key: value · key: value`) in addition to the default rows form; `column_align` per-column alignment; `align` honoured on inline layout (matches text_plain / list_*). ## list_plain / list_timeline - `bullet` glyph (`•` / `●` / `▪` / `→` / `none`), `max_items` cap, and (timeline only) `date_format = "relative" | "absolute"`. ## chart_sparkline - Inline `label` prefix + `style = "bars" | "line"`. ## chart_bar - `horizontal` orientation, `max_bars` top-N cap (sorted descending), `stacked` placeholder for future multi-series, `bar_width` with direction-aware default (3 for vertical, 1 for horizontal). ## status_badge - `shape = "rounded" | "square" | "none"` + `padding`. ## Best-effort on the rest - `chart_pie` (legend position, donut mode). - `chart_line` / `chart_scatter` (axes block, scatter `marker`). - `gauge_circle` (ring_thickness / label_position — accepted for forward compat). - `grid_heatmap` (`cell_char` glyph override). - `grid_calendar` (`week_start` / `marker` — accepted for forward compat). Every renderer (including `animated_postfx` / `animated_typewriter`) now declares `option_schemas()` so `cargo xtask` regenerates the reference pages from a single source of truth. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`gauge_line`'s new `value_format = "fraction" | "both"` needs the underlying count, not just the 0..=1 ratio, to render `118 of 365`. Add an optional `denominator: Option<u64>` on `RatioData` and wire it up in fetchers that know the total: - `clock_ratio` populates `total_units(period)` (day/hour in seconds, week/month/quarter/year in days) so gauge_line can render the real fraction against the period's natural granularity. - Stub `None` on the other ratio-emitting fetchers (system, read_store); they can light it up later when useful. `gauge_line` falls back to percent when `denominator` is None, so this stays a pure addition. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Two new fetchers for the repo header band:
- `project_name` — local Safe. Parses `owner/name` out of the git
`origin` remote (via the shared `slug_from_url` helper) and emits
the name portion as Text, so `text_ascii` figlet can render the
repo name as a hero. Falls back to the cwd directory name when no
remote exists.
- `project` — Safe (fixed-host GitHub API). Hits `/repos/{o}/{n}`
and emits `{ slug, description, license.spdx_id }` as `Entries`,
`TextBlock` (one line per field), or `Text` (`·`-joined).
Missing fields are filtered out so the output stays tight.
Plumbing: exposes `fetcher::github::{client, common}` as pub(crate)
so non-github fetchers can reuse `rest_get` / `resolve_repo` /
`slug_from_url` without re-implementing the remote parse.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
New `GithubLanguages` fetcher hits `/repos/{o}/{n}/languages` and
emits the byte-count breakdown as `Bars` (for chart_pie /
chart_bar) or `Entries` with percent values (for grid_table).
Sorted descending, capped to `limit` (default 6), overflow folded
into an `"other"` bucket so totals still add up. Safe — fixed
api.github.com host, same trust profile as the other `github_*`
fetchers.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`derive_shape` used to pick the renderer's first accepted shape regardless of what the fetcher could emit. For a multi-shape fetcher (e.g. `project` lists `[Entries, TextBlock, Text]`) paired with a multi-shape renderer (`text_plain` accepts `[Text, TextBlock]`), this forced the subtitle back to the one-liner `Text` form instead of the multi-line `TextBlock` the fetcher naturally prefers. New rule: intersect the renderer's accepts with the fetcher's shapes in **fetcher order**, picking the first match. Fetchers already list their most-natural shape first, so this respects their stated preference. Falls back to renderer-first when the fetcher is unknown or the intersection is empty, so the old placeholder / mismatch paths behave identically. Regression-guarded by a new test; the existing "renderer wins over fetcher default" test still passes. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Rewrites `.splashboard/dashboard.toml` to lean on the #79 / new fetchers instead of static-divider hacks: - Header band (full-width `bg = "subtle"`): • hero via `project_name` → text_ascii figlet banner, coral via `color = "panel_title"`, animated_postfx coalesce. • subtitle via `project` TextBlock → text_plain centered; slug / description / license each on their own line. • `github_repo_stars` inline stats row. - Body, three 2-column rows with `border = "top"` + `title` per child so the divider rule spans exactly the widget's own width: • languages (horizontal chart_bar) | releases (list_timeline). • PRs (list_plain) | issues (list_plain). • commits heatmap (git_commits_activity) | top contributors (chart_bar capped at 5). A 2-cell `gap` static widget between 34-wide siblings stops the sibling rules from touching in the middle. No `[general]` section — padding / viewport / theme preferences now live in `$HOME/.splashboard/settings.toml` per the #85 split. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
3d3f7be to
f2560d5
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
==========================================
+ Coverage 76.53% 76.88% +0.34%
==========================================
Files 72 74 +2
Lines 10254 11354 +1100
==========================================
+ Hits 7848 8729 +881
- Misses 2406 2625 +219
🚀 New features to boost your workflow:
|
- `fetcher::github::languages` — swap `sort_by(|a,b| b.1.cmp(&a.1))` for `sort_by_key(|e| Reverse(e.1))` so clippy 1.95's `unnecessary_sort_by` stops failing CI. - `fetcher::clock::ratio::total_units` — year/month/quarter/week stay in days, day now reports hours (24), hour reports minutes (60). Seconds-level denominators rendered unreadable fractions (`43200 of 86400`); whole-unit counts give `12 of 24` / `30 of 60`. - `render::animated_postfx` effect schema lists every name `build_effect` actually handles (sweep_in / slide_in directional variants, hsl_shift) and drops the advertised-but-unimplemented `glitch`. - `render::chart_scatter` marker schema matches `parse_marker`: dot / block / bar / braille / half_block. Drops `cross` / `plus` and the "any single char" claim that the code never honoured. - `render::grid_heatmap::cell_glyph` truncates the user-supplied string to its first `char`. A multi-char input would bleed into the 2-col-per-cell geometry's spacer column; the schema already promised single-glyph handling, now the code matches. - `render::mod::RenderOptions::value_format` doc drops the obsolete `"fraction:n/d"` label hint and points at `RatioData.denominator` instead. - `src/render/figlet_fonts/NOTICE.md` — attribution table for the bundled FIGlet fonts (Standard / Small / Big by Chappell et al., Banner by Youck). License text lives in each `.flf` header per FIGlet convention; the NOTICE lists authors + permissions so the third-party content is traceable. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
`NOTICE` has specific Apache-2.0 semantics (must-redistribute attribution file) that don't apply here — splashboard ships under ISC, and the per-font permissions live in the `.flf` headers already. Renaming to `README.md` keeps the directory-description content but drops the misleading filename. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/render/mod.rs (1)
114-116:⚠️ Potential issue | 🟡 MinorUpdate the
aligndocs forgrid_tableinline layout.This still says
grid_tableignoresalign, butgrid_tablenow honors it forlayout = "inline".Proposed doc fix
- /// "center", or "right". Not every renderer honours this — text_plain and text_ascii do; - /// structural renderers (grid_table, gauge_*, chart_*) ignore it. + /// "center", or "right". Not every renderer honours this — text_plain, text_ascii, and + /// grid_table's inline layout do; structural renderers generally ignore it.As per coding guidelines, renderers must honor
RenderOptions.align(left/center/right) where it makes sense.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/mod.rs` around lines 114 - 116, Update the documentation comment for the `align` option to reflect that `grid_table` now respects `RenderOptions.align` when `layout = "inline"`; locate the doc string around the `align` description in src/render/mod.rs and change the sentence that says "structural renderers (grid_table, gauge_*, chart_*) ignore it" to note that `grid_table` honours `align` for `layout = "inline"` while other structural renderers still ignore it, and ensure you mention the accepted values ("left", "center", "right") and that this applies to `RenderOptions.align`.
🧹 Nitpick comments (3)
src/render/list_timeline.rs (1)
25-32: Quote thebulletdefault for doc-gen consistency.Every other string-valued default in this file uses inner quotes (e.g.
Some("\"relative\""),Some("\"left\"")) — these render as"relative"in the generated reference.bullet's default is a literal token"none"listed in thetype_hint, so it should match the same form.Proposed diff
OptionSchema { name: "bullet", type_hint: "\"●\" | \"•\" | \"▪\" | \"→\" | \"none\"", required: false, - default: Some("none"), + default: Some("\"none\""), description: "Glyph prefixed to each event after the time column. `none` (default) shows only the time column and title.", },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/list_timeline.rs` around lines 25 - 32, The default for the "bullet" OptionSchema is currently set as a raw token and should be quoted to match the other string defaults and doc-gen expectations; locate OPTION_SCHEMAS and the OptionSchema entry with name "bullet" and change its default from Some("none") to include inner quotes like Some("\"none\"") so the generated docs render the default as "none".src/render/gauge_line.rs (1)
76-84: Minor:reservedover-reserves the bar area by one cell.
compose_spansemits prefix ("{prefix}: ", alreadyprefix_widthcells) + bar + suffix (" {suffix}",suffix.chars().count() + 1cells). So the non-bar footprint isprefix_width + suffix_chars + 1, butreservedadds+ 1 + ... + 1, leaving the last cell of every gauge empty. Not a correctness issue; just an unintentional right-margin.Proposed diff
- let reserved = prefix_width(&prefix) + 1 + suffix.chars().count() as u16 + 1; + // prefix ("{label}: ", already counted) + bar + " {suffix}" (leading space). + let reserved = prefix_width(&prefix) + suffix.chars().count() as u16 + 1; let bar_width = area.width.saturating_sub(reserved);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/gauge_line.rs` around lines 76 - 84, The gauge over-reserves one cell because reserved is computed as prefix_width(&prefix) + 1 + suffix.chars().count() as u16 + 1 while compose_spans already accounts for the prefix separator; change the reserved calculation in src/render/gauge_line.rs (the reserved binding used to compute bar_width and filled) to reserved = prefix_width(&prefix) + suffix.chars().count() as u16 + 1 so the non-bar footprint equals prefix_width + suffix_chars + 1 and update bar_width/fill computation to use that value.src/render/text_ascii.rs (1)
195-203: Optional: fall back to bundledFONT_STANDARDto avoid.expect().If
FIGfont::from_content(source)fails for one of the bundled.flfs, the fallback reparsesfiglet_rs' built-in standard with.expect(). Since all four bundled fonts (standard.flf,small.flf,big.flf,banner.flf) are already loaded viainclude_str!()and tested to parse successfully, you can tighten the fallback by retryingFONT_STANDARDdirectly before panicking, or returning aResulthigher up. Very unlikely to matter in practice—tests confirm all bundled fonts load without error.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/render/text_ascii.rs` around lines 195 - 203, In load_font, avoid calling FIGfont::standard().expect(...) on parse failure; instead, if FIGfont::from_content(source) fails, retry parsing the bundled FONT_STANDARD via FIGfont::from_content(FONT_STANDARD) and only panic (or propagate a Result) if that second parse also fails; update the error path in load_font to attempt FONT_STANDARD before calling expect, referencing load_font, FIGfont::from_content, and FONT_STANDARD.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/fetcher/github/languages.rs`:
- Around line 69-96: The cache_key() implementation currently only uses
repo_for_key(ctx) and omits the parsed limit, causing different limit values to
share cached payloads; update cache_key() to parse the same Options from
ctx.options (using parse_options or default behavior), derive the effective
limit (same logic as in fetch: opts.limit -> DEFAULT_LIMIT -> .max(1)), and
include that limit value in the extra key passed to cache_key(self.name(), ctx,
&extra) (e.g., append or include "limit={}" in the extra string) so cache
entries differ for different limits; reference functions: cache_key,
repo_for_key, parse_options, and the limit computation used in fetch.
In `@src/fetcher/project.rs`:
- Around line 75-77: The cache key for Project currently only uses
cwd_scoped(self.name()), which causes collisions when Project::fetch produces
different Body variants based on FetchContext.shape; update the cache_key(&self,
_ctx: &FetchContext) -> String implementation to include the ctx.shape (e.g.,
append or incorporate ctx.shape.as_str() or its Debug/string form) so keys are
unique per shape, and make the same change for the other cache_key
implementation mentioned (the second Project cache_key around the 111-120
region) so both Project::cache_key methods include FetchContext.shape when
deriving the key.
In `@src/runtime.rs`:
- Around line 64-78: The cache key generation for multi-shape fetchers needs to
include ctx.shape so different shapes don't collide; update the fetcher
implementations that declare multiple shapes (e.g., static_text,
project/Metadata) to append the current ctx.shape to their cache_key() output
(follow the existing pattern used in read_store, GitHub, and Git fetchers), or
conditionally include ctx.shape inside cache_key() whenever
fetcher.shapes().len() > 1; make sure the cache_key() override reads ctx.shape
and incorporates it deterministically alongside the existing fetcher/options
components.
---
Outside diff comments:
In `@src/render/mod.rs`:
- Around line 114-116: Update the documentation comment for the `align` option
to reflect that `grid_table` now respects `RenderOptions.align` when `layout =
"inline"`; locate the doc string around the `align` description in
src/render/mod.rs and change the sentence that says "structural renderers
(grid_table, gauge_*, chart_*) ignore it" to note that `grid_table` honours
`align` for `layout = "inline"` while other structural renderers still ignore
it, and ensure you mention the accepted values ("left", "center", "right") and
that this applies to `RenderOptions.align`.
---
Nitpick comments:
In `@src/render/gauge_line.rs`:
- Around line 76-84: The gauge over-reserves one cell because reserved is
computed as prefix_width(&prefix) + 1 + suffix.chars().count() as u16 + 1 while
compose_spans already accounts for the prefix separator; change the reserved
calculation in src/render/gauge_line.rs (the reserved binding used to compute
bar_width and filled) to reserved = prefix_width(&prefix) +
suffix.chars().count() as u16 + 1 so the non-bar footprint equals prefix_width +
suffix_chars + 1 and update bar_width/fill computation to use that value.
In `@src/render/list_timeline.rs`:
- Around line 25-32: The default for the "bullet" OptionSchema is currently set
as a raw token and should be quoted to match the other string defaults and
doc-gen expectations; locate OPTION_SCHEMAS and the OptionSchema entry with name
"bullet" and change its default from Some("none") to include inner quotes like
Some("\"none\"") so the generated docs render the default as "none".
In `@src/render/text_ascii.rs`:
- Around line 195-203: In load_font, avoid calling
FIGfont::standard().expect(...) on parse failure; instead, if
FIGfont::from_content(source) fails, retry parsing the bundled FONT_STANDARD via
FIGfont::from_content(FONT_STANDARD) and only panic (or propagate a Result) if
that second parse also fails; update the error path in load_font to attempt
FONT_STANDARD before calling expect, referencing load_font,
FIGfont::from_content, and FONT_STANDARD.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9a5f6a34-3379-4971-8dc2-7bf4e79beb73
📒 Files selected for processing (37)
.splashboard/dashboard.tomlsrc/config.rssrc/fetcher/clock/ratio.rssrc/fetcher/github/languages.rssrc/fetcher/github/mod.rssrc/fetcher/mod.rssrc/fetcher/project.rssrc/fetcher/read_store.rssrc/fetcher/system.rssrc/layout.rssrc/payload.rssrc/render/animated_postfx.rssrc/render/animated_typewriter.rssrc/render/chart_bar.rssrc/render/chart_line.rssrc/render/chart_pie.rssrc/render/chart_scatter.rssrc/render/chart_sparkline.rssrc/render/figlet_fonts/NOTICE.mdsrc/render/figlet_fonts/banner.flfsrc/render/figlet_fonts/big.flfsrc/render/figlet_fonts/small.flfsrc/render/figlet_fonts/standard.flfsrc/render/gauge_circle.rssrc/render/gauge_line.rssrc/render/grid_calendar.rssrc/render/grid_heatmap.rssrc/render/grid_table.rssrc/render/list_plain.rssrc/render/list_timeline.rssrc/render/media_image.rssrc/render/mod.rssrc/render/status_badge.rssrc/render/text_ascii.rssrc/runtime.rssrc/samples.rssrc/theme/mod.rs
✅ Files skipped from review due to trivial changes (7)
- src/fetcher/read_store.rs
- src/render/figlet_fonts/NOTICE.md
- src/fetcher/system.rs
- src/render/figlet_fonts/banner.flf
- src/render/figlet_fonts/standard.flf
- src/render/figlet_fonts/big.flf
- src/render/figlet_fonts/small.flf
🚧 Files skipped from review as they are similar to previous changes (10)
- src/samples.rs
- src/theme/mod.rs
- src/fetcher/github/mod.rs
- src/render/animated_postfx.rs
- src/render/list_plain.rs
- src/config.rs
- src/render/chart_line.rs
- src/layout.rs
- src/render/status_badge.rs
- src/render/chart_sparkline.rs
Binary distribution (cargo install / brew / GH Release tarballs) needs third-party attribution in the distributable, not just in the source tree. A README.md under `src/render/figlet_fonts/` is invisible to anyone downloading a binary. Move the per-font notice block to the project root where cargo-publish / release archives carry it alongside the existing LICENSE. Expanded while I'm at it so each font's exact permission string (preserved from the `.flf` header) is reproduced — FIGlet convention keeps the license text inside the font, but those comments never reach the user of the compiled binary, so the root file becomes the canonical copy. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…cargo-about Binary distribution needs attribution for every linked crate, not just the bundled FIGlet fonts. Set up `cargo about` so the full dependency license listing regenerates from `Cargo.lock`: - `about.toml` — allow-list of SPDX licenses we accept for binary redistribution. Covers the dependencies currently pulled in (`Apache-2.0`, `MIT`, `ISC`, `BSD-*`, `MPL-2.0`, `CDLA-Permissive- 2.0` for webpki-roots, `NCSA` for libfuzzer-sys, etc.). Any future crate outside the list fails the generate step so we notice before shipping. - `about.hbs` — handlebars template rendering markdown with a hand-written preamble (splashboard's own license + the FIGlet font block) followed by the per-crate license text. - `THIRDPARTY-LICENSES.md` — regenerated output. Covers both the FIGlet fonts and every crate in the current dep graph. Regenerate with `cargo about generate about.hbs -o THIRDPARTY-LICENSES.md`; can be wired into the release job later so the shipped artefact is always current. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Closes #79. Tracks #76 (0.x release scope).
Summary
BorderSpec::Toppaints only the top edge so rows can express section dividers withborder = "top"+titleinstead of static hack rows.config.rs::BorderSpec/layout.rs::build_blockboth thread the new variant through.include_str!—render = { type = "text_ascii", style = "figlet", font = "banner" }is now valid.color = "<theme token>"lets blocks / figlet pick any[theme]key.align,fit(contain / cover / stretch →Resize::Fit/Crop/Scale),max_width,max_height,padding— small hero images stop warping across the slot.year: ▓▓▓▓░░░░ 32% (118 of 365));label+value_format = \"percent\" | \"fraction\" | \"both\". Fraction/both requireRatioData.denominator, new optional field —clock_ratiofills it in for every period.layout = \"inline\"(key: value · key: value),column_alignper-column alignment in the defaultrowslayout.bulletglyph (•/●/▪/→/none),max_itemscap, and (timeline only)date_format = \"relative\" | \"absolute\".labelprefix +style = \"bars\" | \"line\".shape = \"rounded\" | \"square\" | \"none\"+paddingfor pill framing.chart_pie(legend position / donut),chart_line/chart_scatter(axes block + scattermarker),chart_bar(horizontal / stacked / max_bars),gauge_circle(ring_thickness / label_position — accepted for forward compat),grid_heatmap(cell_char),grid_calendar(week_start / marker — accepted for forward compat).theme::token_color()resolves any single-colour key by name. Every renderer declaresoption_schemas()socargo xtaskregenerates the reference docs cleanly.Out of scope (future issues): the
{ sides, style }object form of border spec (no demand yet), presets themselves (#77 rewrites their static─── title ───rows toborder = \"top\"+titleonce that issue lands).Test plan
cargo test— 371 passing, no regressions.cargo clippy --all-targets -- -D warnings— clean.cargo fmt --all -- --check— clean.cargo xtaskregenerates the docs-site reference pages from the new schemas.border = \"top\"row paints a single rule with title,font = \"banner\"renders,gauge_lineshowsyear: ▓░ 32% (118 of 365).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Improvements