Skip to content

feat(shell): splashboard init <shell> for rc integration (#6) - #26

Merged
unhappychoice merged 4 commits into
mainfrom
feat/6-shell-integration
Apr 21, 2026
Merged

unhappychoice merged 4 commits into
mainfrom
feat/6-shell-integration

Conversation

@unhappychoice

@unhappychoice unhappychoice commented Apr 21, 2026 •

Copy link
Copy Markdown
Owner

Summary

Ships the cd-hook that unlocks the killer feature (per-directory dashboards). One-line install:

eval "$(splashboard init zsh)"    # or bash / fish / powershell

Drop the eval into your rc file and every new shell renders the splash. On every cd, if the destination directory directly holds a .splashboard.toml or .splashboard/config.toml, the splash re-renders; otherwise it stays quiet. Combined with the discovery from #2, the splash appears once per project entry, not on every subdirectory navigation.

CLI

splashboard now uses clap:

invocation behavior
splashboard full resolution (local walk-up → global → baked default); intended for shell startup
splashboard --on-cd current-dir-only; skip silently if no local config; intended for cd hooks
splashboard init <shell> print rc snippet to stdout

Render guards

Both render modes no-op when the environment is unsuitable:

  • stdout or stdin is not a terminal (pipe, CI, rc sourcing, non-interactive)
  • CI env var is set (GitHub Actions, GitLab, etc.)
  • TERM=dumb
  • SPLASHBOARD_SILENT or NO_SPLASHBOARD is set (user opt-out for AI IDE terminals, automation sessions, etc.)

Render errors are swallowed silently — a broken splash will never noisify the user's shell startup.

Snippets

Each bundled via include_str! from src/shells/:

shell hook interactive guard
bash PROMPT_COMMAND + PWD-change detection [[ $- == *i* ]]
zsh add-zsh-hook chpwd [[ -o interactive ]]
fish function --on-variable PWD status is-interactive
powershell $ExecutionContext.InvokeCommand.LocationChangedAction (sourced from $PROFILE)

Each snippet calls splashboard on startup and splashboard --on-cd on cd events.

Refactor

Extracted stub widget payload builders from main.rs to src/stubs.rs. main.rs now focuses on CLI dispatch and render-mode selection. Stubs will be replaced by real fetchers when #4 async/cache + widget issues land.

Test plan

  • cargo build (zero warnings)
  • cargo test (59 passed: 12 payload + 12 render + 9 layout + 14 config + 6 shell + 6 render-guard)
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --check
  • Verified binary: each splashboard init <shell> emits its snippet; splashboard | cat exits 0 silently (non-TTY guard).
  • CI (ubuntu / macos / windows)

Closes #6.

🤖 Generated with Claude Code

One-line install: \`eval "$(splashboard init zsh)"\` wires up chpwd so
every \`cd\` renders the splash. This is what unlocks the
per-directory dashboard UX — without the hook, users have to type
\`splashboard\` manually.

Supports bash / zsh / fish / powershell. Each snippet is bundled via
include_str! from src/shells/*.{sh,fish,ps1} and guards for
interactive context so sourcing from a login-shell or CI script is a
no-op.

- bash: PROMPT_COMMAND hook with PWD-change detection (native chpwd
  doesn't exist in bash); guarded on \$- containing 'i'.
- zsh: add-zsh-hook chpwd; guarded on -o interactive.
- fish: function --on-variable PWD; guarded on status is-interactive.
- powershell: \$ExecutionContext.InvokeCommand.LocationChangedAction.

CLI gains clap-driven argument parsing. The default \`splashboard\`
(no subcommand) still renders the splash and now short-circuits with
exit 0 when stdout isn't a terminal (pipe, CI, script source).

Extracted the stub widget payload builders to src/stubs.rs to keep
main.rs focused on CLI dispatch. Those will be replaced by real
fetchers as #4 + widget issues land.

Closes #6

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 26 minutes and 13 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 26 minutes and 13 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: b9f1cdf7-8af7-4aee-a14e-fa73fe4f08dc

📥 Commits

Reviewing files that changed from the base of the PR and between 1518bfe and 2612c37.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (9)
  • Cargo.toml
  • src/config.rs
  • src/main.rs
  • src/shell.rs
  • src/shells/bash.sh
  • src/shells/fish.fish
  • src/shells/powershell.ps1
  • src/shells/zsh.sh
  • src/stubs.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/6-shell-integration

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 21, 2026 10:38
Previously the cd hook ran the full resolution (walk-up + global
fallback) every time, which meant every subdirectory navigation inside
a project re-rendered the same splash.

New behavior:
- splashboard              → full resolution (for shell startup)
- splashboard --on-cd      → current-dir-only, skip silently if absent

Semantic: the splash appears once when you cross into a project root,
then stays quiet on subdirectory navigation within that project, and
re-appears when you cd into a different project root. Matches the
"entering a project" mental model.

Shell snippets updated to call --on-cd on their cd hooks and bare
splashboard on shell startup.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Stdout-is-a-TTY alone wasn't enough. Extra skip signals:

- Require stdin is also a terminal (catches piped-stdin wrappers).
- Skip when CI env var is set (GitHub Actions, GitLab CI, etc.).
- Skip when TERM=dumb.
- Opt-out env vars for users to silence splashboard in AI IDE /
  automation contexts: SPLASHBOARD_SILENT, NO_SPLASHBOARD.

Also: render errors are now swallowed silently rather than bubbled up,
so a broken splash never noisies up the user's shell startup.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Viewport::Inline(16) + the default 2×3 grid look broken when the
terminal is narrower than ~40 cols or shorter than the inline
viewport. Check size via crossterm before engaging the render path;
below minimum, exit silently (same as other guards). Bails out
conservatively when size can't be determined.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@unhappychoice
unhappychoice merged commit ea3cf0f into main Apr 21, 2026
5 checks passed
@unhappychoice
unhappychoice deleted the feat/6-shell-integration branch April 21, 2026 02:15
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: Shell integration (.bashrc / .zshrc / fish one-liner)

1 participant