Skip to content

feat: show plugin release status#3

Merged
flamerged merged 1 commit into
mainfrom
feat/release-version-status
May 14, 2026
Merged

feat: show plugin release status#3
flamerged merged 1 commit into
mainfrom
feat/release-version-status

Conversation

@flamerged
Copy link
Copy Markdown
Owner

@flamerged flamerged commented May 14, 2026

Summary

  • add cached latest-release checks for copied plugin installs
  • show footer status such as latest, checking, unavailable, or update vX available
  • add a manual update-status refresh action and update the update button label when a newer release is cached

Validation

  • ./scripts/check.sh
  • copied plugin no-cache/status smokes
  • release check cache success/failure smokes
  • cr --type uncommitted

Summary by CodeRabbit

  • New Features

    • Added configurable background release update checks for the plugin.
    • Menu now displays version status with update information and provides instant update-check capability.
  • Documentation

    • Updated README with new environment variable configuration options for controlling release checks and update caching behavior.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

📝 Walkthrough

Walkthrough

MenuTube plugin adds a configurable release-check subsystem that periodically fetches and caches the latest GitHub release tag, displaying cached update status in the menu for non-git-checkout installations. Documentation, utility functions, menu rendering, dispatch command, and test controls are all updated to support this feature.

Changes

Release Update Status Checking

Layer / File(s) Summary
Feature documentation and configuration
README.md
README gains a feature bullet for built-in version status, clarified install guidance on update behavior differences, and three new config variables for release-check enablement, TTL, and cache location.
Release-check utilities and configuration defaults
bin/menutube.5s.sh
SwiftBar metadata declares the three release-check variables; default declarations expand ~ in cache path; twelve utility functions handle GitHub API queries, tag normalization, cache read/write/age, TTL-gated refresh with lockfile, status label/color rendering, and latest-tag retrieval.
Menu integration and command dispatch
bin/menutube.5s.sh
Dispatch command check-release triggers immediate release-cache refresh; menu rendering conditionally incorporates cached release status and adds "Check plugin update status now" item when not running from git checkout.
Test and validation updates
scripts/check.sh
Validation adds MENUTUBE_CHECK_RELEASE_UPDATES to required xbar variables; dry render and literal-tilde regression tests disable release checks via environment to isolate that subsystem.

Sequence Diagram

sequenceDiagram
  participant MenuRender as Menu Render
  participant UpdateCache as Release Check Cache
  participant GitHubAPI as GitHub API
  MenuRender->>UpdateCache: maybe_refresh_release_check
  UpdateCache->>UpdateCache: check TTL and lockfile
  UpdateCache->>GitHubAPI: latest_release_tag if refresh needed
  GitHubAPI-->>UpdateCache: latest tag or error
  UpdateCache->>UpdateCache: write_release_check_cache with status
  UpdateCache-->>MenuRender: cached_latest_release_tag
  MenuRender->>MenuRender: render release_status_label and color
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • flamerged/menutube#2: Both PRs update bin/menutube.5s.sh and scripts/check.sh with changes to tilde-expansion and test invocations, though #2 addresses self-update behavior while this PR focuses on cached latest-release status checks.

Poem

🐰 A rabbit checks releases in the cache,
No network thrash, just a speedy splash!
Updates displayed with a colorful flair,
TTL gating keeps freshness in the air. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: show plugin release status' clearly and concisely summarizes the main feature addition: displaying plugin release status in the menu.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/release-version-status

Comment @coderabbitai help to get the list of available commands and usage tips.

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)
bin/menutube.5s.sh (1)

318-334: ⚡ Quick win

Document the lock timeout.

The 120-second lock timeout at line 328 is a magic number that determines how long to wait before allowing another release check if a previous check's lock file still exists. Consider adding a brief comment explaining this value, or making it configurable if this timeout might need adjustment.

📝 Example documentation
   now="$(date +%s 2>/dev/null || printf '0')"
   lock_age="$(cache_mtime "${MENUTUBE_RELEASE_CHECK_CACHE}.lock")"
+  # Prevent concurrent checks; stale lock cleanup after 120s
   if [[ -n "$lock_age" && $(( now - lock_age )) -lt 120 ]]; then
     return
   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 `@bin/menutube.5s.sh` around lines 318 - 334, In maybe_refresh_release_check(),
the hard-coded 120-second lock timeout (used when comparing now and lock_age)
should be documented or made configurable: add a brief comment above that check
explaining why 120 seconds was chosen (prevents concurrent checks and allows
quick retries) and optionally introduce a configurable variable like
MENUTUBE_RELEASE_CHECK_LOCK_TTL_SECONDS with a default of 120 to replace the
literal; update the comparison to use that variable and ensure any default is
set earlier (e.g., fall back to 120 if unset) so the behavior can be adjusted
without changing code.
🤖 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 `@bin/menutube.5s.sh`:
- Around line 318-334: In maybe_refresh_release_check(), the hard-coded
120-second lock timeout (used when comparing now and lock_age) should be
documented or made configurable: add a brief comment above that check explaining
why 120 seconds was chosen (prevents concurrent checks and allows quick retries)
and optionally introduce a configurable variable like
MENUTUBE_RELEASE_CHECK_LOCK_TTL_SECONDS with a default of 120 to replace the
literal; update the comparison to use that variable and ensure any default is
set earlier (e.g., fall back to 120 if unset) so the behavior can be adjusted
without changing code.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 843e4cc7-016d-4982-8788-143b98166ba0

📥 Commits

Reviewing files that changed from the base of the PR and between 93523bc and d70ff13.

📒 Files selected for processing (3)
  • README.md
  • bin/menutube.5s.sh
  • scripts/check.sh

@flamerged flamerged merged commit df3c106 into main May 14, 2026
4 checks passed
@flamerged flamerged deleted the feat/release-version-status branch May 14, 2026 19:00
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