Route sibling-package omarchy-* commands via a /usr/bin fallback (fixes #7185) - #9290
Open
WhiskeyTuesday wants to merge 1 commit into
Open
Route sibling-package omarchy-* commands via a /usr/bin fallback (fixes #7185)#9290WhiskeyTuesday wants to merge 1 commit into
WhiskeyTuesday wants to merge 1 commit into
Conversation
…ary bin dir The dispatcher scans its own directory (OMARCHY_BIN_DIR, /usr/share/omarchy/bin on a production install) and only that directory, so any omarchy-* binary a sibling package installs into /usr/bin without also symlinking into /usr/share/omarchy/bin becomes unroutable through the CLI. Today that hides five commands (omarchy-debug, omarchy-debug-idle, omarchy-upload-log from omarchy-settings; omarchy-nvim-setup, omarchy-nvim-refresh from omarchy-nvim) and every future sibling-package command hits the same wall. Scan a secondary directory as a fallback when running as a production install (OMARCHY_BIN_DIR == /usr/share/omarchy/bin). The primary directory always wins on name collision so the omarchy tree remains authoritative. Dev-link and test invocations honour OMARCHY_SECONDARY_BIN_DIR themselves; an empty value disables the fallback, which the tests use to drive the new code paths against scratch directories rather than /usr/bin. Track a per-command origin so `omarchy commands --check` stays strict for the project's own binaries but only warns for sibling-package binaries. Without this, users who install optional packages that ship an omarchy-* binary without a metadata summary (currently omarchy-nvim) would see a previously-green check start failing. Fixes omacom#7185. Related: omacom#6977, omacom#7060.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7185. Adjacent to #6977 and #7060 (both symptoms of the same split).
Problem
bin/omarchyresolves subcommands by globbing its own directory (OMARCHY_BIN_DIR), so on a production install it only sees/usr/share/omarchy/bin. Sibling packages install their ownomarchy-*binaries into/usr/binwithout symlinking them into/usr/share/omarchy/bin, which puts every one of their routes out of the dispatcher's reach. Today that hides at least five commands — three fromomarchy-settings(omarchy-debug,omarchy-debug-idle,omarchy-upload-log) and two fromomarchy-nvim(omarchy-nvim-setup,omarchy-nvim-refresh) — and every optional package following the same pattern (omarchy-emacs,omarchy-fish,omarchy-zsh, future ones) hits the same wall. The three fromomarchy-settingsare the most user-visible because the bug template and the shippedomarchyagent skill both instruct people to runomarchy debug --no-sudo --print, which currently exits 127 on production installs.The split is deliberate on the packaging side (
omarchy-settingsmust be usable on the ISO live env beforeomarchyis installed), sobin/omarchy's PKGBUILD deliberately excludes those three from the standardinstall -Dm755 … + ln -s /usr/share/omarchy/bin/…loop. Fixing this on the dispatcher side keeps the invariant in one place instead of asking every sibling-package PKGBUILD to remember to drop a symlink into a directory another package owns.Change
When the dispatcher runs as a production install (
OMARCHY_BIN_DIR == /usr/share/omarchy/bin), also scan/usr/bin/omarchy-*as a secondary source. The primary directory always wins on name collision, so theomarchypackage's own binaries stay authoritative.The touch points are the six discovery/resolution paths in
bin/omarchy—load_commands,load_command_by_binary,load_child_commands_by_binary,group_has_child_commands,group_has_binary_commands,load_group_commands,resolve_direct_route— plus the twobinary_path=sites indispatch_fast_or_help/dispatch_or_helpand the missing-binary check incommands --check. All of those funnel through a singleresolve_binary_pathhelper (primary first, then secondary), andresolve_direct_routenow returnsDIRECT_RESOLVED_PATHso the fast path can exec the right file without recomputing.Dev-link and test invocations honour the env variable
OMARCHY_SECONDARY_BIN_DIRthemselves — set it to a directory to override, set it to the empty string to disable the fallback. The tests use that seam to drive the new code paths against scratch directories rather than/usr/bin.Metadata check behavior
Once sibling-package binaries become visible to the dispatcher, they also become visible to
omarchy commands --check.omarchy-nvim's two binaries ship without an# omarchy:summary=line today, so a strict check regressed from green to red on any machine withomarchy-nviminstalled.To avoid pinning the fix to a coordinated release with a sibling package,
commands --checknow tracks per-command origin (primaryvssecondary). Missing-summary and metadata-validation errors from primary binaries still fail the check exactly as before — that guardrail on the project's own tree is untouched. The same errors from secondary binaries surface as warnings with a(foreign)tag and do not count toward the failure total. Missing-binary errors continue to fail regardless of origin. Happy to invert that decision if the preference is to fail hard and use it as pressure to fix sibling-package metadata.Tests
test/cligains a block that reuses the existing symlink-into-tmpdir pattern:commands --all --jsonlists secondary-dir commandscommands --checkpasses when a well-formed command lives only in secondaryOMARCHY_SECONDARY_BIN_DIRdisables the fallbackFull suite is green (
bash test/cli— 126 tests pass).Verification against the real system
With
OMARCHY_SECONDARY_BIN_DIR=/usr/bin(i.e. simulating a production install from a dev checkout), the previously-invisible routes now resolve on my machine:Relationship to #7239
PR #7239 (open, targets
default/hypr/envs.lua) fixes the PATH-shadowing side of #6977 — with it landed, an interactive shell in Hyprland has/usr/binahead of/usr/share/omarchy/binon PATH, soomarchyresolves from/usr/bin/omarchy, and that dispatcher then scans/usr/bin/omarchy-*and finds everything. It functionally papers over #7185 for interactive shells. This PR fixes the dispatcher itself, so any invocation of/usr/share/omarchy/bin/omarchy debug(scripts, non-interactive shells, scopedOMARCHY_PATHuses) also routes correctly. The two are orthogonal — either can land first.