Skip to content

feat(install): accept owner/repo shorthand in plugin add and theme install - #11398

Open
rpaweb wants to merge 5 commits into
omacom:quattrofrom
rpaweb:feature/plugin-shorthand-install
Open

feat(install): accept owner/repo shorthand in plugin add and theme install#11398
rpaweb wants to merge 5 commits into
omacom:quattrofrom
rpaweb:feature/plugin-shorthand-install

Conversation

@rpaweb

@rpaweb rpaweb commented Sep 12, 2026

Copy link
Copy Markdown

Problem

omarchy plugin add and omarchy theme install only ever accepted a full git URL, so installing anything meant leaving the terminal to find and copy one — even though the vast majority of published plugins and themes live on GitHub (100% of the ~3006 plugins in plugins.omarchy.org/catalog.json, and 100% of the extra themes listed at omarchy.org/themes/, as of 2026-09-11).

Behavior

Both commands now also accept a bare owner/repo:

omarchy plugin add acme/omarchy-weather
omarchy theme install acme/omarchy-cool-theme

It expands to a full clone URL (https://github.com/owner/repo.git by default) before anything else runs. --gitlab, --bitbucket, and --codeberg pick a different host explicitly — nothing about the shorthand itself says which platform it names, so the platform always comes from the flag, GitHub only because it's the default. Passing a full URL (any host, any transport git supports) works exactly as it does today; the shorthand is purely additive.

Implementation

  • bin/omarchy-git-shorthand-expand (new, hidden): expands owner/repo against a small host table (github/gitlab/bitbucket/codeberg). Anything already url-shaped (scheme://, scp-style user@host:path) or not owner/repo-shaped at all passes through untouched — the existing omarchy-git-url-check guard always sees the real URL that's about to be cloned, never the raw shorthand.
  • bin/omarchy-plugin-add and bin/omarchy-theme-install: parse the new platform flags and run every URL/shorthand through the expander first. Both scripts already shared omarchy-git-url-check; they now share this the same way.
  • Adding a platform is a one-line addition to the host table plus one word in each script's flag list, not a block of code per platform.

Tests

  • test/shell.d/git-shorthand-expand-test.sh (new): unit coverage — expansion per platform, every URL form already accepted by omarchy-git-url-check passes through byte-for-byte regardless of the platform argument, non-shorthand arguments pass through unchanged, an unrecognized platform is refused only when it would actually be used, and the owner/repo match is locale-pinned (LC_ALL=C) the same way omarchy-theme-install's theme-name check already is.
  • test/shell.d/plugin-add-test.sh and test/shell.d/theme-install-guards-test.sh: integration cases confirming the shorthand (with and without a platform flag) reaches git clone with the correct expanded URL, and that conflicting platform flags are refused before cloning.
  • ./test/cli and omarchy commands --check pass (455 commands). ./test/shell: same 5 pre-existing environment-only failures as on an unmodified quattro checkout (missing sibling omarchy-pkgs checkout, a locale/encoding issue reading a fixture — unrelated to this change).

…stall

Add a hidden omarchy-git-shorthand-expand helper that turns a bare
owner/repo into https://github.com/owner/repo.git before the existing
omarchy-git-url-check guard runs. Anything already url-shaped (scheme://,
scp-style user@host:path) passes through untouched, so every URL form
accepted today keeps working exactly as it does now.

Shared between omarchy-plugin-add and omarchy-theme-install, the same way
both already share the git-url-check guard.
…stall

Add a hidden omarchy-git-shorthand-expand helper that turns a bare
owner/repo into a full clone URL before the existing omarchy-git-url-check
guard runs. GitHub is the default host; --github, --gitlab, and --bitbucket
pick it explicitly, since nothing about the shorthand itself says which
platform it names. Anything already url-shaped (scheme://, scp-style
user@host:path) passes through untouched, so every URL form accepted today
keeps working exactly as it does now.

Shared between omarchy-plugin-add and omarchy-theme-install, the same way
both already share the git-url-check guard.
One line in omarchy-git-shorthand-expand's host table, plus --codeberg
alongside the existing platform flags in plugin add and theme install.
Move the platform lookup in omarchy-git-shorthand-expand inside the
owner/repo match, so a URL or non-shorthand argument never fails on an
unrecognized platform name it was never going to use. Also document the
owner/repo shorthand in shell/README.md, which had the same plugin-add
example as the other two docs but was missed.

@johnpippett johnpippett left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The basic shorthand examples give the correct clone URLs. The checks found a problem with some permitted GitLab and Bitbucket owner names. Inputs with a .git suffix receive a second suffix. The inline comments give the details.

Head: fd7c3e8e824216c64f4f20d8a20521c902957330
Base: 31bd80daa4613ffdee995ac27467fce5a2990806

A test harness did 59 caller cases on each revision. On the head, 51 cases gave the specified clone arguments and exit codes. The differences were six owner-name cases and two cases with an existing .git suffix. For the suffix cases, the specified result contains only one .git suffix. The documented examples without this suffix give the correct results.

The cases included all four host flags, flag order, repeated flags, conflicting flags, full URLs, explicit local paths, prompt input, and plugin-enable arguments. Command stubs recorded clone and application operations. Additional checks used real Git with local repositories. Explicit ./ and absolute local paths worked on both revisions.

test/cli gave 112 ok lines on each revision. The new test/shell.d/git-shorthand-expand-test.sh gave seven ok lines. The test scope did not include the full shell suite or the existing plugin-add and theme-install guard suites.

Environment: Linux x86_64, Bash 5.3.15, Git 2.55.0, and bubblewrap 0.11.2. Each test process had an empty home directory and no network or desktop access. These checks did not include remote clones, actual plugin loading, or theme display.

Codex agents did these tests and prepared this review.

Comment thread bin/omarchy-git-shorthand-expand Outdated
Comment thread bin/omarchy-git-shorthand-expand Outdated
…horthand

Widen the shorthand's owner character class to include dots and
underscores: GitHub usernames are alnum-and-hyphen only, but GitLab
namespaces and Bitbucket workspace ids also allow those, so a valid
owner like first.last or first_last was silently falling through as a
local path instead of expanding. Also strip a trailing .git from the
shorthand before building the URL, so an input that already carries one
(e.g. acme/repo.git) no longer doubles it.
@rpaweb

rpaweb commented Sep 12, 2026

Copy link
Copy Markdown
Author

@johnpippett Both findings fixed in 0d45857 — the owner class now covers the dots/underscores GitLab and Bitbucket allow, and a trailing .git is stripped before building the URL. Appreciate another look when you have a chance.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants