Repository navigation
feat(docs): widget catalogue site via xtask + astro/starlight (#52) - #54
Conversation
…enderer Adds two trait methods, each with sensible defaults, so widget metadata lives next to the code that implements it instead of drifting in prose: - `option_schemas()` on `Fetcher` / `RealtimeFetcher` / `Renderer` returns a `&[OptionSchema]` describing what the widget accepts from `[widget.options]` (name, type hint, required, default, description). Populated for the clock family and ascii_art / simple renderers. - `sample_body(shape)` on both fetcher traits returns a representative `Body` for previewing the widget without executing it. Populated for every built-in fetcher; `read_store` falls through to a shape-level canonical fallback in `samples::canonical_sample`. Library exposure comes along with this: `src/lib.rs` now re-exports every module so downstream tooling (xtask, future CLI preview subcommand) can reach registries and samples via `splashboard::…`. `main.rs` becomes a thin binary that imports from the library. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Introduces the docs surface for issue #52: - `xtask` workspace crate with `cargo xtask` alias (.cargo/config.toml). Reads the built-in fetcher / renderer registries and writes one Markdown page per widget under `docs-site/src/content/docs/reference/` — overview, per-fetcher, per-renderer — plus inline HTML previews. Previews render each `(fetcher, shape, renderer)` triple through a ratatui `TestBackend`, converting the resulting `Buffer` to cell-wrapped spans so column alignment survives the browser's rendering of block glyphs. Sample payloads come from each fetcher's own `sample_body(shape)` override; this crate only handles layout and HTML conversion. - `docs-site/` — Astro 5 + Starlight 0.37, scaffolded for GitHub Pages under `/splashboard/`. Generated reference pages are gitignored so the repo only carries handwritten content (landing + 404 + custom CSS); `cargo xtask` regenerates them on demand. `@astrojs/sitemap` pinned to 3.7.0 via overrides because 3.7.1 pulls zod v4 which collides with the rest of the stack. - `.github/workflows/docs.yml` — builds the site on every push to `main` (and on manual dispatch), then publishes via the official `actions/deploy-pages` flow. Requires Settings → Pages → Source to be set to "GitHub Actions" one time. Closes #52. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
📝 WalkthroughWalkthroughThis pull request establishes a comprehensive documentation site infrastructure for splashboard. It converts the repository to a Cargo workspace, adds an Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as cargo xtask
participant Matrix as gen_matrix
participant Fetchers as Fetcher Registry
participant Renderers as Renderer Registry
participant Snapshots as snapshots
participant RTerm as ratatui Terminal
participant HTML as html_snapshot
participant Docs as docs-site/reference
CLI->>Matrix: run(out_path)
Matrix->>Fetchers: get all registered fetchers
Matrix->>Renderers: get all registered renderers
Matrix->>Docs: write matrix.md overview
loop For each fetcher
Matrix->>Fetchers: get option_schemas & shapes
Matrix->>Docs: write fetcher/<name>.md (schema table)
Matrix->>Snapshots: previews_for(fetcher, renderers)
loop For each supported shape
Snapshots->>Fetchers: sample_body(shape)
Snapshots->>Renderers: find compatible renderers
loop For each compatible renderer
Snapshots->>RTerm: render sample via TestBackend
RTerm->>HTML: convert Buffer to HTML
HTML->>Snapshots: <pre class="splash-snapshot">
Snapshots->>Docs: embed preview + config in reference page
end
end
end
loop For each renderer
Matrix->>Renderers: get option_schemas
Matrix->>Docs: write renderer/<name>.md (schema table)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 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 docstrings
🧪 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: 6
🧹 Nitpick comments (6)
docs-site/src/styles/snapshot.css (1)
5-5: Remote Google Fonts import adds a third-party runtime dependency.Importing from
fonts.googleapis.comat runtime means every docs visitor hits Google, which can be a privacy/GDPR concern for a GitHub Pages site and also breaks offline/air-gapped viewing. Consider self-hosting JetBrains Mono (e.g., via@fontsource/jetbrains-mono) so the font ships with the built site and no third-party request is made.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs-site/src/styles/snapshot.css` at line 5, The CSS currently pulls JetBrains Mono from Google via the `@import` URL in snapshot.css, creating a third-party runtime dependency; remove that remote `@import` and instead self-host the font (for example install `@fontsource/jetbrains-mono` and import it from the package in your build entry or main stylesheet), then update snapshot.css to reference "JetBrains Mono" in font-family without the external URL; locate the `@import` line in snapshot.css and replace the external import with the local package import and ensure any build/asset pipeline copies the font into the site bundle so no fonts.googleapis.com requests occur.src/fetcher/clock/derived.rs (1)
54-59: Sample doesn't reflect the defaultKind.
Options::kinddefaults toKind::TimeOfDay(which produces"morning"/"afternoon"/"evening"/"night"), but the preview sample shows"day 113 of 2026"— output ofKind::DayOfYear. Readers landing on the docs page for the default configuration will see a sample that doesn't match what they'd actually get out of the box.Consider using
"afternoon"(or similartime_of_dayoutput) so the preview matches the no-config behavior, or pick the most visually interesting kind and document thatkindis set today_of_yearin the preview.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/fetcher/clock/derived.rs` around lines 54 - 59, The sample_body implementation currently returns a DayOfYear string ("day 113 of 2026") which mismatches the default Options::kind (Kind::TimeOfDay); update the Shape::Lines branch in sample_body (function sample_body, pattern Shape::Lines, call samples::lines) to return a TimeOfDay-style sample such as "afternoon" (e.g., samples::lines(&["afternoon"])), or alternatively change the preview code to explicitly document that the sample uses Kind::DayOfYear if you intend to keep the current sample.src/render/mod.rs (1)
197-203: Minor: prefer iterator-chain sort.Per coding guidelines ("Prefer
map,filter,reduceover imperative loops"), this can be expressed more idiomatically, though the current form is fine.♻️ Optional refactor
- pub fn sorted(&self) -> Vec<Arc<dyn Renderer>> { - let mut entries: Vec<_> = self.renderers.values().cloned().collect(); - entries.sort_by(|a, b| a.name().cmp(b.name())); - entries - } + pub fn sorted(&self) -> Vec<Arc<dyn Renderer>> { + let mut entries: Vec<_> = self.renderers.values().cloned().collect(); + entries.sort_by_key(|r| r.name().to_string()); + entries + }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/mod.rs` around lines 197 - 203, The sorted() method currently collects into a Vec then sorts imperatively; change it to an iterator-chain using itertools so it's more idiomatic: use self.renderers.values().cloned().sorted_by_key(|r| r.name()).collect() (requires adding use itertools::Itertools) or alternatively use collect().into_iter().sorted_by_key(...) from Itertools; update the sorted() implementation accordingly referencing the sorted() function and the renderers field.docs-site/package.json (1)
18-20: Document the@astrojs/sitemappin.The
overridespin to3.7.0has no accompanying comment explaining why a specific version is required (peer/resolution conflict with Starlight 0.37? a regression in a newer sitemap?). A brief note here (or in a nearby doc) will prevent the next maintainer from silently bumping it and reintroducing the problem.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@docs-site/package.json` around lines 18 - 20, The package.json overrides entry pins "@astrojs/sitemap": "3.7.0" but lacks any explanatory comment; update the docs/package.json area to add a short comment (or nearby README note) explaining why the sitemap package is pinned (e.g., peer resolution conflict with Starlight 0.37 or a regression in newer sitemap versions), referencing the exact override key "@astrojs/sitemap": "3.7.0" and including reproduction details or links to the issue/PR so future maintainers understand why it must not be bumped silently..github/workflows/docs.yml (1)
16-18: Considercancel-in-progress: falsefor the Pages deploy group.GitHub's own Pages starter workflows recommend not cancelling in-progress deploy runs, because cancelling after
upload-pages-artifact/ duringdeploy-pagescan leave the site in an inconsistent state or trip the Pages API. Rapid-fire pushes will still queue and only the latest artifact wins, just more safely. Build-only cancellation is fine, but for a single combinedpagesgroup this is usually set tofalse.concurrency: group: pages - cancel-in-progress: true + cancel-in-progress: false🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/docs.yml around lines 16 - 18, The concurrency block currently sets cancel-in-progress: true for the GitHub Actions concurrency group named "pages"; change the key cancel-in-progress to false so the pages deploy group does not cancel in-progress runs (i.e., update the concurrency.group "pages" entry to use cancel-in-progress: false) to avoid leaving Pages deployments in an inconsistent state when upload-pages-artifact / deploy-pages are in-flight.xtask/src/html_snapshot.rs (1)
17-26: Avoid the per-cellCell::clone().Only immutable reads (
cell_style(&cell),cell.symbol()) are needed; a reference is enough and avoids an allocation-per-cell on larger buffers.♻️ Suggested change
- for x in 0..area.width { - let cell = buf[(x, y)].clone(); - let style = cell_style(&cell); + for x in 0..area.width { + let cell = &buf[(x, y)]; + let style = cell_style(cell); if Some(style) != run_style { flush_run(&mut out, run_style.as_ref(), &run_cells); run_cells.clear(); run_style = Some(style); } run_cells.push(cell.symbol().to_string()); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@xtask/src/html_snapshot.rs` around lines 17 - 26, The loop is cloning each Cell unnecessarily; change let cell = buf[(x, y)].clone() to borrow the cell (let cell = &buf[(x, y)]) and update subsequent calls to use the reference (cell_style(&cell) stays the same, cell.symbol() stays the same) so you avoid an allocation-per-cell; ensure run_cells.push(...) still accepts the symbol (convert to String as before) and that flush_run(&mut out, run_style.as_ref(), &run_cells) continues to work with run_style and run_cells unchanged.
🤖 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/git/commits_activity.rs`:
- Around line 40-49: The sample for Shape::Lines in sample_body currently uses
the text "42 commits this month" which doesn't match render_body's real output;
update the Shape::Lines arm inside fn sample_body to emit a string following the
actual format (e.g., "42 commits in the last 52 weeks" or use the WEEKS constant
if available) so docs previews match render_body's "{total} commits in the last
{WEEKS} weeks" output.
In `@src/fetcher/git/latest_tag.rs`:
- Around line 34-44: In sample_body (function sample_body) the Entries branch
emits an entry with key "short" but the real build() uses "commit"; update the
Entries sample in sample_body (Shape::Entries) to use the key "commit" with the
same short-hash value and ensure the entry order/keys match the real output
["tag","commit","date"] so docs previews reflect the actual payload shape.
In `@src/fetcher/git/status.rs`:
- Around line 34-46: The Lines sample in sample_body (Shape::Lines branch using
samples::lines) uses a different glyph set than the real output from
format_line; update the sample to match format_line's runtime string (e.g.,
"main ↑2 ↓0 · clean") or generate the sample by calling format_line (or the same
helper that format_line uses) so documentation previews reflect actual output;
modify sample_body's Shape::Lines case accordingly and keep PayloadStatus/other
sample values consistent with format_line's inputs.
In `@src/fetcher/git/worktrees.rs`:
- Around line 30-44: The sample_body implementation in sample_body
(Shape::Entries and Shape::Lines) doesn't match the real render_body/format_line
schema: replace the samples::entries call so entries use worktree id as the key
(e.g. "(main)") and values formatted as "<branch> @ <path>" (e.g. "main @
/repo") to mirror Entry { key = worktree id, value = "<branch> @ <path>" }, and
update the Shape::Lines samples::lines strings to the same format used by
format_line ("<id> (<branch>) @ <path>") so both Entries and Lines snapshots
reflect actual output; adjust the array items for samples::entries and
samples::lines in sample_body accordingly.
In `@src/fetcher/mod.rs`:
- Around line 92-98: The default sample_body currently returns
samples::canonical_sample for any non-image Shape even if that Shape is not
advertised by the Fetcher; change sample_body(&self, shape: Shape) to first
check whether shape is contained in self.shapes() and only then return
samples::canonical_sample(shape), otherwise return None; apply the same pattern
to the other default sample helper implementations referenced in the review so
they all enforce membership in shapes() before returning a sample.
In `@xtask/src/main.rs`:
- Around line 1-15: Update the crate-level doc comment to remove "future work"
wording and state that HTML snapshot/preview generation is implemented in this
crate: reference the html_snapshot and snapshots modules and the gen_matrix code
path that emits <pre class="splash-snapshot"> fragments via buffer_to_html;
change the prose to say previews/HTML production are produced here (at
build/xtask time) and briefly mention the modules responsible (html_snapshot,
snapshots, gen_matrix/buffer_to_html) so the comment accurately reflects current
behavior.
---
Nitpick comments:
In @.github/workflows/docs.yml:
- Around line 16-18: The concurrency block currently sets cancel-in-progress:
true for the GitHub Actions concurrency group named "pages"; change the key
cancel-in-progress to false so the pages deploy group does not cancel
in-progress runs (i.e., update the concurrency.group "pages" entry to use
cancel-in-progress: false) to avoid leaving Pages deployments in an inconsistent
state when upload-pages-artifact / deploy-pages are in-flight.
In `@docs-site/package.json`:
- Around line 18-20: The package.json overrides entry pins "@astrojs/sitemap":
"3.7.0" but lacks any explanatory comment; update the docs/package.json area to
add a short comment (or nearby README note) explaining why the sitemap package
is pinned (e.g., peer resolution conflict with Starlight 0.37 or a regression in
newer sitemap versions), referencing the exact override key "@astrojs/sitemap":
"3.7.0" and including reproduction details or links to the issue/PR so future
maintainers understand why it must not be bumped silently.
In `@docs-site/src/styles/snapshot.css`:
- Line 5: The CSS currently pulls JetBrains Mono from Google via the `@import` URL
in snapshot.css, creating a third-party runtime dependency; remove that remote
`@import` and instead self-host the font (for example install
`@fontsource/jetbrains-mono` and import it from the package in your build entry or
main stylesheet), then update snapshot.css to reference "JetBrains Mono" in
font-family without the external URL; locate the `@import` line in snapshot.css
and replace the external import with the local package import and ensure any
build/asset pipeline copies the font into the site bundle so no
fonts.googleapis.com requests occur.
In `@src/fetcher/clock/derived.rs`:
- Around line 54-59: The sample_body implementation currently returns a
DayOfYear string ("day 113 of 2026") which mismatches the default Options::kind
(Kind::TimeOfDay); update the Shape::Lines branch in sample_body (function
sample_body, pattern Shape::Lines, call samples::lines) to return a
TimeOfDay-style sample such as "afternoon" (e.g.,
samples::lines(&["afternoon"])), or alternatively change the preview code to
explicitly document that the sample uses Kind::DayOfYear if you intend to keep
the current sample.
In `@src/render/mod.rs`:
- Around line 197-203: The sorted() method currently collects into a Vec then
sorts imperatively; change it to an iterator-chain using itertools so it's more
idiomatic: use self.renderers.values().cloned().sorted_by_key(|r|
r.name()).collect() (requires adding use itertools::Itertools) or alternatively
use collect().into_iter().sorted_by_key(...) from Itertools; update the sorted()
implementation accordingly referencing the sorted() function and the renderers
field.
In `@xtask/src/html_snapshot.rs`:
- Around line 17-26: The loop is cloning each Cell unnecessarily; change let
cell = buf[(x, y)].clone() to borrow the cell (let cell = &buf[(x, y)]) and
update subsequent calls to use the reference (cell_style(&cell) stays the same,
cell.symbol() stays the same) so you avoid an allocation-per-cell; ensure
run_cells.push(...) still accepts the symbol (convert to String as before) and
that flush_run(&mut out, run_style.as_ref(), &run_cells) continues to work with
run_style and run_cells unchanged.
🪄 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: a7b539ab-87d0-4af0-8729-55794207cd52
⛔ Files ignored due to path filters (2)
Cargo.lockis excluded by!**/*.lockdocs-site/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (42)
.cargo/config.toml.github/workflows/docs.ymlCargo.tomldocs-site/.gitignoredocs-site/astro.config.mjsdocs-site/package.jsondocs-site/src/content.config.tsdocs-site/src/content/docs/404.mddocs-site/src/content/docs/index.mddocs-site/src/styles/snapshot.cssdocs-site/tsconfig.jsonsrc/fetcher/clock/countdown.rssrc/fetcher/clock/derived.rssrc/fetcher/clock/mod.rssrc/fetcher/clock/ratio.rssrc/fetcher/clock/state.rssrc/fetcher/clock/sunrise.rssrc/fetcher/clock/timezones.rssrc/fetcher/git/blame_heatmap.rssrc/fetcher/git/commits_activity.rssrc/fetcher/git/contributors.rssrc/fetcher/git/latest_tag.rssrc/fetcher/git/recent_commits.rssrc/fetcher/git/stash_count.rssrc/fetcher/git/status.rssrc/fetcher/git/worktrees.rssrc/fetcher/mod.rssrc/fetcher/static_text.rssrc/fetcher/stub.rssrc/fetcher/system.rssrc/lib.rssrc/main.rssrc/options.rssrc/render/ascii_art.rssrc/render/mod.rssrc/render/text.rssrc/samples.rsxtask/Cargo.tomlxtask/src/gen_matrix.rsxtask/src/html_snapshot.rsxtask/src/main.rsxtask/src/snapshots.rs
| fn sample_body(&self, shape: Shape) -> Option<Body> { | ||
| Some(match shape { | ||
| Shape::Heatmap => samples::heatmap_grid(7, 14), | ||
| Shape::NumberSeries => samples::number_series(&[ | ||
| 2, 5, 3, 8, 4, 9, 6, 11, 7, 3, 4, 6, 2, 5, 8, 10, 7, 4, 9, 6, | ||
| ]), | ||
| Shape::Lines => samples::lines(&["42 commits this month"]), | ||
| _ => return None, | ||
| }) | ||
| } |
There was a problem hiding this comment.
Minor: Lines sample phrasing drifts from real output.
render_body emits "{total} commits in the last {WEEKS} weeks" (52 weeks), while the sample says "42 commits this month". Consider matching the real format so docs previews represent actual output.
♻️ Suggested tweak
- Shape::Lines => samples::lines(&["42 commits this month"]),
+ Shape::Lines => samples::lines(&["128 commits in the last 52 weeks"]),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| fn sample_body(&self, shape: Shape) -> Option<Body> { | |
| Some(match shape { | |
| Shape::Heatmap => samples::heatmap_grid(7, 14), | |
| Shape::NumberSeries => samples::number_series(&[ | |
| 2, 5, 3, 8, 4, 9, 6, 11, 7, 3, 4, 6, 2, 5, 8, 10, 7, 4, 9, 6, | |
| ]), | |
| Shape::Lines => samples::lines(&["42 commits this month"]), | |
| _ => return None, | |
| }) | |
| } | |
| fn sample_body(&self, shape: Shape) -> Option<Body> { | |
| Some(match shape { | |
| Shape::Heatmap => samples::heatmap_grid(7, 14), | |
| Shape::NumberSeries => samples::number_series(&[ | |
| 2, 5, 3, 8, 4, 9, 6, 11, 7, 3, 4, 6, 2, 5, 8, 10, 7, 4, 9, 6, | |
| ]), | |
| Shape::Lines => samples::lines(&["128 commits in the last 52 weeks"]), | |
| _ => return None, | |
| }) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/fetcher/git/commits_activity.rs` around lines 40 - 49, The sample for
Shape::Lines in sample_body currently uses the text "42 commits this month"
which doesn't match render_body's real output; update the Shape::Lines arm
inside fn sample_body to emit a string following the actual format (e.g., "42
commits in the last 52 weeks" or use the WEEKS constant if available) so docs
previews match render_body's "{total} commits in the last {WEEKS} weeks" output.
| fn sample_body(&self, shape: Shape) -> Option<Body> { | ||
| Some(match shape { | ||
| Shape::Lines => samples::lines(&["v1.2.3"]), | ||
| Shape::Entries => samples::entries(&[ | ||
| ("tag", "v1.2.3"), | ||
| ("short", "a1b2c3d"), | ||
| ("date", "2026-04-14"), | ||
| ]), | ||
| _ => return None, | ||
| }) | ||
| } |
There was a problem hiding this comment.
sample_body entry key diverges from real fetch output.
The real build() emits entry keys ["tag", "commit", "date"] (line 59 uses entry("commit", &tag.short_hash) and the test at line 151 asserts exactly that order/keys), but the sample here emits "short" instead of "commit". Docs previews generated from sample_body will therefore misrepresent the actual payload shape that renderers/configs see at runtime.
Proposed fix
Shape::Entries => samples::entries(&[
("tag", "v1.2.3"),
- ("short", "a1b2c3d"),
+ ("commit", "a1b2c3d"),
("date", "2026-04-14"),
]),🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/fetcher/git/latest_tag.rs` around lines 34 - 44, In sample_body (function
sample_body) the Entries branch emits an entry with key "short" but the real
build() uses "commit"; update the Entries sample in sample_body (Shape::Entries)
to use the key "commit" with the same short-hash value and ensure the entry
order/keys match the real output ["tag","commit","date"] so docs previews
reflect the actual payload shape.
| fn sample_body(&self, shape: Shape) -> Option<Body> { | ||
| Some(match shape { | ||
| Shape::Entries => samples::entries(&[ | ||
| ("branch", "main"), | ||
| ("ahead", "2"), | ||
| ("modified", "3"), | ||
| ("untracked", "1"), | ||
| ]), | ||
| Shape::Lines => samples::lines(&["main +2 −0 ◆3 ?1"]), | ||
| Shape::Badge => samples::badge(PayloadStatus::Ok, "clean"), | ||
| _ => return None, | ||
| }) | ||
| } |
There was a problem hiding this comment.
Lines sample drifts from the actual format_line output.
The sample "main +2 −0 ◆3 ?1" uses a different glyph vocabulary than the real runtime string produced by format_line ("main ↑2 ↓0 · clean"). Since sample_body is the source of truth for generated documentation previews, showing a format that users will never actually see is a bit misleading. Consider aligning the sample with real output (or updating format_line if this new vocabulary is intended).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/fetcher/git/status.rs` around lines 34 - 46, The Lines sample in
sample_body (Shape::Lines branch using samples::lines) uses a different glyph
set than the real output from format_line; update the sample to match
format_line's runtime string (e.g., "main ↑2 ↓0 · clean") or generate the sample
by calling format_line (or the same helper that format_line uses) so
documentation previews reflect actual output; modify sample_body's Shape::Lines
case accordingly and keep PayloadStatus/other sample values consistent with
format_line's inputs.
| fn sample_body(&self, shape: Shape) -> Option<Body> { | ||
| Some(match shape { | ||
| Shape::Entries => samples::entries(&[ | ||
| ("main", "/repo"), | ||
| ("feat/foo", "/repo-feat"), | ||
| ("hotfix", "/repo-hotfix"), | ||
| ]), | ||
| Shape::Lines => samples::lines(&[ | ||
| "main /repo", | ||
| "feat/foo /repo-feat", | ||
| "hotfix /repo-hotfix", | ||
| ]), | ||
| _ => return None, | ||
| }) | ||
| } |
There was a problem hiding this comment.
Sample Entries payload doesn't match the actual fetch output schema.
The real render_body emits Entry { key = worktree id (e.g. "(main)"), value = "<branch> @ <path>" }, but the sample calls samples::entries(&[("main", "/repo"), ...]) which produces key="main", value="/repo" — no branch-qualified value, and key is branch rather than worktree id. This will make the rendered docs preview diverge from real output.
🛠️ Suggested fix
- Shape::Entries => samples::entries(&[
- ("main", "/repo"),
- ("feat/foo", "/repo-feat"),
- ("hotfix", "/repo-hotfix"),
- ]),
+ Shape::Entries => samples::entries(&[
+ ("(main)", "main @ /repo"),
+ ("wt-1", "feat/foo @ /repo-feat"),
+ ("wt-2", "hotfix @ /repo-hotfix"),
+ ]),Also note the Lines sample uses a "<branch> <path>" column layout while the real format_line emits "<id> (<branch>) @ <path>" — consider aligning those too for snapshot fidelity.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/fetcher/git/worktrees.rs` around lines 30 - 44, The sample_body
implementation in sample_body (Shape::Entries and Shape::Lines) doesn't match
the real render_body/format_line schema: replace the samples::entries call so
entries use worktree id as the key (e.g. "(main)") and values formatted as
"<branch> @ <path>" (e.g. "main @ /repo") to mirror Entry { key = worktree id,
value = "<branch> @ <path>" }, and update the Shape::Lines samples::lines
strings to the same format used by format_line ("<id> (<branch>) @ <path>") so
both Entries and Lines snapshots reflect actual output; adjust the array items
for samples::entries and samples::lines in sample_body accordingly.
| /// A representative payload body for the given shape, used to preview what this fetcher | ||
| /// emits without executing it. Default falls back to [`crate::samples::canonical_sample`]; | ||
| /// fetchers override to surface something closer to real output (`"main +2 ◆3"` for | ||
| /// `git_status`, `"14:35"` for `clock`). Must be a member of `shapes()`. | ||
| fn sample_body(&self, shape: Shape) -> Option<Body> { | ||
| samples::canonical_sample(shape) | ||
| } |
There was a problem hiding this comment.
Return None for unsupported sample shapes.
The defaults currently return a canonical payload for any non-image Shape, even when that shape is not in self.shapes(). That can make docs/preview callers accidentally render unsupported Fetcher × Renderer pairings as valid. Based on learnings, Each Fetcher must declare its supported shapes via fn shapes(&self) -> &[Shape].
🛡️ Proposed fix to enforce the advertised shape contract
fn sample_body(&self, shape: Shape) -> Option<Body> {
- samples::canonical_sample(shape)
+ if self.shapes().contains(&shape) {
+ samples::canonical_sample(shape)
+ } else {
+ None
+ }
}
@@
fn sample_body(&self, shape: Shape) -> Option<Body> {
- samples::canonical_sample(shape)
+ if self.shapes().contains(&shape) {
+ samples::canonical_sample(shape)
+ } else {
+ None
+ }
}
@@
pub fn sample_body(&self, shape: Shape) -> Option<Body> {
match self {
- Self::Cached(f) => f.sample_body(shape),
- Self::Realtime(f) => f.sample_body(shape),
+ Self::Cached(f) if f.shapes().contains(&shape) => f.sample_body(shape),
+ Self::Realtime(f) if f.shapes().contains(&shape) => f.sample_body(shape),
+ _ => None,
}
}Also applies to: 117-120, 195-199
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/fetcher/mod.rs` around lines 92 - 98, The default sample_body currently
returns samples::canonical_sample for any non-image Shape even if that Shape is
not advertised by the Fetcher; change sample_body(&self, shape: Shape) to first
check whether shape is contained in self.shapes() and only then return
samples::canonical_sample(shape), otherwise return None; apply the same pattern
to the other default sample helper implementations referenced in the review so
they all enforce membership in shapes() before returning a sample.
| //! Workspace tooling for splashboard. Run via `cargo xtask`. | ||
| //! | ||
| //! Reads the built-in fetcher / renderer registries and writes Markdown reference pages (one | ||
| //! per fetcher, one per renderer, plus an overview). Snapshot / preview generation lives with | ||
| //! the Astro docs-site (future work) so HTML production stays a build-time concern of the site, | ||
| //! not this tool. | ||
|
|
||
| use std::path::PathBuf; | ||
|
|
||
| use anyhow::Result; | ||
| use clap::Parser; | ||
|
|
||
| mod gen_matrix; | ||
| mod html_snapshot; | ||
| mod snapshots; |
There was a problem hiding this comment.
Stale module doc: snapshot/HTML generation is no longer "future work".
The doc comment says HTML production lives on the Astro side, but this crate declares html_snapshot and snapshots, and gen_matrix embeds <pre class="splash-snapshot"> fragments via buffer_to_html. Please update the description to reflect that previews are now produced here.
✏️ Suggested wording
//! Workspace tooling for splashboard. Run via `cargo xtask`.
//!
//! Reads the built-in fetcher / renderer registries and writes Markdown reference pages (one
-//! per fetcher, one per renderer, plus an overview). Snapshot / preview generation lives with
-//! the Astro docs-site (future work) so HTML production stays a build-time concern of the site,
-//! not this tool.
+//! per fetcher, one per renderer, plus an overview). Inline HTML previews are rendered here
+//! via ratatui's `TestBackend` and embedded into the generated Markdown as
+//! `<pre class="splash-snapshot">` fragments (see `snapshots` and `html_snapshot`).📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| //! Workspace tooling for splashboard. Run via `cargo xtask`. | |
| //! | |
| //! Reads the built-in fetcher / renderer registries and writes Markdown reference pages (one | |
| //! per fetcher, one per renderer, plus an overview). Snapshot / preview generation lives with | |
| //! the Astro docs-site (future work) so HTML production stays a build-time concern of the site, | |
| //! not this tool. | |
| use std::path::PathBuf; | |
| use anyhow::Result; | |
| use clap::Parser; | |
| mod gen_matrix; | |
| mod html_snapshot; | |
| mod snapshots; | |
| //! Workspace tooling for splashboard. Run via `cargo xtask`. | |
| //! | |
| //! Reads the built-in fetcher / renderer registries and writes Markdown reference pages (one | |
| //! per fetcher, one per renderer, plus an overview). Inline HTML previews are rendered here | |
| //! via ratatui's `TestBackend` and embedded into the generated Markdown as | |
| //! `<pre class="splash-snapshot">` fragments (see `snapshots` and `html_snapshot`). | |
| use std::path::PathBuf; | |
| use anyhow::Result; | |
| use clap::Parser; | |
| mod gen_matrix; | |
| mod html_snapshot; | |
| mod snapshots; |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@xtask/src/main.rs` around lines 1 - 15, Update the crate-level doc comment to
remove "future work" wording and state that HTML snapshot/preview generation is
implemented in this crate: reference the html_snapshot and snapshots modules and
the gen_matrix code path that emits <pre class="splash-snapshot"> fragments via
buffer_to_html; change the prose to say previews/HTML production are produced
here (at build/xtask time) and briefly mention the modules responsible
(html_snapshot, snapshots, gen_matrix/buffer_to_html) so the comment accurately
reflects current behavior.
Replaces the local 4-element SHAPES const with the shared `LIST_SHAPES` (LinkedTextBlock / TextBlock / MarkdownTextBlock / ImageLinkedList / Entries / Text / Bars / Badge / Timeline). `fetch` routes through `forge_items::dispatch_rows_async` so `ImageLinkedList` resolves author avatars through the thumbnails cache and `Badge` produces the `"N open PRs"` count-pill. Entries key convention changes from "splashboard #54" to "#54" so the row label stays consistent across every shape variant. Repo-scope fetchers (which already used `#54`) are unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Same migration as the user-scope fetchers, but with `include_repo = false` so the row label stays the bare `#54` rather than the full `#54`. Badge noun pair is ("open PR", "open PRs"). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Closes #52.
Summary
Fetcher/RealtimeFetcher/Renderertraits so widget metadata lives next to the implementing code (no docs drift). Populated for every built-in fetcher; renderer option schemas coverascii_art+simple.xtaskworkspace crate (cargo xtask) reads the built-in registries and writes per-widget Markdown pages — overview, one page per fetcher, one per renderer — with inline previews rendered via ratatuiTestBackendand converted to cell-wrapped HTML spans so block glyphs don't drift columns in the browser.docs-site/— Astro 5 + Starlight 0.37 under/splashboard/. Generated reference pages are gitignored; only handwritten content (landing, 404,.splash-snapshotCSS) is checked in..github/workflows/docs.ymlbuilds via xtask → npm → astro on every push tomainand deploys viaactions/deploy-pages.Test plan
cargo test --workspace— 287 + 12 + 2 passingcargo clippy --workspace --all-targets -- -D warningscleancargo fmt --all --checkcleancargo xtaskregenerates 48 reference MDs from the live registriescd docs-site && npm ci && npm run build→ 50 pages (index + 404 + 1 matrix + 30 fetchers + 17 renderers), pagefind + sitemap wired upGitHub Actions(required before the workflow can deploy)🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores
xtask) to maintain reference docs in sync with code