Expand description
Codex’s own plugin manager: the source layout it consumes and the codex
subcommands that register and install from it.
super renders the two manifests a hook plugin is. Neither is
installable on its own: Codex installs a plugin from a marketplace, a
directory whose .agents/plugins/marketplace.json offers one or more
plugins as local sources, and it installs by running its own CLI. So a
consumer that only had the templates could write a tree and then had to
tell the user to finish the job by hand.
Everything needed to finish it lives here, and it is all Codex knowledge rather than any consumer’s:
- The wrapper.
MARKETPLACE_MANIFEST_TEMPLATEand the paths underplugin_source_dirare the layoutcodex plugin marketplace addwalks. A consumer supplies two names and gets the tree Codex reads. - The invocation.
PluginManager::registerruns the two commands in order and interprets the answers. - The quirks. Codex reports “this is already done” as a failure with a distinguishing phrase on stderr, and it refuses a same-named marketplace pointing at a different directory. Recognising those answers is the difference between an install that completes and one that reports a spurious error, and it is the bulk of what this module knows.
§Observed behaviour, and why it is guarded
The collision and refresh semantics below were verified against
codex-cli 0.146.0. They are matched on stderr phrases because the CLI
offers nothing better — no machine-readable status, no distinct exit code.
Every phrase check therefore only ever reinterprets a failure, and only
against the specific phrasings observed, so a CLI whose wording moves
degrades to an honest failure plus PluginManager::manual_commands
rather than to a silent wrong answer.
§What stays with the consumer
Bytes on disk and words on a terminal. This module never writes a file, never reads one, and never prints: it takes a marketplace root that already exists and hands back outcomes. Whether a consumer extracts an embedded bundle or renders one, how it records what it has delivered, and how it narrates any of that are its own.
Structs§
- Marketplace
Identity - The two names a marketplace manifest carries, plus the display string the app shows for the source.
- Plugin
Manager - One packaged plugin, and the
codexbinary that manages it.
Enums§
- Install
Goal - What a registration run must accomplish on Codex’s side.
- Install
Outcome - Outcome of installing or refreshing the plugin.
- Manager
Run - What one
PluginManager::registerrun found, distinguishing “there is no CLI here at all” from per-step outcomes so a summary never fakes success. - Marketplace
Outcome - Outcome of registering the marketplace source.
Constants§
- MARKETPLACE_
DISPLAY_ NAME_ SLOT - Slot for the marketplace’s display name, shown when the app lists sources.
- MARKETPLACE_
MANIFEST_ PATH - Where
MARKETPLACE_MANIFEST_TEMPLATEis written, relative to the marketplace root a consumer handscodex plugin marketplace add. - MARKETPLACE_
MANIFEST_ TEMPLATE - The marketplace manifest template —
MARKETPLACE_MANIFEST_PATHin the packaged tree. - MARKETPLACE_
NAME_ SLOT - Slot in
MARKETPLACE_MANIFEST_TEMPLATEfor the marketplace name — the namecodex plugin marketplace removetakes and the right-hand side of a<plugin>@<marketplace>spec. - MARKETPLACE_
PLUGIN_ NAME_ SLOT - Slot for the offered plugin’s name. The same spelling
super::PLUGIN_MANIFEST_TEMPLATEuses, because it must hold the same value: Codex resolves the offer against the plugin manifest’sname. - MARKETPLACE_
PLUGIN_ SOURCE_ PATH_ SLOT - Slot for the offered plugin’s source path, relative to the marketplace
root. Its own slot rather than text spliced around
MARKETPLACE_PLUGIN_NAME_SLOTso substitution stays whole-value and JSON-escaped, exactly as every other slot in this crate is. - SKIPPED_
DISABLED_ REASON - Why
ManagerRun::SkippedDisabledhappened, in words a consumer can print.
Functions§
- hooks_
manifest_ path - Where
super::render_hooks_manifest’s output is written, relative to the marketplace root. This is Codex’s default hooks location, which is why a rendered plugin manifest declares nohooksoverride. - plugin_
disabled_ in_ config - Whether Codex’s
config.tomlmarksplugin_specexplicitly disabled. - plugin_
manifest_ path - Where
super::render_plugin_manifest’s output is written, relative to the marketplace root. - plugin_
source_ dir - The plugin’s source directory, relative to the marketplace root.
- plugin_
spec - The
<plugin>@<marketplace>speccodex plugin addandcodex plugin removetake, and the key Codex records enablement under in itsconfig.toml. - render_
marketplace_ manifest - Render the marketplace manifest around a consumer’s names.