mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
[plugins] Expose marketplace source in marketplace list JSON (#27009)
## Summary - Follow-up to #26417 and #26631 - Add `marketplaceSource` to `codex plugin marketplace list --json` entries for configured marketplaces - Reuse the existing `marketplaceSource` shape from `codex plugin list --json` - Keep human-readable marketplace list output unchanged - Add CLI coverage for configured local and git marketplace sources Example: ```json { "marketplaces": [ { "name": "debug", "root": "/path/to/.codex/.tmp/marketplaces/debug", "marketplaceSource": { "sourceType": "git", "source": "https://example.com/acme/agent-skills.git" } } ] } ``` ## Validation - `just fmt` - `just fix -p codex-cli` - `just test -p codex-cli marketplace_list` - `just test -p codex-cli`
This commit is contained in:
committed by
GitHub
Unverified
parent
6d8e12ac42
commit
0aa9931aea
@@ -341,6 +341,7 @@ async fn marketplace_list_shows_configured_marketplace_names() -> Result<()> {
|
||||
#[tokio::test]
|
||||
async fn marketplace_list_json_prints_configured_marketplaces() -> Result<()> {
|
||||
let (codex_home, source) = setup_local_marketplace()?;
|
||||
let source_path = source.path().display().to_string();
|
||||
|
||||
let assert = codex_command(codex_home.path())?
|
||||
.args(["plugin", "marketplace", "list", "--json"])
|
||||
@@ -355,7 +356,112 @@ async fn marketplace_list_json_prints_configured_marketplaces() -> Result<()> {
|
||||
"marketplaces": [
|
||||
{
|
||||
"name": "debug",
|
||||
"root": source.path().display().to_string(),
|
||||
"root": source_path,
|
||||
"marketplaceSource": {
|
||||
"sourceType": "local",
|
||||
"source": source_path,
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn marketplace_list_json_includes_configured_git_marketplace_source() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let marketplace_root = codex_home
|
||||
.path()
|
||||
.join(".tmp")
|
||||
.join("marketplaces")
|
||||
.join("debug");
|
||||
write_plugins_enabled_config(codex_home.path())?;
|
||||
write_marketplace_source(&marketplace_root)?;
|
||||
let update = MarketplaceConfigUpdate {
|
||||
last_updated: "2026-06-04T08:39:49Z",
|
||||
last_revision: Some("abc123"),
|
||||
source_type: "git",
|
||||
source: "https://example.com/acme/agent-skills.git",
|
||||
ref_name: None,
|
||||
sparse_paths: &[],
|
||||
};
|
||||
record_user_marketplace(codex_home.path(), "debug", &update)?;
|
||||
let normalized_root = canonicalize_existing_preserving_symlinks(&marketplace_root)?;
|
||||
|
||||
let assert = codex_command(codex_home.path())?
|
||||
.args(["plugin", "marketplace", "list", "--json"])
|
||||
.assert()
|
||||
.success();
|
||||
let stdout = assert.get_output().stdout.as_slice();
|
||||
let actual: serde_json::Value = serde_json::from_slice(stdout)?;
|
||||
|
||||
assert_eq!(
|
||||
actual,
|
||||
json!({
|
||||
"marketplaces": [
|
||||
{
|
||||
"name": "debug",
|
||||
"root": normalized_root.display().to_string(),
|
||||
"marketplaceSource": {
|
||||
"sourceType": "git",
|
||||
"source": "https://example.com/acme/agent-skills.git",
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn marketplace_list_json_keys_configured_source_by_root() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let home = TempDir::new()?;
|
||||
let marketplace_root = codex_home
|
||||
.path()
|
||||
.join(".tmp")
|
||||
.join("marketplaces")
|
||||
.join("debug");
|
||||
write_plugins_enabled_config(codex_home.path())?;
|
||||
write_marketplace_source(home.path())?;
|
||||
write_marketplace_source(&marketplace_root)?;
|
||||
let update = MarketplaceConfigUpdate {
|
||||
last_updated: "2026-06-04T08:39:49Z",
|
||||
last_revision: Some("abc123"),
|
||||
source_type: "git",
|
||||
source: "https://example.com/acme/agent-skills.git",
|
||||
ref_name: None,
|
||||
sparse_paths: &[],
|
||||
};
|
||||
record_user_marketplace(codex_home.path(), "debug", &update)?;
|
||||
let normalized_root = canonicalize_existing_preserving_symlinks(&marketplace_root)?;
|
||||
|
||||
let assert = codex_command(codex_home.path())?
|
||||
.env("HOME", home.path())
|
||||
.args(["plugin", "marketplace", "list", "--json"])
|
||||
.assert()
|
||||
.success();
|
||||
let stdout = assert.get_output().stdout.as_slice();
|
||||
let actual: serde_json::Value = serde_json::from_slice(stdout)?;
|
||||
|
||||
assert_eq!(
|
||||
actual,
|
||||
json!({
|
||||
"marketplaces": [
|
||||
{
|
||||
"name": "debug",
|
||||
"root": home.path().display().to_string(),
|
||||
},
|
||||
{
|
||||
"name": "debug",
|
||||
"root": normalized_root.display().to_string(),
|
||||
"marketplaceSource": {
|
||||
"sourceType": "git",
|
||||
"source": "https://example.com/acme/agent-skills.git",
|
||||
},
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user