Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,30 @@ fn marketplace_import_sources_prefers_supported_declaration_over_materialization
);
}

#[test]
fn marketplace_import_sources_infers_bundled_claude_code_marketplace() {
let (_root, external_agent_home, _codex_home) = fixture_paths();
let settings = serde_json::json!({
"enabledPlugins": {
"code-review@claude-code-plugins": true,
}
});

let import_sources = source_cla::marketplace_import_sources(
&settings,
&external_agent_home,
&external_agent_home,
);

assert_eq!(
import_sources.get("claude-code-plugins"),
Some(&MarketplaceImportSource {
source: "anthropics/claude-code".to_string(),
ref_name: None,
})
);
}

#[tokio::test]
async fn detect_home_plugins_uses_local_settings_over_project_settings() {
let (_root, external_agent_home, codex_home) = fixture_paths();
Expand Down
27 changes: 17 additions & 10 deletions codex-rs/external-agent-migration/src/source_cla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ use crate::model::PluginsMigration;
pub(super) const KNOWN_MARKETPLACES_PATH: &str = "plugins/known_marketplaces.json";
pub(super) const OFFICIAL_MARKETPLACE_NAME: &str = "claude-plugins-official";
pub(super) const OFFICIAL_MARKETPLACE_SOURCE: &str = "anthropics/claude-plugins-official";
pub(super) const CLAUDE_CODE_MARKETPLACE_NAME: &str = "claude-code-plugins";
pub(super) const CLAUDE_CODE_MARKETPLACE_SOURCE: &str = "anthropics/claude-code";
pub(super) const REWRITE_PROFILE: RewriteProfile = ClaSource::REWRITE_PROFILE;
const COMMAND_MIGRATION_PROFILE: CommandMigrationProfile = CommandMigrationProfile::new(
CommandRewriteProfile::new(
Expand Down Expand Up @@ -101,16 +103,21 @@ pub(super) fn marketplace_import_sources(
));
}

if has_enabled_plugin_for_marketplace(settings, OFFICIAL_MARKETPLACE_NAME)
&& !import_sources.contains_key(OFFICIAL_MARKETPLACE_NAME)
{
import_sources.insert(
OFFICIAL_MARKETPLACE_NAME.to_string(),
MarketplaceImportSource {
source: OFFICIAL_MARKETPLACE_SOURCE.to_string(),
ref_name: None,
},
);
for (marketplace_name, marketplace_source) in [
(OFFICIAL_MARKETPLACE_NAME, OFFICIAL_MARKETPLACE_SOURCE),
(CLAUDE_CODE_MARKETPLACE_NAME, CLAUDE_CODE_MARKETPLACE_SOURCE),
] {
if has_enabled_plugin_for_marketplace(settings, marketplace_name)
&& !import_sources.contains_key(marketplace_name)
{
import_sources.insert(
marketplace_name.to_string(),
MarketplaceImportSource {
source: marketplace_source.to_string(),
ref_name: None,
},
);
}
}

import_sources
Expand Down
Loading