feat(cli): manage desktop app settings and theme from the CLI (superset settings)
Summary
- New
superset settingscommand group:list/get <key>/set <key> <value>/reset <key>plus athemesubgroup (theme list/get/set) — 35 desktop settings (behavior, git, notifications, terminal, terminal/editor typography) and the app theme, all editable from any shell with no cloud login. - Adds a
superset-settingsagent skill (.agents/skills/superset-settings/SKILL.md) and a CLI reference section so agents and humans can discover keys, allowed values, and propagation semantics.
Why / Context
Settings were only reachable through the desktop UI. Agents running in Superset terminals (and users scripting their setup) had no way to flip a toggle, change fonts, pick a ringtone, or switch themes. The CLI already ships on every host, so it's the natural surface.
How It Works
Three stores, routed per key by a single registry (packages/cli/src/lib/settings/registry.ts) that mirrors the desktop's validation (enums, ranges, half/tenth font steps):
- local.db (most keys): upserts the same single-row
settingstable the desktop writes, via drizzle overbun:sqlite. A running app picks changes up on its next window refocus (electron IPC queries havestaleTime: 0+ refetch-on-focus). The CLI never creates the DB or tables — the desktop owns migrations; a fresh machine gets an actionable error instead. - host service (
branchPrefixMode,branchPrefixCustom,worktreeBaseDir): these are host-wide values the v2 Git settings page reads fromhost_settings, so the CLI talks to the local host service's tRPC using the manifest auth token (~/.superset/host/<org>/manifest.json) — still no cloud login. The legacy local.db columns are mirrored best-effort for v1 surfaces.settings listdegrades to a(host service not running)note when it's down. - app-state.json (theme): validated against built-ins + imported custom themes +
system(with--system-light/--system-darkmappings), written atomically preserving all other app state. Applies at next launch; the command output tells users to quit first.
Deliberately excluded: exposeHostServiceViaRelay (paywalled + confirm dialog in the app), structured JSON settings (terminal presets, agent overrides), and renderer-localStorage prefs (deleteLocalBranch, diff view, hotkeys) that nothing outside the renderer can reach.
Manual QA (CDP against the dev desktop app, this worktree)
Recorded a full demo video locally (CLI command → app updating on refocus) — happy to share; each item below was verified end-to-end with before/after screenshots:
-
set confirmOnQuit true/set showResourceMonitor false— General toggles flip on refocus, and back on revert -
set terminalFontSize 20,set editorFontSize 16,reset terminalFontSize— Appearance live previews resize (20px → back to 14px) -
set notificationVolume 40— volume dropdown updates to "Low (40%)" -
set branchPrefixMode custom+set branchPrefixCustom kiet/— v2 Git page shows "Custom prefix" + livekiet/branch-namepreview (this is what caught the host-service routing requirement: writing only local.db left the UI unchanged) -
theme set lightwith app quit → relaunch boots in light theme;theme set darkrestores - Compiled binary (
bun run build→dist/superset) exercised for all of the above, including manifest-token auth to the host service - Error paths: unknown key, out-of-range/enum/step violations, missing local.db, host service down
Caveats verified and documented in the skill/docs:
- Force-killing the app leaves a fresh
theme-storage:pendinglocalStorage snapshot that beatsapp-state.jsonfor ~5 min on next boot (reproduced both ways) — hence "quit cleanly first". selectedRingtoneIdchanges the played sound immediately (main process reads the DB) but the Notifications checkmark hydrates once at boot, so it updates after restart.- QA refocus was triggered by dispatching
windowblur/focus events over CDP — the same events a real refocus fires.
Testing
bun test packages/cli/src/lib/settings packages/cli/src/commands/settings— 31 tests (registry validation, local.db roundtrip against a schema-derived temp DB, app-state preservation, host routing fallbacks, command-level set/get/reset)- Mutation check: broke boolean parsing → registry test fails, restored → green
bun run typecheck(packages/cli),bun run lint(exit 0),bunx sherif(no issues)packages/clihas notestscript wired into turbo, so CI won't run these suites automatically (pre-existing gap; ran manually)
Design Decisions
- Direct store access over new desktop IPC: the desktop has no external settings surface, and adding one is a bigger change; writing the same stores with the same validation gets full coverage today. The registry keeps key→store→rules in one reviewable place.
skipMiddleware: true: settings are machine-local; requiring OAuth would break offline/agent use for no security gain (local.db and the host manifest are already 0600 on-disk secrets).- Manifest-token host auth instead of
--hosttargeting: git settings follow the UI's "This device" scope; remote-host settings can layer onto the existingresolveHostTargetlater if wanted.
Known Limitations
- Theme changes need an app relaunch (the app reads
app-state.jsononce at boot); no push channel exists for external settings changes generally — refocus refetch is the propagation mechanism. settings listshows host-backed git keys as unavailable while the host service is down (rather than silently showing stale legacy values).
Summary by cubic
Manage Superset desktop app settings and theme from the CLI. Previously UI-only; now superset settings (list/get/set/reset) and superset settings theme (list/get/set/export/import/remove). Theme changes apply on restart; other settings apply on next window refocus. Removes the unused terminalPersistence setting and drops the persist_terminal column from the local DB.
Highlights
- Validates values through one registry using limits from
@superset/shared/settings-constraints. Local settings upsert the singlesettingsrow in~/.superset/local.dbwithdrizzle-ormoverbun:sqlite(opened readwrite to survive WAL; reads mirror the desktop by using the first row, notid=1); rejects blank numeric input. - Host-wide Git settings (
branchPrefixMode,branchPrefixCustom,worktreeBaseDir) route through the local host service via tRPC + manifest token and mirror to legacy columns. Calls time out (5s) and map transport/auth failures to actionable errors;settings listdegrades these to “host service not running” instead of failing. - Theme commands update
~/.superset/app-state.jsonatomically and reuse the desktop’s parser and built-ins from@superset/shared/themes(reserved ids rejected, ids slugified, 256 KB import limit, export stripsisBuiltIn, re-import replaces). Rejects arrays as app-state, drops malformed custom themes instead of crashing, and stamps imported themes withisCustom/isBuiltIn. Messages clarify when only system light/dark mappings changed; ringtone changes note immediate sound with Settings reflecting after restart. - Consolidates ringtones and numeric constraints to
@superset/sharedwith desktop re-export shims; adds a registry-coverage ratchet so every settings column is either exposed or explicitly excluded.
Rollout
- Launch the desktop app once so stores exist; commands otherwise return an actionable error.
- Git settings require the desktop app or
superset startto be running. - Quit the app before changing or importing themes; restart to apply.
- The local DB migration dropping
persist_terminalruns at desktop boot; no user intervention required.
Summary by CodeRabbit
- New Features
- Added CLI commands to list, view, update, reset, and validate desktop settings.
- Added theme management for built-in, system, and custom themes, including import, export, removal, and system light/dark options.
- Added support for Git preferences requiring the desktop host service.
- Added Light, Dark, and Monokai themes with editor and terminal styling.
- Documentation
- Added comprehensive CLI guidance for settings and themes.
- Tests
- Added coverage for settings, validation, theme workflows, and host-service behavior.