Skip to content

feat: update plugin from latest release#4

Merged
flamerged merged 1 commit into
mainfrom
feat/release-asset-self-update
May 14, 2026
Merged

feat: update plugin from latest release#4
flamerged merged 1 commit into
mainfrom
feat/release-asset-self-update

Conversation

@flamerged

@flamerged flamerged commented May 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • replace the user-facing git updater with a single Update to latest release action
  • add safe release-asset self-update for copied plugin installs
  • update install docs so normal users download the release asset and git clone is development-only

Validation

  • ./scripts/check.sh
  • temporary copied-plugin menu shows Update to latest release
  • temporary copied-plugin update downloads and validates the current release asset
  • cr --type uncommitted

Summary by CodeRabbit

  • New Features

    • Plugin can self-update from the latest GitHub release and shows an “Update to latest release” action when not running from a source checkout.
    • When running from a detected checkout, UI prompts to use git/development updates and still displays branch/commit info.
  • Documentation

    • Installation instructions revised to use direct release download and a development install flow via source checkout.
    • Configuration table extended with new environment variables for release/install configuration.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 14, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Agent Watch plugin now supports release-asset-based self-updates instead of requiring local git checkouts. A new update_plugin_from_release() function downloads, validates, and atomically replaces the plugin script from GitHub releases. The xbar action dispatcher switches from update-self to update-release, and installation/configuration documentation is updated to reflect the new workflow.

Changes

Release Asset Self-Update

Layer / File(s) Summary
Configuration variables and environment setup
bin/agent-watch.30s.sh, README.md
AGENTWATCH_RELEASE_ASSET_URL environment variable is documented and RELEASE_ASSET_URL is defined; README install instructions and config table extended with repository metadata variables and release-asset install guidance.
Release asset update function
bin/agent-watch.30s.sh
New update_plugin_from_release() downloads the release asset, validates Agent Watch markers (shebang/title and PLUGIN_VERSION), makes it executable, and atomically replaces the plugin file with explicit error handling and a guard against updating when running from a git checkout.
Action dispatcher and UI integration
bin/agent-watch.30s.sh, README.md
xbar action case label changes from update-self to update-release; menu text now offers "Update to latest release" for non-checkout installs and retains git diagnostic rows when a repo checkout is detected.

Sequence Diagram

sequenceDiagram
  participant User
  participant xbar
  participant update_plugin_from_release
  participant GitHub
  participant Filesystem

  User->>xbar: Click "Update to latest release"
  xbar->>update_plugin_from_release: Call update-release action
  update_plugin_from_release->>GitHub: Download RELEASE_ASSET_URL
  GitHub-->>update_plugin_from_release: agent-watch.30s.sh asset
  update_plugin_from_release->>update_plugin_from_release: Validate shebang and PLUGIN_VERSION
  update_plugin_from_release->>Filesystem: chmod +x temp file
  update_plugin_from_release->>Filesystem: Atomically replace PLUGIN_PATH
  Filesystem-->>update_plugin_from_release: Success
  update_plugin_from_release-->>xbar: Update complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • flamerged/agent-watch#3: Modifies the existing update_plugin_from_git flow and version labeling, contrasting with this PR's shift to release-asset-based updates.

Poem

🐰 I hop from branch to release with a cheer,
A temp file, a curl, the new script appears near.
Validate, chmod, then swap with delight,
Updates that land while I nibble a bite. 🥕

🚥 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 title accurately reflects the main change: replacing git-based updates with release asset self-updates for the plugin.
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-asset-self-update

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

@flamerged flamerged self-assigned this May 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 248-255: The updater currently allows overwriting files even when
the plugin is a git checkout; in update_plugin_from_release() add a guard that
detects repository-managed installs (e.g., presence of a .git directory or using
git rev-parse --is-inside-work-tree) and aborts with a clear message instead of
proceeding, and combine that check with the existing writability checks for
PLUGIN_PATH and PLUGIN_DIR so the updater only runs for copied installs; also
apply the same guard to the code path that displays the action (the lines
referenced around where the update action is shown) so the update option is not
presented for checkout-managed plugins.
- Around line 263-266: The download currently uses "$CURL -fsSL
$RELEASE_ASSET_URL -o $tmp" with no timeout or retry; change the invocation that
uses the CURL variable to include a per-request timeout and a bounded retry
policy (e.g., add curl flags like --max-time, --connect-timeout, --retry and
--retry-delay/--retry-connrefused) or wrap the call in a timeout utility, and
ensure failures still rm -f "$tmp" and return 1; update the invocation that
references RELEASE_ASSET_URL and tmp so the script fails quickly on hanging
networks and retries a few times before giving up.
🪄 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: f8cf849a-27b5-479c-9e43-a2ca96a97391

📥 Commits

Reviewing files that changed from the base of the PR and between 721e69c and 1188bf5.

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

Comment thread bin/agent-watch.30s.sh
Comment thread bin/agent-watch.30s.sh Outdated
@flamerged
flamerged force-pushed the feat/release-asset-self-update branch from 1188bf5 to 8693101 Compare May 14, 2026 17:49

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
bin/agent-watch.30s.sh (1)

958-961: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Use the same checkout predicate when rendering the update action.

print_plugin_rows() hides “Update to latest release” whenever any repo root is found, but update_plugin_from_release() only blocks when PLUGIN_PATH is actually inside that repo. If AGENTWATCH_REPO_DIR is set just for metadata, copied-plugin installs lose the update action.

Suggested fix
 print_plugin_rows() {
   local root git_summary version_label
   root="$(plugin_repo_root)"
   version_label="$(plugin_version_label "$root")"
   emit "--Version: ${version_label} | font=Menlo"
   emit "--Config: $(shorten_path "$CONFIG_FILE") | font=Menlo"
   emit "--Script: $(shorten_path "$PLUGIN_PATH") | font=Menlo"
   if [[ -n "$root" ]]; then
     git_summary="$(plugin_git_summary "$root")"
     emit "--Repo: $(shorten_path "$root") | font=Menlo"
     emit "--Git: ${git_summary:-unknown} | font=Menlo"
+  fi
+  if [[ -n "$root" && "$PLUGIN_PATH" == "$root"/* ]]; then
     emit "----Use git commands for development updates | color=gray"
   else
     emit "--Update to latest release | bash=$PLUGIN_PATH param1=update-release terminal=true refresh=true"
   fi
   emit "--Open config file | bash=$PLUGIN_PATH param1=open param2=agent-watch-config terminal=false refresh=true"
🤖 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/agent-watch.30s.sh` around lines 958 - 961, print_plugin_rows() currently
hides the "Update to latest release" action whenever any repo root is present,
but update_plugin_from_release() only blocks when PLUGIN_PATH is inside that
repo; make the rendering predicate identical to the runtime check so
copied-plugin installs still show the update action. Update the conditional in
print_plugin_rows() to call or replicate the same check used by
update_plugin_from_release() (use PLUGIN_PATH and AGENTWATCH_REPO_DIR to
determine "inside repo" rather than "any repo root found") so the button is
rendered only when the update handler would actually block.
🤖 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.

Duplicate comments:
In `@bin/agent-watch.30s.sh`:
- Around line 958-961: print_plugin_rows() currently hides the "Update to latest
release" action whenever any repo root is present, but
update_plugin_from_release() only blocks when PLUGIN_PATH is inside that repo;
make the rendering predicate identical to the runtime check so copied-plugin
installs still show the update action. Update the conditional in
print_plugin_rows() to call or replicate the same check used by
update_plugin_from_release() (use PLUGIN_PATH and AGENTWATCH_REPO_DIR to
determine "inside repo" rather than "any repo root found") so the button is
rendered only when the update handler would actually block.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fccf7d36-eb72-417e-8d40-6c6fc917f66d

📥 Commits

Reviewing files that changed from the base of the PR and between 1188bf5 and 8693101.

📒 Files selected for processing (2)
  • README.md
  • bin/agent-watch.30s.sh
✅ Files skipped from review due to trivial changes (1)
  • README.md

@flamerged
flamerged merged commit 2355f1f into main May 14, 2026
4 checks passed
@flamerged
flamerged deleted the feat/release-asset-self-update branch May 14, 2026 17:53
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