Skip to content

Resolve theme display names to on-disk directories and reject unknown themes - #19485

Open
ThePrimeagen wants to merge 4 commits into
omacom:quattrofrom
ThePrimeagen:fix/c306c7ff-2d58-45a3-a1fa-0aad27250d7d
Open

ThePrimeagen wants to merge 4 commits into
omacom:quattrofrom
ThePrimeagen:fix/c306c7ff-2d58-45a3-a1fa-0aad27250d7d

Conversation

@ThePrimeagen

Copy link
Copy Markdown
Contributor

Running omarchy theme dir "Tokyo Night" prints /usr/share/omarchy/themes/Tokyo Night and exits 0, but that directory does not exist and ls of it fails. The real directory is /usr/share/omarchy/themes/tokyo-night, and bin/omarchy-theme-dir uses the name verbatim instead of resolving it to that slug.

Screenshots

Before After
before after

Reproduce

  1. Press Super+Return to open a terminal.
  2. Type omarchy theme dir "Tokyo Night"; echo DIR_EXIT:$?; ls "$(omarchy theme dir "Tokyo Night")" and press Enter.
  3. It prints /usr/share/omarchy/themes/Tokyo Night with DIR_EXIT:0, and ls fails with No such file or directory (os error 2).

More cases

Bogus theme prints a non-existent path and succeeds

Before After
before after

No argument prints usage but exits 0

Before After
before after

Related

… missing-arg help

Normalize omarchy-theme-dir's argument the same way omarchy-theme-set does (strip markup, lowercase, spaces to dashes), reject invalid names, and only print a theme directory that exists in the user or shipped themes path, exiting 1 with an error on stderr otherwise. Make the omarchy dispatcher return 1 after printing help for a command invoked without its required arguments, in both dispatch paths, so a missing <theme-name> is a usage error instead of success.
@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no outstanding defects were found.

Summary

omarchy-theme-dir now finds existing theme directories from display names while preserving exact custom folder names.

  • Theme names resolve to real folders or return an error.

Reviews (3) · Last reviewed commit: "Keep the omarchy-theme-dir tests that gu..." · Reviewed by Greptile

Comment thread bin/omarchy-theme-dir Resolved
Comment thread bin/omarchy Resolved
@omarchybot

Copy link
Copy Markdown
Collaborator

I read the theme-directory lookup, its Plymouth callers, CLI dispatch, and the existing review comments at e29e876fb2c5d5fe589f277bebaae4824899c8ec. My classification is bug, but the configured classification model, deepseek-v4p1-flash, returned no usable class, so classification remains unsettled and needs another classification pass before verification can continue. No worker tests ran, and no changes or labels were applied.

Checked by GPT-6 High in Codex. No second code review was requested because classification did not complete.

@omarchybot

Copy link
Copy Markdown
Collaborator

I read the updated theme-directory lookup and CLI tests at 9fa75c040fdbab19f84ad3a572a8fca1c889f6a6, its callers, and the replies to the earlier findings. Classification still needs another pass: my answer is bug, but deepseek-v4p1-flash again returned no usable class, so verification cannot continue under the queue rules. No worker tests ran, and no code changes or labels were applied.

Checked by GPT-6 High in Codex. No second code review was requested because classification did not complete.

omarchybot and others added 2 commits November 20, 2026 09:32
omarchy-theme-set strips tags because menu labels can carry them. Every caller of omarchy-theme-dir passes a folder name from find or a name typed on the command line, so the strip fixed nothing here and made a folder with angle brackets in its name unfindable.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
Co-Authored-By: Muse Wonder High <noreply@meta.com>
The plymouth-list check repeated the exact-folder check through a caller, the user-copy check repeated the display-name one, and "." and "../evil" took the same path as "..". What stays is one check per branch of the lookup, each of which fails when that branch is taken out.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
Co-Authored-By: Muse Wonder High <noreply@meta.com>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Nov 20, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Reviewed by Claude Fable 5.2 at a82ed156c, with the change run on a worker built from the Omarchy ISO.

The bug is real on quattro: omarchy theme dir "Tokyo Night" prints …/themes/Tokyo Night, which does not exist, and exits 0, and so does any name at all. On this branch the same call prints …/themes/tokyo-night, an exact folder such as My Theme or a hand-made Gruvbox still resolves to itself, and a theme that is not there exits 1 with a message. ./test/cli passes on the worker, and fails again with bin/omarchy-theme-dir put back to quattro's.

This is not the resolver #18795 was closed over. It is the same two steps #18557 gave omarchy-theme-set and omarchy-theme-remove: the exact folder first, then the existing conversion.

I pushed two small commits:

  • a98628610 takes the markup-tag strip back out. omarchy-theme-set needs it because menu labels can carry tags, but every caller of omarchy-theme-dir passes a folder name or a name typed on the command line.
  • a82ed156c trims the tests to one per branch of the lookup: the listed name, the exact folder, and the rejection. Each fails on the worker when its branch is taken out. The Plymouth-list check, the user-copy check, and . and ../evil repeated those.

Exiting 1 for an unknown theme changes what the command promises, so I followed all five callers (omarchy-agent-look-page, omarchy-plymouth-current, -list, -set-by-theme, -switcher). Each ends where it did before. Two differences are visible: omarchy plymouth list now prints one line on stderr for a dangling symlink or a dot-named folder under ~/.config/omarchy/themes, and omarchy agent look page --theme prints the new message ahead of its own.

Second opinion: Opus 5.5 High and muse-wonder (thinking high) each read it twice. They found no defect, both called the markup strip and half the tests surplus, which is what the two commits remove, and both said that failing for an unknown name is the maintainer's call rather than part of the bug. Their independence from this review is not guaranteed. Both also noted that user-copy-before-bundled is untested at this head, as it is on quattro.

Classification is unsettled at this head, so it carries no class label. The lookup half fixes a bug; a third model, asked after the two commits above, called the pull request an enhancement, and failing for an unknown name is a change in behaviour rather than a repair. They could be two pull requests, and the first would be about six lines.

Greptile scores this head 5/5 and its two earlier findings are answered in their threads. This now waits on the maintainer, for whether omarchy theme dir should fail for a theme that does not exist. #19481 adds tests at the same place in test/cli, so whichever lands second will need a trivial merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants