Skip to content

Add marketplace command#17087

Merged
xli-oai merged 18 commits intomainfrom
xli-codex/marketplace-add-command
Apr 11, 2026
Merged

Add marketplace command#17087
xli-oai merged 18 commits intomainfrom
xli-codex/marketplace-add-command

Conversation

@xli-oai
Copy link
Copy Markdown
Contributor

@xli-oai xli-oai commented Apr 8, 2026

Added a new top-level codex marketplace add command for installing plugin marketplaces into Codex’s local marketplace cache.

This change adds source parsing for local directories, GitHub shorthand, and git URLs, supports optional --ref and git-only --sparse checkout paths, stages the source in a temp directory, validates the marketplace manifest, and installs it under $CODEX_HOME/marketplaces/<marketplace-name>

Included tests cover local install behavior in the CLI and marketplace discovery from installed roots in core. Scoped formatting and fix passes were run, and targeted CLI/core tests passed.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 8, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@xli-oai
Copy link
Copy Markdown
Contributor Author

xli-oai commented Apr 8, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Apr 8, 2026
Comment thread codex-rs/core/src/plugins/manager.rs Outdated
Comment thread codex-rs/cli/src/marketplace_cmd.rs Outdated
Comment thread codex-rs/core/src/plugins/manager.rs Outdated
Copy link
Copy Markdown
Contributor Author

xli-oai commented Apr 8, 2026

Design / storage summary for the current branch:

Filesystem layout

  • $CODEX_HOME/.tmp/plugins/ remains the existing OpenAI-curated marketplace checkout. This PR does not move or rename it.
  • $CODEX_HOME/.tmp/marketplaces/<marketplace-name>/ is where marketplaces added by codex marketplace add are materialized.
  • $CODEX_HOME/.tmp/marketplaces/.staging/ is temporary staging space used while cloning/copying before install.
  • $CODEX_HOME/plugins/cache/<marketplace>/<plugin>/<version>/ remains the existing plugin artifact/install cache. Marketplace add does not install plugin artifacts into this cache.

State

  • User-added marketplace metadata is stored in $CODEX_HOME/config.toml under [marketplaces.<marketplace-name>].
  • Each entry records last_updated, source_type, source, optional ref, and optional sparse_paths.
  • known_marketplaces.json is no longer written or read.
  • .codex-marketplace-source is no longer written or read.

Flow

codex marketplace add <source> accepts a local marketplace directory or Git source. It checks config.toml for an existing matching source, stages the source by copying/cloning when needed, validates the staged root as a Codex marketplace, rejects the reserved openai-curated marketplace name, installs under .tmp/marketplaces/<name>, and records metadata in config.toml.

Adding the same normalized source again is idempotent. Adding a different source with the same marketplace name is rejected instead of replacing the existing marketplace.

@xli-oai xli-oai marked this pull request as ready for review April 8, 2026 21:32
@xli-oai xli-oai force-pushed the xli-codex/marketplace-add-command branch 6 times, most recently from faaff79 to f4909a7 Compare April 8, 2026 23:24
Comment thread codex-rs/core/src/plugins/manager.rs Outdated
}
}

pub fn marketplace_install_root(codex_home: &Path) -> PathBuf {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe have a marketplace.rs or something as this file becomes too big.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Copy Markdown
Contributor Author

@xli-oai xli-oai Apr 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 53deb35f0: I split installed marketplace root discovery out of core/src/plugins/manager.rs into core/src/plugins/installed_marketplaces.rs. manager.rs now only asks for configured marketplace roots; the new module owns the config-to-filesystem discovery helper and the installed marketplace directory constant. Earlier in 16813bd29, I also split the CLI clone/copy/replace helpers into marketplace_cmd/ops.rs.

@xl-openai
Copy link
Copy Markdown
Collaborator

@codex review

@xli-oai xli-oai force-pushed the xli-codex/marketplace-add-command branch from f4909a7 to f9b23d5 Compare April 8, 2026 23:32
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9b23d58b9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/core/src/plugins/manager.rs Outdated
Comment thread codex-rs/cli/src/marketplace_cmd.rs Outdated
Comment thread codex-rs/core/src/plugins/manager.rs Outdated
Comment thread codex-rs/cli/src/marketplace_cmd.rs Outdated
Comment thread codex-rs/cli/src/marketplace_cmd.rs Outdated
@xli-oai
Copy link
Copy Markdown
Contributor Author

xli-oai commented Apr 9, 2026

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 972d3a5495

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/cli/src/marketplace_cmd.rs
Comment thread codex-rs/cli/src/marketplace_cmd/metadata.rs Outdated
Copy link
Copy Markdown
Collaborator

@sayan-oai sayan-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for cleaning up! one nit

Comment thread codex-rs/cli/src/marketplace_cmd.rs Outdated
@xli-oai xli-oai force-pushed the xli-codex/marketplace-add-command branch from e8fa02e to 972d3a5 Compare April 9, 2026 22:14
@xli-oai
Copy link
Copy Markdown
Contributor Author

xli-oai commented Apr 10, 2026

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: add49f91b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/cli/src/marketplace_cmd.rs Outdated
Comment thread codex-rs/cli/src/marketplace_cmd.rs Outdated
Copy link
Copy Markdown
Contributor Author

xli-oai commented Apr 10, 2026

Updated design summary after the latest config-only changes:

State and metadata

  • User-added marketplace metadata is stored in $CODEX_HOME/config.toml under [marketplaces.<marketplace-name>].
  • Each entry records last_updated, source_type, source, optional ref, and optional sparse_paths.
  • known_marketplaces.json is no longer written or read.
  • .codex-marketplace-source is no longer written or read.

Filesystem layout

  • $CODEX_HOME/.tmp/plugins/ remains the existing OpenAI-curated marketplace checkout.
  • $CODEX_HOME/.tmp/marketplaces/<marketplace-name>/ stores marketplaces added by codex marketplace add.
  • $CODEX_HOME/.tmp/marketplaces/.staging/ is temporary staging space for copy/clone before install.
  • $CODEX_HOME/plugins/cache/<marketplace>/<plugin>/<version>/ remains the existing plugin artifact cache and is not changed by marketplace add.

Flow

codex marketplace add <source> parses a local directory or Git source, checks config.toml for an existing matching source, stages by copying/cloning when needed, validates the marketplace manifest, rejects the reserved openai-curated name, installs under .tmp/marketplaces/<name>, and writes the config metadata. Adding the same source again is idempotent; adding a different source with the same marketplace name is rejected.

@xli-oai
Copy link
Copy Markdown
Contributor Author

xli-oai commented Apr 10, 2026

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cdac5ef786

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/cli/src/marketplace_cmd.rs Outdated

let source = expand_home(source);
let path = PathBuf::from(&source);
let path_exists = path.try_exists().with_context(|| {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Classify git URLs before try_exists to avoid Windows failures

parse_marketplace_source calls PathBuf::try_exists() on raw input before URL classification. On Windows, inputs like https://... or git@host:repo can raise invalid-name errors, causing an early "failed to access local marketplace source" failure instead of parsing as git sources. This breaks advertised URL-based installs on Windows.

Useful? React with 👍 / 👎.

Comment thread codex-rs/cli/src/marketplace_cmd.rs Outdated
Comment on lines +337 to +338
fn is_ssh_git_url(source: &str) -> bool {
source.starts_with("git@") && source.contains(':')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Accept ssh:// URLs promised by marketplace source docs

The command docs say SOURCE supports SSH URLs, but is_ssh_git_url only recognizes scp-style git@...:.... A valid SSH URL like ssh://git@github.com/org/repo.git falls through and is rejected as an invalid source format, which mismatches the declared behavior.

Useful? React with 👍 / 👎.

@xli-oai
Copy link
Copy Markdown
Contributor Author

xli-oai commented Apr 10, 2026

@codex reivew

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 238f4b1214

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +311 to +313
if url.starts_with("https://github.com/") && !url.ends_with(".git") {
format!("{url}.git")
} else {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Trim trailing slash before appending .git

normalize_git_url blindly appends .git for any https://github.com/... URL without that suffix. If the user passes a common copied URL ending in / (e.g. https://github.com/org/repo/), this becomes .../repo/.git, which points to a different path and causes marketplace add clone failures. Strip a trailing slash before normalization.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 674015acd: normalize_git_url now trims trailing slashes before appending .git, so https://github.com/org/repo/ normalizes to https://github.com/org/repo.git instead of https://github.com/org/repo/.git. I also added parser coverage for this trailing-slash GitHub URL shape.

@xli-oai
Copy link
Copy Markdown
Contributor Author

xli-oai commented Apr 10, 2026

@codex review

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 674015acdf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +32 to +33
let Ok(config) = std::fs::read_to_string(&config_path) else {
return Ok(None);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Handle config read errors instead of treating as missing

installed_marketplace_root_for_source swallows every read_to_string error and returns Ok(None). Permission/I/O failures are misclassified as “no config”, so marketplace add can continue and later fail after mutating disk. Only NotFound should be ignored; other read errors should abort early.

Useful? React with 👍 / 👎.

Comment thread codex-rs/cli/src/marketplace_cmd.rs Outdated
Comment on lines +183 to +185
ops::replace_marketplace_root(&staged_root, &destination)
.with_context(|| format!("failed to install marketplace at {}", destination.display()))?;
record_added_marketplace(&codex_home, &marketplace_name, &install_metadata)?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Persist marketplace config before finalizing install move

run_add moves the staged directory into the install root before updating config.toml. If record_added_marketplace fails (e.g., invalid or unwritable config), the command errors but leaves the marketplace installed. Subsequent retries hit the existing destination and fail as a “different source,” requiring manual cleanup.

Useful? React with 👍 / 👎.

@xli-oai xli-oai merged commit f9a8d18 into main Apr 11, 2026
21 of 22 checks passed
@xli-oai xli-oai deleted the xli-codex/marketplace-add-command branch April 11, 2026 02:18
@xli-oai
Copy link
Copy Markdown
Contributor Author

xli-oai commented Apr 11, 2026

@codex review

@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2026
@xli-oai
Copy link
Copy Markdown
Contributor Author

xli-oai commented Apr 11, 2026

@codex review

@xli-oai xli-oai added the oai PRs contributed by OpenAI employees label Apr 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

oai PRs contributed by OpenAI employees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants