Skip to content

feat(config): TOML config with per-directory discovery (#2) - #25

Merged
unhappychoice merged 2 commits into
mainfrom
feat/2-config-system
Apr 21, 2026
Merged

unhappychoice merged 2 commits into
mainfrom
feat/2-config-system

Conversation

@unhappychoice

@unhappychoice unhappychoice commented Apr 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Declarative TOML config replaces the programmatic Layout in main.rs. Built-in default lives at src/default_config.toml (bundled via include_str!). Config covers all axes: widget definitions + layout tree + panel decoration.

Schema (2-level: rows × cols)

[general]
wait_for_fresh = false

[[widget]]
id = "greeting"
fetcher = "static"
render = "text"

[[row]]
height = { min = 6 }

  [[row.child]]
  widget = "greeting"
  title = "Greeting"
  width = { fill = 1 }
  border = "rounded"
  • size specs ({ fill = 1 } / { length = 6 } / { min = 6 } / { max = 30 } / { percentage = 50 }) map to the full Ratatui Constraint repertoire via core: Layout engine (widget positioning) #3's Size.
  • title + border attach a Panel to that row or widget (group-style or per-widget).

Discovery order

At each ancestor directory walking up from CWD, first match wins:

  1. ./.splashboard/config.toml — directory form (future companions: plugins/, themes/, cache/)
  2. ./.splashboard.toml — flat dotfile
  3. $XDG_CONFIG_HOME/splashboard/config.toml — global
  4. baked-in default

Drop either form at the root of any project and splashboard run inside that tree picks it up automatically. The cd-hook that triggers the splash without typing splashboard is scope for #6 shell integration.

What's still hardcoded

Widget payloads are produced by stub_* functions in main.rs matched by id. Real fetchers (sysinfo, git log, HTTP clients, subprocess plugins) replace the stubs in #4 async/cache + the per-widget issues (#7–#14, #20).

Test plan

  • cargo build (zero warnings)
  • cargo test (46 passed: 12 payload + 12 render + 9 layout + 13 config)
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --check
  • CI (ubuntu / macos / windows)

Closes #2.

🤖 Generated with Claude Code

Declarative config replaces the hardcoded programmatic layout in main.rs:

- src/default_config.toml: built-in default, bundled via include_str!
- Config types mirror the runtime Layout tree at a 2-level (rows × cols)
  granularity — enough for splash layouts, ergonomic in TOML.
- SizeSpec / BorderSpec / RenderType deserialize via serde's default
  externally-tagged enum repr (`width = { fill = 1 }` / `border = "rounded"`).
- Config::to_layout converts the declarative tree into the runtime
  Layout built by #3, preserving panel titles and borders.

## Config discovery

`resolve_config_path` walks up from the current directory looking for
`.splashboard.toml`; if none found, falls back to
`$XDG_CONFIG_HOME/splashboard/config.toml`; if that's missing too, uses
the baked-in default.

This enables per-project dashboards: drop a `.splashboard.toml` at the
root of any repo and `splashboard` run inside that tree picks it up.
The cd-hook piece that triggers the splash automatically is out of
scope here — that's #6 shell integration.

Main.rs now loads config at startup, derives layout from it, and
matches widget ids against stub payload builders. Real fetchers replace
the stubs in #4 and the widget implementation issues.

Closes #2

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 49 minutes and 30 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 49 minutes and 30 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: 28bd5688-64b9-42f1-923c-85125b45a5cc

📥 Commits

Reviewing files that changed from the base of the PR and between 9ef659a and 780214a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • src/config.rs
  • src/default_config.toml
  • src/main.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/2-config-system

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.

Adds a second candidate for project-local config, preferred over the
flat dotfile when both exist in the same directory. The directory form
lets projects group future companion files (plugins/, themes/, cache/)
under one `.splashboard/` root alongside the config — same pattern as
.github/, .vscode/, .cargo/.

Discovery order at each ancestor directory, first match wins:
1. .splashboard/config.toml
2. .splashboard.toml

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@unhappychoice
unhappychoice merged commit 1518bfe into main Apr 21, 2026
5 checks passed
@unhappychoice
unhappychoice deleted the feat/2-config-system branch April 21, 2026 01:32
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.

core: Config system (TOML loading + defaults)

1 participant