Skip to content

Store custom app themes under .bb/theme/<name>/theme.css#305

Open
SawyerHood wants to merge 2 commits into
mainfrom
bb/move-custom-themes-into-bb-theme-thr_auvt5g9iwc
Open

Store custom app themes under .bb/theme/<name>/theme.css#305
SawyerHood wants to merge 2 commits into
mainfrom
bb/move-custom-themes-into-bb-theme-thr_auvt5g9iwc

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Summary

Moves custom app-theme storage out of the database and onto disk, following the BB .bb convention: custom themes now live under <data-dir>/theme/<name>/theme.css (the packaged app uses ~/.bb/theme/…), mirroring how user skills live under <data-dir>/skills/. The folder name is the palette id.

This is a breaking change (as requested): the old bb theme set-custom --file path and the DB-stored custom CSS blob are removed. Custom themes are now created/edited by writing the file and selected by name.

Behavior

  • Discovery/loading: the server scans <data-dir>/theme/*/theme.css, resolves the active theme's CSS from disk, and broadcasts it live. A selected theme whose folder is deleted falls back to the default palette.
  • Server: appearance in /system/config is resolved server-side; added customThemes to the config and a new GET /settings/themes catalog ({dir, custom, active}). PUT /settings/appearance now takes a theme-id selection and validates it (400 for an unsafe id, 404 for a missing custom theme, with the expected path in the message).
  • CLI: theme list enumerates built-ins + discovered custom themes + the dir; theme set <id> accepts a custom theme name; new theme dir; removed theme set-custom.
  • Settings: the Palette picker lists discovered custom themes alongside built-ins.
  • DB: dropped the now-unused app_theme.custom_css column (migration 0043); the table stores only the active selection.
  • Docs/skills: updated the bb-cli skill + theming reference to establish the .bb/theme/<name>/theme.css habit and the create/edit/select workflow.

Tests

  • @bb/db — 307 passed (incl. migration journal/folder checks validating 0043).
  • @bb/server theme tests — 13 passed (appearance + new custom-themes service: discovery, disk resolve, delete-fallback, size cap, 404 missing, 400 unsafe name).
  • Typecheck (Turbo): @bb/domain, @bb/db, @bb/server-contract, @bb/sdk, @bb/server, @bb/app, @bb/desktop — all clean.
  • Manual QA: ran the dev server, verified the catalog endpoint, customThemes in config, the picker lists a sample sunset theme, and selection applies live.

Notes / risks

  • Custom theme names are reserved against built-in ids and constrained to a safe single path segment (no ../separators); CSS is size-capped to keep the broadcast payload bounded.
  • Pre-existing unrelated typecheck failure in apps/cli/.../thread-open.test.ts (missing activity field from Change thread open to resolve workspace paths #276) — confirmed present on a clean tree, untouched here.

🤖 Generated with Claude Code

SawyerHood and others added 2 commits June 22, 2026 14:13
Move custom theme storage from a DB-stored CSS blob to named themes on
disk under <data-dir>/theme/<name>/theme.css (mirroring user skills at
<data-dir>/skills). The server discovers themes and resolves their CSS
from disk; the DB stores only the active palette selection.

- Remove `bb theme set-custom`; add `bb theme dir`; `theme list` and the
  Settings picker enumerate discovered custom themes.
- Add GET /settings/themes catalog and customThemes to /system/config;
  PUT /settings/appearance now takes a theme id selection.
- Drop the now-unused app_theme.custom_css column (migration 0043).
- Update bb-cli skill + theming reference to the new convention.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The ThreadListEntry fixture in thread-open.test.ts was missing the
`activity` field (required since #276). It stayed green on main because
cli's turbo typecheck cache was never busted there; touching apps/cli in
this branch forced a real re-typecheck and surfaced it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant