Skip to content

fix(ujust): only run brew bundle when enabling bluefin-cli#358

Merged
inffy merged 2 commits into
mainfrom
fix/bluefin-cli-toggle-brew
May 31, 2026
Merged

fix(ujust): only run brew bundle when enabling bluefin-cli#358
inffy merged 2 commits into
mainfrom
fix/bluefin-cli-toggle-brew

Conversation

@hanthor
Copy link
Copy Markdown
Member

@hanthor hanthor commented May 29, 2026

Summary

Fixes #164: ujust bluefin-cli no longer reinstalls Homebrew CLI packages when disabling bling.

Problem

The bluefin-cli recipe always ran brew bundle --file=/usr/share/ublue-os/homebrew/cli.Brewfile after toggling bling. When a user disabled bling, the recipe would:

  1. Remove the bling source line from shell config ✅
  2. Then reinstall all Homebrew packages anyway ❌

Fix

Before toggling bling, the recipe now checks whether bling is currently installed (by looking for the bling source line in the shell config). It only runs brew bundle when bling was not installed — meaning the user is enabling bling.

Closes #164

Test plan

  • Running ujust bluefin-cli when bling is enabled should disable bling without reinstalling brew packages
  • Running ujust bluefin-cli when bling is disabled should enable bling and install brew packages

Summary by CodeRabbit

  • Bug Fixes
    • Improved system configuration command with intelligent shell detection and efficient conditional dependency installation. It now avoids running unnecessary operations when toggling features.

Previously the bluefin-cli recipe always ran 'brew bundle' after
toggling bling, which meant disabling bling would reinstall all
Homebrew CLI packages unnecessarily.

Now the recipe checks whether bling is already installed before
toggling, and only runs brew bundle when enabling (i.e., bling
was not previously installed).

Closes #164
@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 29, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

The bluefin-cli recipe is refactored from a simple two-step flow (call ublue-bling, then unconditionally run brew bundle) into an inline bash script that detects the active shell, checks bling sourcing state, toggles bling, and conditionally runs dependency installation only when enabling bling.

Changes

Bluefin CLI

Layer / File(s) Summary
Shell-aware bling toggle with conditional brew bundle
system_files/bluefin/usr/share/ublue-os/just/system.just
Inline bash script detects the user's active shell and config file location, checks whether bling is already sourced, invokes ublue-bling to toggle integration, and runs brew bundle --file=.../cli.Brewfile only when bling was not previously installed. Prevents brew bundle from executing during bling removal.

🎯 2 (Simple) | ⏱️ ~10 minutes

🐰 A bling so bright, now off and on,
Shell-aware magic from dusk to dawn,
Brew bundles dance when bling is born,
But rest when toggled off at morn.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: preventing brew bundle from running unconditionally when disabling bling in the bluefin-cli recipe.
Description check ✅ Passed The description provides clear problem statement, explains the fix, references the linked issue (#164), and includes test plan checkboxes.
Linked Issues check ✅ Passed The PR directly addresses issue #164 by implementing logic to detect bling installation status and only run brew bundle when enabling bling (not when disabling).
Out of Scope Changes check ✅ Passed All changes are scoped to the bluefin-cli recipe in system.just, directly addressing the linked issue with no extraneous modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bluefin-cli-toggle-brew

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.

@dosubot dosubot Bot added area/brew Homebrew things area/just Justfile things kind/bug Something isn't working labels May 29, 2026
Copy link
Copy Markdown
Member Author

@hanthor hanthor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed: Only runs brew bundle when explicitly enabling bluefin-cli. Correct fix — prevents unnecessary brew operations on every ujust invocation.

@castrojo
Copy link
Copy Markdown
Contributor

🤖 Copilot Test Report

Branch: fix/bluefin-cli-toggle-brew | 6 commits behind main | Tested: 2026-05-30T04:51Z

Test Results

Test Result
just check (syntax validation) ✅ PASS
Branch freshness ✅ Near head

Change

Expands bluefin-cli recipe in system.just to detect whether bling was already installed before toggling, and only runs brew bundle when enabling (not when disabling).

⚠️ Overlap with #362

Both PRs fix the same bluefin-cli recipe:

PR Approach
#358 (this) Full shell expansion — detects shell type, checks if bling was installed, skips brew on disable
#362 One-liner: ublue-bling && brew bundle — simple short-circuit, brew only runs if bling enable succeeds

These cannot both merge. #358 is the more correct fix (brew should be skipped when disabling). #362 is a partial fix (brew skips on bling failure, but still runs on disable if bling 'succeeds' at disabling).

@inffy inffy enabled auto-merge May 31, 2026 05:59
@inffy inffy added this pull request to the merge queue May 31, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 31, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
system_files/bluefin/usr/share/ublue-os/just/system.just (1)

31-33: 💤 Low value

Consider using conventional boolean naming for clarity.

The variable BLING_WAS_INSTALLED uses inverted logic: 0 means installed and 1 means not installed. This is contrary to typical boolean conventions where 0 usually means false/no and 1 means true/yes.

While the logic is correct, using a name like BLING_WAS_NOT_INSTALLED or inverting the values would make the code more intuitive and easier to maintain.

♻️ Proposed refactor for clarity
     # Check if bling is currently installed before toggling
-    BLING_WAS_INSTALLED=1
+    BLING_WAS_NOT_INSTALLED=1
     if [ -f "${TARGET_FILE}" ] && grep -q "source ${BLING_SRC_DIR}/${BLING_SCRIPT}" "${TARGET_FILE}" 2>/dev/null; then
-        BLING_WAS_INSTALLED=0
+        BLING_WAS_NOT_INSTALLED=0
     fi
     # Toggle bling (ublue-bling will remove if installed, add if not)
     ublue-bling
     # Only install brew packages when enabling (bling was not installed before)
-    if [ "${BLING_WAS_INSTALLED}" -ne 0 ]; then
+    if [ "${BLING_WAS_NOT_INSTALLED}" -ne 0 ]; then
         brew bundle --file=/usr/share/ublue-os/homebrew/cli.Brewfile
     fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@system_files/bluefin/usr/share/ublue-os/just/system.just` around lines 31 -
33, The variable BLING_WAS_INSTALLED uses inverted logic (set to 1 by default, 0
when installed); rename it to BLING_WAS_NOT_INSTALLED or flip its boolean values
to match conventional semantics and update the conditional accordingly — locate
the initialization and check around BLING_WAS_INSTALLED (and its use with
TARGET_FILE, BLING_SRC_DIR, BLING_SCRIPT) and either change the name to
BLING_WAS_NOT_INSTALLED and invert the assignment/condition, or keep the name
and swap the assigned values so 1=true (installed) and 0=false (not installed)
throughout the script to preserve behavior while making intent clear.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@system_files/bluefin/usr/share/ublue-os/just/system.just`:
- Around line 31-33: The variable BLING_WAS_INSTALLED uses inverted logic (set
to 1 by default, 0 when installed); rename it to BLING_WAS_NOT_INSTALLED or flip
its boolean values to match conventional semantics and update the conditional
accordingly — locate the initialization and check around BLING_WAS_INSTALLED
(and its use with TARGET_FILE, BLING_SRC_DIR, BLING_SCRIPT) and either change
the name to BLING_WAS_NOT_INSTALLED and invert the assignment/condition, or keep
the name and swap the assigned values so 1=true (installed) and 0=false (not
installed) throughout the script to preserve behavior while making intent clear.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 64106387-182c-4fdb-8911-f199a8b2ed94

📥 Commits

Reviewing files that changed from the base of the PR and between b132745 and 6895f98.

📒 Files selected for processing (1)
  • system_files/bluefin/usr/share/ublue-os/just/system.just

Merged via the queue into main with commit 493b5af May 31, 2026
3 checks passed
@inffy inffy deleted the fix/bluefin-cli-toggle-brew branch May 31, 2026 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/brew Homebrew things area/just Justfile things kind/bug Something isn't working lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ujust bluefin-cli does not remove bling

3 participants