Repository navigation
docs(presets): align preset guide with shipped templates - #94
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 51 minutes and 47 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 (19)
📝 WalkthroughWalkthroughThis PR updates documentation by removing outdated notes about future features, redesigns preset guidance with embedded template previews and updated widget composition, and refactors snapshot rendering in xtask to support multiple preset templates with realtime fetcher handling and environment variable scrubbing. Changes
Sequence DiagramsequenceDiagram
actor Renderer
participant SnapshotGen as Snapshot Generator
participant Fetcher
participant FetchContext
participant Widget
Renderer->>SnapshotGen: Render snapshot for preset
SnapshotGen->>Fetcher: Check if realtime?
alt Realtime Fetcher
Fetcher-->>SnapshotGen: Yes, is_realtime
SnapshotGen->>FetchContext: Construct context<br/>(widget_id, format, 50ms timeout, shape, options)
FetchContext-->>SnapshotGen: Context created
SnapshotGen->>Fetcher: compute(&context)
Fetcher->>Widget: Generate Payload
Widget-->>SnapshotGen: Payload result
else Cached Fetcher
Fetcher-->>SnapshotGen: No, not realtime
SnapshotGen->>Fetcher: override_from_format(...)<br/>or sample_body(shape)
Fetcher-->>SnapshotGen: Payload result
end
SnapshotGen-->>Renderer: Rendered output
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
==========================================
- Coverage 78.81% 78.80% -0.02%
==========================================
Files 82 82
Lines 12902 12902
==========================================
- Hits 10169 10167 -2
- Misses 2733 2735 +2 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@xtask/src/main.rs`:
- Around line 83-96: scrub_host_env() currently removes KITTY_WINDOW_ID but not
TERM, so detect_terminal() can still detect Kitty via TERM == "xterm-kitty" and
leak terminal-specific behavior; update scrub_host_env() to also remove the
"TERM" environment variable (call std::env::remove_var("TERM") in the same
unsafe block or loop of keys) so detect_terminal() cannot observe TERM and
snapshots remain deterministic.
🪄 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: c1b60ada-1c39-44e3-b2da-be51b7f64453
📒 Files selected for processing (9)
docs-site/src/content/docs/guides/getting-started.mddocs-site/src/content/docs/guides/presets.mdxdocs-site/src/content/docs/guides/themes.mddocs-site/src/content/docs/guides/trust.mddocs-site/src/content/docs/index.mdxdocs-site/src/content/docs/showcases.mddocs-site/src/styles/snapshot.cssxtask/src/dashboard_snapshot.rsxtask/src/main.rs
💤 Files with no reviewable changes (3)
- docs-site/src/content/docs/guides/themes.md
- docs-site/src/content/docs/guides/getting-started.md
- docs-site/src/content/docs/index.mdx
| fn scrub_host_env() { | ||
| for key in [ | ||
| "WT_SESSION", | ||
| "GHOSTTY_RESOURCES_DIR", | ||
| "KITTY_WINDOW_ID", | ||
| "ALACRITTY_WINDOW_ID", | ||
| "ALACRITTY_LOG", | ||
| "WEZTERM_PANE", | ||
| "TERM_PROGRAM", | ||
| ] { | ||
| // SAFETY: xtask is a single-threaded CLI entry point; no other threads can race this. | ||
| unsafe { std::env::remove_var(key) }; | ||
| } | ||
| } |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find all env var reads in fetcher code to confirm scrub coverage.
rg -nP --type=rust -C1 '\b(std::env::var|env!|env\()\s*\(?\s*"' src/fetcher/Repository: unhappychoice/splashboard
Length of output: 3041
Add TERM to the scrub list to prevent Kitty from leaking on dev machines.
detect_terminal() triggers the Kitty branch via KITTY_WINDOW_ID.is_some() || TERM == "xterm-kitty". The scrub list removes KITTY_WINDOW_ID but leaves TERM in place, so a dev running xtask inside Kitty (where TERM=xterm-kitty) will still produce snapshots identified as "Kitty"—the exact non-determinism this function exists to prevent.
🛡️ Fix
fn scrub_host_env() {
for key in [
"WT_SESSION",
"GHOSTTY_RESOURCES_DIR",
"KITTY_WINDOW_ID",
"ALACRITTY_WINDOW_ID",
"ALACRITTY_LOG",
"WEZTERM_PANE",
"TERM_PROGRAM",
+ "TERM",
] {
// SAFETY: xtask is a single-threaded CLI entry point; no other threads can race this.
unsafe { std::env::remove_var(key) };
}
}📝 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 scrub_host_env() { | |
| for key in [ | |
| "WT_SESSION", | |
| "GHOSTTY_RESOURCES_DIR", | |
| "KITTY_WINDOW_ID", | |
| "ALACRITTY_WINDOW_ID", | |
| "ALACRITTY_LOG", | |
| "WEZTERM_PANE", | |
| "TERM_PROGRAM", | |
| ] { | |
| // SAFETY: xtask is a single-threaded CLI entry point; no other threads can race this. | |
| unsafe { std::env::remove_var(key) }; | |
| } | |
| } | |
| fn scrub_host_env() { | |
| for key in [ | |
| "WT_SESSION", | |
| "GHOSTTY_RESOURCES_DIR", | |
| "KITTY_WINDOW_ID", | |
| "ALACRITTY_WINDOW_ID", | |
| "ALACRITTY_LOG", | |
| "WEZTERM_PANE", | |
| "TERM_PROGRAM", | |
| "TERM", | |
| ] { | |
| // SAFETY: xtask is a single-threaded CLI entry point; no other threads can race this. | |
| unsafe { std::env::remove_var(key) }; | |
| } | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@xtask/src/main.rs` around lines 83 - 96, scrub_host_env() currently removes
KITTY_WINDOW_ID but not TERM, so detect_terminal() can still detect Kitty via
TERM == "xterm-kitty" and leak terminal-specific behavior; update
scrub_host_env() to also remove the "TERM" environment variable (call
std::env::remove_var("TERM") in the same unsafe block or loop of keys) so
detect_terminal() cannot observe TERM and snapshots remain deterministic.
…ghten landing Extend xtask's DASHBOARD_SNAPSHOTS to render every shipped template (src/templates/home_*.toml, src/templates/project_github_activity.toml) at a uniform 120×42 canvas so they sit side-by-side under .splash-landing at identical physical size. Teach dashboard_snapshot::sample_payloads to call RealtimeFetcher::compute for realtime fetchers so widget format / options land in the preview; scrub host-identifying env vars before rendering so the snapshot is deterministic across dev machines. Rewrite presets.mdx to match what the templates actually ship today (home_splash = terminal figlet + greeting + clock, home_daily = 2-col almanac dashboard, home_github = avatar + contributions + activity, project_github_activity = figlet repo hero + 3 activity rows), split into Home / Project sections, drop the hand-drawn ASCII mockups and the 160-line TOML listing in favour of live-render + widget table. Landing page: drop the "Example: project_github_activity" meta paragraph so the preview sits directly under the hero, and tighten the vertical rhythm — zero out .hero's padding-block-end on splash templates and widen .sl-container's sibling gap to 3.25rem so the button→preview gap matches the 1.5em h2 top-margin below (both ≈ 52px). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…ives The flat concepts.md covered each piece in a paragraph. Move to a directory with the overview at the index plus four full pages, each focused on what a user needs to understand to configure, debug, or extend that piece: - concepts/ (overview) — the composition equation, the "why" of the split, cross-links to each deep dive. - concepts/widget.md — fields, shape resolution, lifecycle (cached vs realtime paths), every placeholder state (loading / trust / empty / error), the animation window, and the config scope hierarchy. - concepts/shape.md — every one of the 12 variants with Rust Body struct, JSON payload example, compatible renderers, typical fetchers, empty-state rules, and the add-a-shape recipe. - concepts/fetcher.md — Cached vs Realtime contracts, FetchContext, Safety classification with threat-model examples, options / cache keys / sample_body, the two ReadStore / basic_static escape hatches, and the add-a-fetcher recipe. - concepts/renderer.md — the full trait surface, RenderOptions, alignment rules, empty-state handling, default-per-shape table, naming convention, animation integration, and the add-a-renderer recipe. Sidebar gains a nested Concepts group plus a ReadStore entry so the new pages cluster under Guides. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
…are-data format
ReadStore sat as one section in the cookbook, but it's the escape
hatch users land on most often and has a non-obvious file format
(bare inner data struct, not the Body `{shape, data}` envelope the
rest of the system uses). That detail wasn't called out and was the
most common source of copy-paste breakage.
Add guides/read-store.md covering:
- why and when to use it
- the bare-data vs envelope distinction with ✅ / ❌ side-by-side
- how the shape is picked (from the paired renderer, not the file)
- every supported shape (10 of 12 — Badge / Timeline are out) with a
minimal JSON example
- the file_format option (json / toml / text)
- four end-to-end examples (habit tracker, goal progress, custom
sparkline, workout heatmap)
- path / safety / what ReadStore isn't
Trim cookbook's ReadStore section to a one-paragraph pointer and
redirect every `cookbook/#readstore-custom-widgets-without-code`
anchor to the new page. Link the configuration.md file_format bullet
to the Shape concept page. Drop the closed-by-design #5 / #20
parentheticals from the trust guide and rewrite the Network-rollout
note so it stands on its own without tracker links.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Doc pages should stand on their own without pointing at the issue tracker. Strip: - themes.md opening :::note that deferred preset screenshots to issue #78 / #77. - getting-started.md paragraph pointing at issue #16 for prebuilt binaries ("cargo install" alone is enough for the reader). - showcases.md preset-pending line citing issue #77. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
8beb55f to
6cb5c83
Compare
Summary
src/templates/.home_splash/home_daily/home_githubsections to match the widgets actually embedded: terminal figlet + greeting + clock, quote + day hero + calendar|almanac + world_clock|system + elapsed gauges, and avatar +basic_statichandle +github_userprofile respectively.project_github_activityTOML listing with the shipped template (fontansi_shadow, padded titles,title_align = "center").src/templates/<name>.tomlas the copy source; keep thesplashboard install --templatenote tied to feat: "splashboard install" — one-shot setup (rc wiring + starter config from template) #58.Relates to #77 (preset work).
Test plan
npx astro buildindocs-site/— 74 pages built,/guides/presets/index.htmlrendered.dist/guides/presets/index.html) to confirm ASCII previews fit and the embeddedproject_github_activity.htmlrender still sits correctly.🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
Documentation
Style