Repository navigation
Let omarchy update also update plugins, as an opt-in toggle, and let one plugin be held back - #18868
felipecpaiva wants to merge 2 commits into
Conversation
[Medium impact] The PR adds optional plugin updates to the system-update workflow. Do not merge yet: held plugins can still update when their folder name differs from their id. FindingsSummaryAdds opt-in plugin updates to
Reviews (3) · Last reviewed commit: "Let one plugin be held back from updates..." · Reviewed by Greptile |
| plugin=$(basename "$dir") | ||
| if [[ -f $HELD_DIR/$plugin ]]; then |
There was a problem hiding this comment.
The hold check uses the folder name instead of the manifest's id. A manually installed git plugin can live in different-folder while the shell lists it as acme.same; existing tests cover this layout. Running omarchy plugin hold acme.same reports success, but bulk updates still fetch and update that plugin. An unattended update can therefore replace code the user asked to keep unchanged. Read the manifest's id when checking whether a plugin is held.
| [[ $id =~ ^[A-Za-z0-9][A-Za-z0-9._-]*$ && $id != *..* ]] || fail "invalid plugin id '$id'" | ||
|
|
||
| held_dir="$HOME/.local/state/omarchy/plugins/held" | ||
| mkdir -p "$held_dir" && : >"$held_dir/$id" |
There was a problem hiding this comment.
If mkdir -p fails, Bash skips the file write but continues to the success message because the failed command is on the left of &&. The command then exits successfully without saving the hold, so later bulk updates can still change the plugin. Run directory creation and the file write as separate commands, or explicitly fail when either fails.
| mkdir -p "$held_dir" && : >"$held_dir/$id" | |
| mkdir -p "$held_dir" | |
| : >"$held_dir/$id" |
Plugins are third-party code, so the update leaves them alone unless the update-plugins toggle is on. They update before the shell restart, so the restart loads the new plugin code. -y approves each change, and a failed plugin warns without failing the system update.
053d8e5 to
dbe8f3a
Compare
| plugin_update_args=() | ||
| fi | ||
| if ! omarchy-plugin-update "${plugin_update_args[@]}"; then | ||
| echo -e "\e[33m\nSome plugins could not be updated. Review the errors above and run 'omarchy plugin update' to retry.\e[0m" >&2 |
There was a problem hiding this comment.
The new plugin failure warning prints English directly. The repository requires warnings from omarchy update to use omarchy-i18n, so users receive them in their chosen language. Add an English catalog entry and print it through that helper. This repository requirement must be satisfied before merging.
File Used: docs/i18n.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
omarchy updatenever touches third-party plugins.So they go stale unless you remember
omarchy plugin update.This adds it as an opt-in. Default is off, so nothing changes for anyone who does not turn it on.
Discussion and the 7 earlier asks behind it: #18867
What it does
update-pluginstoggle is on,omarchy updaterunsomarchy-plugin-updateright before it restarts the shell.-ypasses--yes, same as it already does for the other steps.Why opt-in
On #10021, @nickwarters pointed out that plugins are third-party code that runs inside the shell. An automatic update installs whatever the plugin repo has now.
I agree with that, so IMO this should never be the default. The toggle uses the existing
omarchy-toggleflag file, no new setting type.Hold one plugin back (second commit)
The toggle is all or nothing. Today I needed every plugin to update except one that I patched locally. So:
omarchy plugin updatewith no id, so also by the opt-in step above. It printsacme.weather is held back; run: omarchy plugin unhold acme.weather.omarchy plugin update acme.weatherstill updates it, because you named it.~/.local/state/omarchy/plugins/held/, the same idea as the toggles.It also helps when a new plugin version is broken, or when you work on a plugin in place.
Changes
bin/omarchy-update: the opt-in step, 13 lines.test/shell.d/update-sequence-test.sh: 4 new cases (off by default,-yapproves, a normal update reviews, a failure still finishes the update). I checked that they fail onquattrowithout this change.manual/30-updates.md,manual/32-shell-plugins.md,docs/update-process.md: how to turn it on and where it sits in the flow.bin/omarchy-plugin-hold,bin/omarchy-plugin-unhold: new, about 25 lines each.bin/omarchy-plugin-update: skips held plugins when no id is given.test/shell.d/plugin-hold-test.sh: 5 cases (hold records it, update skips it and says so, update by name still works, unhold, a bad id is refused). The skip case fails without the change.Tests
bash test/shell.d/update-sequence-test.sh: all pass../test/cli: all pass (run for the first commit).bash test/shell.d/plugin-hold-test.sh: all pass.Related PRs that took other routes: #7136 (always on in
omarchy update), #6777 and #10248 (menu entries). This one only adds the opt-in, so it does not conflict with a menu entry later.