Skip to content

feat: $HOME/.splashboard/ home-dir layout + ReadStore fetcher - #43

Merged
unhappychoice merged 4 commits into
mainfrom
feat/readstore-home-layout
Apr 21, 2026
Merged

unhappychoice merged 4 commits into
mainfrom
feat/readstore-home-layout

Conversation

@unhappychoice

Copy link
Copy Markdown
Owner

Closes #38.

Summary

Two changes landing together because ReadStore's path resolution sits on the new home-dir layout.

Home-dir layout (`src/paths.rs`)

All splashboard state moves under `$HOME/.splashboard/` — one visible place on every platform, matching the per-directory config convention users already know:

```
$HOME/.splashboard/
├── config.toml # was ~/.config/splashboard/config.toml
├── trust.toml # was ~/.local/share/splashboard/trusted.toml
├── cache/ # was ~/.cache/splashboard/
└── store/ # new, for ReadStore
```

Previously we used the `dirs` crate, which returns platform-native paths (`~/Library/Application Support/...` on macOS, `%APPDATA%` on Windows). Fine for GUI apps, awkward for a Unix-flavored CLI tool where dotfile conventions are the norm. Users asked for one visible dir.

Overridable via `SPLASHBOARD_HOME` env var (tests, CI, power users). No automatic migration — pre-1.0, existing cache/trust stores are disposable and `config.toml` is a one-time manual move.

ReadStore fetcher (`src/fetcher/read_store.rs`)

Fills the gap left by closing #5 (plugin protocol) and #20 (command widget). Users write arbitrary data to `$HOME/.splashboard/store/.`; splashboard deserializes and renders per the widget's declared shape.

  • Always `Safety::Safe` — path is `<fixed_dir>/<sanitized_id>.`, no config-driven path means no traversal vector even in untrusted local configs.
  • Supports every Body shape: lines, entries, ratio, number_series, point_series, bars, image, calendar, heatmap.
  • `file_format = "json" | "toml" | "text"`. Text only valid for `shape = "lines"`.
  • Missing file → empty-but-valid body (silent, no error).
  • Cache key mixes in widget id + shape so distinct widgets don't collide.

Dogfood

The repo's `.splashboard/config.toml` now has a ReadStore demo slot pointing at `$HOME/.splashboard/store/habit.json` as a heatmap. Empty by default; users drop a JSON blob there to see their own grass grid.

Test plan

  • `cargo test` — 171 passing (+8 for ReadStore, +1 for paths env override)
  • `cargo clippy --all-targets -- -D warnings` clean
  • repeated runs show no flaky tests (env-var mutation protected by a crate-shared mutex)
  • manual: `SPLASHBOARD_HOME=/tmp/test-home splashboard` to confirm env override relocates everything

🤖 Generated with Claude Code

… + ship ReadStore fetcher

Two changes landing together because ReadStore's path resolution sits on top
of the new home-dir layout.

**Home directory refactor (src/paths.rs)**

Every splashboard-owned file now lives under \`\$HOME/.splashboard/\` — same
name as the per-directory config convention, so users see one place for all
their splashboard state regardless of platform:

  \$HOME/.splashboard/
  ├── config.toml        (was ~/.config/splashboard/config.toml)
  ├── trust.toml         (was ~/.local/share/splashboard/trusted.toml)
  ├── cache/             (was ~/.cache/splashboard/)
  └── store/             (new — ReadStore files)

Previously these used the \`dirs\` crate, which returns platform-native paths
(\`~/Library/Application Support/...\` on macOS, \`%APPDATA%\` on Windows).
That's fine for GUI apps but awkward for a Unix-flavored CLI tool; users
rightly expect dotfile conventions. One visible dir makes backup, sync,
docs, and troubleshooting substantially easier.

Overridable via the \`SPLASHBOARD_HOME\` env var for tests and CI. No
automatic migration — pre-1.0, existing cache/trust stores are disposable
and \`config.toml\` is a one-time manual move.

**ReadStore fetcher (src/fetcher/read_store.rs)**

Fills the gap left by closing #5 (plugin protocol) and #20 (command widget).
Users write arbitrary data to \`\$HOME/.splashboard/store/<id>.<ext>\`;
splashboard reads and renders per the widget's declared shape.

- Always \`Safety::Safe\` — path is derived from sanitized widget id under a
  fixed home subdir, so a hostile local config has no path-traversal vector.
- Supports every \`Body\` shape: lines, entries, ratio, number_series,
  point_series, bars, image, calendar, heatmap.
- file_format: json | toml | text. Text is only valid for shape=lines.
- Missing file → empty-but-valid body for the declared shape (silent).
- Cache key includes widget id and shape so distinct widgets don't collide.

Closes #38.

**Dogfood**

The repo's own config now ships a ReadStore demo slot that reads
\`\$HOME/.splashboard/store/habit.json\` as a heatmap. Empty by default;
users drop a JSON blob there to see their own grass.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 21, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@unhappychoice has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 28 seconds before requesting another review.

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 5 minutes and 28 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b00a98b1-70c7-4f16-aad6-098ff8dd1c04

📥 Commits

Reviewing files that changed from the base of the PR and between a38b01e and fe6c7f0.

📒 Files selected for processing (12)
  • .splashboard/config.toml
  • src/cache.rs
  • src/config.rs
  • src/fetcher/clock.rs
  • src/fetcher/mod.rs
  • src/fetcher/read_store.rs
  • src/fetcher/static_text.rs
  • src/main.rs
  • src/paths.rs
  • src/render/mod.rs
  • src/runtime.rs
  • src/trust.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/readstore-home-layout

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

unhappychoice and others added 3 commits April 22, 2026 04:11
Until now each renderer silently drew nothing when its body was empty —
heatmap skipped, bar_chart left blank, image no-op'd. The widget slot
looked absent, which is visually indistinguishable from a layout bug.

Dispatch-layer short-circuit: `render_payload` asks `is_empty_body` first
and routes to a centered, dim em-dash placeholder when true. Single
treatment for every shape, no per-renderer work. Especially useful for
ReadStore widgets (missing file → empty body of the declared shape) but
helps any widget whose upstream data hasn't landed yet.

Ratio (0.0 is real data) and Calendar (month/year are always present)
are never considered empty.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Replaces the single em-dash with a two-line centered placeholder when
there's vertical room: a dim dotted-circle glyph (◌) above the caption
\"nothing here yet\". Shrinks to a single line if the slot is too short.
Vertical centering via a Fill / Length / Fill layout, italic + dim styling
so it fades into the background without looking like a real value.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The heatmap ReadStore demo needed users to craft a JSON blob before they
saw anything useful. Swap to a text-file-backed notes slot so the demo
reads exactly how most ReadStore use cases will: drop some text in
\$HOME/.splashboard/store/<id>.txt, see it render.

id renamed to `scratch`, row height reduced to 5 (suits short notes).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@unhappychoice
unhappychoice merged commit ef4df07 into main Apr 21, 2026
4 of 5 checks passed
@unhappychoice
unhappychoice deleted the feat/readstore-home-layout branch April 21, 2026 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: ReadStore fetcher — render user-written local data files

1 participant