ErisPulse 2.1.15.dev3__tar.gz → 2.2.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.0/.github/tools/merge_md.py +226 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.github/tools/update-api-docs.py +25 -34
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.github/workflows/auto-tag-release.yml +8 -7
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.gitignore +1 -0
- erispulse-2.2.0/CONTRIBUTING.md +43 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/LICENSE +7 -1
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/PKG-INFO +7 -1
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/devs/test.py +16 -16
- erispulse-2.2.0/devs/test_cmd.py +242 -0
- erispulse-2.2.0/devs/test_event.py +100 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/AIDocs/ErisPulse-AdapterDev.md +1826 -892
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/AIDocs/ErisPulse-Core.md +1661 -128
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/AIDocs/ErisPulse-Full.md +1812 -899
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/AIDocs/ErisPulse-ModuleDev.md +2080 -1080
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/CHANGELOG.md +82 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/Development/Adapter.md +2 -2
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/Development/Module.md +11 -4
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/PlatformFeatures.md +62 -1
- erispulse-2.2.0/docs/UseCore.md +425 -0
- erispulse-2.2.0/docs/api/ErisPulse/Core/Event/__init__.md +29 -0
- erispulse-2.2.0/docs/api/ErisPulse/Core/Event/base.md +78 -0
- erispulse-2.2.0/docs/api/ErisPulse/Core/Event/command.md +20 -0
- erispulse-2.2.0/docs/api/ErisPulse/Core/Event/exceptions.md +46 -0
- erispulse-2.2.0/docs/api/ErisPulse/Core/Event/message.md +20 -0
- erispulse-2.2.0/docs/api/ErisPulse/Core/Event/meta.md +19 -0
- erispulse-2.2.0/docs/api/ErisPulse/Core/Event/notice.md +19 -0
- erispulse-2.2.0/docs/api/ErisPulse/Core/Event/request.md +19 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/api/ErisPulse/Core/adapter.md +16 -16
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/api/ErisPulse/Core/config.md +3 -3
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/api/ErisPulse/Core/env.md +3 -3
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/api/ErisPulse/Core/erispulse_config.md +4 -4
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/api/ErisPulse/Core/exceptions.md +4 -4
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/api/ErisPulse/Core/logger.md +6 -6
- erispulse-2.2.0/docs/api/ErisPulse/Core/module.md +108 -0
- erispulse-2.1.15.dev3/docs/api/ErisPulse/Core/mods.md → erispulse-2.2.0/docs/api/ErisPulse/Core/module_registry.md +44 -39
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/api/ErisPulse/Core/router.md +7 -7
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/api/ErisPulse/Core/storage.md +5 -5
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/api/ErisPulse/__init__.md +15 -17
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/api/ErisPulse/__main__.md +148 -20
- erispulse-2.2.0/examples/example-module/MyModule/Core.py +91 -0
- erispulse-2.2.0/examples/example-module/README.md +29 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/packages.json +34 -6
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/pyproject.toml +1 -1
- erispulse-2.2.0/src/ErisPulse/Core/Event/__init__.py +51 -0
- erispulse-2.2.0/src/ErisPulse/Core/Event/base.py +100 -0
- erispulse-2.2.0/src/ErisPulse/Core/Event/command.py +310 -0
- erispulse-2.2.0/src/ErisPulse/Core/Event/exceptions.py +37 -0
- erispulse-2.2.0/src/ErisPulse/Core/Event/message.py +84 -0
- erispulse-2.2.0/src/ErisPulse/Core/Event/meta.py +77 -0
- erispulse-2.2.0/src/ErisPulse/Core/Event/notice.py +91 -0
- erispulse-2.2.0/src/ErisPulse/Core/Event/request.py +61 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/Core/__init__.py +7 -2
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/Core/logger.py +2 -2
- erispulse-2.2.0/src/ErisPulse/Core/module.py +150 -0
- erispulse-2.1.15.dev3/src/ErisPulse/Core/mods.py → erispulse-2.2.0/src/ErisPulse/Core/module_registry.py +41 -37
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/__init__.py +16 -9
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/__main__.py +115 -48
- erispulse-2.1.15.dev3/.github/tools/merge_md.py +0 -141
- erispulse-2.1.15.dev3/docs/UseCore.md +0 -138
- erispulse-2.1.15.dev3/examples/example-module/MyModule/Core.py +0 -31
- erispulse-2.1.15.dev3/examples/example-module/README.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.github/ISSUE_TEMPLATE/module_submission.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.github/assets/docs/install_pip.gif +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.github/assets/erispulse_logo.png +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.github/scripts/update_packages.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.github/workflows/auto-update-packages.yml +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.github/workflows/pypi-publish.yml +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.python-version +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/.worker/worker.js +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/CODE_OF_CONDUCT.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/README.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/SECURITY.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/devs/test_adapter.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/devs/test_files/test.docx +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/devs/test_files/test.jpg +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/devs/test_files/test.mp4 +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/AIModuleGeneration.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/AdapterStandards/APIResponse.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/AdapterStandards/EventConversion.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/AdapterStandards/README.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/CLI.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/Development/CLI.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/Development/README.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/StyleGuide/DocstringSpec.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/StyleGuide/README.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/docs/quick-start.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-adapter/LICENSE +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-adapter/MyAdapter/Core.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-adapter/MyAdapter/__init__.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-adapter/README.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-adapter/pyproject.toml +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-cli-module/LICENSE +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-cli-module/README.md +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-cli-module/my_cli_module/__init__.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-cli-module/my_cli_module/cli.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-cli-module/pyproject.toml +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-module/LICENSE +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-module/MyModule/__init__.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/examples/example-module/pyproject.toml +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/scripts/install/install.ps1 +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/scripts/install/install.sh +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/Core/adapter.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/Core/config.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/Core/env.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/Core/erispulse_config.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/Core/exceptions.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/Core/router.py +0 -0
- {erispulse-2.1.15.dev3 → erispulse-2.2.0}/src/ErisPulse/Core/storage.py +0 -0
|
@@ -0,0 +1,226 @@
|
|
|
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(' ', '-')})\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(' ', '-')}) | {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
|
+
outfile.write(f"<a id=\"{filename.replace('.', '').replace(' ', '-')}\"></a>\n")
|
|
42
|
+
outfile.write(f"## {file_info.get('description', filename)}\n\n")
|
|
43
|
+
|
|
44
|
+
with open(file_path, 'r', encoding='utf-8') as infile:
|
|
45
|
+
content = infile.read()
|
|
46
|
+
outfile.write(content)
|
|
47
|
+
outfile.write(f"\n\n---\n\n")
|
|
48
|
+
else:
|
|
49
|
+
print(f"文件不存在,跳过: {file_path}")
|
|
50
|
+
|
|
51
|
+
def merge_api_docs(api_dir, output_file):
|
|
52
|
+
"""
|
|
53
|
+
合并API文档
|
|
54
|
+
|
|
55
|
+
:param api_dir: API文档目录
|
|
56
|
+
:param output_file: 输出文件路径
|
|
57
|
+
"""
|
|
58
|
+
if not os.path.exists(api_dir):
|
|
59
|
+
print(f"API文档目录不存在: {api_dir}")
|
|
60
|
+
return
|
|
61
|
+
|
|
62
|
+
with open(output_file, 'a', encoding='utf-8') as outfile:
|
|
63
|
+
outfile.write("# API参考\n\n")
|
|
64
|
+
|
|
65
|
+
# 收集所有API文档文件
|
|
66
|
+
api_files = []
|
|
67
|
+
for root, _, files in os.walk(api_dir):
|
|
68
|
+
for file in files:
|
|
69
|
+
if file.endswith('.md'):
|
|
70
|
+
file_path = os.path.join(root, file)
|
|
71
|
+
api_files.append(file_path)
|
|
72
|
+
|
|
73
|
+
# 按路径排序以保持一致性
|
|
74
|
+
api_files.sort()
|
|
75
|
+
|
|
76
|
+
# 生成API文档目录
|
|
77
|
+
outfile.write("## API文档目录\n\n")
|
|
78
|
+
for file_path in api_files:
|
|
79
|
+
rel_path = os.path.relpath(file_path, api_dir)
|
|
80
|
+
anchor = rel_path.replace(os.sep, "_").replace(".md", "")
|
|
81
|
+
outfile.write(f"- [{rel_path}](#{anchor})\n")
|
|
82
|
+
outfile.write("\n---\n\n")
|
|
83
|
+
|
|
84
|
+
# 合并API文档内容
|
|
85
|
+
for file_path in api_files:
|
|
86
|
+
rel_path = os.path.relpath(file_path, api_dir)
|
|
87
|
+
anchor = rel_path.replace(os.sep, "_").replace(".md", "")
|
|
88
|
+
|
|
89
|
+
outfile.write(f"<a id=\"{anchor}\"></a>\n")
|
|
90
|
+
outfile.write(f"## {rel_path}\n\n")
|
|
91
|
+
|
|
92
|
+
try:
|
|
93
|
+
with open(file_path, 'r', encoding='utf-8') as infile:
|
|
94
|
+
content = infile.read()
|
|
95
|
+
# 移除原有标题,因为我们已经添加了
|
|
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 generate_full_document():
|
|
108
|
+
print("正在生成完整文档...")
|
|
109
|
+
|
|
110
|
+
# 要合并的文件
|
|
111
|
+
files_to_merge = [
|
|
112
|
+
{"path": "docs/quick-start.md", "description": "快速开始指南"},
|
|
113
|
+
{"path": "docs/UseCore.md", "description": "核心功能使用说明"},
|
|
114
|
+
{"path": "docs/PlatformFeatures.md", "description": "平台功能说明"},
|
|
115
|
+
{"path": "docs/Development/Module.md", "description": "模块开发指南"},
|
|
116
|
+
{"path": "docs/Development/Adapter.md", "description": "适配器开发指南"},
|
|
117
|
+
{"path": "docs/AdapterStandards/APIResponse.md", "description": "API响应标准"},
|
|
118
|
+
{"path": "docs/AdapterStandards/EventConversion.md", "description": "事件转换标准"},
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
# 过滤不存在的文件
|
|
122
|
+
existing_files = [f for f in files_to_merge if os.path.exists(f['path'])]
|
|
123
|
+
if len(existing_files) != len(files_to_merge):
|
|
124
|
+
print(f"警告: {len(files_to_merge) - len(existing_files)} 个文件不存在,已跳过")
|
|
125
|
+
|
|
126
|
+
output_file = "docs/AIDocs/ErisPulse-Full.md"
|
|
127
|
+
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
|
128
|
+
|
|
129
|
+
merge_md_files(output_file, existing_files, "完整开发文档")
|
|
130
|
+
merge_api_docs("docs/api", output_file)
|
|
131
|
+
|
|
132
|
+
print(f"完整文档生成完成,已保存到: {output_file}")
|
|
133
|
+
|
|
134
|
+
def generate_core_document():
|
|
135
|
+
print("正在生成核心功能文档...")
|
|
136
|
+
|
|
137
|
+
files_to_merge = [
|
|
138
|
+
{"path": "docs/quick-start.md", "description": "快速开始指南"},
|
|
139
|
+
{"path": "docs/UseCore.md", "description": "核心功能使用说明"},
|
|
140
|
+
{"path": "docs/PlatformFeatures.md", "description": "平台功能说明"},
|
|
141
|
+
]
|
|
142
|
+
|
|
143
|
+
# 过滤不存在的文件
|
|
144
|
+
existing_files = [f for f in files_to_merge if os.path.exists(f['path'])]
|
|
145
|
+
|
|
146
|
+
output_file = "docs/AIDocs/ErisPulse-Core.md"
|
|
147
|
+
os.makedirs(os.path.dirname(output_file), exist_ok=True)
|
|
148
|
+
|
|
149
|
+
merge_md_files(output_file, existing_files, "核心功能文档")
|
|
150
|
+
# 合并API文档
|
|
151
|
+
merge_api_docs("docs/api", output_file)
|
|
152
|
+
|
|
153
|
+
print(f"核心功能文档生成完成,已保存到: {output_file}")
|
|
154
|
+
|
|
155
|
+
def generate_dev_documents():
|
|
156
|
+
print("正在生成开发文档...")
|
|
157
|
+
|
|
158
|
+
# 模块开发文档
|
|
159
|
+
module_files = [
|
|
160
|
+
{"path": "docs/quick-start.md", "description": "快速开始指南"},
|
|
161
|
+
{"path": "docs/UseCore.md", "description": "核心功能使用说明"},
|
|
162
|
+
{"path": "docs/PlatformFeatures.md", "description": "平台支持的发送类型及差异性说明"},
|
|
163
|
+
{"path": "docs/Development/Module.md", "description": "模块开发指南"}
|
|
164
|
+
]
|
|
165
|
+
|
|
166
|
+
# 过滤不存在的文件
|
|
167
|
+
existing_module_files = [f for f in module_files if os.path.exists(f['path'])]
|
|
168
|
+
|
|
169
|
+
module_output = "docs/AIDocs/ErisPulse-ModuleDev.md"
|
|
170
|
+
os.makedirs(os.path.dirname(module_output), exist_ok=True)
|
|
171
|
+
merge_md_files(module_output, existing_module_files, "模块开发文档")
|
|
172
|
+
# 合并API文档
|
|
173
|
+
merge_api_docs("docs/api", module_output)
|
|
174
|
+
|
|
175
|
+
print(f"模块开发文档生成完成,已保存到: {module_output}")
|
|
176
|
+
|
|
177
|
+
# 适配器开发文档
|
|
178
|
+
adapter_files = [
|
|
179
|
+
{"path": "docs/quick-start.md", "description": "快速开始指南"},
|
|
180
|
+
{"path": "docs/UseCore.md", "description": "核心功能使用说明"},
|
|
181
|
+
{"path": "docs/Development/Adapter.md", "description": "适配器开发指南"},
|
|
182
|
+
{"path": "docs/AdapterStandards/APIResponse.md", "description": "API响应标准"},
|
|
183
|
+
{"path": "docs/AdapterStandards/EventConversion.md", "description": "事件转换标准"},
|
|
184
|
+
]
|
|
185
|
+
|
|
186
|
+
# 过滤不存在的文件
|
|
187
|
+
existing_adapter_files = [f for f in adapter_files if os.path.exists(f['path'])]
|
|
188
|
+
|
|
189
|
+
adapter_output = "docs/AIDocs/ErisPulse-AdapterDev.md"
|
|
190
|
+
os.makedirs(os.path.dirname(adapter_output), exist_ok=True)
|
|
191
|
+
merge_md_files(adapter_output, existing_adapter_files, "适配器开发文档")
|
|
192
|
+
# 合并API文档
|
|
193
|
+
merge_api_docs("docs/api", adapter_output)
|
|
194
|
+
|
|
195
|
+
print(f"适配器开发文档生成完成,已保存到: {adapter_output}")
|
|
196
|
+
|
|
197
|
+
def generate_custom_document(title, files, api_dirs, output_path):
|
|
198
|
+
"""
|
|
199
|
+
生成自定义文档
|
|
200
|
+
|
|
201
|
+
:param title: 文档标题
|
|
202
|
+
:param files: 要合并的文件列表
|
|
203
|
+
:param api_dirs: 要合并的API目录列表
|
|
204
|
+
:param output_path: 输出路径
|
|
205
|
+
"""
|
|
206
|
+
print(f"正在生成{title}...")
|
|
207
|
+
|
|
208
|
+
# 过滤不存在的文件
|
|
209
|
+
existing_files = [f for f in files if os.path.exists(f['path'])]
|
|
210
|
+
|
|
211
|
+
os.makedirs(os.path.dirname(output_path), exist_ok=True)
|
|
212
|
+
merge_md_files(output_path, existing_files, title)
|
|
213
|
+
|
|
214
|
+
# API文档
|
|
215
|
+
merge_api_docs("docs/api", output_path)
|
|
216
|
+
|
|
217
|
+
print(f"{title}生成完成,已保存到: {output_path}")
|
|
218
|
+
|
|
219
|
+
if __name__ == "__main__":
|
|
220
|
+
try:
|
|
221
|
+
generate_full_document()
|
|
222
|
+
generate_core_document()
|
|
223
|
+
generate_dev_documents()
|
|
224
|
+
print("所有文档生成完成")
|
|
225
|
+
except Exception as e:
|
|
226
|
+
print(f"文档生成过程中出现错误: {str(e)}")
|
|
@@ -102,7 +102,7 @@ def parse_python_file(file_path: str) -> Tuple[Optional[str], List[Dict], List[D
|
|
|
102
102
|
try:
|
|
103
103
|
module = ast.parse(source)
|
|
104
104
|
except SyntaxError:
|
|
105
|
-
print(f"
|
|
105
|
+
print(f"语法错误,跳过文件: {file_path}")
|
|
106
106
|
return None, [], []
|
|
107
107
|
|
|
108
108
|
# 提取模块文档
|
|
@@ -211,9 +211,9 @@ def generate_markdown(module_path: str, module_doc: Optional[str],
|
|
|
211
211
|
content = []
|
|
212
212
|
|
|
213
213
|
# 文档头部
|
|
214
|
-
content.append(f"""#
|
|
214
|
+
content.append(f"""# `{module_path}` 模块
|
|
215
215
|
|
|
216
|
-
<sup
|
|
216
|
+
<sup>更新时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}</sup>
|
|
217
217
|
|
|
218
218
|
---
|
|
219
219
|
|
|
@@ -229,9 +229,9 @@ def generate_markdown(module_path: str, module_doc: Optional[str],
|
|
|
229
229
|
|
|
230
230
|
# 函数部分
|
|
231
231
|
if functions:
|
|
232
|
-
content.append("##
|
|
232
|
+
content.append("## 函数列表\n")
|
|
233
233
|
for func in functions:
|
|
234
|
-
async_marker = "
|
|
234
|
+
async_marker = "async " if func["is_async"] else ""
|
|
235
235
|
content.append(f"""### {async_marker}`{func['signature']}`
|
|
236
236
|
|
|
237
237
|
{func['doc']}
|
|
@@ -241,7 +241,7 @@ def generate_markdown(module_path: str, module_doc: Optional[str],
|
|
|
241
241
|
|
|
242
242
|
# 类部分
|
|
243
243
|
if classes:
|
|
244
|
-
content.append("##
|
|
244
|
+
content.append("## 类列表\n")
|
|
245
245
|
for cls in classes:
|
|
246
246
|
content.append(f"""### `{cls['signature']}`
|
|
247
247
|
|
|
@@ -251,9 +251,9 @@ def generate_markdown(module_path: str, module_doc: Optional[str],
|
|
|
251
251
|
|
|
252
252
|
# 类方法
|
|
253
253
|
if cls["methods"]:
|
|
254
|
-
content.append("####
|
|
254
|
+
content.append("#### 方法列表\n")
|
|
255
255
|
for method in cls["methods"]:
|
|
256
|
-
async_marker = "
|
|
256
|
+
async_marker = "async " if method["is_async"] else ""
|
|
257
257
|
content.append(f"""##### {async_marker}`{method['signature']}`
|
|
258
258
|
|
|
259
259
|
{method['doc']}
|
|
@@ -480,8 +480,8 @@ def generate_html(module_path: str, module_doc: Optional[str],
|
|
|
480
480
|
<body>
|
|
481
481
|
<header>
|
|
482
482
|
<div class="container">
|
|
483
|
-
<h1
|
|
484
|
-
<p><small
|
|
483
|
+
<h1>`{module_path}` 模块</h1>
|
|
484
|
+
<p><small>更新时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}</small></p>
|
|
485
485
|
</div>
|
|
486
486
|
</header>
|
|
487
487
|
|
|
@@ -498,18 +498,18 @@ def generate_html(module_path: str, module_doc: Optional[str],
|
|
|
498
498
|
|
|
499
499
|
# 函数部分
|
|
500
500
|
if functions:
|
|
501
|
-
html_content.append("</section>\n\n<section>\n<h2
|
|
501
|
+
html_content.append("</section>\n\n<section>\n<h2>函数列表</h2>\n")
|
|
502
502
|
for func in functions:
|
|
503
|
-
async_marker = "
|
|
503
|
+
async_marker = "async " if func["is_async"] else ""
|
|
504
504
|
html_content.append(f"""<article>
|
|
505
|
-
<h3
|
|
505
|
+
<h3><code class="signature function-signature">{async_marker}{func['signature']}</code></h3>
|
|
506
506
|
<div>{func['doc']}</div>
|
|
507
507
|
</article>
|
|
508
508
|
""")
|
|
509
509
|
|
|
510
510
|
# 类部分
|
|
511
511
|
if classes:
|
|
512
|
-
html_content.append("</section>\n\n<section>\n<h2
|
|
512
|
+
html_content.append("</section>\n\n<section>\n<h2>类列表</h2>\n")
|
|
513
513
|
for cls in classes:
|
|
514
514
|
html_content.append(f"""<article>
|
|
515
515
|
<h3><code class="signature class-signature">{cls['signature']}</code></h3>
|
|
@@ -518,11 +518,11 @@ def generate_html(module_path: str, module_doc: Optional[str],
|
|
|
518
518
|
|
|
519
519
|
# 类方法
|
|
520
520
|
if cls["methods"]:
|
|
521
|
-
html_content.append("<h4
|
|
521
|
+
html_content.append("<h4>方法列表</h4>\n")
|
|
522
522
|
for method in cls["methods"]:
|
|
523
|
-
async_marker = "
|
|
523
|
+
async_marker = "async " if method["is_async"] else ""
|
|
524
524
|
html_content.append(f"""<article>
|
|
525
|
-
<h5
|
|
525
|
+
<h5><code class="signature method-signature">{async_marker}{method['signature']}</code></h5>
|
|
526
526
|
<div>{method['doc']}</div>
|
|
527
527
|
</article>
|
|
528
528
|
""")
|
|
@@ -539,7 +539,7 @@ def generate_html(module_path: str, module_doc: Optional[str],
|
|
|
539
539
|
</footer>
|
|
540
540
|
</body>
|
|
541
541
|
</html>""")
|
|
542
|
-
|
|
542
|
+
|
|
543
543
|
return "\n".join(html_content)
|
|
544
544
|
|
|
545
545
|
def generate_api_docs(src_dir: str, output_dir: str, format: str = "markdown"):
|
|
@@ -568,7 +568,7 @@ def generate_api_docs(src_dir: str, output_dir: str, format: str = "markdown"):
|
|
|
568
568
|
|
|
569
569
|
# 跳过没有文档的文件
|
|
570
570
|
if not module_doc and not classes and not functions:
|
|
571
|
-
print(f"
|
|
571
|
+
print(f"跳过无文档文件: {file_path}")
|
|
572
572
|
continue
|
|
573
573
|
|
|
574
574
|
# 生成内容
|
|
@@ -586,7 +586,7 @@ def generate_api_docs(src_dir: str, output_dir: str, format: str = "markdown"):
|
|
|
586
586
|
with open(output_path, "w", encoding="utf-8") as f:
|
|
587
587
|
f.write(content)
|
|
588
588
|
|
|
589
|
-
print(f"
|
|
589
|
+
print(f"已生成: {output_path}")
|
|
590
590
|
|
|
591
591
|
if __name__ == "__main__":
|
|
592
592
|
parser = argparse.ArgumentParser(description="API文档生成器")
|
|
@@ -597,20 +597,11 @@ if __name__ == "__main__":
|
|
|
597
597
|
|
|
598
598
|
args = parser.parse_args()
|
|
599
599
|
|
|
600
|
-
print(f"""
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
600
|
+
print(f"""源代码目录: {args.src}
|
|
601
|
+
输出目录: {args.output}
|
|
602
|
+
输出格式: {args.format}
|
|
603
|
+
正在生成API文档...""")
|
|
604
604
|
|
|
605
605
|
generate_api_docs(args.src, args.output, args.format)
|
|
606
606
|
|
|
607
|
-
print(f"
|
|
608
|
-
|
|
609
|
-
生成文档包含以下改进:
|
|
610
|
-
✨ 更现代化的样式和布局
|
|
611
|
-
📅 自动添加生成时间戳
|
|
612
|
-
🔖 使用emoji图标提高可读性
|
|
613
|
-
📝 优化了参数和返回值的显示方式
|
|
614
|
-
📱 响应式设计,适配移动设备
|
|
615
|
-
💡 改进了示例代码的展示方式
|
|
616
|
-
""")
|
|
607
|
+
print(f"API文档生成完成!")
|
|
@@ -5,7 +5,7 @@ permissions:
|
|
|
5
5
|
|
|
6
6
|
on:
|
|
7
7
|
push:
|
|
8
|
-
branches: [main]
|
|
8
|
+
branches: [main, Pre-Release/v2]
|
|
9
9
|
|
|
10
10
|
jobs:
|
|
11
11
|
auto-tag-and-release:
|
|
@@ -96,15 +96,16 @@ jobs:
|
|
|
96
96
|
changelog="$changelog\n\n"
|
|
97
97
|
fi
|
|
98
98
|
|
|
99
|
-
#
|
|
99
|
+
# 贡献信息
|
|
100
100
|
changelog="${changelog}### 🧙♀️ 魔法贡献者\n\n"
|
|
101
101
|
while IFS= read -r contributor; do
|
|
102
|
-
|
|
102
|
+
escaped_contributor=$(echo "$contributor" | sed 's/>/\>/g' | sed 's/</\</g')
|
|
103
|
+
changelog="${changelog}- ${escaped_contributor}\n"
|
|
103
104
|
done <<< "$contributors"
|
|
104
|
-
|
|
105
|
-
# 添加提交信息
|
|
105
|
+
|
|
106
106
|
changelog="${changelog}\n### 📜 魔法卷轴更新\n\n"
|
|
107
|
-
|
|
107
|
+
escaped_commit_msg=$(echo "$commit_msg" | sed 's/#/\\#/g')
|
|
108
|
+
changelog="${changelog}- 最新提交: $escaped_commit_msg (by $commit_author, $commit_short)\n"
|
|
108
109
|
changelog="${changelog}- 变更文件: ${{ steps.changed_files.outputs.files }}\n"
|
|
109
110
|
|
|
110
111
|
if ! git rev-parse "$tag_name" >/dev/null 2>&1; then
|
|
@@ -125,4 +126,4 @@ jobs:
|
|
|
125
126
|
--prerelease=$is_dev
|
|
126
127
|
echo "✨ 已发布新的魔法版本 $tag_name"
|
|
127
128
|
fi
|
|
128
|
-
|
|
129
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# 项目贡献指南
|
|
2
|
+
|
|
3
|
+
## 分支管理规范
|
|
4
|
+
|
|
5
|
+
### 分支结构
|
|
6
|
+
- **main**: 主分支,存放稳定可发布的代码
|
|
7
|
+
- **Develop/v2**: 开发主分支,所有功能分支最终合并至此
|
|
8
|
+
- **Pre-Release/v2**: 预发布分支,用于版本发布前的测试
|
|
9
|
+
- **feature/***: 功能开发分支,按功能命名
|
|
10
|
+
- **Archive/v1**: 归档分支,存放旧版本代码
|
|
11
|
+
|
|
12
|
+
## 贡献流程
|
|
13
|
+
|
|
14
|
+
1. **Fork仓库**
|
|
15
|
+
- 首先fork主仓库到您的个人账户
|
|
16
|
+
|
|
17
|
+
2. **创建个人分支**
|
|
18
|
+
- 从`Develop/v2`创建您的功能分支,命名规范:
|
|
19
|
+
- `feature/描述性名称` (如`feature/wsu2059q`) -> 可为长期的功能开发/修复分支
|
|
20
|
+
|
|
21
|
+
3. **开发工作**
|
|
22
|
+
- 在您的功能分支上进行开发
|
|
23
|
+
- 保持提交信息清晰明确
|
|
24
|
+
- 提交前确保已经在ChangeLog中添加描述
|
|
25
|
+
- 定期从`Develop/v2`拉取更新以避免冲突
|
|
26
|
+
|
|
27
|
+
4. **提交Pull Request**
|
|
28
|
+
- 开发完成后,向`Develop/v2`分支提交PR
|
|
29
|
+
- 在PR的模板中勾选对应选项 或 添加一些详情信息
|
|
30
|
+
|
|
31
|
+
5. **合并到Develop/v2**
|
|
32
|
+
- 审查通过后,代码将被合并到`Develop/v2`
|
|
33
|
+
|
|
34
|
+
6. **发布流程**
|
|
35
|
+
- 版本更新, `Develop/v2` 会随更新合并到 `Pre-Release/v2` 发布并进行测试
|
|
36
|
+
- 测试通过后,代码将最终发布到`main`分支
|
|
37
|
+
|
|
38
|
+
## 注意事项
|
|
39
|
+
|
|
40
|
+
- 请勿直接向`main`或`Pre-Release/v2`分支提交代码
|
|
41
|
+
- 如有疑问,请联系 `support@erisdev.com` 或者 添加我们的社交讨论群: 云湖群ID -> 635409929
|
|
42
|
+
|
|
43
|
+
感谢您的贡献!
|
|
@@ -28,4 +28,10 @@ This SDK's core adapter standardization layer strictly follows OneBot12 specific
|
|
|
28
28
|
- Message segment definitions
|
|
29
29
|
- Metadata definitions
|
|
30
30
|
|
|
31
|
-
This ensures consistent behavior and interoperability across all adapter implementations.
|
|
31
|
+
This ensures consistent behavior and interoperability across all adapter implementations.
|
|
32
|
+
|
|
33
|
+
感谢所有为开源社区做出贡献的开发者和作者
|
|
34
|
+
|
|
35
|
+
请尊重每一位开源作者的劳动成果,承诺在使用、修改和分发本软件时,将严格遵守相关许可证条款,并保留所有原始版权声明
|
|
36
|
+
|
|
37
|
+
开源精神的核心在于分享、协作与尊重。我们希望通过本项目,能够传承这一精神,为开源社区的发展贡献一份力量
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ErisPulse
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
|
|
5
5
|
Author-email: "艾莉丝·格雷拉特(WSu2059)" <wsu2059@qq.com>
|
|
6
6
|
License: MIT License
|
|
@@ -34,6 +34,12 @@ License: MIT License
|
|
|
34
34
|
- Metadata definitions
|
|
35
35
|
|
|
36
36
|
This ensures consistent behavior and interoperability across all adapter implementations.
|
|
37
|
+
|
|
38
|
+
感谢所有为开源社区做出贡献的开发者和作者
|
|
39
|
+
|
|
40
|
+
请尊重每一位开源作者的劳动成果,承诺在使用、修改和分发本软件时,将严格遵守相关许可证条款,并保留所有原始版权声明
|
|
41
|
+
|
|
42
|
+
开源精神的核心在于分享、协作与尊重。我们希望通过本项目,能够传承这一精神,为开源社区的发展贡献一份力量
|
|
37
43
|
License-File: LICENSE
|
|
38
44
|
Classifier: Development Status :: 5 - Production/Stable
|
|
39
45
|
Classifier: Intended Audience :: Developers
|
|
@@ -74,7 +74,7 @@ async def test_logger():
|
|
|
74
74
|
|
|
75
75
|
print(f"\n{Colors.GREEN}日志测试完成,请查看控制台和文件 {log_file} 的输出{Colors.END}")
|
|
76
76
|
|
|
77
|
-
async def
|
|
77
|
+
async def test_storage():
|
|
78
78
|
while True:
|
|
79
79
|
print(f"\n{Colors.CYAN}--- 环境配置测试 ---{Colors.END}")
|
|
80
80
|
print(f"{Colors.BLUE}1. 设置/获取单个配置项{Colors.END}")
|
|
@@ -91,36 +91,36 @@ async def test_env():
|
|
|
91
91
|
print(f"\n{Colors.YELLOW}--- 单个配置项测试 ---{Colors.END}")
|
|
92
92
|
key = input(f"{Colors.GREEN}请输入配置项名称: {Colors.END}").strip()
|
|
93
93
|
value = input(f"{Colors.GREEN}请输入{key}的值: {Colors.END}").strip()
|
|
94
|
-
sdk.
|
|
94
|
+
sdk.storage.set(key, value)
|
|
95
95
|
print(f"{Colors.GREEN}已设置 {key}={value}{Colors.END}")
|
|
96
|
-
print(f"{Colors.GREEN}读取测试: {key} = {sdk.
|
|
96
|
+
print(f"{Colors.GREEN}读取测试: {key} = {sdk.storage.get(key)}{Colors.END}")
|
|
97
97
|
|
|
98
98
|
elif choice == "2":
|
|
99
99
|
print(f"\n{Colors.YELLOW}--- 批量配置项测试 ---{Colors.END}")
|
|
100
100
|
count = input(f"{Colors.GREEN}请输入要批量设置的配置项数量(默认3): {Colors.END}") or "3"
|
|
101
101
|
items = {f"test_key_{i}": f"value_{i}" for i in range(1, int(count)+1)}
|
|
102
|
-
sdk.
|
|
102
|
+
sdk.storage.set_multi(items)
|
|
103
103
|
print(f"{Colors.GREEN}已批量设置 {len(items)} 个配置项{Colors.END}")
|
|
104
|
-
print(f"{Colors.GREEN}批量读取结果: {sdk.
|
|
104
|
+
print(f"{Colors.GREEN}批量读取结果: {sdk.storage.get_multi(list(items.keys()))}{Colors.END}")
|
|
105
105
|
|
|
106
106
|
elif choice == "3":
|
|
107
107
|
print(f"\n{Colors.YELLOW}--- 测试配置管理 ---{Colors.END}")
|
|
108
108
|
config_key = input(f"{Colors.GREEN}请输入配置项key: {Colors.END}") or None
|
|
109
109
|
config_value = input(f"{Colors.GREEN}请输入配置项value: {Colors.END}") or None
|
|
110
110
|
if config_key and config_value:
|
|
111
|
-
sdk.
|
|
111
|
+
sdk.storage.setConfig(config_key, config_value)
|
|
112
112
|
print(f"{Colors.GREEN}已设置 {config_key}={config_value}{Colors.END}")
|
|
113
|
-
print(f"{Colors.GREEN}读取测试: {config_key} = {sdk.
|
|
113
|
+
print(f"{Colors.GREEN}读取测试: {config_key} = {sdk.storage.getConfig(config_key)}{Colors.END}")
|
|
114
114
|
else:
|
|
115
115
|
print(f"{Colors.RED}请设置配置项key和value{Colors.END}")
|
|
116
116
|
|
|
117
117
|
elif choice == "4":
|
|
118
118
|
print(f"\n{Colors.YELLOW}--- 事务操作测试 ---{Colors.END}")
|
|
119
119
|
print(f"{Colors.YELLOW}开始事务...{Colors.END}")
|
|
120
|
-
with sdk.
|
|
121
|
-
sdk.
|
|
122
|
-
sdk.
|
|
123
|
-
print(f"{Colors.GREEN}事务中设置的值: tx_key1={sdk.
|
|
120
|
+
with sdk.storage.transaction():
|
|
121
|
+
sdk.storage.set("tx_key1", "value1")
|
|
122
|
+
sdk.storage.set("tx_key2", "value2")
|
|
123
|
+
print(f"{Colors.GREEN}事务中设置的值: tx_key1={sdk.storage.get('tx_key1')}{Colors.END}")
|
|
124
124
|
print(f"{Colors.GREEN}事务提交成功{Colors.END}")
|
|
125
125
|
|
|
126
126
|
elif choice == "5":
|
|
@@ -128,11 +128,11 @@ async def test_env():
|
|
|
128
128
|
try:
|
|
129
129
|
# 测试创建快照
|
|
130
130
|
snapshot_name = input(f"{Colors.GREEN}请输入快照名称(默认: test_snapshot): {Colors.END}") or "test_snapshot"
|
|
131
|
-
snapshot_path = sdk.
|
|
131
|
+
snapshot_path = sdk.storage.snapshot(snapshot_name)
|
|
132
132
|
print(f"{Colors.GREEN}✓ 快照创建成功: {snapshot_path}{Colors.END}")
|
|
133
133
|
|
|
134
134
|
# 测试列出快照
|
|
135
|
-
snapshots = sdk.
|
|
135
|
+
snapshots = sdk.storage.list_snapshots()
|
|
136
136
|
print(f"\n{Colors.CYAN}当前可用快照:{Colors.END}")
|
|
137
137
|
for i, (name, date, size) in enumerate(snapshots, 1):
|
|
138
138
|
print(f"{i}. {name} - {date.strftime('%Y-%m-%d %H:%M:%S')} ({size/1024:.1f} KB)")
|
|
@@ -142,7 +142,7 @@ async def test_env():
|
|
|
142
142
|
restore_choice = input(f"\n{Colors.GREEN}是否要测试恢复快照?(y/n): {Colors.END}").lower()
|
|
143
143
|
if restore_choice == 'y':
|
|
144
144
|
snap_name = snapshots[0][0] # 取第一个快照
|
|
145
|
-
if sdk.
|
|
145
|
+
if sdk.storage.restore(snap_name):
|
|
146
146
|
print(f"{Colors.GREEN}✓ 快照恢复成功: {snap_name}{Colors.END}")
|
|
147
147
|
else:
|
|
148
148
|
print(f"{Colors.RED}✗ 快照恢复失败{Colors.END}")
|
|
@@ -357,14 +357,14 @@ async def main():
|
|
|
357
357
|
if choice == "1":
|
|
358
358
|
print("\n核心模块列表:")
|
|
359
359
|
print("- logger: 日志记录系统")
|
|
360
|
-
print("-
|
|
360
|
+
print("- storage: 数据存储系统")
|
|
361
361
|
print("- exceptions: 异常处理系统")
|
|
362
362
|
print("- router: 路由管理")
|
|
363
363
|
print("- adapter: 适配器系统")
|
|
364
364
|
elif choice == "2":
|
|
365
365
|
await test_logger()
|
|
366
366
|
elif choice == "3":
|
|
367
|
-
await
|
|
367
|
+
await test_storage()
|
|
368
368
|
elif choice == "4":
|
|
369
369
|
await test_exceptions()
|
|
370
370
|
elif choice == "5":
|