ErisPulse 2.2.1__tar.gz → 2.3.0__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.
- {erispulse-2.2.1 → erispulse-2.3.0}/.github/scripts/update_packages.py +1 -1
- erispulse-2.3.0/.github/tools/merge_md.py +424 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/.github/tools/update-api-docs.py +2 -2
- erispulse-2.3.0/.github/workflows/auto-tag-release.yml +95 -0
- erispulse-2.3.0/.github/workflows/code-quality-check.yml +86 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/.gitignore +2 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/CHANGELOG.md +226 -1
- erispulse-2.3.0/CONTRIBUTING.md +62 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/LICENSE +1 -1
- {erispulse-2.2.1 → erispulse-2.3.0}/PKG-INFO +24 -5
- {erispulse-2.2.1 → erispulse-2.3.0}/README.md +22 -3
- {erispulse-2.2.1 → erispulse-2.3.0}/devs/test.py +1 -3
- {erispulse-2.2.1 → erispulse-2.3.0}/devs/test_event.py +1 -1
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/README.md +12 -34
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/ai/AIDocs/ErisPulse-AdapterDev.md +4192 -2754
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/ai/AIDocs/ErisPulse-Full.md +3857 -1857
- erispulse-2.3.0/docs/ai/AIDocs/ErisPulse-ModuleDev.md +3279 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/ai/module-generation.md +1 -2
- erispulse-2.3.0/docs/api/ErisPulse/Core/Bases/__init__.md +16 -0
- erispulse-2.3.0/docs/api/ErisPulse/Core/Bases/adapter.md +145 -0
- erispulse-2.3.0/docs/api/ErisPulse/Core/Bases/module.md +60 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/Event/__init__.md +9 -2
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/Event/base.md +11 -2
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/Event/command.md +14 -3
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/Event/exceptions.md +2 -2
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/Event/message.md +14 -3
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/Event/meta.md +14 -3
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/Event/notice.md +14 -3
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/Event/request.md +14 -3
- erispulse-2.2.1/docs/api/ErisPulse/Core/erispulse_config.md → erispulse-2.3.0/docs/api/ErisPulse/Core/_self_config.md +11 -3
- erispulse-2.3.0/docs/api/ErisPulse/Core/adapter.md +280 -0
- erispulse-2.3.0/docs/api/ErisPulse/Core/config.md +82 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/exceptions.md +2 -2
- erispulse-2.3.0/docs/api/ErisPulse/Core/lifecycle.md +101 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/logger.md +28 -4
- erispulse-2.3.0/docs/api/ErisPulse/Core/module.md +229 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/router.md +23 -4
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/Core/storage.md +29 -3
- erispulse-2.3.0/docs/api/ErisPulse/Core/ux.md +101 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/api/ErisPulse/__init__.md +83 -37
- erispulse-2.3.0/docs/api/ErisPulse/__main__.md +30 -0
- erispulse-2.3.0/docs/api/ErisPulse/utils/__init__.md +16 -0
- erispulse-2.3.0/docs/api/ErisPulse/utils/cli.md +157 -0
- erispulse-2.2.1/docs/api/ErisPulse/__main__.md → erispulse-2.3.0/docs/api/ErisPulse/utils/package_manager.md +5 -211
- erispulse-2.3.0/docs/api/ErisPulse/utils/reload_handler.md +69 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/core/README.md +1 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/core/cli.md +11 -0
- erispulse-2.3.0/docs/core/event-system.md +597 -0
- erispulse-2.3.0/docs/core/lazy-loading.md +261 -0
- erispulse-2.3.0/docs/core/modules.md +659 -0
- erispulse-2.3.0/docs/core/router.md +535 -0
- erispulse-2.3.0/docs/core/self-config.md +188 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/development/adapter.md +159 -138
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/development/module.md +36 -23
- erispulse-2.3.0/docs/platform-features/README.md +219 -0
- erispulse-2.3.0/docs/platform-features/email.md +138 -0
- erispulse-2.3.0/docs/platform-features/maintain-notes.md +144 -0
- erispulse-2.3.0/docs/platform-features/onebot11.md +167 -0
- erispulse-2.3.0/docs/platform-features/telegram.md +139 -0
- erispulse-2.3.0/docs/platform-features/yunhu.md +153 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/quick-start.md +65 -2
- erispulse-2.3.0/docs/standards/event-conversion.md +194 -0
- erispulse-2.3.0/docs/styleguide/README.md +5 -0
- erispulse-2.3.0/docs/styleguide/docstring_spec.md +95 -0
- erispulse-2.3.0/examples/example-adapter/MyAdapter/Converter.py +38 -0
- erispulse-2.3.0/examples/example-adapter/MyAdapter/Core.py +141 -0
- erispulse-2.3.0/examples/example-adapter/MyAdapter/__init__.py +7 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-cli-module/my_cli_module/cli.py +1 -1
- erispulse-2.3.0/examples/example-module/MyModule/Core.py +166 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/packages.json +6 -18
- {erispulse-2.2.1 → erispulse-2.3.0}/pyproject.toml +14 -1
- erispulse-2.3.0/src/ErisPulse/Core/Bases/__init__.py +14 -0
- erispulse-2.3.0/src/ErisPulse/Core/Bases/adapter.py +196 -0
- erispulse-2.3.0/src/ErisPulse/Core/Bases/module.py +54 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/Event/__init__.py +14 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/Event/base.py +15 -2
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/Event/command.py +21 -2
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/Event/message.py +15 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/Event/meta.py +15 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/Event/notice.py +15 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/Event/request.py +16 -1
- erispulse-2.3.0/src/ErisPulse/Core/__init__.py +49 -0
- erispulse-2.2.1/src/ErisPulse/Core/erispulse_config.py → erispulse-2.3.0/src/ErisPulse/Core/_self_config.py +27 -2
- erispulse-2.3.0/src/ErisPulse/Core/adapter.py +551 -0
- erispulse-2.3.0/src/ErisPulse/Core/config.py +177 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/exceptions.py +6 -1
- erispulse-2.3.0/src/ErisPulse/Core/lifecycle.py +167 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/logger.py +97 -49
- erispulse-2.3.0/src/ErisPulse/Core/module.py +373 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/router.py +112 -23
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/storage.py +258 -77
- erispulse-2.3.0/src/ErisPulse/Core/ux.py +635 -0
- erispulse-2.3.0/src/ErisPulse/__init__.py +1245 -0
- erispulse-2.3.0/src/ErisPulse/__main__.py +26 -0
- erispulse-2.3.0/src/ErisPulse/utils/__init__.py +17 -0
- erispulse-2.3.0/src/ErisPulse/utils/cli.py +1092 -0
- erispulse-2.3.0/src/ErisPulse/utils/console.py +53 -0
- erispulse-2.3.0/src/ErisPulse/utils/package_manager.py +845 -0
- erispulse-2.3.0/src/ErisPulse/utils/reload_handler.py +111 -0
- erispulse-2.2.1/.github/tools/merge_md.py +0 -214
- erispulse-2.2.1/.github/workflows/auto-tag-release.yml +0 -117
- erispulse-2.2.1/.worker/worker.js +0 -118
- erispulse-2.2.1/CONTRIBUTING.md +0 -107
- erispulse-2.2.1/docs/ai/AIDocs/ErisPulse-ModuleDev.md +0 -1693
- erispulse-2.2.1/docs/api/ErisPulse/Core/adapter.md +0 -399
- erispulse-2.2.1/docs/api/ErisPulse/Core/config.md +0 -44
- erispulse-2.2.1/docs/api/ErisPulse/Core/env.md +0 -19
- erispulse-2.2.1/docs/api/ErisPulse/Core/module.md +0 -108
- erispulse-2.2.1/docs/api/ErisPulse/Core/module_registry.md +0 -217
- erispulse-2.2.1/docs/core/event-system.md +0 -274
- erispulse-2.2.1/docs/core/modules.md +0 -321
- erispulse-2.2.1/docs/platform-features.md +0 -468
- erispulse-2.2.1/docs/standards/event-conversion.md +0 -202
- erispulse-2.2.1/examples/example-adapter/MyAdapter/Core.py +0 -74
- erispulse-2.2.1/examples/example-adapter/MyAdapter/__init__.py +0 -1
- erispulse-2.2.1/examples/example-module/MyModule/Core.py +0 -91
- erispulse-2.2.1/src/ErisPulse/Core/__init__.py +0 -30
- erispulse-2.2.1/src/ErisPulse/Core/adapter.py +0 -554
- erispulse-2.2.1/src/ErisPulse/Core/config.py +0 -78
- erispulse-2.2.1/src/ErisPulse/Core/env.py +0 -15
- erispulse-2.2.1/src/ErisPulse/Core/module.py +0 -150
- erispulse-2.2.1/src/ErisPulse/Core/module_registry.py +0 -227
- erispulse-2.2.1/src/ErisPulse/__init__.py +0 -767
- erispulse-2.2.1/src/ErisPulse/__main__.py +0 -2024
- {erispulse-2.2.1 → erispulse-2.3.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/.github/ISSUE_TEMPLATE/module_submission.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/.github/assets/docs/install_pip.gif +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/.github/assets/erispulse_logo.png +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/.github/workflows/auto-update-packages.yml +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/.github/workflows/pypi-publish.yml +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/.python-version +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/CODE_OF_CONDUCT.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/SECURITY.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/devs/test_adapter.py +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/devs/test_cmd.py +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/devs/test_files/test.docx +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/devs/test_files/test.jpg +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/devs/test_files/test.mp4 +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/ai/README.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/core/adapters.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/core/best-practices.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/core/concepts.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/development/README.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/development/cli.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/standards/README.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/docs/standards/api-response.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-adapter/LICENSE +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-adapter/README.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-adapter/pyproject.toml +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-cli-module/LICENSE +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-cli-module/README.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-cli-module/my_cli_module/__init__.py +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-cli-module/pyproject.toml +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-module/LICENSE +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-module/MyModule/__init__.py +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-module/README.md +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/examples/example-module/pyproject.toml +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/scripts/install/install.ps1 +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/scripts/install/install.sh +0 -0
- {erispulse-2.2.1 → erispulse-2.3.0}/src/ErisPulse/Core/Event/exceptions.py +0 -0
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
|
|
4
|
+
def merge_md_files(output_file, files_to_merge, title="文档合集"):
|
|
5
|
+
"""
|
|
6
|
+
合并多个Markdown文件
|
|
7
|
+
|
|
8
|
+
:param output_file: 输出文件路径
|
|
9
|
+
:param files_to_merge: 要合并的文件列表,包含文件路径和描述
|
|
10
|
+
:param title: 文档标题
|
|
11
|
+
"""
|
|
12
|
+
with open(output_file, 'w', encoding='utf-8') as outfile:
|
|
13
|
+
# 写入头部说明
|
|
14
|
+
outfile.write(f"# ErisPulse {title}\n\n")
|
|
15
|
+
outfile.write(f"**生成时间**: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n")
|
|
16
|
+
outfile.write("本文件由多个开发文档合并而成,用于辅助开发者理解 ErisPulse 的相关功能。\n\n")
|
|
17
|
+
|
|
18
|
+
# 写入目录
|
|
19
|
+
outfile.write("## 目录\n\n")
|
|
20
|
+
for i, file_info in enumerate(files_to_merge, 1):
|
|
21
|
+
filename = os.path.basename(file_info['path'])
|
|
22
|
+
outfile.write(f"{i}. [{file_info.get('description', filename)}](#{filename.replace('.', '').replace(' ', '-').replace('/', '').replace('(', '').replace(')', '')})\n")
|
|
23
|
+
outfile.write("\n")
|
|
24
|
+
|
|
25
|
+
outfile.write("## 各文件对应内容说明\n\n")
|
|
26
|
+
outfile.write("| 文件名 | 作用 |\n")
|
|
27
|
+
outfile.write("|--------|------|\n")
|
|
28
|
+
|
|
29
|
+
# 写入文件说明
|
|
30
|
+
for file_info in files_to_merge:
|
|
31
|
+
filename = os.path.basename(file_info['path'])
|
|
32
|
+
outfile.write(f"| [{filename}](#{filename.replace('.', '').replace(' ', '-').replace('/', '').replace('(', '').replace(')', '')}) | {file_info.get('description', '')} |\n")
|
|
33
|
+
|
|
34
|
+
outfile.write("\n---\n\n")
|
|
35
|
+
|
|
36
|
+
# 合并文件内容
|
|
37
|
+
for file_info in files_to_merge:
|
|
38
|
+
file_path = file_info['path']
|
|
39
|
+
if os.path.exists(file_path):
|
|
40
|
+
filename = os.path.basename(file_path)
|
|
41
|
+
anchor_name = filename.replace('.', '').replace(' ', '-').replace('/', '').replace('(', '').replace(')', '')
|
|
42
|
+
outfile.write(f"<a id=\"{anchor_name}\"></a>\n")
|
|
43
|
+
outfile.write(f"## {file_info.get('description', filename)}\n\n")
|
|
44
|
+
|
|
45
|
+
with open(file_path, 'r', encoding='utf-8') as infile:
|
|
46
|
+
content = infile.read()
|
|
47
|
+
outfile.write(content)
|
|
48
|
+
outfile.write("\n\n---\n\n")
|
|
49
|
+
else:
|
|
50
|
+
print(f"文件不存在,跳过: {file_path}")
|
|
51
|
+
|
|
52
|
+
def merge_api_docs(api_dir, output_file):
|
|
53
|
+
"""
|
|
54
|
+
合并API文档
|
|
55
|
+
|
|
56
|
+
:param api_dir: API文档目录
|
|
57
|
+
:param output_file: 输出文件路径
|
|
58
|
+
"""
|
|
59
|
+
if not os.path.exists(api_dir):
|
|
60
|
+
print(f"API文档目录不存在: {api_dir}")
|
|
61
|
+
return
|
|
62
|
+
|
|
63
|
+
with open(output_file, 'a', encoding='utf-8') as outfile:
|
|
64
|
+
outfile.write("# API参考\n\n")
|
|
65
|
+
|
|
66
|
+
# 收集所有API文档文件
|
|
67
|
+
api_files = []
|
|
68
|
+
for root, _, files in os.walk(api_dir):
|
|
69
|
+
for file in files:
|
|
70
|
+
if file.endswith('.md'):
|
|
71
|
+
file_path = os.path.join(root, file)
|
|
72
|
+
api_files.append(file_path)
|
|
73
|
+
|
|
74
|
+
# 按路径排序以保持一致性
|
|
75
|
+
api_files.sort()
|
|
76
|
+
|
|
77
|
+
# 生成API文档目录
|
|
78
|
+
outfile.write("## API文档目录\n\n")
|
|
79
|
+
for file_path in api_files:
|
|
80
|
+
rel_path = os.path.relpath(file_path, api_dir)
|
|
81
|
+
anchor = rel_path.replace(os.sep, "_").replace(".md", "").replace("/", "_").replace("\\", "_")
|
|
82
|
+
outfile.write(f"- [{rel_path}](#{anchor})\n")
|
|
83
|
+
outfile.write("\n---\n\n")
|
|
84
|
+
|
|
85
|
+
# 合并API文档内容
|
|
86
|
+
for file_path in api_files:
|
|
87
|
+
rel_path = os.path.relpath(file_path, api_dir)
|
|
88
|
+
anchor = rel_path.replace(os.sep, "_").replace(".md", "").replace("/", "_").replace("\\", "_")
|
|
89
|
+
|
|
90
|
+
outfile.write(f"<a id=\"{anchor}\"></a>\n")
|
|
91
|
+
outfile.write(f"## {rel_path}\n\n")
|
|
92
|
+
|
|
93
|
+
try:
|
|
94
|
+
with open(file_path, 'r', encoding='utf-8') as infile:
|
|
95
|
+
content = infile.read()
|
|
96
|
+
lines = content.split('\n')
|
|
97
|
+
if lines and lines[0].startswith('# '):
|
|
98
|
+
content = '\n'.join(lines[1:])
|
|
99
|
+
|
|
100
|
+
outfile.write(content)
|
|
101
|
+
outfile.write("\n\n")
|
|
102
|
+
except Exception as e:
|
|
103
|
+
outfile.write(f"无法读取文件 {file_path}: {str(e)}\n\n")
|
|
104
|
+
|
|
105
|
+
outfile.write("---\n")
|
|
106
|
+
|
|
107
|
+
def get_core_files():
|
|
108
|
+
"""
|
|
109
|
+
获取core目录下的所有文档文件
|
|
110
|
+
"""
|
|
111
|
+
core_files = []
|
|
112
|
+
core_dir = "docs/core"
|
|
113
|
+
|
|
114
|
+
if os.path.exists(core_dir):
|
|
115
|
+
# 按重要性排序的文件列表
|
|
116
|
+
important_files = [
|
|
117
|
+
"README.md",
|
|
118
|
+
"concepts.md",
|
|
119
|
+
"modules.md",
|
|
120
|
+
"adapters.md",
|
|
121
|
+
"event-system.md",
|
|
122
|
+
"cli.md",
|
|
123
|
+
"best-practices.md"
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
# 按顺序添加文件
|
|
127
|
+
for filename in important_files:
|
|
128
|
+
file_path = os.path.join(core_dir, filename)
|
|
129
|
+
if os.path.exists(file_path):
|
|
130
|
+
description = ""
|
|
131
|
+
if filename == "README.md":
|
|
132
|
+
description = "核心功能文档列表"
|
|
133
|
+
elif filename == "concepts.md":
|
|
134
|
+
description = "核心概念"
|
|
135
|
+
elif filename == "modules.md":
|
|
136
|
+
description = "核心模块详解"
|
|
137
|
+
elif filename == "adapters.md":
|
|
138
|
+
description = "适配器系统"
|
|
139
|
+
elif filename == "event-system.md":
|
|
140
|
+
description = "事件系统"
|
|
141
|
+
elif filename == "cli.md":
|
|
142
|
+
description = "命令行接口"
|
|
143
|
+
elif filename == "best-practices.md":
|
|
144
|
+
description = "最佳实践"
|
|
145
|
+
|
|
146
|
+
core_files.append({
|
|
147
|
+
"path": file_path,
|
|
148
|
+
"description": description
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
return core_files
|
|
152
|
+
|
|
153
|
+
def get_development_files():
|
|
154
|
+
"""
|
|
155
|
+
获取development目录下的所有文档文件
|
|
156
|
+
"""
|
|
157
|
+
dev_files = []
|
|
158
|
+
dev_dir = "docs/development"
|
|
159
|
+
|
|
160
|
+
if os.path.exists(dev_dir):
|
|
161
|
+
# 按重要性排序的文件列表
|
|
162
|
+
important_files = [
|
|
163
|
+
"README.md",
|
|
164
|
+
"module.md",
|
|
165
|
+
"adapter.md",
|
|
166
|
+
"cli.md"
|
|
167
|
+
]
|
|
168
|
+
|
|
169
|
+
# 按顺序添加文件
|
|
170
|
+
for filename in important_files:
|
|
171
|
+
file_path = os.path.join(dev_dir, filename)
|
|
172
|
+
if os.path.exists(file_path):
|
|
173
|
+
description = ""
|
|
174
|
+
if filename == "README.md":
|
|
175
|
+
description = "开发者指南列表"
|
|
176
|
+
elif filename == "module.md":
|
|
177
|
+
description = "模块开发指南"
|
|
178
|
+
elif filename == "adapter.md":
|
|
179
|
+
description = "适配器开发指南"
|
|
180
|
+
elif filename == "cli.md":
|
|
181
|
+
description = "CLI开发指南"
|
|
182
|
+
|
|
183
|
+
dev_files.append({
|
|
184
|
+
"path": file_path,
|
|
185
|
+
"description": description
|
|
186
|
+
})
|
|
187
|
+
|
|
188
|
+
return dev_files
|
|
189
|
+
|
|
190
|
+
def get_standards_files():
|
|
191
|
+
"""
|
|
192
|
+
获取standards目录下的所有文档文件
|
|
193
|
+
"""
|
|
194
|
+
standards_files = []
|
|
195
|
+
standards_dir = "docs/standards"
|
|
196
|
+
|
|
197
|
+
if os.path.exists(standards_dir):
|
|
198
|
+
# 按重要性排序的文件列表
|
|
199
|
+
important_files = [
|
|
200
|
+
"README.md",
|
|
201
|
+
"event-conversion.md",
|
|
202
|
+
"api-response.md"
|
|
203
|
+
]
|
|
204
|
+
|
|
205
|
+
# 按顺序添加文件
|
|
206
|
+
for filename in important_files:
|
|
207
|
+
file_path = os.path.join(standards_dir, filename)
|
|
208
|
+
if os.path.exists(file_path):
|
|
209
|
+
description = ""
|
|
210
|
+
if filename == "README.md":
|
|
211
|
+
description = "标准规范总览"
|
|
212
|
+
elif filename == "event-conversion.md":
|
|
213
|
+
description = "事件转换标准"
|
|
214
|
+
elif filename == "api-response.md":
|
|
215
|
+
description = "API响应标准"
|
|
216
|
+
|
|
217
|
+
standards_files.append({
|
|
218
|
+
"path": file_path,
|
|
219
|
+
"description": description
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
return standards_files
|
|
223
|
+
|
|
224
|
+
def get_platform_features_files():
|
|
225
|
+
"""
|
|
226
|
+
获取platform-features目录下的所有文档文件
|
|
227
|
+
"""
|
|
228
|
+
platform_files = []
|
|
229
|
+
platform_dir = "docs/platform-features"
|
|
230
|
+
|
|
231
|
+
if os.path.exists(platform_dir):
|
|
232
|
+
# 按重要性排序的文件列表
|
|
233
|
+
important_files = [
|
|
234
|
+
"README.md",
|
|
235
|
+
"yunhu.md",
|
|
236
|
+
"telegram.md",
|
|
237
|
+
"onebot11.md",
|
|
238
|
+
"email.md"
|
|
239
|
+
]
|
|
240
|
+
|
|
241
|
+
# 按顺序添加文件
|
|
242
|
+
for filename in important_files:
|
|
243
|
+
file_path = os.path.join(platform_dir, filename)
|
|
244
|
+
if os.path.exists(file_path):
|
|
245
|
+
# 跳过维护说明文件
|
|
246
|
+
if filename == "maintain-notes.md":
|
|
247
|
+
continue
|
|
248
|
+
|
|
249
|
+
description = ""
|
|
250
|
+
if filename == "README.md":
|
|
251
|
+
description = "平台特性总览"
|
|
252
|
+
elif filename == "yunhu.md":
|
|
253
|
+
description = "云湖平台特性"
|
|
254
|
+
elif filename == "telegram.md":
|
|
255
|
+
description = "Telegram平台特性"
|
|
256
|
+
elif filename == "onebot11.md":
|
|
257
|
+
description = "OneBot11平台特性"
|
|
258
|
+
elif filename == "email.md":
|
|
259
|
+
description = "邮件平台特性"
|
|
260
|
+
|
|
261
|
+
platform_files.append({
|
|
262
|
+
"path": file_path,
|
|
263
|
+
"description": description
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
return platform_files
|
|
267
|
+
|
|
268
|
+
def generate_full_document():
|
|
269
|
+
print("正在生成完整文档...")
|
|
270
|
+
|
|
271
|
+
# 基础文件
|
|
272
|
+
base_files = [
|
|
273
|
+
{"path": "docs/README.md", "description": "文档总览"},
|
|
274
|
+
{"path": "docs/quick-start.md", "description": "快速开始指南"},
|
|
275
|
+
]
|
|
276
|
+
|
|
277
|
+
# 添加核心文档
|
|
278
|
+
core_files = get_core_files()
|
|
279
|
+
|
|
280
|
+
# 添加开发文档
|
|
281
|
+
dev_files = get_development_files()
|
|
282
|
+
|
|
283
|
+
# 添加标准文档
|
|
284
|
+
standards_files = get_standards_files()
|
|
285
|
+
|
|
286
|
+
# 添加平台特性文件
|
|
287
|
+
platform_files = get_platform_features_files()
|
|
288
|
+
|
|
289
|
+
# 合并所有文件
|
|
290
|
+
files_to_merge = base_files + core_files + dev_files + standards_files + platform_files
|
|
291
|
+
|
|
292
|
+
# 过滤不存在的文件
|
|
293
|
+
existing_files = [f for f in files_to_merge if os.path.exists(f['path'])]
|
|
294
|
+
if len(existing_files) != len(files_to_merge):
|
|
295
|
+
print(f"警告: {len(files_to_merge) - len(existing_files)} 个文件不存在,已跳过")
|
|
296
|
+
|
|
297
|
+
output_file = "docs/ai/AIDocs/ErisPulse-Full.md"
|
|
298
|
+
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
|
299
|
+
|
|
300
|
+
merge_md_files(output_file, existing_files, "完整开发文档")
|
|
301
|
+
merge_api_docs("docs/api", output_file)
|
|
302
|
+
|
|
303
|
+
print(f"完整文档生成完成,已保存到: {output_file}")
|
|
304
|
+
|
|
305
|
+
def generate_dev_documents():
|
|
306
|
+
print("正在生成开发文档...")
|
|
307
|
+
|
|
308
|
+
# 模块开发文档
|
|
309
|
+
module_files = [
|
|
310
|
+
{"path": "docs/README.md", "description": "文档总览"},
|
|
311
|
+
{"path": "docs/quick-start.md", "description": "快速开始指南"},
|
|
312
|
+
{"path": "docs/core/concepts.md", "description": "基础架构和设计理念"},
|
|
313
|
+
{"path": "docs/core/modules.md", "description": "核心模块"},
|
|
314
|
+
{"path": "docs/core/adapters.md", "description": "适配器"},
|
|
315
|
+
{"path": "docs/core/event-system.md", "description": "事件系统"},
|
|
316
|
+
]
|
|
317
|
+
|
|
318
|
+
# 添加开发文档 (包括模块开发指南)
|
|
319
|
+
dev_files = get_development_files()
|
|
320
|
+
module_dev_files = [f for f in dev_files if "模块" in f["description"] or "指南列表" in f["description"]]
|
|
321
|
+
|
|
322
|
+
# 添加标准文档
|
|
323
|
+
standards_files = get_standards_files()
|
|
324
|
+
|
|
325
|
+
# 添加平台特性文件
|
|
326
|
+
platform_files = get_platform_features_files()
|
|
327
|
+
|
|
328
|
+
# 合并所有文件
|
|
329
|
+
files_to_merge = module_files + module_dev_files + standards_files + platform_files
|
|
330
|
+
|
|
331
|
+
# 过滤不存在的文件
|
|
332
|
+
existing_files = [f for f in files_to_merge if os.path.exists(f['path'])]
|
|
333
|
+
|
|
334
|
+
module_output = "docs/ai/AIDocs/ErisPulse-ModuleDev.md"
|
|
335
|
+
os.makedirs(os.path.dirname(module_output), exist_ok=True)
|
|
336
|
+
merge_md_files(module_output, existing_files, "模块开发文档")
|
|
337
|
+
|
|
338
|
+
print(f"模块开发文档生成完成,已保存到: {module_output}")
|
|
339
|
+
|
|
340
|
+
# 适配器开发文档
|
|
341
|
+
adapter_files = [
|
|
342
|
+
{"path": "docs/README.md", "description": "文档总览"},
|
|
343
|
+
{"path": "docs/quick-start.md", "description": "快速开始指南"},
|
|
344
|
+
{"path": "docs/core/concepts.md", "description": "核心概念"},
|
|
345
|
+
{"path": "docs/core/modules.md", "description": "核心模块"},
|
|
346
|
+
{"path": "docs/core/adapters.md", "description": "适配器系统"},
|
|
347
|
+
{"path": "docs/core/event-system.md", "description": "事件系统"},
|
|
348
|
+
{"path": "docs/core/best-practices.md", "description": "最佳实践"},
|
|
349
|
+
]
|
|
350
|
+
|
|
351
|
+
# 添加开发文档 (包括适配器开发指南)
|
|
352
|
+
adapter_dev_files = [f for f in dev_files if "适配器" in f["description"] or "指南列表" in f["description"]]
|
|
353
|
+
|
|
354
|
+
# 合并所有文件
|
|
355
|
+
files_to_merge = adapter_files + adapter_dev_files + standards_files + platform_files
|
|
356
|
+
|
|
357
|
+
# 过滤不存在的文件
|
|
358
|
+
existing_files = [f for f in files_to_merge if os.path.exists(f['path'])]
|
|
359
|
+
|
|
360
|
+
adapter_output = "docs/ai/AIDocs/ErisPulse-AdapterDev.md"
|
|
361
|
+
os.makedirs(os.path.dirname(adapter_output), exist_ok=True)
|
|
362
|
+
merge_md_files(adapter_output, existing_files, "适配器开发文档")
|
|
363
|
+
merge_api_docs("docs/api", adapter_output)
|
|
364
|
+
|
|
365
|
+
print(f"适配器开发文档生成完成,已保存到: {adapter_output}")
|
|
366
|
+
|
|
367
|
+
def generate_core_document():
|
|
368
|
+
print("正在生成核心文档...")
|
|
369
|
+
|
|
370
|
+
# 基础文件
|
|
371
|
+
base_files = [
|
|
372
|
+
{"path": "docs/README.md", "description": "文档总览"},
|
|
373
|
+
{"path": "docs/quick-start.md", "description": "快速开始指南"},
|
|
374
|
+
]
|
|
375
|
+
|
|
376
|
+
# 核心文档
|
|
377
|
+
core_files = get_core_files()
|
|
378
|
+
|
|
379
|
+
# 添加平台特性文件
|
|
380
|
+
platform_files = get_platform_features_files()
|
|
381
|
+
|
|
382
|
+
# 合并所有文件
|
|
383
|
+
files_to_merge = base_files + core_files + platform_files
|
|
384
|
+
|
|
385
|
+
# 过滤不存在的文件
|
|
386
|
+
existing_files = [f for f in files_to_merge if os.path.exists(f['path'])]
|
|
387
|
+
|
|
388
|
+
core_output = "docs/ai/AIDocs/ErisPulse-Core.md"
|
|
389
|
+
os.makedirs(os.path.dirname(core_output), exist_ok=True)
|
|
390
|
+
merge_md_files(core_output, existing_files, "核心功能文档")
|
|
391
|
+
|
|
392
|
+
print(f"核心文档生成完成,已保存到: {core_output}")
|
|
393
|
+
|
|
394
|
+
def generate_custom_document(title, files, api_dirs, output_path):
|
|
395
|
+
"""
|
|
396
|
+
生成自定义文档
|
|
397
|
+
|
|
398
|
+
:param title: 文档标题
|
|
399
|
+
:param files: 要合并的文件列表
|
|
400
|
+
:param api_dirs: 要合并的API目录列表
|
|
401
|
+
:param output_path: 输出路径
|
|
402
|
+
"""
|
|
403
|
+
print(f"正在生成{title}...")
|
|
404
|
+
|
|
405
|
+
# 过滤不存在的文件
|
|
406
|
+
existing_files = [f for f in files if os.path.exists(f['path'])]
|
|
407
|
+
|
|
408
|
+
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
|
409
|
+
merge_md_files(output_path, existing_files, title)
|
|
410
|
+
|
|
411
|
+
# API文档
|
|
412
|
+
for api_dir in api_dirs:
|
|
413
|
+
merge_api_docs(api_dir, output_path)
|
|
414
|
+
|
|
415
|
+
print(f"{title}生成完成,已保存到: {output_path}")
|
|
416
|
+
|
|
417
|
+
if __name__ == "__main__":
|
|
418
|
+
try:
|
|
419
|
+
generate_full_document()
|
|
420
|
+
generate_dev_documents()
|
|
421
|
+
# generate_core_document()
|
|
422
|
+
print("所有文档生成完成")
|
|
423
|
+
except Exception as e:
|
|
424
|
+
print(f"文档生成过程中出现错误: {str(e)}")
|
|
@@ -2,7 +2,7 @@ import os
|
|
|
2
2
|
import ast
|
|
3
3
|
import re
|
|
4
4
|
import argparse
|
|
5
|
-
from typing import List, Dict, Tuple, Optional
|
|
5
|
+
from typing import List, Dict, Tuple, Optional
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
|
|
8
8
|
def process_docstring(docstring: str) -> Optional[str]:
|
|
@@ -606,4 +606,4 @@ if __name__ == "__main__":
|
|
|
606
606
|
|
|
607
607
|
generate_api_docs(args.src, args.output, args.format)
|
|
608
608
|
|
|
609
|
-
print(
|
|
609
|
+
print("API文档生成完成!")
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
name: 🎀 艾莉丝的版本标签魔法 ~
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
contents: write
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main, Pre-Release/v2]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
update-latest-release:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- name: 检出代码
|
|
15
|
+
uses: actions/checkout@v4
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
token: ${{ secrets.GITHUB_TOKEN }}
|
|
19
|
+
|
|
20
|
+
- name: 施展版本魔法
|
|
21
|
+
env:
|
|
22
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
23
|
+
shell: bash
|
|
24
|
+
run: |
|
|
25
|
+
# 读取当前版本
|
|
26
|
+
version=$(grep '^version' pyproject.toml | head -1 | sed 's/version = "//;s/"//')
|
|
27
|
+
tag_name="v$version"
|
|
28
|
+
|
|
29
|
+
echo "当前版本: $version"
|
|
30
|
+
echo "标签名称: $tag_name"
|
|
31
|
+
|
|
32
|
+
# 从 CHANGELOG.md 提取更新日志
|
|
33
|
+
if [ -f "CHANGELOG.md" ]; then
|
|
34
|
+
# 修复版本号格式:将 -de. 替换为 -dev.
|
|
35
|
+
fixed_version=$(echo "$version" | sed 's/-de\./-dev./g')
|
|
36
|
+
|
|
37
|
+
echo "尝试匹配版本: $version 或 $fixed_version"
|
|
38
|
+
|
|
39
|
+
# 使用 sed 提取版本更新日志
|
|
40
|
+
# 先尝试匹配原始版本号
|
|
41
|
+
changelog_section=$(sed -n "/^## \[$version\] -/,/^## \[.*\] -/p" CHANGELOG.md | sed '$d')
|
|
42
|
+
|
|
43
|
+
# 如果没找到,尝试匹配修复后的版本号
|
|
44
|
+
if [ -z "$changelog_section" ]; then
|
|
45
|
+
changelog_section=$(sed -n "/^## \[$fixed_version\] -/,/^## \[.*\] -/p" CHANGELOG.md | sed '$d')
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# 移除第一行(标题行)
|
|
49
|
+
if [ -n "$changelog_section" ]; then
|
|
50
|
+
changelog=$(echo "$changelog_section" | tail -n +2)
|
|
51
|
+
|
|
52
|
+
# 判断是否为开发版本
|
|
53
|
+
if [[ $version =~ dev|alpha|beta|pre|a|b ]]; then
|
|
54
|
+
is_dev="true"
|
|
55
|
+
latest_flag=""
|
|
56
|
+
else
|
|
57
|
+
is_dev="false"
|
|
58
|
+
latest_flag="--latest"
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# 检查标签是否已存在
|
|
62
|
+
if ! git rev-parse "$tag_name" >/dev/null 2>&1; then
|
|
63
|
+
echo "🎀🎀 创建新标签 $tag_name..."
|
|
64
|
+
git tag "$tag_name"
|
|
65
|
+
git push origin "$tag_name"
|
|
66
|
+
else
|
|
67
|
+
echo "标签 $tag_name 已存在"
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
# 检查发行是否存在
|
|
71
|
+
if gh release view "$tag_name" &>/dev/null; then
|
|
72
|
+
# 更新发行
|
|
73
|
+
echo "🔄 更新发行 $tag_name..."
|
|
74
|
+
gh release edit "$tag_name" \
|
|
75
|
+
--notes "$changelog" \
|
|
76
|
+
--prerelease=$is_dev
|
|
77
|
+
echo "✅ 已更新发行 $tag_name"
|
|
78
|
+
else
|
|
79
|
+
# 创建发行
|
|
80
|
+
echo "✨ 创建发行 $tag_name..."
|
|
81
|
+
gh release create "$tag_name" \
|
|
82
|
+
--notes "$changelog" \
|
|
83
|
+
--title "✨ 艾莉丝的魔法更新 $tag_name" \
|
|
84
|
+
--prerelease=$is_dev \
|
|
85
|
+
$latest_flag
|
|
86
|
+
echo "✅ 已创建发行 $tag_name"
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
echo "📦 发行页面: https://github.com/${{ github.repository }}/releases/tag/$tag_name"
|
|
90
|
+
else
|
|
91
|
+
echo "⚠️ 未找到版本 $version 的更新日志"
|
|
92
|
+
fi
|
|
93
|
+
else
|
|
94
|
+
echo "⚠️ CHANGELOG.md 文件不存在"
|
|
95
|
+
fi
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
name: 🔍 艾莉丝的代码审查魔法 ~
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
contents: read
|
|
5
|
+
pull-requests: write
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
pull_request:
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
code-quality-check:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
steps:
|
|
15
|
+
- name: 检出魔法书
|
|
16
|
+
uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
fetch-depth: 0
|
|
19
|
+
|
|
20
|
+
- name: 准备魔法环境
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: '3.x'
|
|
24
|
+
|
|
25
|
+
- name: 召唤审查精灵 Ruff
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install ruff
|
|
29
|
+
|
|
30
|
+
- name: 施展代码审查魔法
|
|
31
|
+
id: ruff-check
|
|
32
|
+
continue-on-error: true
|
|
33
|
+
run: |
|
|
34
|
+
echo "🔍 艾莉丝正在使用 Ruff 审查代码规范..."
|
|
35
|
+
ruff_output=$(ruff check . 2>&1; echo "RUFF_EXIT_CODE=$?")
|
|
36
|
+
exit_code=${ruff_output##*RUFF_EXIT_CODE=}
|
|
37
|
+
ruff_output=${ruff_output%RUFF_EXIT_CODE=*}
|
|
38
|
+
|
|
39
|
+
echo "RUFF_OUTPUT<<EOF" >> $GITHUB_ENV
|
|
40
|
+
echo "$ruff_output" >> $GITHUB_ENV
|
|
41
|
+
echo "EOF" >> $GITHUB_ENV
|
|
42
|
+
|
|
43
|
+
if [ -n "$ruff_output" ] || [ "$exit_code" -ne 0 ]; then
|
|
44
|
+
echo "has_errors=true" >> $GITHUB_OUTPUT
|
|
45
|
+
else
|
|
46
|
+
echo "has_errors=false" >> $GITHUB_OUTPUT
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
- name: 提交审查结果到PR
|
|
50
|
+
if: steps.ruff-check.outputs.has_errors == 'true' && github.event_name == 'pull_request'
|
|
51
|
+
uses: actions/github-script@v6
|
|
52
|
+
with:
|
|
53
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
54
|
+
script: |
|
|
55
|
+
const { data: comments } = await github.rest.issues.listComments({
|
|
56
|
+
owner: context.repo.owner,
|
|
57
|
+
repo: context.repo.repo,
|
|
58
|
+
issue_number: context.payload.pull_request.number
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const botComment = comments.find(comment =>
|
|
62
|
+
comment.user.login === '艾莉丝[bot]' &&
|
|
63
|
+
comment.body.includes('🔍 代码审查结果')
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
const message = `
|
|
67
|
+
🔍 代码审查结果
|
|
68
|
+
|
|
69
|
+
${process.env.RUFF_OUTPUT}
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
if (botComment) {
|
|
73
|
+
await github.rest.issues.updateComment({
|
|
74
|
+
owner: context.repo.owner,
|
|
75
|
+
repo: context.repo.repo,
|
|
76
|
+
comment_id: botComment.id,
|
|
77
|
+
body: message
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
await github.rest.issues.createComment({
|
|
81
|
+
owner: context.repo.owner,
|
|
82
|
+
repo: context.repo.repo,
|
|
83
|
+
issue_number: context.payload.pull_request.number,
|
|
84
|
+
body: message
|
|
85
|
+
});
|
|
86
|
+
}
|