Repository navigation
Resolve alias and metadata-moved routes without reading every command header - #15041
Merged
Merged
Conversation
… header Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
…ter's fast path Addresses Codex review: tab-separated aliases were missed, and a C-locale sort could pick a different winner for colliding routes than the locale-sorted full load. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses Greptile review: the earlier tests passed through the full load too, so losing the fast path would have gone unnoticed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Addresses Greptile review: root reads through chmod 111, so the check failed for a correct router. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omarchybot
added a commit
to WhiskeyTuesday/omarchy
that referenced
this pull request
Oct 12, 2026
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 was referenced Oct 12, 2026
Closed
Sebo1411
added a commit
to Sebo1411/omarchy
that referenced
this pull request
Nov 1, 2026
omacom#15041 introduced candidate loading to avoid parsing every command header on alias dispatches, but grep scanning ~530 files in bin/ on each invocation still costs ~60-80ms. Write candidate prefixes to an index file under ~/.cache/omarchy/ keyed by a hash of OMARCHY_BIN_DIR. On subsequent dispatches, load matching candidates directly from the index in ~1-2ms. Validate index freshness against file mtimes in OMARCHY_BIN_DIR using a fast find check to invalidate the cache on in-place edits. Handle pipe-separated, tabbed, indented, and CRLF alias metadata.
Sebo1411
added a commit
to Sebo1411/omarchy
that referenced
this pull request
Nov 1, 2026
Follow-up to omacom#15041. Candidate loading avoids parsing every command header on alias dispatches, but grep scanning ~530 files in bin/ on each invocation still costs ~60-80ms. Write candidate prefixes to an index file under ~/.cache/omarchy/ keyed by a hash of OMARCHY_BIN_DIR. On subsequent dispatches, load matching candidates directly from the index in ~1-2ms. Validate index freshness against file mtimes in OMARCHY_BIN_DIR using a fast find check to invalidate the cache on in-place edits. Handle pipe-separated, tabbed, indented, and CRLF alias metadata.
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.
omarchy screenshot,omarchy reboot,omarchy shutdown,omarchy logout,omarchy background,omarchy shareand other alias or metadata-moved routes have no matching filename. The router therefore parsed the metadata header of every command (~530 files) before dispatching, about 195ms per invocation. Filename routes likeomarchy theme currentalready took ~5ms.The router now first loads only the commands that could own a route under the first word: files named
omarchy-<word>-*, and files whose header names<word>as their group or in an alias. It registers them in the same order a full load would. If that resolves a route that runs its command, it dispatches straight away. Help output (which lists related commands from the whole table), a bare route that needs arguments, and anything unresolved reset the registry and take the existing full-load path unchanged.Verified:
omarchy screenshotdispatch went from 196ms to 12ms.--helpoutput under the old and new router.bin/where every command is a stub that keeps its metadata header and prints its own name, 1,644 dispatches (each route with no arguments, one and two) pick the same command with the same arguments under both routers. Unknown words, group names, bareomarchyandomarchy commandsmatch too../test/clipasses, with new cases for an alias route, the longest alias winning, a metadata-moved route and help on an alias route.docs/cli-router.mddescribes the new path.🤖 Generated with Claude Code