Skip to content

feat: show plugin release status#6

Merged
flamerged merged 3 commits into
mainfrom
feat/release-version-status
May 14, 2026
Merged

feat: show plugin release status#6
flamerged merged 3 commits 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 Agent Watch installs
  • show footer status such as latest, checking, unavailable, or update vX available
  • add a manual plugin update-status refresh action and update the update button label when a newer release is cached

Validation

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

Summary by CodeRabbit

  • New Features

    • Menu now shows plugin version with a colored status indicating if an update is available.
    • Background checks for the latest release plus an on-demand “refresh release status” action.
    • Conditional “Update to latest release” action when running an installed (non-source) plugin.
  • Documentation

    • Added config options to control release-check behavior, cache path and TTL.
    • Clarified privacy/security distinction between CLI package checks and plugin release lookups.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 038e339c-50cc-4606-a2b5-3c2ad4afbb68

📥 Commits

Reviewing files that changed from the base of the PR and between 1595df9 and b478d9f.

📒 Files selected for processing (1)
  • bin/agent-watch.30s.sh
🚧 Files skipped from review as they are similar to previous changes (1)
  • bin/agent-watch.30s.sh

📝 Walkthrough

Walkthrough

This PR adds cached release-status checking and UI integration to the Agent Watch SwiftBar plugin. Configuration variables control whether release checks run and how long results are cached; a subsystem of helper functions discovers, caches, and computes release status; and the UI displays colored status alongside the plugin version with conditional update and manual check commands.

Changes

Release Update Checking Feature

Layer / File(s) Summary
Configuration schema, documentation, and validation
README.md, bin/agent-watch.30s.sh, scripts/check.sh
README documents release-status display, update behavior, cache TTL controls, and privacy implications. Plugin config declares AGENTWATCH_CHECK_RELEASE_UPDATES, AGENTWATCH_RELEASE_CHECK_TTL_SECONDS, and AGENTWATCH_RELEASE_CHECK_CACHE. Runtime defaults are initialized with tilde expansion. Validation in check.sh confirms the new variables and disables release checks during test renders.
Release check helpers and cache subsystem
bin/agent-watch.30s.sh (lines 260–406)
Implements file mtime detection, release tag normalization, latest-tag discovery from GitHub asset URL and API fallback, TSV cache read/write, cache-age computation, asynchronous background refresh with lock-file concurrency control, release status label/color computation, and cached latest-tag accessor.
UI integration and check-release action
bin/agent-watch.30s.sh (lines 547–550, 1134–1159)
CLI action router adds check-release command to manually refresh the cache. Plugin version row displays colored release status when not in git checkout, emits conditional "Update to latest release" or version-specific update row based on cached tag, and adds an on-demand "Check plugin update status now" action row.

Sequence Diagram(s)

sequenceDiagram
  participant Plugin as AgentWatchPlugin
  participant Checker as maybe_refresh_release_check
  participant GitHub as GitHubAPI
  participant Cache as TSVCacheFile
  participant Lock as LockFile

  Plugin->>Checker: request latest release (on stale or manual)
  Checker->>Lock: create short-lived lock
  alt GitHub API available
    Checker->>GitHub: GET latest release / asset URL parse
    GitHub-->>Checker: latest tag
  else fallback by parsing asset URL
    Checker->>Checker: derive latest tag from asset URL
  end
  Checker->>Cache: write TSV (timestamp,status,latest_tag)
  Cache-->>Plugin: cached latest_tag / status
  Lock-->>Checker: remove lock
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • flamerged/agent-watch#4: Extends the existing "update from latest GitHub release asset" flow introduced in PR #4 by adding cached latest-release checking, release-status UI labeling, and a conditional on-demand "Update to latest release" trigger.
  • flamerged/agent-watch#3: Both PRs modify bin/agent-watch.30s.sh's UI/version-row rendering logic, one introducing a computed plugin_version_label, the other extending the displayed plugin version row with cached "latest release" status and update prompts.
  • flamerged/agent-watch#5: Both PRs modify bin/agent-watch.30s.sh's "Update to latest release" workflow and release-install handling; main PR extends it by adding cached "latest release" checking/status rendering and a check-release action on top of the same release-update mechanism.

Poem

🐰 A rabbit's delight, a cache so bright,
Checking GitHub releases day and night,
No more "is it stale?" with a nervous fright—
Status in color, update in sight! 🎨✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 pull request title 'feat: show plugin release status' directly reflects the main change: adding UI display of plugin release status alongside the version information.
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.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@bin/agent-watch.30s.sh`:
- Around line 274-279: The tag extraction function
latest_release_tag_from_asset_url can return the literal "latest" from the
RELEASE_ASSET_URL which should be treated as an invalid fallback; modify
latest_release_tag_from_asset_url so that after extracting tag (currently into
variable tag) you check if tag is empty or equals "latest" and return non-zero
in that case (do not emit "latest"). Also apply the same validation where
AGENTWATCH_RELEASE_ASSET_URL is parsed (the logic referenced around lines
309-310) so that any "latest" result is rejected and does not produce an "update
latest available" status.
- Around line 363-368: The lock creation is race-prone because the script
overwrites "${RELEASE_CHECK_CACHE}.lock" non-atomically before spawning the
background job; change to an atomic lock-acquire pattern (e.g., create a lock
directory or use an atomic link/redirect with noclobber) and only spawn
"$PLUGIN_PATH" check-release in the background when the lock was successfully
acquired; ensure the atomic lock uses RELEASE_CHECK_CACHE (or
"${RELEASE_CHECK_CACHE}.lock") as the unique token, and release/remove the lock
when the background check-release process completes (or use a trap/cleanup on
exit) so concurrent runs won't both spawn duplicate jobs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e230dcd-8ef0-4040-8fa4-24c54203d3ce

📥 Commits

Reviewing files that changed from the base of the PR and between 1d8d6b6 and e1f1104.

📒 Files selected for processing (3)
  • README.md
  • bin/agent-watch.30s.sh
  • scripts/check.sh

Comment thread bin/agent-watch.30s.sh
Comment thread bin/agent-watch.30s.sh Outdated
@flamerged flamerged merged commit 2759748 into main May 14, 2026
4 checks passed
@flamerged flamerged deleted the feat/release-version-status branch May 14, 2026 19:24
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