feat: 插件自动发现 — plugins.json + 代码生成器

- plugins.json 配置文件列出所有插件及其import路径
- gen_plugins.go 读取配置生成 plugins_gen.go
- main.go 调用 registerPlugins() 替代硬编码列表
- 新增 backend/plugins/ 第三方插件目录
- 插件开发文档: docs/api/plugin-development.md

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-24 19:30:52 +08:00
parent 2e94e7b0bf
commit cfebf5480e
5 changed files with 132 additions and 19 deletions
+38
View File
@@ -0,0 +1,38 @@
// Code generated by gen_plugins.go; DO NOT EDIT.
package main
import (
plgSDK "git.yeij.top/AskaEth/Cyrene-Plugins/sdk"
calculatorpkg "git.yeij.top/AskaEth/Cyrene-Plugins/calculator"
datetimepkg "git.yeij.top/AskaEth/Cyrene-Plugins/datetime"
textpkg "git.yeij.top/AskaEth/Cyrene-Plugins/text"
cryptopkg "git.yeij.top/AskaEth/Cyrene-Plugins/crypto"
randompkg "git.yeij.top/AskaEth/Cyrene-Plugins/random"
markdownpkg "git.yeij.top/AskaEth/Cyrene-Plugins/markdown"
json_opspkg "git.yeij.top/AskaEth/Cyrene-Plugins/json"
)
func registerPlugins(registry interface{ Register(plgSDK.Tool) error }) {
for _, t := range (&calculatorpkg.CalculatorPlugin{}).Tools() {
registry.Register(t)
}
for _, t := range (&datetimepkg.DatetimePlugin{}).Tools() {
registry.Register(t)
}
for _, t := range (&textpkg.TextPlugin{}).Tools() {
registry.Register(t)
}
for _, t := range (&cryptopkg.CryptoPlugin{}).Tools() {
registry.Register(t)
}
for _, t := range (&randompkg.RandomPlugin{}).Tools() {
registry.Register(t)
}
for _, t := range (&markdownpkg.MarkdownPlugin{}).Tools() {
registry.Register(t)
}
for _, t := range (&json_opspkg.JSONPlugin{}).Tools() {
registry.Register(t)
}
}