feat: add short description support for plugin#7931
Conversation
short description will be displayed in the plugin card
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
cardDescriptioncomputed passes its own fallback chain intopluginShortDesc, even thoughpluginShortDescalready implements the same fallback logic; you can simplify this by callingpluginShortDesc(props.plugin)directly and letting the helper manage all fallbacks. - Given that
pluginShortDescalready considersplugin.short_desc,plugin.desc, andplugin.descriptioninternally, thefallbackparameter may no longer be necessary and could be removed to avoid confusion about which fallback order actually applies.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `cardDescription` computed passes its own fallback chain into `pluginShortDesc`, even though `pluginShortDesc` already implements the same fallback logic; you can simplify this by calling `pluginShortDesc(props.plugin)` directly and letting the helper manage all fallbacks.
- Given that `pluginShortDesc` already considers `plugin.short_desc`, `plugin.desc`, and `plugin.description` internally, the `fallback` parameter may no longer be necessary and could be removed to avoid confusion about which fallback order actually applies.
## Individual Comments
### Comment 1
<location path="dashboard/src/components/extension/MarketPluginCard.vue" line_range="36-37" />
<code_context>
normalizePlatformList(props.plugin?.support_platforms),
);
+const cardDescription = computed(() =>
+ pluginShortDesc(props.plugin, props.plugin?.short_desc || props.plugin?.desc || ""),
+);
+
</code_context>
<issue_to_address>
**suggestion:** Avoid duplicating fallback logic already handled by `pluginShortDesc`.
`pluginShortDesc` already applies the `short_desc || desc || ''` fallback, so passing the fallback here duplicates logic and hurts maintainability. You can rely on `pluginShortDesc` directly:
```js
const cardDescription = computed(() => pluginShortDesc(props.plugin));
```
This keeps the fallback behavior centralized while preserving the intended i18n lookup behavior.
Suggested implementation:
```
const cardDescription = computed(() => pluginShortDesc(props.plugin),
```
The provided snippet appears to contain duplicated `useModuleI18n`, `usePluginI18n`, and `defineProps` declarations, as well as some incomplete code (e.g., partial `plugin` prop definition and `normalizePlatformList` usage). You should:
1. Ensure `useModuleI18n`, `usePluginI18n`, `defineProps`, and `normalizePlatformList` are each declared only once.
2. Confirm that the `plugin` prop definition is complete and syntactically valid.
3. Verify that the updated `cardDescription` line has correct parentheses and trailing semicolon in the actual file context.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| const cardDescription = computed(() => | ||
| pluginShortDesc(props.plugin, props.plugin?.short_desc || props.plugin?.desc || ""), |
There was a problem hiding this comment.
suggestion: Avoid duplicating fallback logic already handled by pluginShortDesc.
pluginShortDesc already applies the short_desc || desc || '' fallback, so passing the fallback here duplicates logic and hurts maintainability. You can rely on pluginShortDesc directly:
const cardDescription = computed(() => pluginShortDesc(props.plugin));This keeps the fallback behavior centralized while preserving the intended i18n lookup behavior.
Suggested implementation:
const cardDescription = computed(() => pluginShortDesc(props.plugin),
The provided snippet appears to contain duplicated useModuleI18n, usePluginI18n, and defineProps declarations, as well as some incomplete code (e.g., partial plugin prop definition and normalizePlatformList usage). You should:
- Ensure
useModuleI18n,usePluginI18n,defineProps, andnormalizePlatformListare each declared only once. - Confirm that the
pluginprop definition is complete and syntactically valid. - Verify that the updated
cardDescriptionline has correct parentheses and trailing semicolon in the actual file context.
There was a problem hiding this comment.
Code Review
This pull request introduces a short_desc field to plugin metadata, enabling concise summaries for plugin marketplace cards. The changes include updates to the StarMetadata model, plugin loading and management logic, and the dashboard's plugin card component. Additionally, the field has been integrated into the search index and internationalization utilities, with corresponding documentation updates in both English and Chinese. Feedback was provided to simplify the cardDescription computed property in MarketPluginCard.vue by removing redundant fallback logic that is already handled by the pluginShortDesc utility.
| const cardDescription = computed(() => | ||
| pluginShortDesc(props.plugin, props.plugin?.short_desc || props.plugin?.desc || ""), | ||
| ); |
There was a problem hiding this comment.
The fallback logic passed as the second argument to pluginShortDesc is redundant because pluginShortDesc already implements the same fallback chain (plugin?.short_desc || plugin?.desc || plugin?.description || '') internally when the second argument is falsy. Simplifying this makes the code cleaner and leverages the utility's built-in logic.
const cardDescription = computed(() => pluginShortDesc(props.plugin));
short description will be displayed in the plugin card
Modifications / 改动点
Screenshots or Test Results / 运行截图或测试结果
Checklist / 检查清单
😊 If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc.
/ 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
👀 My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above.
/ 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
🤓 I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in
requirements.txtandpyproject.toml./ 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到
requirements.txt和pyproject.toml文件相应位置。😮 My changes do not introduce malicious code.
/ 我的更改没有引入恶意代码。
Summary by Sourcery
Add support for plugin short descriptions and surface them in the WebUI and documentation.
New Features:
Enhancements:
Documentation:
Tests: