feat(install): accept owner/repo shorthand in plugin add and theme install - #11398
feat(install): accept owner/repo shorthand in plugin add and theme install#11398rpaweb wants to merge 5 commits into
Conversation
…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
left a comment
There was a problem hiding this comment.
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.
…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.
|
@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. |
Problem
omarchy plugin addandomarchy theme installonly 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 inplugins.omarchy.org/catalog.json, and 100% of the extra themes listed atomarchy.org/themes/, as of 2026-09-11).Behavior
Both commands now also accept a bare
owner/repo:It expands to a full clone URL (
https://github.com/owner/repo.gitby default) before anything else runs.--gitlab,--bitbucket, and--codebergpick 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): expandsowner/repoagainst a small host table (github/gitlab/bitbucket/codeberg). Anything already url-shaped (scheme://, scp-styleuser@host:path) or not owner/repo-shaped at all passes through untouched — the existingomarchy-git-url-checkguard always sees the real URL that's about to be cloned, never the raw shorthand.bin/omarchy-plugin-addandbin/omarchy-theme-install: parse the new platform flags and run every URL/shorthand through the expander first. Both scripts already sharedomarchy-git-url-check; they now share this the same way.Tests
test/shell.d/git-shorthand-expand-test.sh(new): unit coverage — expansion per platform, every URL form already accepted byomarchy-git-url-checkpasses 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 wayomarchy-theme-install's theme-name check already is.test/shell.d/plugin-add-test.shandtest/shell.d/theme-install-guards-test.sh: integration cases confirming the shorthand (with and without a platform flag) reachesgit clonewith the correct expanded URL, and that conflicting platform flags are refused before cloning../test/cliandomarchy commands --checkpass (455 commands)../test/shell: same 5 pre-existing environment-only failures as on an unmodifiedquattrocheckout (missing siblingomarchy-pkgscheckout, a locale/encoding issue reading a fixture — unrelated to this change).