mofox-plugin-dev-toolkit 0.3.1__tar.gz → 0.3.5__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 (54) hide show
  1. {mofox_plugin_dev_toolkit-0.3.1/mofox_plugin_dev_toolkit.egg-info → mofox_plugin_dev_toolkit-0.3.5}/PKG-INFO +200 -40
  2. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/README.md +198 -38
  3. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5/mofox_plugin_dev_toolkit.egg-info}/PKG-INFO +200 -40
  4. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mofox_plugin_dev_toolkit.egg-info/SOURCES.txt +1 -0
  5. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/__init__.py +1 -1
  6. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/cli.py +7 -8
  7. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/commands/dev.py +38 -171
  8. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/commands/generate.py +70 -52
  9. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/commands/init.py +198 -13
  10. mofox_plugin_dev_toolkit-0.3.5/mpdt/dev/bridge_plugin/cleanup_handler.py +65 -0
  11. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/dev/bridge_plugin/file_watcher.py +12 -5
  12. mofox_plugin_dev_toolkit-0.3.5/mpdt/dev/bridge_plugin/plugin.py +219 -0
  13. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/templates/__init__.py +2 -3
  14. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/utils/config_loader.py +11 -11
  15. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/utils/config_manager.py +9 -16
  16. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/utils/file_ops.py +25 -22
  17. mofox_plugin_dev_toolkit-0.3.5/mpdt/utils/plugin_parser.py +137 -0
  18. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/validators/auto_fix_validator.py +34 -18
  19. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/pyproject.toml +2 -2
  20. mofox_plugin_dev_toolkit-0.3.1/mpdt/dev/bridge_plugin/plugin.py +0 -119
  21. mofox_plugin_dev_toolkit-0.3.1/mpdt/utils/plugin_parser.py +0 -195
  22. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/LICENSE +0 -0
  23. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/MANIFEST.in +0 -0
  24. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mofox_plugin_dev_toolkit.egg-info/dependency_links.txt +0 -0
  25. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mofox_plugin_dev_toolkit.egg-info/entry_points.txt +0 -0
  26. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mofox_plugin_dev_toolkit.egg-info/requires.txt +0 -0
  27. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mofox_plugin_dev_toolkit.egg-info/top_level.txt +0 -0
  28. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/__main__.py +0 -0
  29. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/commands/__init__.py +0 -0
  30. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/commands/check.py +0 -0
  31. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/dev/bridge_plugin/__init__.py +0 -0
  32. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/dev/bridge_plugin/dev_config.py +0 -0
  33. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/templates/action_template.py +0 -0
  34. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/templates/adapter_template.py +0 -0
  35. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/templates/chatter_template.py +0 -0
  36. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/templates/event_template.py +0 -0
  37. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/templates/plus_command_template.py +0 -0
  38. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/templates/prompt_template.py +0 -0
  39. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/templates/router_template.py +0 -0
  40. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/templates/tool_template.py +0 -0
  41. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/utils/__init__.py +0 -0
  42. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/utils/code_parser.py +0 -0
  43. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/utils/color_printer.py +0 -0
  44. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/utils/license_generator.py +0 -0
  45. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/utils/template_engine.py +0 -0
  46. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/validators/__init__.py +0 -0
  47. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/validators/base.py +0 -0
  48. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/validators/component_validator.py +0 -0
  49. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/validators/config_validator.py +0 -0
  50. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/validators/metadata_validator.py +0 -0
  51. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/validators/structure_validator.py +0 -0
  52. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/validators/style_validator.py +0 -0
  53. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/mpdt/validators/type_validator.py +0 -0
  54. {mofox_plugin_dev_toolkit-0.3.1 → mofox_plugin_dev_toolkit-0.3.5}/setup.cfg +0 -0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mofox-plugin-dev-toolkit
3
- Version: 0.3.1
3
+ Version: 0.3.5
4
4
  Summary: 开发工具集,用于快速创建、开发和测试 MoFox-Bot 插件
5
- Author-email: MoFox-Studio <mofox.studio@example.com>
5
+ Author-email: MoFox-Studio <wwwww95915@qq.com>
6
6
  License: GPL-3.0-or-later
7
7
  Project-URL: Homepage, https://github.com/MoFox-Studio/mofox-plugin-toolkit
8
8
  Project-URL: Documentation, https://docs.mofox.studio/mpdt
@@ -54,7 +54,7 @@ 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.1-orange.svg)](https://github.com/MoFox-Studio/mofox-plugin-toolkit)
57
+ [![Version](https://img.shields.io/badge/version-0.3.3-orange.svg)](https://github.com/MoFox-Studio/mofox-plugin-toolkit)
58
58
 
59
59
  一个类似于 Vite 的 Python 开发工具,专门为 MoFox-Bot 插件系统设计,提供快速创建、开发、检查和热重载的完整工具链。
60
60
 
@@ -64,21 +64,23 @@ Dynamic: license-file
64
64
 
65
65
  - 🚀 **快速初始化** - 一键创建标准化的插件项目结构,支持 6 种模板(basic、action、tool、plus_command、full、adapter)
66
66
  - 🎨 **代码生成** - 快速生成 8 种组件类型(Action、Tool、Event、Adapter、Prompt、PlusCommand、Router、Chatter),始终生成异步方法
67
- - 🔍 **完整的静态检查系统** - 集成 6 层验证体系:
67
+ - 🔍 **完整的静态检查系统** - 集成 7 层验证体系:
68
68
  - ✅ **结构检查** - 验证插件目录结构、必需文件和推荐文件
69
69
  - ✅ **元数据检查** - 检查 `__plugin_meta__` 配置的完整性和正确性
70
70
  - ✅ **组件检查** - 验证组件注册、命名规范和导入路径
71
71
  - ✅ **配置检查** - 检查 `config.toml` 的语法和必需配置
72
72
  - ✅ **类型检查** - 使用 mypy 进行严格的类型检查
73
73
  - ✅ **代码风格检查** - 使用 ruff 检查代码规范并自动修复
74
- - 🔥 **热重载开发模式** - 基于 WebSocket 的实时热重载系统:
74
+ - **自动修复** - 智能修复可自动处理的问题
75
+ - 🔥 **热重载开发模式** - 基于 DevBridge 插件的实时热重载系统:
75
76
  - 🔄 文件变化自动检测和重载
76
- - 📡 通过 WebSocket 与主程序通信
77
+ - 📦 自动注入开发桥接插件
77
78
  - 🚦 自动管理插件生命周期
78
79
  - 📊 实时显示重载状态和日志
79
80
  - 🎯 **Git 集成** - 支持自动初始化 Git 仓库和提取用户信息
80
81
  - 🎨 **美观的交互界面** - 基于 Rich 和 Questionary 的现代化命令行体验
81
82
  - 📜 **多种许可证** - 支持 GPL-v3.0、MIT、Apache-2.0、BSD-3-Clause
83
+ - 🛠️ **配置管理** - 完整的配置管理命令,支持交互式配置和验证
82
84
 
83
85
  ## 📦 安装
84
86
 
@@ -160,13 +162,18 @@ mpdt generate chatter ChatHandler --description "对话处理器"
160
162
  # 启动开发模式(需要先配置 MoFox-Bot 主程序路径)
161
163
  mpdt dev
162
164
 
165
+ # 指定主程序路径
166
+ mpdt dev --mmc-path /path/to/mofox
167
+
168
+ # 指定插件路径
169
+ mpdt dev --plugin-path /path/to/plugin
170
+
163
171
  # 首次运行会提示配置
164
172
  # 之后会自动:
165
- # 1. 注入开发桥接插件到主程序
166
- # 2. 启动主程序
167
- # 3. 建立 WebSocket 连接
168
- # 4. 监控文件变化
169
- # 5. 自动热重载插件
173
+ # 1. 注入目标插件到主程序 plugins 目录
174
+ # 2. 注入 DevBridge 插件(包含文件监控和热重载逻辑)
175
+ # 3. 启动主程序
176
+ # 4. DevBridge 插件自动监控文件变化并热重载
170
177
 
171
178
  # 开发模式功能:
172
179
  # - 🔄 文件保存后自动重载插件
@@ -174,12 +181,13 @@ mpdt dev
174
181
  # - 🚦 自动管理插件生命周期
175
182
  # - 📝 实时查看主程序日志
176
183
  # - ⚡ 无需手动重启主程序
184
+ # - 🧹 主程序退出时自动清理 DevBridge 插件
177
185
  ```
178
186
 
179
187
  ### 4. 检查插件
180
188
 
181
189
  ```bash
182
- # 运行所有检查(包含 6 个检查器)
190
+ # 运行所有检查(包含 7 个检查器)
183
191
  mpdt check
184
192
 
185
193
  # 自动修复可修复的问题
@@ -188,18 +196,41 @@ mpdt check --fix
188
196
  # 只显示错误级别的问题
189
197
  mpdt check --level error
190
198
 
191
- # 生成 Markdown 格式的检查报告
199
+ # 生成 Markdown 或 JSON 格式的检查报告
192
200
  mpdt check --report markdown --output check_report.md
201
+ mpdt check --report json --output check_report.json
193
202
 
194
203
  # 跳过特定检查
195
204
  mpdt check --no-type # 跳过类型检查
196
205
  mpdt check --no-style # 跳过代码风格检查
197
206
  mpdt check --no-component # 跳过组件检查
207
+ mpdt check --no-structure # 跳过结构检查
208
+ mpdt check --no-metadata # 跳过元数据检查
198
209
 
199
210
  # 组合使用
200
211
  mpdt check --fix --level warning --report markdown -o report.md
201
212
  ```
202
213
 
214
+ ### 5. 配置管理
215
+
216
+ ```bash
217
+ # 交互式配置向导
218
+ mpdt config init
219
+
220
+ # 显示当前配置
221
+ mpdt config show
222
+
223
+ # 测试配置是否有效
224
+ mpdt config test
225
+
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
232
+ ```
233
+
203
234
  **检查项说明**:
204
235
  - **结构检查** (structure) - 验证目录结构、必需文件(`__init__.py`、`plugin.py`、`config/config.toml`)和推荐文件(`README.md`、`pyproject.toml`、`tests/`)
205
236
  - **元数据检查** (metadata) - 检查 `__plugin_meta__` 的存在性、类型和必需字段(name、description、usage)
@@ -207,9 +238,22 @@ mpdt check --fix --level warning --report markdown -o report.md
207
238
  - **配置检查** (config) - 检查 `config.toml` 的语法、必需配置项和数据类型
208
239
  - **类型检查** (type) - 使用 mypy 进行严格的类型检查,确保类型安全
209
240
  - **代码风格检查** (style) - 使用 ruff 检查代码规范,支持自动修复格式问题
241
+ - **自动修复** (autofix) - 智能分析并自动修复可处理的问题
210
242
 
211
243
  ## 📖 命令参考
212
244
 
245
+ ### `mpdt` - 主命令
246
+
247
+ ```bash
248
+ mpdt [OPTIONS] COMMAND [ARGS]...
249
+
250
+ 选项:
251
+ -v, --verbose 详细输出模式
252
+ --no-color 禁用彩色输出
253
+ --version 显示版本信息
254
+ --help 显示帮助信息
255
+ ```
256
+
213
257
  ### `mpdt init` - 初始化插件
214
258
 
215
259
  创建新的插件项目,支持多种模板和自动化配置。
@@ -269,28 +313,34 @@ mpdt generate [COMPONENT_TYPE] [COMPONENT_NAME] [OPTIONS]
269
313
 
270
314
  ```bash
271
315
  mpdt dev [OPTIONS]
272
- ```
316
+
317
+ 选项:
318
+ --mmc-path PATH MoFox 主程序路径
319
+ --plugin-path PATH 插件路径(默认当前目录)
273
320
 
274
321
  功能特性:
275
322
  - 🔄 自动检测文件变化并热重载
276
- - 📡 基于 WebSocket 与主程序通信
323
+ - 📦 自动注入 DevBridge 开发桥接插件
277
324
  - 🚦 自动管理插件生命周期
278
325
  - 📊 实时显示重载状态和耗时
279
326
  - 📝 显示主程序运行日志
327
+ - 🧹 主程序退出时自动清理
280
328
 
281
329
  首次运行:
282
330
  首次运行会提示配置 MoFox 主程序路径
283
- 配置将保存到 ~/.mpdt/config.toml 或者
331
+ 配置将保存到 ~/.mpdt/config.toml
284
332
 
285
333
  工作流程:
286
- 1. 自动注入开发桥接插件到主程序
287
- 2. 启动主程序并建立连接
288
- 3. 监控插件目录的文件变化
289
- 4. 检测到变化时通过 WebSocket 通知主程序重载
290
- 5. 主程序自动卸载旧版本并加载新版本
334
+ 1. 自动将目标插件复制到主程序 plugins 目录
335
+ 2. 注入 DevBridge 插件(包含文件监控逻辑)
336
+ 3. 启动主程序
337
+ 4. DevBridge 插件监控文件变化
338
+ 5. 检测到变化时自动卸载旧版本并加载新版本
291
339
 
292
340
  示例:
293
- mpdt dev # 在插件目录中运行
341
+ mpdt dev # 在插件目录中运行
342
+ mpdt dev --mmc-path /path/to/mofox # 指定主程序路径
343
+ ```
294
344
 
295
345
  ### `mpdt check` - 检查插件
296
346
 
@@ -318,15 +368,47 @@ mpdt check [PATH] [OPTIONS]
318
368
  config - 检查 config.toml 配置文件
319
369
  type - 使用 mypy 进行类型检查
320
370
  style - 使用 ruff 进行代码风格检查
371
+ autofix - 自动修复可处理的问题
321
372
 
322
373
  示例:
323
374
  mpdt check # 运行所有检查
324
375
  mpdt check --fix # 自动修复问题
325
376
  mpdt check --level error # 只显示错误
326
- mpdt check --report markdown -o report.md # 生成报告
377
+ mpdt check --report markdown -o report.md # 生成 Markdown 报告
378
+ mpdt check --report json -o report.json # 生成 JSON 报告
327
379
  mpdt check --no-type --no-style # 跳过耗时检查
328
380
  ```
329
381
 
382
+ ### `mpdt config` - 配置管理
383
+
384
+ 管理 MPDT 的配置信息。
385
+
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
403
+ ```
404
+
405
+ 配置项说明:
406
+ - **MoFox 路径** - MoFox-Bot 主程序的安装路径
407
+ - **虚拟环境类型** - venv、uv、conda、poetry 或 none
408
+ - **虚拟环境路径** - 虚拟环境目录路径
409
+ - **自动重载** - 是否启用自动重载功能
410
+ - **重载延迟** - 文件变化后的重载延迟时间
411
+
330
412
  ---
331
413
 
332
414
  ## 🏗️ 插件结构
@@ -369,18 +451,19 @@ my_plugin/ # 插件根目录
369
451
 
370
452
  ## 🎯 开发状态
371
453
 
372
- ### ✅ 已完成功能(v0.2.1
454
+ ### ✅ 已完成功能(v0.3.3
373
455
 
374
456
  #### 1. ✅ 插件初始化 (`mpdt init`)
375
- - 支持 6 种模板类型
457
+ - 支持 6 种模板类型(basic、action、tool、plus_command、full、adapter)
376
458
  - 交互式问答模式
377
459
  - Git 自动初始化和用户信息提取
378
- - 多种开源协议支持
460
+ - 多种开源协议支持(GPL-v3.0、MIT、Apache-2.0、BSD-3-Clause)
379
461
  - 自动生成标准化项目结构
380
462
 
381
463
  #### 2. ✅ 组件生成 (`mpdt generate`)
382
- - 支持 8 种组件类型
464
+ - 支持 8 种组件类型(action、tool、event、adapter、prompt、plus-command、router、chatter)
383
465
  - 所有方法自动生成为异步
466
+ - 基于 libcst 的智能代码解析和注入
384
467
  - 自动更新插件主类注册代码
385
468
  - 交互式和命令行两种模式
386
469
  - 组件文件自动放置到正确目录
@@ -392,16 +475,25 @@ my_plugin/ # 插件根目录
392
475
  - **配置验证器** - `config.toml` 验证
393
476
  - **类型检查器** - mypy 集成,严格类型检查
394
477
  - **代码风格检查器** - ruff 集成,自动修复
395
- - 支持生成 Markdown 格式报告
478
+ - **自动修复验证器** - 智能问题修复
479
+ - 支持生成 Markdown 和 JSON 格式报告
396
480
  - 灵活的级别过滤(error/warning/info)
397
481
 
398
482
  #### 4. ✅ 热重载开发模式 (`mpdt dev`)
399
- - 基于 WebSocket 的实时通信
400
- - 自动注入开发桥接插件
483
+ - 基于 DevBridge 插件的热重载机制
484
+ - 自动注入目标插件和开发桥接插件
401
485
  - 文件变化自动检测(使用 watchdog)
402
486
  - 插件生命周期自动管理
403
487
  - 实时状态显示和日志查看
404
- - 支持主程序自动启动和停止
488
+ - 主程序退出时自动清理
489
+
490
+ #### 5. ✅ 配置管理 (`mpdt config`)
491
+ - 交互式配置向导 (`mpdt config init`)
492
+ - 配置显示 (`mpdt config show`)
493
+ - 配置验证 (`mpdt config test`)
494
+ - MoFox 路径设置 (`mpdt config set-mofox`)
495
+ - 虚拟环境设置 (`mpdt config set-venv`)
496
+ - 支持多种虚拟环境类型(venv、uv、conda、poetry)
405
497
 
406
498
  ### 🚧 计划中功能
407
499
 
@@ -412,15 +504,15 @@ my_plugin/ # 插件根目录
412
504
  - 测试报告输出
413
505
 
414
506
  #### 构建打包 (`mpdt build`)
415
- - 插件打包为发布格式
416
- - 版本号自动管理
507
+ - 插件打包为发布格式(zip、tar.gz、wheel)
508
+ - 版本号自动管理(major、minor、patch)
417
509
  - 依赖项打包
418
- - 多种打包格式支持
510
+ - 文档包含选项
419
511
 
420
- #### 配置管理
421
- - 项目级配置文件 `.mpdtrc.toml`
422
- - 全局配置管理
423
- - 配置验证和迁移
512
+ #### 插件市场集成
513
+ - 插件上传和发布
514
+ - 版本管理
515
+ - 依赖解析
424
516
 
425
517
  ---
426
518
 
@@ -479,6 +571,7 @@ mypy mpdt
479
571
  ### 开发工具
480
572
  - **模板引擎**: [Jinja2](https://jinja.palletsprojects.com/) - 灵活的模板系统
481
573
  - **配置管理**: [TOML](https://toml.io/), [Pydantic](https://docs.pydantic.dev/) - 配置解析和验证
574
+ - **代码解析**: [libcst](https://libcst.readthedocs.io/) - Python 具体语法树解析和修改
482
575
  - **代码检查**:
483
576
  - [Mypy](https://mypy.readthedocs.io/) - 静态类型检查
484
577
  - [Ruff](https://docs.astral.sh/ruff/) - 快速的 Python 代码检查器和格式化工具
@@ -488,6 +581,55 @@ mypy mpdt
488
581
  - **WebSocket**: [websockets](https://websockets.readthedocs.io/) - 异步 WebSocket 库
489
582
  - **HTTP 客户端**: [aiohttp](https://docs.aiohttp.org/) - 异步 HTTP 客户端/服务器
490
583
 
584
+ ## 🏗️ 项目结构
585
+
586
+ ```
587
+ mofox-plugin-toolkit/
588
+ ├── mpdt/ # 主包
589
+ │ ├── __init__.py # 版本信息
590
+ │ ├── __main__.py # 入口点
591
+ │ ├── cli.py # CLI 主入口
592
+ │ ├── commands/ # 命令实现
593
+ │ │ ├── init.py # 插件初始化
594
+ │ │ ├── generate.py # 组件生成
595
+ │ │ ├── check.py # 静态检查
596
+ │ │ └── dev.py # 开发模式
597
+ │ ├── validators/ # 验证器
598
+ │ │ ├── base.py # 基础验证器
599
+ │ │ ├── structure_validator.py # 结构验证
600
+ │ │ ├── metadata_validator.py # 元数据验证
601
+ │ │ ├── component_validator.py # 组件验证
602
+ │ │ ├── config_validator.py # 配置验证
603
+ │ │ ├── type_validator.py # 类型检查
604
+ │ │ ├── style_validator.py # 代码风格
605
+ │ │ └── auto_fix_validator.py # 自动修复
606
+ │ ├── templates/ # 组件模板
607
+ │ │ ├── action_template.py
608
+ │ │ ├── tool_template.py
609
+ │ │ ├── event_template.py
610
+ │ │ ├── adapter_template.py
611
+ │ │ ├── prompt_template.py
612
+ │ │ ├── plus_command_template.py
613
+ │ │ ├── router_template.py
614
+ │ │ └── chatter_template.py
615
+ │ ├── utils/ # 工具函数
616
+ │ │ ├── code_parser.py # 代码解析
617
+ │ │ ├── color_printer.py # 彩色输出
618
+ │ │ ├── config_loader.py # 配置加载
619
+ │ │ ├── config_manager.py # 配置管理
620
+ │ │ ├── file_ops.py # 文件操作
621
+ │ │ ├── license_generator.py # 许可证生成
622
+ │ │ ├── plugin_parser.py # 插件解析
623
+ │ │ └── template_engine.py # 模板引擎
624
+ │ └── dev/ # 开发模式相关
625
+ ├── docs/ # 文档
626
+ ├── examples/ # 示例
627
+ ├── plugin_dev_toolkit_design/ # 设计文档
628
+ ├── pyproject.toml # 项目配置
629
+ ├── README.md # 说明文档
630
+ └── LICENSE # 许可证
631
+ ```
632
+
491
633
  ---
492
634
 
493
635
  ## 🛠️ 完整依赖清单
@@ -504,6 +646,7 @@ dependencies = [
504
646
  "pydantic>=2.5.0", # 数据验证
505
647
  "watchdog>=3.0.0", # 文件监控
506
648
  "websockets>=12.0", # WebSocket
649
+ "libcst>=1.8.6", # Python CST 解析(代码智能注入)
507
650
  "aiohttp>=3.9.0", # 异步 HTTP
508
651
  "uvicorn>=0.24.0", # ASGI 服务器
509
652
  "fastapi>=0.104.0", # Web 框架
@@ -517,7 +660,7 @@ dependencies = [
517
660
  ## 💡 常见问题
518
661
 
519
662
  ### Q: 如何配置开发模式?
520
- A: 首次运行 `mpdt dev` 时会提示输入 MoFox 主程序路径,配置会保存到 `~/.mpdt/config.toml`。
663
+ A: 首次运行 `mpdt dev` 时会提示输入 MoFox 主程序路径,配置会保存到 `~/.mpdt/config.toml`。也可以使用 `mpdt config init` 进行交互式配置。
521
664
 
522
665
  ### Q: 检查器报错怎么办?
523
666
  A: 首先尝试使用 `mpdt check --fix` 自动修复。如果仍有问题,查看具体错误信息和建议。
@@ -531,13 +674,30 @@ A: 组件会自动放置到对应的目录,例如 Action 放在 `components/ac
531
674
  ### Q: 如何更新工具?
532
675
  A: 如果是从源码安装,执行 `git pull && pip install -e .`。
533
676
 
677
+ ### Q: 支持哪些虚拟环境类型?
678
+ A: 支持 venv、uv、conda、poetry,也可以设置为 none 使用系统 Python。
679
+
680
+ ### Q: 开发模式如何工作?
681
+ A: MPDT 会将 DevBridge 插件注入到主程序,该插件负责监控文件变化并自动热重载目标插件。主程序退出时会自动清理 DevBridge。
682
+
534
683
  ---
535
684
 
536
685
  ## 📝 更新日志
537
686
 
687
+ ### v0.3.3 (2026-01-02)
688
+ - ✅ 更新项目文档
689
+ - ✅ 完善配置管理功能
690
+ - ✅ 优化代码结构
691
+
692
+ ### v0.3.x
693
+ - ✅ 添加 libcst 代码解析支持
694
+ - ✅ 实现自动修复验证器 (AutoFixValidator)
695
+ - ✅ 支持 JSON 格式报告输出
696
+ - ✅ 改进组件代码注入机制
697
+
538
698
  ### v0.2.1 (2025-12-14)
539
699
  - ✅ 实现完整的热重载开发模式 (`mpdt dev`)
540
- - ✅ 添加 WebSocket 通信机制
700
+ - ✅ 添加 DevBridge 插件注入机制
541
701
  - ✅ 实现开发桥接插件自动注入
542
702
  - ✅ 改进文件监控和自动重载
543
703
  - ✅ 优化用户交互体验