Skip to content

[CTX-0169] feat(config): named profiles --profile + env overrides (#271) - #308

Merged
Xuepoo merged 1 commit into
mainfrom
ctx-0169/feat-named-profiles
Sep 5, 2026
Merged

Xuepoo merged 1 commit into
mainfrom
ctx-0169/feat-named-profiles

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Closes #271.

What

Named profiles layered UNDER the user file, per #271 decision and lua-and-xdg.md §Layers:

  • --profile NAME (CLI) over BITTY_PROFILE (env) -> $XDG_CONFIG_HOME/bitty/profiles/<name>.lua as the Profile layer (precedence Cli 70 > User 50 > Profile 40).
  • --config PATH (CLI) over BITTY_CONFIG (env), else the XDG default probe. Both explicit sources fail closed when missing.
  • Precedence: CLI flags > BITTY_* env > file+profile > defaults. init.lua (or the explicit file) still wins over the profile; --theme wins over both (deep-merge compose, not whole-file replace).
  • --config + --profile together: both layers load (explicit file wins) with a stderr warning.
  • Missing/invalid profile names fail closed (exit 2, no fallback guessing). Names restricted to [A-Za-z0-9_-] (1..=64) so a profile always maps to exactly one file; XDG_CONFIG_DIRS never consulted.
  • config check prints a profile = row plus per-key profile: <path> sources; config path respects BITTY_CONFIG; headless line carries profile=<name>.

CTX-0180 rebase note

CLI overrides now flow through one CliOverrides struct -> one Cli plan (resolve_effective_full); resolve_effective stays as a thin back-compat delegate. CTX-0180 (--font-family/--font-size/--opacity) only adds fields to CliOverrides::to_layer — no signature churn. Unblocks on this merge.

Tests

  • bitty-config: name validation, path resolution, CLI>env resolvers, user>profile>default + deep-merge compose, load_profile_layer kind tag, missing-profile fail-closed.
  • bitty-app: --profile parsing (space/equals/subcommand-order/escape-hatch), CLI>env pin, merge-level precedence + config check label, traversal fail-closed.
  • Gates: cargo fmt --check, clippy -D warnings (workspace), cargo test --workspace --all-targets --locked (all ok, 0 failed), windows cargo check target, actionlint clean.

Live (headless-guarded, seat contested for pixels)

Worktree recording/ctx-0169/ (uncommitted): two profiles switch theme/font live via config check + --headless (source=profile end to end, exit codes incl. fail-closed 2). No display server on host, so pixel screenshots skipped with reason (see LIVE.md); seated reviewer can check hyprctl clients title ... (profile).

Priority: P2 | Area: config | Labels: feat,area:config,P2 | Milestone: v0.1.0 | RFC: - | Task: CTX-0169

@Xuepoo Xuepoo added feat Feature area:config Area: configuration P2 Priority: medium labels Sep 5, 2026
@Xuepoo Xuepoo added this to the v0.1.0 milestone Sep 5, 2026
@Xuepoo
Xuepoo merged commit 380e0bf into main Sep 5, 2026
10 checks passed
@Xuepoo
Xuepoo deleted the ctx-0169/feat-named-profiles branch September 5, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:config Area: configuration feat Feature P2 Priority: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Named profiles: --profile + BITTY_CONFIG/BITTY_PROFILE env overrides

1 participant