Skip to content

Install a plugin by name — bb plugin install git:github.com/acme/bb-plugins/plugins/notify #1774

Description

@smsunarto

What I'd like

One string to address a plugin, the way go get addresses a module: the
repository followed by the plugin's path inside it. The git: scheme stays — it's what separates a git
source from npm:, path:, and a catalog entry, and it's worth keeping. What
goes is the flag assembly after it.

bb plugin install git:github.com/acme/bb-plugins/plugins/notify

No version selector in the common case, because "install this plugin" almost
always means "install its newest release".

Today the same install takes three inputs that have to be assembled by hand
and kept in agreement. Everything below is about collapsing those three into
one.

Before / after

Install the newest release

# before
$ bb plugin install git:github.com/acme/bb-plugins@semver:notify/:* --plugin notify
[email protected]  running

# after
$ bb plugin install git:github.com/acme/bb-plugins/plugins/notify
[email protected]  running   (notify/v0.2.2)

Pin to a release line

# before
$ bb plugin install git:github.com/acme/bb-plugins@semver:notify/:^0.2.0 --plugin notify

# after
$ bb plugin install git:github.com/acme/bb-plugins/plugins/notify@^0.2.0

Take an exact release, or a branch

# before
$ bb plugin install git:github.com/acme/bb-plugins@ref:notify/v0.2.1 --plugin notify
$ bb plugin install git:github.com/acme/bb-plugins@main --plugin notify

# after
$ bb plugin install git:github.com/acme/bb-plugins/plugins/[email protected]
$ bb plugin install git:github.com/acme/bb-plugins/plugins/notify@main

See what you're on

# before
$ bb plugin outdated
notify   /var/folders/…   —   —   current

# after
$ bb plugin outdated
notify   github.com/acme/bb-plugins/plugins/notify   notify/v0.2.2 → notify/v0.3.0   update

Publish, as the author — nothing new to learn:

$ git tag notify/v0.3.0 && git push origin notify/v0.3.0

The tagging convention

<plugin-name>/v<semver>, where the name is the last segment of the
address — exactly what monorepos here already tag:

notify/v0.2.2
amp/v0.3.0
monokai/v0.2.0

So …/plugins/notify builds plugins/notify and resolves notify/vX.Y.Z
tags. One string, both facts, nothing to keep in agreement. (This is the one
place the proposal departs from Go, which prefixes with the full subdirectory
— plugins/notify/v0.2.2. The short form reads better and is what people
already tag.) A plugin at the repository root has no trailing segments and
keeps repo-wide vX.Y.Z tags, as today.

Drop .bb/plugins.json, don't build on it

Nothing above needs an index. The address already carries the directory, so
there is no name to look up: …/bb-plugins/plugins/notify says where the
plugin is as plainly as a path can.

That leaves .bb/plugins.json as a third copy of facts that already live in
the repository layout and each plugin's package.json — one more file to edit
when a directory moves, and one more thing that can disagree with the other
two. It exists today only to give --plugin a name to resolve; with the
address doing that job, both can go.

How it resolves

flowchart TD
  IN["git:github.com/acme/bb-plugins/plugins/notify@latest"]
  IN --> REPO["repository<br/>github.com/acme/bb-plugins"]
  IN --> Q["version query<br/>(default: latest)"]

  IN --> DIR["directory<br/>plugins/notify"]
  DIR --> PFX["tag prefix = last segment<br/>notify/vX.Y.Z"]
  PFX --> RES["resolve tags → commit"]
  Q --> RES
  REPO --> RES
  RES --> CO["checkout"]
  DIR --> CO
  CO --> BUILD["npm install → bb build"]
Loading

No lookup, no scan, no index — the checkout already has the directory the
address names. Two things worth calling out:

  • The last segment should be checked, not trusted. bb derives a plugin's
    id from its package name (@acme/bb-plugin-notify → notify). If that id
    and the last segment disagree, the install is asking for tags that will
    never match the plugin it builds, so refuse it and say which is which.
  • latest is the default query: highest release tag, else highest
    prerelease, else a pseudo-version of the default branch tip
    (v0.0.0-20260817120000-31693bd52d20) so an untagged install still says
    what it is.

Why (what the current shape costs)

Three inputs — clone URL, directory, tag prefix — are independent, and
nothing checks them against each other. On bb 0.38.0, with a plugin
scaffolded by bb plugin new and two tag lines at different commits:

setup
cd "$(mktemp -d)"
bb plugin new demo
mkdir -p repro/plugins && mv bb-plugin-demo repro/plugins/demo
cd repro && rm -rf plugins/demo/node_modules plugins/demo/dist && git init -q .

(cd plugins/demo && npm pkg set version=1.0.0)
git add -A && git commit -qm "demo 1.0.0" && git tag demo/v1.0.0
(cd plugins/demo && npm pkg set version=2.0.0)
git commit -qam "demo 2.0.0" && git tag unrelated/v9.9.9
R=$PWD
$ bb plugin install "git:$R@semver:demo/:*"      --subdirectory plugins/demo --yes
[email protected]  running
$ bb plugin install "git:$R@semver:unrelated/:*" --subdirectory plugins/demo --yes
[email protected]  running        # this plugin's directory, the other plugin's release commit

Both succeed. The second is a real build of the right directory from the
wrong commit, and nothing in plugin list, plugin source, or
plugin outdated distinguishes them. Deriving the prefix from the name in
the address makes that pair unrepresentable rather than merely wrong.

The omitted-selector case has the same root:

$ bb plugin install "git:$R" --subdirectory plugins/demo --yes
[email protected]  running        # branch tip, not the newest release (demo/v1.0.0)
$ bb plugin outdated
demo   …   current

The shortest command is the one without a selector, so it's the one people
will type — and it quietly means "subscribe to main" while reading as up
to date. With latest as the default, the short command does the expected
thing.

Non-goals

  • Go's /vN major-version suffix. It exists so two majors can link into
    one binary; a bb plugin is one id, one install, one process.
  • Minimal version selection — plugins have no dependency graph on each other.

Open questions

  1. Where does the repository end? Three segments works for GitHub, but
    not universally: a GitLab subgroup URL like gitlab.com/org/team/repo is
    a valid clone URL today, so treating the last segment as a plugin name
    would break it. Options: a ?go-get=1-style probe, per-host shapes, or an
    explicit separator (git:gitlab.com/org/team/repo:notify), which needs
    no host knowledge at all and may be the honest answer.
  2. Directory moves rename the address. plugins/notify → apps/notify
    changes the published install command, exactly as it does for a Go module.
    Acceptable, or worth a redirect mechanism?
  3. latest and prereleases. A bare * range already excludes them, so
    latest needs an explicit fallback for a plugin with no release tag yet.

Activity

  1. smsunarto commented on Aug 18, 2026

    @smsunarto
    ContributorAuthor

    @SawyerHood some thoughts on the install via git semver UX

  2. added
    plugins
    cli
    on Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliplugins

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions