Repository navigation
Route sibling-package omarchy-* commands via a /usr/bin fallback (fixes #7185) - #9290
WhiskeyTuesday wants to merge 5 commits 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.
|
Reviewed at ee539e8 and verified on a worker built from the Omarchy ISO, which has Reproduction. With each dispatcher installed as Tests. Review. Claude Opus 5.5 read the diff against current Related. #12750 fixes the same bug differently, with a last-resort Next. This waits on the maintainer, who has two decisions to make: which of this and #12750 to take, and whether metadata errors in sibling-package binaries should warn, as here, or fail |
quattro's router now resolves alias and metadata-moved routes by loading only the commands that can own a route under its first word (omacom#15041). Those candidates came from the primary directory alone, so a sibling package's alias could lose to a shorter primary route on the fast path while the full load would have picked it. The candidates now include secondary binaries the primary directory does not shadow, in the full load's order, and reset_commands clears COMMAND_ORIGIN with the rest of the table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This branch had gone into conflict with What changed in the merge. Reproduction. With Tests. On the worker, Review. Claude Opus 5.5 found no defects in the merged change. Codex Medium, the second opinion, ran this time. It found no lookup still limited to the primary directory and called the fast-path change sound. It raised two points:
Competing fix. #12750 fixes the same bug with a last-resort Next. This is labelled |
[Medium impact] The changes reach command routing across the Omarchy CLI and its sibling packages. The PR should not merge until longer secondary aliases stop losing to shorter direct filename matches. Findings
SummaryAdds a second directory for sibling-package commands.
Reviews (3) · Last reviewed commit: "Describe the /usr/bin fallback where the..." · Reviewed by Greptile |
Both sides added a test block after the alias fast-path test in test/cli; keep both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This branch went into conflict with Reproduction. On a stock install, Tests. On the worker, Review. Claude Opus 5.5 found no defects in the merge. Codex Medium, the second opinion, agreed the merge kept both test blocks correctly, and that the per-invocation Competing fix. #12750 is still open and also conflicts with Next. This is labelled |
| if resolve_binary_path "$binary"; then | ||
| DIRECT_RESOLVED_BINARY="$binary" | ||
| DIRECT_RESOLVED_COUNT="$prefix_count" | ||
| DIRECT_RESOLVED_ROUTE="$route" | ||
| DIRECT_RESOLVED_PATH="$RESOLVED_BINARY_PATH" |
There was a problem hiding this comment.
Longer sibling aliases get skipped
If a sibling command declares the alias omarchy update plugin, calling omarchy update plugin payload selects the shorter primary omarchy-update filename match and forwards plugin payload to it. The dispatcher executes that command before load_route_candidates can find the longer secondary alias, so the wrong command runs. Compare matching secondary routes before executing the shorter direct match.
|
On Greptile's finding at Codex Medium, the second opinion, read the same code at 7cddb52 and agreed: the precedence comes from Nothing else has changed since the last comment. This is still |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The comment at the top of bin/omarchy said dev-link sets OMARCHY_SECONDARY_BIN_DIR, but omarchy-dev-link does not: away from /usr/share/omarchy/bin the fallback is simply off unless the variable is set. docs/cli-router.md said every command lives in the router's own directory, which is no longer true on an installed system. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The maintainer asked for this to be brought up to date with current Reproduction. I ran this on a worker built from the Omarchy ISO, calling the dispatcher as Tests. On the worker, Review. Claude Opus 5.5 checked every place in the merged Dev-linked checkouts: my recommendation is to leave the fallback off there, as this pull request does. On an installed system, This is labelled |
|
A smaller fix may be possible here. It's for the maintainer to weigh against this one, and it isn't a defect in this pull request. On a stock install, every entry in [[ $OMARCHY_BIN_DIR == "/usr/share/omarchy/bin" ]] && OMARCHY_BIN_DIR=/usr/binEvery existing lookup would then see the full installed set, and a checkout or dev-linked tree would keep using its own Checked on a worker built from the Omarchy ISO. All 589 entries in Codex Medium raised the idea as the second opinion on our own QA review of this bug. Claude Opus 5.5 checked it against |
|
Tested on a stock Omarchy 4.5.0-3 install ( How I tested without touching the install.
The PR's own Not tested: |
|
Closing in favour of #19093. The maintainer chose to route the one command that matters by hand rather than give the router a general /usr/bin fallback: on a packaged install only omarchy debug is advertised and unreachable, so #19093 routes debug to omarchy-debug on PATH when nothing in the router's own folder answers, and leaves everything else in the router as it is. Thanks for the careful work on this; it is what made the cause clear. Reviewed by Claude Opus 5.5 with Codex Medium as a second opinion; its independence is not guaranteed. |
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.Fixes #12629
Fixes #7060