Skip to main content

Module manager

Module manager 

Source
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_TEMPLATE and the paths under plugin_source_dir are the layout codex plugin marketplace add walks. A consumer supplies two names and gets the tree Codex reads.
  • The invocation. PluginManager::register runs 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§

MarketplaceIdentity
The two names a marketplace manifest carries, plus the display string the app shows for the source.
PluginManager
One packaged plugin, and the codex binary that manages it.

Enums§

InstallGoal
What a registration run must accomplish on Codex’s side.
InstallOutcome
Outcome of installing or refreshing the plugin.
ManagerRun
What one PluginManager::register run found, distinguishing “there is no CLI here at all” from per-step outcomes so a summary never fakes success.
MarketplaceOutcome
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_TEMPLATE is written, relative to the marketplace root a consumer hands codex plugin marketplace add.
MARKETPLACE_MANIFEST_TEMPLATE
The marketplace manifest template — MARKETPLACE_MANIFEST_PATH in the packaged tree.
MARKETPLACE_NAME_SLOT
Slot in MARKETPLACE_MANIFEST_TEMPLATE for the marketplace name — the name codex plugin marketplace remove takes 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_TEMPLATE uses, because it must hold the same value: Codex resolves the offer against the plugin manifest’s name.
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_SLOT so substitution stays whole-value and JSON-escaped, exactly as every other slot in this crate is.
SKIPPED_DISABLED_REASON
Why ManagerRun::SkippedDisabled happened, 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 no hooks override.
plugin_disabled_in_config
Whether Codex’s config.toml marks plugin_spec explicitly 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> spec codex plugin add and codex plugin remove take, and the key Codex records enablement under in its config.toml.
render_marketplace_manifest
Render the marketplace manifest around a consumer’s names.