mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
Preserve remote plugin default prompts (#25887)
## Summary - Read `default_prompts` from remote plugin release metadata. - Prefer the plural prompt list over legacy `default_prompt`. - Fall back to `default_prompt` as a single-item list for backward compatibility. ## Testing - `just test -p codex-core-plugins` - `just test -p codex-app-server`
This commit is contained in:
@@ -1754,6 +1754,8 @@ async fn plugin_list_includes_remote_marketplaces_when_remote_plugin_enabled() -
|
||||
"interface": {
|
||||
"short_description": "Plan and track work",
|
||||
"capabilities": ["Read", "Write"],
|
||||
"default_prompt": "Use the legacy Linear prompt",
|
||||
"default_prompts": ["Create a Linear issue", "Review my Linear projects"],
|
||||
"logo_url": "https://example.com/linear.png",
|
||||
"screenshot_urls": ["https://example.com/linear-shot.png"]
|
||||
},
|
||||
@@ -1893,6 +1895,16 @@ async fn plugin_list_includes_remote_marketplaces_when_remote_plugin_enabled() -
|
||||
.and_then(|interface| interface.display_name.as_deref()),
|
||||
Some("Linear")
|
||||
);
|
||||
assert_eq!(
|
||||
remote_marketplace.plugins[0]
|
||||
.interface
|
||||
.as_ref()
|
||||
.and_then(|interface| interface.default_prompt.clone()),
|
||||
Some(vec![
|
||||
"Create a Linear issue".to_string(),
|
||||
"Review my Linear projects".to_string(),
|
||||
])
|
||||
);
|
||||
assert_eq!(
|
||||
remote_marketplace.plugins[0].keywords,
|
||||
vec![
|
||||
@@ -1907,6 +1919,10 @@ async fn plugin_list_includes_remote_marketplaces_when_remote_plugin_enabled() -
|
||||
let cached_catalog: serde_json::Value =
|
||||
serde_json::from_slice(&std::fs::read(&cache_files[0])?)?;
|
||||
assert_eq!(cached_catalog["schema_version"], serde_json::json!(1));
|
||||
assert_eq!(
|
||||
cached_catalog["plugins"][0]["release"]["interface"]["default_prompts"],
|
||||
serde_json::json!(["Create a Linear issue", "Review my Linear projects"])
|
||||
);
|
||||
let cached_plugin_ids = cached_catalog["plugins"]
|
||||
.as_array()
|
||||
.expect("cached plugins should be an array")
|
||||
|
||||
@@ -159,7 +159,9 @@ plugins = true
|
||||
"keywords": [],
|
||||
"interface": {
|
||||
"short_description": "Plan and track work",
|
||||
"capabilities": []
|
||||
"capabilities": [],
|
||||
"default_prompt": "Use the legacy Linear prompt",
|
||||
"default_prompts": []
|
||||
},
|
||||
"skills": []
|
||||
}
|
||||
@@ -217,6 +219,15 @@ plugins = true
|
||||
assert_eq!(response.plugin.summary.name, "linear");
|
||||
assert_eq!(response.plugin.summary.source, PluginSource::Remote);
|
||||
assert_eq!(response.plugin.summary.share_context, None);
|
||||
assert_eq!(
|
||||
response
|
||||
.plugin
|
||||
.summary
|
||||
.interface
|
||||
.as_ref()
|
||||
.and_then(|interface| interface.default_prompt.clone()),
|
||||
Some(vec!["Use the legacy Linear prompt".to_string()])
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -404,6 +415,8 @@ async fn plugin_read_reads_remote_plugin_details_when_remote_plugin_enabled() ->
|
||||
"interface": {
|
||||
"short_description": "Plan and track work",
|
||||
"capabilities": ["Read", "Write"],
|
||||
"default_prompt": "Use the legacy Linear prompt",
|
||||
"default_prompts": ["Create a Linear issue", "Review my Linear projects"],
|
||||
"logo_url": "https://example.com/linear.png",
|
||||
"screenshot_urls": ["https://example.com/linear-shot.png"]
|
||||
},
|
||||
@@ -518,6 +531,18 @@ async fn plugin_read_reads_remote_plugin_details_when_remote_plugin_enabled() ->
|
||||
"project management".to_string()
|
||||
]
|
||||
);
|
||||
assert_eq!(
|
||||
response
|
||||
.plugin
|
||||
.summary
|
||||
.interface
|
||||
.as_ref()
|
||||
.and_then(|interface| interface.default_prompt.clone()),
|
||||
Some(vec![
|
||||
"Create a Linear issue".to_string(),
|
||||
"Review my Linear projects".to_string(),
|
||||
])
|
||||
);
|
||||
assert_eq!(response.plugin.skills.len(), 1);
|
||||
assert_eq!(response.plugin.skills[0].name, "plan-work");
|
||||
assert_eq!(response.plugin.skills[0].path, None);
|
||||
|
||||
Reference in New Issue
Block a user