Skip to content

feat(plugin): add user-level plugin directory that survives upgrades - #1618

Open
Cyb3rDudu wants to merge 1 commit into
apple:mainfrom
Cyb3rDudu:feat/user-plugin-directory
Open

Cyb3rDudu wants to merge 1 commit into
apple:mainfrom
Cyb3rDudu:feat/user-plugin-directory

Conversation

@Cyb3rDudu

Copy link
Copy Markdown

CLI plugins installed into {install-root}/libexec/container-plugins/ are lost on every container upgrade because the path lives inside the versioned keg (e.g. Homebrew rotates Cellar/container/0.12.3/ → 0.12.4/).

Add a fourth search directory to PluginLoader that is stable across upgrades: XDG_DATA_HOME/container/plugins/ (falls back to ~/.local/share/container/plugins/). The directory is opt-in — it must exist before container will scan it.

User-home plugins take priority over install-root plugins, so a package-manager upgrade cannot silently shadow plugins the user installed themselves. Search order is now: user-home → install-root → app-bundle.

Closes #1617

Plugins installed into the versioned install root are lost on every
container upgrade (e.g. brew upgrade rotates Cellar/container/0.12.3 →
0.12.4, taking libexec/container-plugins/ with it).

Add a fourth search directory to PluginLoader that is stable across
upgrades: XDG_DATA_HOME/container/plugins/ (falls back to
~/.local/share/container/plugins/). The directory is opt-in — it must
exist before container will scan it, so users are not surprised.

User-home plugins take priority over install-root plugins, so
package-managed installs cannot silently shadow plugins the user
installed themselves. Search order is now: user-home → install-root →
app-bundle.

Closes apple#1617
@Cyb3rDudu

Copy link
Copy Markdown
Author

@jglogan any updates on this. Sorry for bumping :)

adrum added a commit to adrum/Container-Compose that referenced this pull request Nov 14, 2026
…ainer plugin

Apple's `container` dispatches an unknown subcommand `compose` to a CLI
plugin at <pluginsDir>/compose/{bin/compose, config.toml}, where the
binary name must match the directory and config.toml must omit
servicesConfig to be treated as CLI rather than a daemon. There is no
metadata handshake — the binary is simply execvp'd — so a symlink plus a
manifest is sufficient.

install-plugin creates that layout, symlinking the binary (preferring the
stable PATH copy so it survives container-compose upgrades). It defaults
to installing into both the user-level dir
($XDG_DATA_HOME/container/plugins, falling back to ~/.local/share/...,
matching apple/container#1618) and the install-root keg, so
`container compose` works on current releases and survives `container`
upgrades. The command is idempotent and re-runnable, and supports
--location, --plugin-dir, --binary, --install-root, and --uninstall.
adrum added a commit to adrum/Container-Compose that referenced this pull request Nov 25, 2026
…ainer plugin

Apple's `container` dispatches an unknown subcommand `compose` to a CLI
plugin at <pluginsDir>/compose/{bin/compose, config.toml}, where the
binary name must match the directory and config.toml must omit
servicesConfig to be treated as CLI rather than a daemon. There is no
metadata handshake — the binary is simply execvp'd — so a symlink plus a
manifest is sufficient.

install-plugin creates that layout, symlinking the binary (preferring the
stable PATH copy so it survives container-compose upgrades). It defaults
to installing into both the user-level dir
($XDG_DATA_HOME/container/plugins, falling back to ~/.local/share/...,
matching apple/container#1618) and the install-root keg, so
`container compose` works on current releases and survives `container`
upgrades. The command is idempotent and re-runnable, and supports
--location, --plugin-dir, --binary, --install-root, and --uninstall.

This branch has not been deployed

No deployments
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.

[Request]: User-installed CLI plugins are lost on every container upgrade

1 participant