mofox-plugin-dev-toolkit 0.4.3__tar.gz → 0.4.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. {mofox_plugin_dev_toolkit-0.4.3/mofox_plugin_dev_toolkit.egg-info → mofox_plugin_dev_toolkit-0.4.8}/PKG-INFO +282 -125
  2. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/README.md +281 -124
  3. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8/mofox_plugin_dev_toolkit.egg-info}/PKG-INFO +282 -125
  4. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/__init__.py +1 -1
  5. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/cli.py +14 -46
  6. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/commands/dev.py +7 -51
  7. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/commands/init.py +39 -19
  8. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/dev/bridge_plugin/cleanup_handler.py +1 -1
  9. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/dev/bridge_plugin/manifest.json +3 -0
  10. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/event_template.py +1 -1
  11. mofox_plugin_dev_toolkit-0.4.8/mpdt/utils/config_manager.py +143 -0
  12. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/pyproject.toml +1 -1
  13. mofox_plugin_dev_toolkit-0.4.3/mpdt/utils/config_manager.py +0 -290
  14. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/LICENSE +0 -0
  15. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/MANIFEST.in +0 -0
  16. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mofox_plugin_dev_toolkit.egg-info/SOURCES.txt +0 -0
  17. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mofox_plugin_dev_toolkit.egg-info/dependency_links.txt +0 -0
  18. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mofox_plugin_dev_toolkit.egg-info/entry_points.txt +0 -0
  19. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mofox_plugin_dev_toolkit.egg-info/requires.txt +0 -0
  20. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mofox_plugin_dev_toolkit.egg-info/top_level.txt +0 -0
  21. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/__main__.py +0 -0
  22. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/commands/__init__.py +0 -0
  23. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/commands/build.py +0 -0
  24. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/commands/check.py +0 -0
  25. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/commands/generate.py +0 -0
  26. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/dev/bridge_plugin/__init__.py +0 -0
  27. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/dev/bridge_plugin/dev_config.py +0 -0
  28. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/dev/bridge_plugin/file_watcher.py +0 -0
  29. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/dev/bridge_plugin/plugin.py +0 -0
  30. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/__init__.py +0 -0
  31. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/action_template.py +0 -0
  32. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/adapter_template.py +0 -0
  33. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/chatter_template.py +0 -0
  34. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/collection_template.py +0 -0
  35. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/config_template.py +0 -0
  36. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/plus_command_template.py +0 -0
  37. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/prompt_template.py +0 -0
  38. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/router_template.py +0 -0
  39. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/service_template.py +0 -0
  40. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/templates/tool_template.py +0 -0
  41. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/utils/__init__.py +0 -0
  42. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/utils/code_parser.py +0 -0
  43. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/utils/color_printer.py +0 -0
  44. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/utils/config_loader.py +0 -0
  45. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/utils/file_ops.py +0 -0
  46. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/utils/license_generator.py +0 -0
  47. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/utils/plugin_parser.py +0 -0
  48. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/utils/template_engine.py +0 -0
  49. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/validators/__init__.py +0 -0
  50. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/validators/auto_fix_validator.py +0 -0
  51. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/validators/base.py +0 -0
  52. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/validators/component_validator.py +0 -0
  53. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/validators/config_validator.py +0 -0
  54. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/validators/metadata_validator.py +0 -0
  55. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/validators/structure_validator.py +0 -0
  56. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/validators/style_validator.py +0 -0
  57. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/mpdt/validators/type_validator.py +0 -0
  58. {mofox_plugin_dev_toolkit-0.4.3 → mofox_plugin_dev_toolkit-0.4.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mofox-plugin-dev-toolkit
3
- Version: 0.4.3
3
+ Version: 0.4.8
4
4
  Summary: 开发工具集,用于快速创建、开发和测试 MoFox-Bot 插件
5
5
  Author-email: MoFox-Studio <wwwww95915@qq.com>
6
6
  License: GPL-3.0-or-later
@@ -54,24 +54,51 @@ Dynamic: license-file
54
54
 
55
55
  [![Python Version](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/)
56
56
  [![License](https://img.shields.io/badge/license-GPL--3.0-green.svg)](LICENSE)
57
- [![Version](https://img.shields.io/badge/version-0.3.3-orange.svg)](https://github.com/MoFox-Studio/mofox-plugin-toolkit)
57
+ [![Version](https://img.shields.io/badge/version-0.4.5-orange.svg)](https://github.com/MoFox-Studio/mofox-plugin-toolkit)
58
+ [![PyPI](https://img.shields.io/badge/PyPI-mofox--plugin--dev--toolkit-blue.svg)](https://pypi.org/project/mofox-plugin-dev-toolkit/)
58
59
 
59
- 一个类似于 Vite 的 Python 开发工具,专门为 MoFox-Bot 插件系统设计,提供快速创建、开发、检查和热重载的完整工具链。
60
+ 一个类似于 Vite 的 Python 开发工具,专门为 Neo-MoFox 插件系统设计,提供快速创建、开发、构建、检查和热重载的完整工具链。
61
+
62
+ ## ⚡ 快速开始
63
+
64
+ ```bash
65
+ # 1. 安装 MPDT
66
+ pip install mofox-plugin-dev-toolkit
67
+
68
+ # 2. 创建插件
69
+ mpdt init my_awesome_plugin
70
+
71
+ # 3. 进入插件目录
72
+ cd my_awesome_plugin
73
+
74
+ # 4. 生成组件
75
+ mpdt generate action HelloWorld
76
+
77
+ # 5. 检查代码
78
+ mpdt check
79
+
80
+ # 6. 构建插件
81
+ mpdt build
82
+
83
+ # 7. 开发模式(需先配置 Neo-MoFox 路径)
84
+ mpdt dev
85
+ ```
60
86
 
61
87
  ## ✨ 特性
62
88
 
63
89
  ### 核心功能
64
90
 
65
91
  - 🚀 **快速初始化** - 一键创建标准化的插件项目结构,支持 6 种模板(basic、action、tool、plus_command、full、adapter)
66
- - 🎨 **代码生成** - 快速生成 8 种组件类型(Action、Tool、Event、Adapter、Prompt、PlusCommand、Router、Chatter),始终生成异步方法
67
- - 🔍 **完整的静态检查系统** - 集成 7 层验证体系:
92
+ - 🎨 **代码生成** - 快速生成 11 种组件类型(Action、Tool、Event、Adapter、Prompt、PlusCommand、Router、Chatter、Service、Config、Collection),始终生成异步方法
93
+ - 🔍 **完整的静态检查系统** - 集成 8 层验证体系:
68
94
  - ✅ **结构检查** - 验证插件目录结构、必需文件和推荐文件
69
- - ✅ **元数据检查** - 检查 `__plugin_meta__` 配置的完整性和正确性
95
+ - ✅ **元数据检查** - 检查 `manifest.json` 配置的完整性和正确性
70
96
  - ✅ **组件检查** - 验证组件注册、命名规范和导入路径
71
- - ✅ **配置检查** - 检查 `config.toml` 的语法和必需配置
97
+ - ✅ **配置检查** - 检查配置文件的语法和必需配置
72
98
  - ✅ **类型检查** - 使用 mypy 进行严格的类型检查
73
99
  - ✅ **代码风格检查** - 使用 ruff 检查代码规范并自动修复
74
- - ✅ **自动修复** - 智能修复可自动处理的问题
100
+ - ✅ **自动修复** - 智能修复可自动处理的问题
101
+ - 📦 **插件构建打包** - 将插件打包为标准 `.mfp` 格式(本质为 ZIP),支持版本号自动升级
75
102
  - 🔥 **热重载开发模式** - 基于 DevBridge 插件的实时热重载系统:
76
103
  - 🔄 文件变化自动检测和重载
77
104
  - 📦 自动注入开发桥接插件
@@ -80,19 +107,47 @@ Dynamic: license-file
80
107
  - 🎯 **Git 集成** - 支持自动初始化 Git 仓库和提取用户信息
81
108
  - 🎨 **美观的交互界面** - 基于 Rich 和 Questionary 的现代化命令行体验
82
109
  - 📜 **多种许可证** - 支持 GPL-v3.0、MIT、Apache-2.0、BSD-3-Clause
83
- - 🛠️ **配置管理** - 完整的配置管理命令,支持交互式配置和验证
110
+ - 🛠️ **完整的配置管理** - 支持交互式配置向导、配置显示、配置验证和路径设置
84
111
 
85
112
  ## 📦 安装
86
113
 
114
+ ### 使用 pip 安装(推荐)
115
+
87
116
  ```bash
88
- # 从源码安装
117
+ # 从 PyPI 安装最新版本
118
+ pip install mofox-plugin-dev-toolkit
119
+
120
+ # 指定版本安装
121
+ pip install mofox-plugin-dev-toolkit==0.4.5
122
+
123
+ # 安装开发依赖
124
+ pip install "mofox-plugin-dev-toolkit[dev]"
125
+ ```
126
+
127
+ ### 从源码安装
128
+
129
+ ```bash
130
+ # 克隆仓库
131
+ git clone https://github.com/MoFox-Studio/mofox-plugin-toolkit.git
89
132
  cd mofox-plugin-toolkit
133
+
134
+ # 安装到本地
90
135
  pip install -e .
91
136
 
92
137
  # 安装开发依赖
93
138
  pip install -e ".[dev]"
94
139
  ```
95
140
 
141
+ ### 验证安装
142
+
143
+ ```bash
144
+ # 查看版本
145
+ mpdt --version
146
+
147
+ # 显示帮助
148
+ mpdt --help
149
+ ```
150
+
96
151
  ## 🚀 快速开始
97
152
 
98
153
  ### 1. 创建新插件
@@ -142,6 +197,8 @@ mpdt generate adapter CustomAdapter --description "自定义适配器"
142
197
  mpdt generate prompt SystemPrompt --description "系统提示词"
143
198
  mpdt generate router MessageRouter --description "消息路由器"
144
199
  mpdt generate chatter ChatHandler --description "对话处理器"
200
+ mpdt generate service DataService --description "数据服务"
201
+ mpdt generate config PluginConfig --description "插件配置类"
145
202
  ```
146
203
 
147
204
  **支持的组件类型**:
@@ -153,17 +210,19 @@ mpdt generate chatter ChatHandler --description "对话处理器"
153
210
  - `plus-command` - PlusCommand 组件(Plus 系统命令)
154
211
  - `router` - Router 组件(路由器)
155
212
  - `chatter` - Chatter 组件(对话处理器)
213
+ - `service` - Service 组件(服务类)
214
+ - `config` - Config 组件(配置类)
156
215
 
157
- **注意**:所有生成的组件方法都是异步的(async),符合 MoFox-Bot 的异步架构。
216
+ **注意**:所有生成的组件方法都是异步的(async),符合 Neo-MoFox 的异步架构。
158
217
 
159
218
  ### 3. 开发模式(热重载)
160
219
 
161
220
  ```bash
162
- # 启动开发模式(需要先配置 MoFox-Bot 主程序路径)
221
+ # 启动开发模式(需要先配置 Neo-MoFox 主程序路径)
163
222
  mpdt dev
164
223
 
165
224
  # 指定主程序路径
166
- mpdt dev --mmc-path /path/to/mofox
225
+ mpdt dev --neo-mofox-path /path/to/neo-mofox
167
226
 
168
227
  # 指定插件路径
169
228
  mpdt dev --plugin-path /path/to/plugin
@@ -187,7 +246,7 @@ mpdt dev --plugin-path /path/to/plugin
187
246
  ### 4. 检查插件
188
247
 
189
248
  ```bash
190
- # 运行所有检查(包含 7 个检查器)
249
+ # 运行所有检查(包含 8 个检查器)
191
250
  mpdt check
192
251
 
193
252
  # 自动修复可修复的问题
@@ -211,7 +270,42 @@ mpdt check --no-metadata # 跳过元数据检查
211
270
  mpdt check --fix --level warning --report markdown -o report.md
212
271
  ```
213
272
 
214
- ### 5. 配置管理
273
+ **检查项说明**:
274
+ - **结构检查** (structure) - 验证目录结构、必需文件(`__init__.py`、`plugin.py`、`manifest.json`)和推荐文件(`README.md`、`pyproject.toml`、`tests/`)
275
+ - **元数据检查** (metadata) - 检查 `manifest.json` 的存在性、格式和必需字段
276
+ - **组件检查** (component) - 验证组件注册、命名规范、导入路径和类型正确性
277
+ - **配置检查** (config) - 检查配置文件的语法、必需配置项和数据类型
278
+ - **类型检查** (type) - 使用 mypy 进行严格的类型检查,确保类型安全
279
+ - **代码风格检查** (style) - 使用 ruff 检查代码规范,支持自动修复格式问题
280
+ - **自动修复** (autofix) - 智能分析并自动修复可处理的问题
281
+
282
+ ### 5. 构建插件
283
+
284
+ ```bash
285
+ # 构建插件为 .mfp 文件(推荐格式)
286
+ mpdt build
287
+
288
+ # 指定输出目录
289
+ mpdt build --output dist
290
+
291
+ # 包含文档
292
+ mpdt build --with-docs
293
+
294
+ # 构建为 .zip 格式
295
+ mpdt build --format zip
296
+
297
+ # 自动升级版本号
298
+ mpdt build --bump patch # 升级补丁版本 (0.0.1 -> 0.0.2)
299
+ mpdt build --bump minor # 升级次版本 (0.1.0 -> 0.2.0)
300
+ mpdt build --bump major # 升级主版本 (1.0.0 -> 2.0.0)
301
+
302
+ # 组合使用
303
+ mpdt build --with-docs --bump patch --output release
304
+ ```
305
+
306
+ **说明**:`.mfp` 文件是 Neo-MoFox 的标准插件格式(本质为 ZIP 压缩包),可直接被 loader.py 加载。
307
+
308
+ ### 6. 配置管理
215
309
 
216
310
  ```bash
217
311
  # 交互式配置向导
@@ -223,22 +317,15 @@ mpdt config show
223
317
  # 测试配置是否有效
224
318
  mpdt config test
225
319
 
226
- # 设置 MoFox 主程序路径
227
- mpdt config set-mofox /path/to/mofox
228
-
229
- # 设置虚拟环境
230
- mpdt config set-venv /path/to/venv --type venv
231
- mpdt config set-venv --type none # 使用系统 Python
320
+ # 设置 Neo-MoFox 主程序路径
321
+ mpdt config set-mofox /path/to/neo-mofox
232
322
  ```
233
323
 
234
- **检查项说明**:
235
- - **结构检查** (structure) - 验证目录结构、必需文件(`__init__.py`、`plugin.py`、`config/config.toml`)和推荐文件(`README.md`、`pyproject.toml`、`tests/`)
236
- - **元数据检查** (metadata) - 检查 `__plugin_meta__` 的存在性、类型和必需字段(name、description、usage)
237
- - **组件检查** (component) - 验证组件注册、命名规范、导入路径和类型正确性
238
- - **配置检查** (config) - 检查 `config.toml` 的语法、必需配置项和数据类型
239
- - **类型检查** (type) - 使用 mypy 进行严格的类型检查,确保类型安全
240
- - **代码风格检查** (style) - 使用 ruff 检查代码规范,支持自动修复格式问题
241
- - **自动修复** (autofix) - 智能分析并自动修复可处理的问题
324
+ **配置项说明**:
325
+ - **Neo-MoFox 路径** - Neo-MoFox 主程序的安装路径
326
+ - **自动重载** - 是否启用自动重载功能(默认启用)
327
+ - **重载延迟** - 文件变化后的重载延迟时间(默认 1 秒)
328
+ - **Python 环境** - 自动检测和配置虚拟环境
242
329
 
243
330
  ## 📖 命令参考
244
331
 
@@ -265,16 +352,14 @@ mpdt init [PLUGIN_NAME] [OPTIONS]
265
352
  -t, --template TEXT 模板类型: basic, action, tool, plus_command, full, adapter
266
353
  -a, --author TEXT 作者名称(可从 Git 配置自动获取)
267
354
  -l, --license TEXT 开源协议: GPL-v3.0, MIT, Apache-2.0, BSD-3-Clause
268
- --with-examples 包含示例代码和用法说明
269
355
  --with-docs 创建文档目录和基础文档文件
270
- --init-git 初始化 Git 仓库(默认)
271
- --no-init-git 不初始化 Git 仓库
356
+ --init-git/--no-init-git 是否初始化 Git 仓库(默认初始化)
272
357
  -o, --output PATH 输出目录(默认为当前目录)
273
358
 
274
359
  示例:
275
360
  mpdt init my_plugin # 交互式创建
276
361
  mpdt init my_plugin -t action -a "张三" # 指定参数创建
277
- mpdt init my_plugin -t full --with-examples # 创建完整模板
362
+ mpdt init my_plugin -t full --with-docs # 创建完整模板
278
363
  ```
279
364
 
280
365
  ### `mpdt generate` - 生成组件
@@ -293,6 +378,8 @@ mpdt generate [COMPONENT_TYPE] [COMPONENT_NAME] [OPTIONS]
293
378
  plus-command PlusCommand 组件 - Plus 系统命令
294
379
  router Router 组件 - 路由器
295
380
  chatter Chatter 组件 - 对话处理器
381
+ service Service 组件 - 服务类
382
+ config Config 组件 - 配置类
296
383
 
297
384
  选项:
298
385
  -d, --description TEXT 组件描述信息
@@ -303,10 +390,72 @@ mpdt generate [COMPONENT_TYPE] [COMPONENT_NAME] [OPTIONS]
303
390
  mpdt generate # 交互式生成
304
391
  mpdt generate action SendMsg -d "发送消息" # 命令行生成
305
392
  mpdt generate tool Formatter --force # 强制覆盖
393
+ mpdt generate service DataService # 生成服务类
306
394
  ```
307
395
 
308
396
  **注意**:不提供参数时将进入交互式问答模式,更易于使用。
309
397
 
398
+ ### `mpdt check` - 检查插件
399
+
400
+ 对插件进行全面的静态检查,包括 8 个检查器。
401
+
402
+ ```bash
403
+ mpdt check [PATH] [OPTIONS]
404
+
405
+ 选项:
406
+ -l, --level TEXT 显示问题级别: error, warning, info(默认 warning)
407
+ --fix 自动修复可修复的问题(主要是代码风格)
408
+ --report TEXT 报告格式: console(默认), markdown, json
409
+ -o, --output PATH 报告输出路径(仅用于 markdown 和 json 格式)
410
+ --no-structure 跳过结构检查
411
+ --no-metadata 跳过元数据检查
412
+ --no-component 跳过组件检查
413
+ --no-type 跳过类型检查
414
+ --no-style 跳过代码风格检查
415
+
416
+ 检查器说明:
417
+ structure - 检查目录结构、必需文件和推荐文件
418
+ metadata - 检查 manifest.json 的完整性
419
+ component - 检查组件注册和命名规范
420
+ config - 检查配置文件
421
+ type - 使用 mypy 进行类型检查
422
+ style - 使用 ruff 进行代码风格检查
423
+ autofix - 自动修复可处理的问题
424
+
425
+ 示例:
426
+ mpdt check # 运行所有检查
427
+ mpdt check --fix # 自动修复问题
428
+ mpdt check --level error # 只显示错误
429
+ mpdt check --report markdown -o report.md # 生成 Markdown 报告
430
+ mpdt check --report json -o report.json # 生成 JSON 报告
431
+ mpdt check --no-type --no-style # 跳过耗时检查
432
+ ```
433
+
434
+ ### `mpdt build` - 构建插件
435
+
436
+ 将插件打包为标准 `.mfp` 格式(本质为 ZIP 压缩包)。
437
+
438
+ ```bash
439
+ mpdt build [PLUGIN_PATH] [OPTIONS]
440
+
441
+ 选项:
442
+ -o, --output PATH 输出目录(默认为 dist)
443
+ --with-docs 包含文档文件
444
+ --format TEXT 构建格式: mfp(推荐), zip
445
+ --bump TEXT 自动升级版本号: major, minor, patch
446
+
447
+ 参数:
448
+ PLUGIN_PATH 插件根目录(包含 manifest.json),默认当前目录
449
+
450
+ 示例:
451
+ mpdt build # 构建到 dist 目录
452
+ mpdt build --with-docs # 包含文档
453
+ mpdt build --bump patch # 自动升级补丁版本
454
+ mpdt build --format zip -o release # 使用 zip 格式
455
+ ```
456
+
457
+ **说明**:生成的 `.mfp` 文件可直接被 Neo-MoFox 的 loader.py 加载。
458
+
310
459
  ### `mpdt dev` - 开发模式
311
460
 
312
461
  启动带热重载的开发模式,实时监控文件变化并自动重载插件。
@@ -315,8 +464,8 @@ mpdt generate [COMPONENT_TYPE] [COMPONENT_NAME] [OPTIONS]
315
464
  mpdt dev [OPTIONS]
316
465
 
317
466
  选项:
318
- --mmc-path PATH MoFox 主程序路径
319
- --plugin-path PATH 插件路径(默认当前目录)
467
+ --neo-mofox-path PATH Neo-MoFox 主程序路径
468
+ --plugin-path PATH 插件路径(默认当前目录)
320
469
 
321
470
  功能特性:
322
471
  - 🔄 自动检测文件变化并热重载
@@ -327,7 +476,7 @@ mpdt dev [OPTIONS]
327
476
  - 🧹 主程序退出时自动清理
328
477
 
329
478
  首次运行:
330
- 首次运行会提示配置 MoFox 主程序路径
479
+ 首次运行会提示配置 Neo-MoFox 主程序路径
331
480
  配置将保存到 ~/.mpdt/config.toml
332
481
 
333
482
  工作流程:
@@ -338,91 +487,54 @@ mpdt dev [OPTIONS]
338
487
  5. 检测到变化时自动卸载旧版本并加载新版本
339
488
 
340
489
  示例:
341
- mpdt dev # 在插件目录中运行
342
- mpdt dev --mmc-path /path/to/mofox # 指定主程序路径
490
+ mpdt dev # 在插件目录中运行
491
+ mpdt dev --neo-mofox-path /path/to/neo-mofox # 指定主程序路径
343
492
  ```
344
493
 
345
- ### `mpdt check` - 检查插件
494
+ ### `mpdt config` - 配置管理
346
495
 
347
- 对插件进行全面的静态检查,包括 6 个检查器。
496
+ 管理 MPDT 的配置信息。
348
497
 
349
498
  ```bash
350
- mpdt check [PATH] [OPTIONS]
351
-
352
- 选项:
353
- -l, --level TEXT 显示问题级别: error, warning, info(默认显示所有)
354
- --fix 自动修复可修复的问题(主要是代码风格)
355
- --report TEXT 报告格式: console(默认), markdown
356
- -o, --output PATH 报告输出路径(仅用于 markdown 格式)
357
- --no-structure 跳过结构检查
358
- --no-metadata 跳过元数据检查
359
- --no-component 跳过组件检查
360
- --no-config 跳过配置检查
361
- --no-type 跳过类型检查
362
- --no-style 跳过代码风格检查
363
-
364
- 检查器说明:
365
- structure - 检查目录结构、必需文件和推荐文件
366
- metadata - 检查 __plugin_meta__ 的完整性
367
- component - 检查组件注册和命名规范
368
- config - 检查 config.toml 配置文件
369
- type - 使用 mypy 进行类型检查
370
- style - 使用 ruff 进行代码风格检查
371
- autofix - 自动修复可处理的问题
499
+ # 子命令
500
+ mpdt config init # 交互式配置向导
501
+ mpdt config show # 显示当前配置
502
+ mpdt config test # 测试配置是否有效
503
+ mpdt config set-mofox # 设置 Neo-MoFox 主程序路径
372
504
 
373
505
  示例:
374
- mpdt check # 运行所有检查
375
- mpdt check --fix # 自动修复问题
376
- mpdt check --level error # 只显示错误
377
- mpdt check --report markdown -o report.md # 生成 Markdown 报告
378
- mpdt check --report json -o report.json # 生成 JSON 报告
379
- mpdt check --no-type --no-style # 跳过耗时检查
380
- ```
506
+ # 交互式配置
507
+ mpdt config init
381
508
 
382
- ### `mpdt config` - 配置管理
509
+ # 设置 Neo-MoFox 路径
510
+ mpdt config set-mofox /path/to/neo-mofox
383
511
 
384
- 管理 MPDT 的配置信息。
512
+ # 显示配置
513
+ mpdt config show
385
514
 
386
- ```bash
387
- # 子命令
388
- mpdt config init # 交互式配置向导
389
- mpdt config show # 显示当前配置
390
- mpdt config test # 测试配置是否有效
391
- mpdt config set-mofox # 设置 MoFox 主程序路径
392
- mpdt config set-venv # 设置虚拟环境
393
-
394
- # 设置 MoFox 路径
395
- mpdt config set-mofox /path/to/mofox
396
-
397
- # 设置虚拟环境
398
- mpdt config set-venv /path/to/venv --type venv
399
- mpdt config set-venv /path/to/venv --type uv
400
- mpdt config set-venv /path/to/venv --type conda
401
- mpdt config set-venv /path/to/venv --type poetry
402
- mpdt config set-venv --type none # 使用系统 Python
515
+ # 验证配置
516
+ mpdt config test
403
517
  ```
404
518
 
405
- 配置项说明:
406
- - **MoFox 路径** - MoFox-Bot 主程序的安装路径
407
- - **虚拟环境类型** - venv、uv、conda、poetry 或 none
408
- - **虚拟环境路径** - 虚拟环境目录路径
519
+ **配置项说明**:
520
+ - **Neo-MoFox 路径** - Neo-MoFox 主程序的安装路径
409
521
  - **自动重载** - 是否启用自动重载功能
410
- - **重载延迟** - 文件变化后的重载延迟时间
522
+ - **重载延迟** - 文件变化后的重载延迟时间(秒)
523
+ - **Python 环境** - 自动检测虚拟环境和 Python 版本
411
524
 
412
525
  ---
413
526
 
414
527
  ## 🏗️ 插件结构
415
528
 
416
- MPDT 创建的插件遵循 MoFox-Bot 标准结构:
529
+ MPDT 创建的插件遵循 Neo-MoFox 标准结构:
417
530
 
418
531
  ```
419
532
  my_plugin/ # 插件根目录
420
- ├── __init__.py # ⭐ 插件元数据(必需)
421
- │ # 必须包含 __plugin_meta__ 变量
533
+ ├── __init__.py # 包初始化文件
422
534
  ├── plugin.py # ⭐ 插件主类(必需)
423
535
  │ # 继承自 BasePlugin
424
- ├── config/ # ⭐ 配置目录(必需)
425
- └── config.toml # ⭐ 配置文件(必需)
536
+ ├── manifest.json # ⭐ 插件元数据文件(必需)
537
+ # 包含插件名称、版本、作者等信息
426
538
  ├── components/ # 组件目录(可选但推荐)
427
539
  │ ├── actions/ # Action 组件目录
428
540
  │ │ └── send_message.py
@@ -433,7 +545,9 @@ my_plugin/ # 插件根目录
433
545
  │ ├── prompts/ # Prompt 目录
434
546
  │ ├── plus_commands/ # PlusCommand 目录
435
547
  │ ├── routers/ # Router 目录
436
- └── chatters/ # Chatter 目录
548
+ ├── chatters/ # Chatter 目录
549
+ │ ├── services/ # Service 目录
550
+ │ └── configs/ # Config 目录
437
551
  ├── utils/ # 工具函数目录(可选)
438
552
  │ └── helpers.py
439
553
  ├── tests/ # 📋 测试目录(推荐)
@@ -451,7 +565,7 @@ my_plugin/ # 插件根目录
451
565
 
452
566
  ## 🎯 开发状态
453
567
 
454
- ### ✅ 已完成功能(v0.3.3
568
+ ### ✅ 已完成功能(v0.4.5
455
569
 
456
570
  #### 1. ✅ 插件初始化 (`mpdt init`)
457
571
  - 支持 6 种模板类型(basic、action、tool、plus_command、full、adapter)
@@ -459,9 +573,10 @@ my_plugin/ # 插件根目录
459
573
  - Git 自动初始化和用户信息提取
460
574
  - 多种开源协议支持(GPL-v3.0、MIT、Apache-2.0、BSD-3-Clause)
461
575
  - 自动生成标准化项目结构
576
+ - 自动生成 manifest.json 元数据文件
462
577
 
463
578
  #### 2. ✅ 组件生成 (`mpdt generate`)
464
- - 支持 8 种组件类型(action、tool、event、adapter、prompt、plus-command、router、chatter)
579
+ - 支持 11 种组件类型(action、tool、event、adapter、prompt、plus-command、router、chatter、service、config、collection
465
580
  - 所有方法自动生成为异步
466
581
  - 基于 libcst 的智能代码解析和注入
467
582
  - 自动更新插件主类注册代码
@@ -470,16 +585,24 @@ my_plugin/ # 插件根目录
470
585
 
471
586
  #### 3. ✅ 静态检查系统 (`mpdt check`)
472
587
  - **结构验证器** - 目录和文件完整性检查
473
- - **元数据验证器** - `__plugin_meta__` 验证
588
+ - **元数据验证器** - `manifest.json` 验证
474
589
  - **组件验证器** - 组件注册和规范检查
475
- - **配置验证器** - `config.toml` 验证
590
+ - **配置验证器** - 配置文件验证
476
591
  - **类型检查器** - mypy 集成,严格类型检查
477
592
  - **代码风格检查器** - ruff 集成,自动修复
478
593
  - **自动修复验证器** - 智能问题修复
479
594
  - 支持生成 Markdown 和 JSON 格式报告
480
595
  - 灵活的级别过滤(error/warning/info)
481
596
 
482
- #### 4. ✅ 热重载开发模式 (`mpdt dev`)
597
+ #### 4. ✅ 插件构建打包 (`mpdt build`)
598
+ - 将插件打包为标准 `.mfp` 格式(本质为 ZIP)
599
+ - 支持版本号自动升级(major/minor/patch)
600
+ - 智能文件过滤(排除缓存、版本控制等)
601
+ - 支持 `.mfp` 或 `.zip` 格式输出
602
+ - 可选包含文档文件
603
+ - 自动验证 manifest.json
604
+
605
+ #### 5. ✅ 热重载开发模式 (`mpdt dev`)
483
606
  - 基于 DevBridge 插件的热重载机制
484
607
  - 自动注入目标插件和开发桥接插件
485
608
  - 文件变化自动检测(使用 watchdog)
@@ -487,28 +610,28 @@ my_plugin/ # 插件根目录
487
610
  - 实时状态显示和日志查看
488
611
  - 主程序退出时自动清理
489
612
 
490
- #### 5. ✅ 配置管理 (`mpdt config`)
613
+ #### 6. ✅ 配置管理 (`mpdt config`)
491
614
  - 交互式配置向导 (`mpdt config init`)
492
615
  - 配置显示 (`mpdt config show`)
493
616
  - 配置验证 (`mpdt config test`)
494
- - MoFox 路径设置 (`mpdt config set-mofox`)
495
- - 虚拟环境设置 (`mpdt config set-venv`)
496
- - 支持多种虚拟环境类型(venv、uv、conda、poetry)
617
+ - Neo-MoFox 路径设置 (`mpdt config set-mofox`)
618
+ - 自动检测和配置虚拟环境
619
+ - 支持自定义重载延迟和自动重载开关
620
+
621
+ ### 📦 PyPI 发布
622
+ - ✅ 已发布到 PyPI(包名:mofox-plugin-dev-toolkit)
623
+ - ✅ 支持 pip 直接安装
624
+ - ✅ 完整的依赖管理
625
+ - ✅ 支持可选依赖(dev、check、docs)
497
626
 
498
627
  ### 🚧 计划中功能
499
628
 
500
- #### 测试框架 (`mpdt test`)
629
+ #### 测试框架增强
501
630
  - 自动运行插件测试
502
631
  - 覆盖率报告生成
503
632
  - 并行测试执行
504
633
  - 测试报告输出
505
634
 
506
- #### 构建打包 (`mpdt build`)
507
- - 插件打包为发布格式(zip、tar.gz、wheel)
508
- - 版本号自动管理(major、minor、patch)
509
- - 依赖项打包
510
- - 文档包含选项
511
-
512
635
  #### 插件市场集成
513
636
  - 插件上传和发布
514
637
  - 版本管理
@@ -544,6 +667,15 @@ ruff check .
544
667
  mypy mpdt
545
668
  ```
546
669
 
670
+ ### 提交规范
671
+ - feat: 新功能
672
+ - fix: 修复 bug
673
+ - docs: 文档更新
674
+ - style: 代码格式调整
675
+ - refactor: 代码重构
676
+ - test: 测试相关
677
+ - chore: 构建/工具链相关
678
+
547
679
  ---
548
680
 
549
681
  ## 📄 许可证
@@ -554,7 +686,8 @@ mypy mpdt
554
686
 
555
687
  ## 🔗 相关链接
556
688
 
557
- - [MoFox-Bot 主仓库](https://github.com/MoFox-Studio/MoFox-Core)
689
+ - [Neo-MoFox 主仓库](https://github.com/MoFox-Studio/Neo-MoFox)
690
+ - [PyPI 项目页](https://pypi.org/project/mofox-plugin-dev-toolkit/)
558
691
  - [插件开发文档](https://docs.mofox.studio/plugin-development)
559
692
  - [问题反馈](https://github.com/MoFox-Studio/mofox-plugin-toolkit/issues)
560
693
  - [更新日志](CHANGELOG.md)
@@ -593,6 +726,7 @@ mofox-plugin-toolkit/
593
726
  │ │ ├── init.py # 插件初始化
594
727
  │ │ ├── generate.py # 组件生成
595
728
  │ │ ├── check.py # 静态检查
729
+ │ │ ├── build.py # 插件构建
596
730
  │ │ └── dev.py # 开发模式
597
731
  │ ├── validators/ # 验证器
598
732
  │ │ ├── base.py # 基础验证器
@@ -611,7 +745,10 @@ mofox-plugin-toolkit/
611
745
  │ │ ├── prompt_template.py
612
746
  │ │ ├── plus_command_template.py
613
747
  │ │ ├── router_template.py
614
- │ │ └── chatter_template.py
748
+ │ │ ├── chatter_template.py
749
+ │ │ ├── service_template.py
750
+ │ │ ├── config_template.py
751
+ │ │ └── collection_template.py
615
752
  │ ├── utils/ # 工具函数
616
753
  │ │ ├── code_parser.py # 代码解析
617
754
  │ │ ├── color_printer.py # 彩色输出
@@ -626,6 +763,7 @@ mofox-plugin-toolkit/
626
763
  ├── examples/ # 示例
627
764
  ├── plugin_dev_toolkit_design/ # 设计文档
628
765
  ├── pyproject.toml # 项目配置
766
+ ├── MANIFEST.in # 打包清单
629
767
  ├── README.md # 说明文档
630
768
  └── LICENSE # 许可证
631
769
  ```
@@ -659,8 +797,11 @@ dependencies = [
659
797
 
660
798
  ## 💡 常见问题
661
799
 
800
+ ### Q: 如何安装 MPDT?
801
+ A: 推荐使用 pip 安装:`pip install mofox-plugin-dev-toolkit`。也可以从源码安装:`git clone` 后执行 `pip install -e .`。
802
+
662
803
  ### Q: 如何配置开发模式?
663
- A: 首次运行 `mpdt dev` 时会提示输入 MoFox 主程序路径,配置会保存到 `~/.mpdt/config.toml`。也可以使用 `mpdt config init` 进行交互式配置。
804
+ A: 首次运行 `mpdt dev` 时会提示输入 Neo-MoFox 主程序路径,配置会保存到 `~/.mpdt/config.toml`。也可以使用 `mpdt config init` 进行交互式配置。
664
805
 
665
806
  ### Q: 检查器报错怎么办?
666
807
  A: 首先尝试使用 `mpdt check --fix` 自动修复。如果仍有问题,查看具体错误信息和建议。
@@ -672,22 +813,38 @@ A: 使用 `--no-<checker>` 选项,例如 `mpdt check --no-type --no-style`。
672
813
  A: 组件会自动放置到对应的目录,例如 Action 放在 `components/actions/`。
673
814
 
674
815
  ### Q: 如何更新工具?
675
- A: 如果是从源码安装,执行 `git pull && pip install -e .`。
816
+ A: 如果是 pip 安装,执行 `pip install --upgrade mofox-plugin-dev-toolkit`。如果是从源码安装,执行 `git pull && pip install -e .`。
676
817
 
677
- ### Q: 支持哪些虚拟环境类型?
678
- A: 支持 venv、uv、conda、poetry,也可以设置为 none 使用系统 Python。
818
+ ### Q: .mfp 文件是什么?
819
+ A: `.mfp` Neo-MoFox 的标准插件格式,本质为 ZIP 压缩包,可直接被 loader.py 加载,无需解压。
679
820
 
680
821
  ### Q: 开发模式如何工作?
681
822
  A: MPDT 会将 DevBridge 插件注入到主程序,该插件负责监控文件变化并自动热重载目标插件。主程序退出时会自动清理 DevBridge。
682
823
 
824
+ ### Q: 支持哪些组件类型?
825
+ A: 支持 11 种组件:action、tool、event、adapter、prompt、plus-command、router、chatter、service、config、collection。
826
+
827
+ ### Q: manifest.json 和 __plugin_meta__ 的区别?
828
+ A: Neo-MoFox 使用 `manifest.json` 作为插件元数据文件,而不是旧版的 `__plugin_meta__` 变量。MPDT 生成的插件使用 manifest.json。
829
+
683
830
  ---
684
831
 
685
832
  ## 📝 更新日志
686
833
 
687
- ### v0.3.3 (2026-01-02)
688
- - ✅ 更新项目文档
834
+ ### v0.4.5 (2026-02-23)
835
+ - ✅ 发布到 PyPI,支持 pip 安装
836
+ - ✅ 添加 `mpdt build` 命令,支持打包为 .mfp 格式
837
+ - ✅ 支持版本号自动升级(--bump major/minor/patch)
689
838
  - ✅ 完善配置管理功能
690
- - ✅ 优化代码结构
839
+ - ✅ 更新插件结构为 manifest.json 标准
840
+ - ✅ 新增 service 和 config 组件类型
841
+ - ✅ 优化代码结构和文档
842
+
843
+ ### v0.4.x
844
+ - ✅ 实现插件构建和打包功能
845
+ - ✅ 添加 .mfp 格式支持
846
+ - ✅ 完善 CLI 参数和帮助信息
847
+ - ✅ 优化检查器性能
691
848
 
692
849
  ### v0.3.x
693
850
  - ✅ 添加 libcst 代码解析支持
@@ -703,7 +860,7 @@ A: MPDT 会将 DevBridge 插件注入到主程序,该插件负责监控文件
703
860
  - ✅ 优化用户交互体验
704
861
 
705
862
  ### v0.2.0
706
- - ✅ 完成 6 个检查器实现
863
+ - ✅ 完成 8 个检查器实现
707
864
  - ✅ 添加自动修复功能
708
865
  - ✅ 支持 Markdown 报告生成
709
866
  - ✅ 改进错误提示和建议