ErisPulse 2.4.1__tar.gz → 2.4.2.dev1__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.4.1 → erispulse-2.4.2.dev1}/PKG-INFO +5 -4
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/README.md +4 -3
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/pyproject.toml +1 -1
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/cli.py +4 -57
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/cli.pyi +1 -16
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/init.py +1 -1
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/install.py +6 -64
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/install.pyi +1 -3
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/list.py +2 -32
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/list_remote.py +2 -24
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/uninstall.py +0 -9
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/registry.py +5 -33
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/registry.pyi +1 -23
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/utils/package_manager.py +76 -63
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/utils/package_manager.pyi +4 -6
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/command.py +3 -2
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/message.py +9 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/message.pyi +8 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/message_builder.py +0 -25
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/message_builder.pyi +0 -21
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/meta.py +9 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/meta.pyi +8 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/notice.py +9 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/notice.pyi +8 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/request.py +9 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/request.pyi +8 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/wrapper.py +80 -24
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/adapter.py +189 -42
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/adapter.pyi +24 -5
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/config.py +89 -39
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/config.pyi +17 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/module.py +95 -17
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/module.pyi +50 -5
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/router.py +84 -4
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/router.pyi +28 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/finders/__init__.py +1 -3
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/finders/__init__.pyi +1 -2
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/module.py +12 -4
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/sdk.py +85 -53
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/sdk.pyi +39 -8
- erispulse-2.4.1/src/ErisPulse/finders/cli.py +0 -120
- erispulse-2.4.1/src/ErisPulse/finders/cli.pyi +0 -94
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/.gitignore +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/LICENSE +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/base.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/base.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/init.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/list.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/list_remote.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/run.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/run.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/self_update.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/self_update.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/uninstall.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/upgrade.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/commands/upgrade.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/console.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/console.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/utils/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/CLI/utils/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Bases/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Bases/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Bases/adapter.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Bases/adapter.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Bases/manager.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Bases/manager.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Bases/module.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Bases/module.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/base.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/base.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/command.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/session_type.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/session_type.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/Event/wrapper.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/lifecycle.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/lifecycle.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/logger.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/logger.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/storage.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/Core/storage.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/__main__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/__main__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/finders/adapter.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/finders/adapter.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/finders/bases/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/finders/bases/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/finders/bases/finder.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/finders/bases/finder.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/finders/module.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/finders/module.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/adapter.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/adapter.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/bases/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/bases/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/bases/loader.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/bases/loader.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/module.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/strategy.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/loaders/strategy.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/runtime/__init__.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/runtime/__init__.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/runtime/cleanup.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/runtime/cleanup.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/runtime/exceptions.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/runtime/exceptions.pyi +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/runtime/frame_config.py +0 -0
- {erispulse-2.4.1 → erispulse-2.4.2.dev1}/src/ErisPulse/runtime/frame_config.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ErisPulse
|
|
3
|
-
Version: 2.4.
|
|
3
|
+
Version: 2.4.2.dev1
|
|
4
4
|
Summary: ErisPulse 是一个模块化、可扩展的异步 Python SDK 框架,主要用于构建高效、可维护的机器人应用程序。
|
|
5
5
|
Author-email: ErisDev <erisdev@88.com>
|
|
6
6
|
Maintainer-email: "艾莉丝·格雷拉特(WSu2059)" <wsu2059@qq.com>
|
|
@@ -89,8 +89,9 @@ Description-Content-Type: text/markdown
|
|
|
89
89
|
|
|
90
90
|
[](https://pypi.org/project/ErisPulse/)
|
|
91
91
|
[](https://pypi.org/project/ErisPulse/)
|
|
92
|
-
[](https://hub.docker.com/r/erispulse/erispulse)
|
|
93
|
+
[](https://hub.docker.com/r/erispulse/erispulse)
|
|
94
|
+
[](https://hub.docker.com/r/erispulse/erispulse)
|
|
94
95
|
[](https://github.com/astral-sh/ruff)
|
|
95
96
|
|
|
96
97
|
</td>
|
|
@@ -116,7 +117,7 @@ ErisPulse 是一个基于 Python 的事件驱动型多平台机器人开发框
|
|
|
116
117
|
### 使用 Docker (推荐)
|
|
117
118
|
|
|
118
119
|
```bash
|
|
119
|
-
docker pull
|
|
120
|
+
docker pull erispulse/erispulse:latest
|
|
120
121
|
```
|
|
121
122
|
|
|
122
123
|
<details>
|
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
|
|
18
18
|
[](https://pypi.org/project/ErisPulse/)
|
|
19
19
|
[](https://pypi.org/project/ErisPulse/)
|
|
20
|
-
[](https://hub.docker.com/r/erispulse/erispulse)
|
|
21
|
+
[](https://hub.docker.com/r/erispulse/erispulse)
|
|
22
|
+
[](https://hub.docker.com/r/erispulse/erispulse)
|
|
22
23
|
[](https://github.com/astral-sh/ruff)
|
|
23
24
|
|
|
24
25
|
</td>
|
|
@@ -44,7 +45,7 @@ ErisPulse 是一个基于 Python 的事件驱动型多平台机器人开发框
|
|
|
44
45
|
### 使用 Docker (推荐)
|
|
45
46
|
|
|
46
47
|
```bash
|
|
47
|
-
docker pull
|
|
48
|
+
docker pull erispulse/erispulse:latest
|
|
48
49
|
```
|
|
49
50
|
|
|
50
51
|
<details>
|
|
@@ -6,9 +6,6 @@ ErisPulse 命令行接口主入口
|
|
|
6
6
|
|
|
7
7
|
import sys
|
|
8
8
|
import importlib
|
|
9
|
-
import importlib.metadata
|
|
10
|
-
import asyncio
|
|
11
|
-
import inspect
|
|
12
9
|
import traceback
|
|
13
10
|
import pkgutil
|
|
14
11
|
from argparse import ArgumentParser, RawDescriptionHelpFormatter
|
|
@@ -24,7 +21,7 @@ class CLI:
|
|
|
24
21
|
"""
|
|
25
22
|
ErisPulse 命令行接口主类
|
|
26
23
|
|
|
27
|
-
|
|
24
|
+
提供完整的命令行交互功能
|
|
28
25
|
"""
|
|
29
26
|
|
|
30
27
|
def __init__(self):
|
|
@@ -32,7 +29,6 @@ class CLI:
|
|
|
32
29
|
self.registry = CommandRegistry()
|
|
33
30
|
self.parser = self._create_parser()
|
|
34
31
|
self._register_builtin_commands()
|
|
35
|
-
self._load_external_commands()
|
|
36
32
|
|
|
37
33
|
def _create_parser(self) -> ArgumentParser:
|
|
38
34
|
"""
|
|
@@ -128,30 +124,6 @@ class CLI:
|
|
|
128
124
|
)
|
|
129
125
|
command.add_arguments(parser)
|
|
130
126
|
|
|
131
|
-
def _load_external_commands(self):
|
|
132
|
-
"""
|
|
133
|
-
加载第三方 CLI 命令
|
|
134
|
-
"""
|
|
135
|
-
try:
|
|
136
|
-
entry_points = importlib.metadata.entry_points()
|
|
137
|
-
if hasattr(entry_points, 'select'):
|
|
138
|
-
cli_entries = entry_points.select(group='erispulse.cli')
|
|
139
|
-
else:
|
|
140
|
-
cli_entries = entry_points.get('erispulse.cli', [])
|
|
141
|
-
|
|
142
|
-
for entry in cli_entries:
|
|
143
|
-
try:
|
|
144
|
-
cli_func = entry.load()
|
|
145
|
-
if callable(cli_func):
|
|
146
|
-
# 传入 subparsers 和 console,保持兼容性
|
|
147
|
-
cli_func(self.subparsers, console)
|
|
148
|
-
else:
|
|
149
|
-
console.print(f"[warning]模块 {entry.name} 的入口点不是可调用对象[/]")
|
|
150
|
-
except Exception as e:
|
|
151
|
-
console.print(f"[error]加载第三方命令 {entry.name} 失败: {e}[/]")
|
|
152
|
-
except Exception as e:
|
|
153
|
-
console.print(f"[warning]加载第三方CLI命令失败: {e}[/]")
|
|
154
|
-
|
|
155
127
|
def _print_version(self):
|
|
156
128
|
"""打印版本信息"""
|
|
157
129
|
from ErisPulse import __version__
|
|
@@ -192,8 +164,9 @@ class CLI:
|
|
|
192
164
|
if command:
|
|
193
165
|
command.execute(args)
|
|
194
166
|
else:
|
|
195
|
-
|
|
196
|
-
self.
|
|
167
|
+
console.print(f"[error]未知命令: {args.command}[/]")
|
|
168
|
+
self.parser.print_help()
|
|
169
|
+
sys.exit(1)
|
|
197
170
|
|
|
198
171
|
except KeyboardInterrupt:
|
|
199
172
|
console.print("\n[warning]操作被用户中断[/]")
|
|
@@ -203,29 +176,3 @@ class CLI:
|
|
|
203
176
|
if args.verbose >= 1:
|
|
204
177
|
console.print(traceback.format_exc())
|
|
205
178
|
sys.exit(1)
|
|
206
|
-
|
|
207
|
-
def _execute_external_command(self, args):
|
|
208
|
-
"""
|
|
209
|
-
执行第三方命令
|
|
210
|
-
|
|
211
|
-
:param args: 解析后的参数
|
|
212
|
-
"""
|
|
213
|
-
try:
|
|
214
|
-
# 第三方命令在注册时已经通过 set_defaults(func=handle_command) 设置了处理函数
|
|
215
|
-
# 所以 args.func 就是处理函数
|
|
216
|
-
if hasattr(args, 'func') and args.func:
|
|
217
|
-
handler_func = args.func
|
|
218
|
-
if inspect.iscoroutinefunction(handler_func):
|
|
219
|
-
# 异步函数:使用 asyncio.run() 运行
|
|
220
|
-
asyncio.run(handler_func(args))
|
|
221
|
-
else:
|
|
222
|
-
# 同步函数:直接调用
|
|
223
|
-
handler_func(args)
|
|
224
|
-
else:
|
|
225
|
-
console.print(f"[error]命令 {args.command} 没有处理函数[/]")
|
|
226
|
-
sys.exit(1)
|
|
227
|
-
except Exception as e:
|
|
228
|
-
console.print(f"[error]执行第三方命令失败: {e}[/]")
|
|
229
|
-
if args.verbose >= 1:
|
|
230
|
-
console.print(traceback.format_exc())
|
|
231
|
-
sys.exit(1)
|
|
@@ -12,9 +12,6 @@ ErisPulse 命令行接口主入口
|
|
|
12
12
|
|
|
13
13
|
import sys
|
|
14
14
|
import importlib
|
|
15
|
-
import importlib.metadata
|
|
16
|
-
import asyncio
|
|
17
|
-
import inspect
|
|
18
15
|
import traceback
|
|
19
16
|
import pkgutil
|
|
20
17
|
from argparse import ArgumentParser, RawDescriptionHelpFormatter
|
|
@@ -27,7 +24,7 @@ class CLI:
|
|
|
27
24
|
"""
|
|
28
25
|
ErisPulse 命令行接口主类
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
提供完整的命令行交互功能
|
|
31
28
|
"""
|
|
32
29
|
def __init__(self: None) -> ...:
|
|
33
30
|
"""
|
|
@@ -54,11 +51,6 @@ class CLI:
|
|
|
54
51
|
注册所有内置命令(通过自动发现)
|
|
55
52
|
"""
|
|
56
53
|
...
|
|
57
|
-
def _load_external_commands(self: object) -> ...:
|
|
58
|
-
"""
|
|
59
|
-
加载第三方 CLI 命令
|
|
60
|
-
"""
|
|
61
|
-
...
|
|
62
54
|
def _print_version(self: object) -> ...:
|
|
63
55
|
"""
|
|
64
56
|
打印版本信息
|
|
@@ -72,10 +64,3 @@ class CLI:
|
|
|
72
64
|
:raises Exception: 命令执行失败时抛出
|
|
73
65
|
"""
|
|
74
66
|
...
|
|
75
|
-
def _execute_external_command(self: object, args: ...) -> ...:
|
|
76
|
-
"""
|
|
77
|
-
执行第三方命令
|
|
78
|
-
|
|
79
|
-
:param args: 解析后的参数
|
|
80
|
-
"""
|
|
81
|
-
...
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""
|
|
2
2
|
Install 命令实现
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
支持交互式和批量安装模块、适配器
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
7
|
import sys
|
|
@@ -20,7 +20,7 @@ from ..base import Command
|
|
|
20
20
|
|
|
21
21
|
class InstallCommand(Command):
|
|
22
22
|
name = "install"
|
|
23
|
-
description = "
|
|
23
|
+
description = "安装模块/适配器包"
|
|
24
24
|
|
|
25
25
|
def __init__(self):
|
|
26
26
|
self.package_manager = PackageManager()
|
|
@@ -256,7 +256,7 @@ class InstallCommand(Command):
|
|
|
256
256
|
:param pre: 是否包含预发布版本
|
|
257
257
|
"""
|
|
258
258
|
console.print(Panel(
|
|
259
|
-
"[bold cyan]ErisPulse
|
|
259
|
+
"[bold cyan]ErisPulse 安装组件[/]\n"
|
|
260
260
|
"选择您要安装的组件类型",
|
|
261
261
|
title="欢迎",
|
|
262
262
|
border_style="cyan"
|
|
@@ -271,13 +271,12 @@ class InstallCommand(Command):
|
|
|
271
271
|
console.print("[bold cyan]请选择组件类型:[/]")
|
|
272
272
|
console.print(" 1. 适配器")
|
|
273
273
|
console.print(" 2. 模块")
|
|
274
|
-
console.print(" 3.
|
|
275
|
-
console.print(" 4. 自定义安装")
|
|
274
|
+
console.print(" 3. 自定义安装")
|
|
276
275
|
console.print(" q. 退出")
|
|
277
276
|
|
|
278
277
|
choice = Prompt.ask(
|
|
279
|
-
"\n请输入选项
|
|
280
|
-
choices=["1", "2", "3", "
|
|
278
|
+
"\n请输入选项 ",
|
|
279
|
+
choices=["1", "2", "3", "q"],
|
|
281
280
|
default="q"
|
|
282
281
|
)
|
|
283
282
|
|
|
@@ -290,8 +289,6 @@ class InstallCommand(Command):
|
|
|
290
289
|
elif choice == "2":
|
|
291
290
|
self._install_modules(remote_packages, upgrade, pre)
|
|
292
291
|
elif choice == "3":
|
|
293
|
-
self._install_cli_extensions(remote_packages, upgrade, pre)
|
|
294
|
-
elif choice == "4":
|
|
295
292
|
self._install_custom(upgrade, pre)
|
|
296
293
|
|
|
297
294
|
if not Confirm.ask("\n[cyan]是否继续安装其他组件?[/cyan]", default=False):
|
|
@@ -407,61 +404,6 @@ class InstallCommand(Command):
|
|
|
407
404
|
except ValueError:
|
|
408
405
|
console.print("[red]输入格式错误,请输入数字序号[/]")
|
|
409
406
|
|
|
410
|
-
def _install_cli_extensions(self, remote_packages: dict, upgrade: bool, pre: bool):
|
|
411
|
-
console.print("\n[bold]可用的 CLI 扩展:[/bold]")
|
|
412
|
-
|
|
413
|
-
cli_extensions = remote_packages.get("cli_extensions", {})
|
|
414
|
-
|
|
415
|
-
if not cli_extensions:
|
|
416
|
-
console.print("[yellow]没有可用的 CLI 扩展[/yellow]")
|
|
417
|
-
return
|
|
418
|
-
|
|
419
|
-
table = Table(box=SIMPLE, header_style="cli")
|
|
420
|
-
table.add_column("序号", style="cyan")
|
|
421
|
-
table.add_column("命令名", style="cli")
|
|
422
|
-
table.add_column("包名")
|
|
423
|
-
table.add_column("描述")
|
|
424
|
-
|
|
425
|
-
cli_list = list(cli_extensions.items())
|
|
426
|
-
for i, (name, info) in enumerate(cli_list, 1):
|
|
427
|
-
table.add_row(
|
|
428
|
-
str(i),
|
|
429
|
-
name,
|
|
430
|
-
info.get("package", ""),
|
|
431
|
-
info.get("description", "")
|
|
432
|
-
)
|
|
433
|
-
|
|
434
|
-
console.print(table)
|
|
435
|
-
|
|
436
|
-
selected = Prompt.ask(
|
|
437
|
-
"\n[cyan]请输入要安装的 CLI 扩展序号(多个用逗号分隔,如: 1,3)或按 q 返回:[/cyan]"
|
|
438
|
-
)
|
|
439
|
-
|
|
440
|
-
if selected.lower() == 'q':
|
|
441
|
-
return
|
|
442
|
-
|
|
443
|
-
try:
|
|
444
|
-
indices = [int(idx.strip()) for idx in selected.split(",")]
|
|
445
|
-
selected_packages = []
|
|
446
|
-
|
|
447
|
-
for idx in indices:
|
|
448
|
-
if 1 <= idx <= len(cli_list):
|
|
449
|
-
cli_name = cli_list[idx - 1][0]
|
|
450
|
-
selected_packages.append(cli_name)
|
|
451
|
-
console.print(f"[green]已选择: {cli_name}[/]")
|
|
452
|
-
else:
|
|
453
|
-
console.print(f"[red]无效的序号: {idx}[/]")
|
|
454
|
-
|
|
455
|
-
if selected_packages:
|
|
456
|
-
if Confirm.ask(
|
|
457
|
-
f"\n[cyan]确认安装以下 {len(selected_packages)} 个 CLI 扩展吗?[/cyan]",
|
|
458
|
-
default=True
|
|
459
|
-
):
|
|
460
|
-
self.package_manager.install_package(selected_packages, upgrade=upgrade, pre=pre)
|
|
461
|
-
|
|
462
|
-
except ValueError:
|
|
463
|
-
console.print("[red]输入格式错误,请输入数字序号[/]")
|
|
464
|
-
|
|
465
407
|
def _install_custom(self, upgrade: bool, pre: bool):
|
|
466
408
|
package_name = Prompt.ask(
|
|
467
409
|
"\n[cyan]请输入要安装的包名(或按 q 返回):[/cyan]"
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"""
|
|
8
8
|
Install 命令实现
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
支持交互式和批量安装模块、适配器
|
|
11
11
|
"""
|
|
12
12
|
|
|
13
13
|
import sys
|
|
@@ -42,7 +42,5 @@ class InstallCommand(Command):
|
|
|
42
42
|
...
|
|
43
43
|
def _install_modules(self: object, remote_packages: dict, upgrade: bool, pre: bool) -> ...:
|
|
44
44
|
...
|
|
45
|
-
def _install_cli_extensions(self: object, remote_packages: dict, upgrade: bool, pre: bool) -> ...:
|
|
46
|
-
...
|
|
47
45
|
def _install_custom(self: object, upgrade: bool, pre: bool) -> ...:
|
|
48
46
|
...
|
|
@@ -25,7 +25,7 @@ class ListCommand(Command):
|
|
|
25
25
|
def add_arguments(self, parser: ArgumentParser):
|
|
26
26
|
parser.add_argument(
|
|
27
27
|
'--type', '-t',
|
|
28
|
-
choices=['modules', 'adapters', '
|
|
28
|
+
choices=['modules', 'adapters', 'all'],
|
|
29
29
|
default='all',
|
|
30
30
|
help='列出类型 (默认: all)'
|
|
31
31
|
)
|
|
@@ -42,7 +42,6 @@ class ListCommand(Command):
|
|
|
42
42
|
if pkg_type == "all":
|
|
43
43
|
self._print_installed_packages("modules", outdated_only)
|
|
44
44
|
self._print_installed_packages("adapters", outdated_only)
|
|
45
|
-
self._print_installed_packages("cli", outdated_only)
|
|
46
45
|
else:
|
|
47
46
|
self._print_installed_packages(pkg_type, outdated_only)
|
|
48
47
|
|
|
@@ -105,31 +104,7 @@ class ListCommand(Command):
|
|
|
105
104
|
)
|
|
106
105
|
|
|
107
106
|
console.print(table)
|
|
108
|
-
|
|
109
|
-
elif pkg_type == "cli" and installed["cli_extensions"]:
|
|
110
|
-
table = Table(
|
|
111
|
-
title="已安装CLI扩展",
|
|
112
|
-
box=SIMPLE,
|
|
113
|
-
header_style="cli"
|
|
114
|
-
)
|
|
115
|
-
table.add_column("命令名", style="cli")
|
|
116
|
-
table.add_column("包名")
|
|
117
|
-
table.add_column("版本")
|
|
118
|
-
table.add_column("描述")
|
|
119
|
-
|
|
120
|
-
for name, info in installed["cli_extensions"].items():
|
|
121
|
-
if outdated_only and not self._is_package_outdated(info["package"], info["version"]):
|
|
122
|
-
continue
|
|
123
|
-
|
|
124
|
-
table.add_row(
|
|
125
|
-
name,
|
|
126
|
-
info["package"],
|
|
127
|
-
info["version"],
|
|
128
|
-
info["summary"]
|
|
129
|
-
)
|
|
130
|
-
|
|
131
|
-
console.print(table)
|
|
132
|
-
elif not installed.get(pkg_type.replace("cli", "cli_extensions"), {}):
|
|
107
|
+
elif not installed.get(pkg_type, {}):
|
|
133
108
|
pass
|
|
134
109
|
|
|
135
110
|
def _is_package_outdated(self, package_name: str, current_version: str) -> bool:
|
|
@@ -152,9 +127,4 @@ class ListCommand(Command):
|
|
|
152
127
|
if adapter_info["package"] == package_name:
|
|
153
128
|
return adapter_info["version"] != current_version
|
|
154
129
|
|
|
155
|
-
# 检查CLI扩展
|
|
156
|
-
for cli_info in remote_packages.get("cli_extensions", {}).values():
|
|
157
|
-
if cli_info["package"] == package_name:
|
|
158
|
-
return cli_info["version"] != current_version
|
|
159
|
-
|
|
160
130
|
return False
|
|
@@ -25,7 +25,7 @@ class ListRemoteCommand(Command):
|
|
|
25
25
|
def add_arguments(self, parser: ArgumentParser):
|
|
26
26
|
parser.add_argument(
|
|
27
27
|
'--type', '-t',
|
|
28
|
-
choices=['modules', 'adapters', '
|
|
28
|
+
choices=['modules', 'adapters', 'all'],
|
|
29
29
|
default='all',
|
|
30
30
|
help='列出类型 (默认: all)'
|
|
31
31
|
)
|
|
@@ -42,7 +42,6 @@ class ListRemoteCommand(Command):
|
|
|
42
42
|
if pkg_type == "all":
|
|
43
43
|
self._print_remote_packages("modules", force_refresh)
|
|
44
44
|
self._print_remote_packages("adapters", force_refresh)
|
|
45
|
-
self._print_remote_packages("cli", force_refresh)
|
|
46
45
|
else:
|
|
47
46
|
self._print_remote_packages(pkg_type, force_refresh)
|
|
48
47
|
|
|
@@ -98,26 +97,5 @@ class ListRemoteCommand(Command):
|
|
|
98
97
|
)
|
|
99
98
|
|
|
100
99
|
console.print(table)
|
|
101
|
-
|
|
102
|
-
elif pkg_type == "cli" and remote_packages.get("cli_extensions"):
|
|
103
|
-
table = Table(
|
|
104
|
-
title="远程CLI扩展",
|
|
105
|
-
box=SIMPLE,
|
|
106
|
-
header_style="cli"
|
|
107
|
-
)
|
|
108
|
-
table.add_column("命令名", style="cli")
|
|
109
|
-
table.add_column("包名")
|
|
110
|
-
table.add_column("最新版本")
|
|
111
|
-
table.add_column("描述")
|
|
112
|
-
|
|
113
|
-
for name, info in remote_packages["cli_extensions"].items():
|
|
114
|
-
table.add_row(
|
|
115
|
-
name,
|
|
116
|
-
info["package"],
|
|
117
|
-
info["version"],
|
|
118
|
-
info.get("description", "")
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
console.print(table)
|
|
122
|
-
elif not remote_packages.get(pkg_type.replace("cli", "cli_extensions"), {}):
|
|
100
|
+
elif not remote_packages.get(pkg_type, {}):
|
|
123
101
|
console.print(f"[dim]远程没有找到 {pkg_type}[/]")
|
|
@@ -74,15 +74,6 @@ class UninstallCommand(Command):
|
|
|
74
74
|
"version": info["version"]
|
|
75
75
|
})
|
|
76
76
|
|
|
77
|
-
# 添加 CLI 扩展
|
|
78
|
-
for name, info in installed.get("cli_extensions", {}).items():
|
|
79
|
-
all_packages.append({
|
|
80
|
-
"type": "CLI",
|
|
81
|
-
"name": name,
|
|
82
|
-
"package": info["package"],
|
|
83
|
-
"version": info["version"]
|
|
84
|
-
})
|
|
85
|
-
|
|
86
77
|
if not all_packages:
|
|
87
78
|
console.print("[yellow]没有已安装的包[/]")
|
|
88
79
|
return
|
|
@@ -17,7 +17,6 @@ class CommandRegistry:
|
|
|
17
17
|
{!--< tips >!--}
|
|
18
18
|
1. 使用单例模式确保全局唯一
|
|
19
19
|
2. 支持命令的动态注册和查找
|
|
20
|
-
3. 支持第三方命令的兼容
|
|
21
20
|
{!--< /tips >!--}
|
|
22
21
|
|
|
23
22
|
:ivar _commands: 已注册的命令字典 {name: Command}
|
|
@@ -25,14 +24,12 @@ class CommandRegistry:
|
|
|
25
24
|
|
|
26
25
|
_instance = None
|
|
27
26
|
_commands: Dict[str, Command]
|
|
28
|
-
_external_commands: Dict[str, Command]
|
|
29
27
|
|
|
30
28
|
def __new__(cls):
|
|
31
29
|
"""实现单例模式"""
|
|
32
30
|
if cls._instance is None:
|
|
33
31
|
cls._instance = super().__new__(cls)
|
|
34
32
|
cls._instance._commands = {}
|
|
35
|
-
cls._instance._external_commands = {}
|
|
36
33
|
return cls._instance
|
|
37
34
|
|
|
38
35
|
def register(self, command: Command):
|
|
@@ -46,15 +43,6 @@ class CommandRegistry:
|
|
|
46
43
|
raise ValueError(f"命令 '{command.name}' 已存在")
|
|
47
44
|
self._commands[command.name] = command
|
|
48
45
|
|
|
49
|
-
def register_external(self, name: str, command: Command):
|
|
50
|
-
"""
|
|
51
|
-
注册第三方命令
|
|
52
|
-
|
|
53
|
-
:param name: 命令名称
|
|
54
|
-
:param command: 命令实例
|
|
55
|
-
"""
|
|
56
|
-
self._external_commands[name] = command
|
|
57
|
-
|
|
58
46
|
def get(self, name: str) -> Optional[Command]:
|
|
59
47
|
"""
|
|
60
48
|
获取命令
|
|
@@ -62,19 +50,15 @@ class CommandRegistry:
|
|
|
62
50
|
:param name: 命令名称
|
|
63
51
|
:return: 命令实例,未找到返回 None
|
|
64
52
|
"""
|
|
65
|
-
|
|
66
|
-
if name in self._commands:
|
|
67
|
-
return self._commands[name]
|
|
68
|
-
# 然后查找外部命令
|
|
69
|
-
return self._external_commands.get(name)
|
|
53
|
+
return self._commands.get(name)
|
|
70
54
|
|
|
71
55
|
def get_all(self) -> List[Command]:
|
|
72
56
|
"""
|
|
73
|
-
|
|
57
|
+
获取所有命令
|
|
74
58
|
|
|
75
59
|
:return: 所有命令列表
|
|
76
60
|
"""
|
|
77
|
-
return list(self._commands.values())
|
|
61
|
+
return list(self._commands.values())
|
|
78
62
|
|
|
79
63
|
def list_all(self) -> List[str]:
|
|
80
64
|
"""
|
|
@@ -82,7 +66,7 @@ class CommandRegistry:
|
|
|
82
66
|
|
|
83
67
|
:return: 命令名称列表
|
|
84
68
|
"""
|
|
85
|
-
return list(self._commands.keys())
|
|
69
|
+
return list(self._commands.keys())
|
|
86
70
|
|
|
87
71
|
def list_builtin(self) -> List[str]:
|
|
88
72
|
"""
|
|
@@ -92,14 +76,6 @@ class CommandRegistry:
|
|
|
92
76
|
"""
|
|
93
77
|
return list(self._commands.keys())
|
|
94
78
|
|
|
95
|
-
def list_external(self) -> List[str]:
|
|
96
|
-
"""
|
|
97
|
-
列出外部命令名称
|
|
98
|
-
|
|
99
|
-
:return: 外部命令名称列表
|
|
100
|
-
"""
|
|
101
|
-
return list(self._external_commands.keys())
|
|
102
|
-
|
|
103
79
|
def exists(self, name: str) -> bool:
|
|
104
80
|
"""
|
|
105
81
|
检查命令是否存在
|
|
@@ -107,8 +83,4 @@ class CommandRegistry:
|
|
|
107
83
|
:param name: 命令名称
|
|
108
84
|
:return: 命令是否存在
|
|
109
85
|
"""
|
|
110
|
-
return name in self._commands
|
|
111
|
-
|
|
112
|
-
def clear_external(self):
|
|
113
|
-
"""清空外部命令"""
|
|
114
|
-
self._external_commands.clear()
|
|
86
|
+
return name in self._commands
|
|
@@ -22,13 +22,11 @@ class CommandRegistry:
|
|
|
22
22
|
{!--< tips >!--}
|
|
23
23
|
1. 使用单例模式确保全局唯一
|
|
24
24
|
2. 支持命令的动态注册和查找
|
|
25
|
-
3. 支持第三方命令的兼容
|
|
26
25
|
{!--< /tips >!--}
|
|
27
26
|
|
|
28
27
|
:ivar _commands: 已注册的命令字典 {name: Command}
|
|
29
28
|
"""
|
|
30
29
|
_commands: Dict[(str, Command)]
|
|
31
|
-
_external_commands: Dict[(str, Command)]
|
|
32
30
|
def __new__(cls: object) -> ...:
|
|
33
31
|
"""
|
|
34
32
|
实现单例模式
|
|
@@ -42,14 +40,6 @@ class CommandRegistry:
|
|
|
42
40
|
:raises ValueError: 命令名称已存在时抛出
|
|
43
41
|
"""
|
|
44
42
|
...
|
|
45
|
-
def register_external(self: object, name: str, command: Command) -> ...:
|
|
46
|
-
"""
|
|
47
|
-
注册第三方命令
|
|
48
|
-
|
|
49
|
-
:param name: 命令名称
|
|
50
|
-
:param command: 命令实例
|
|
51
|
-
"""
|
|
52
|
-
...
|
|
53
43
|
def get(self: object, name: str) -> Optional[Command]:
|
|
54
44
|
"""
|
|
55
45
|
获取命令
|
|
@@ -60,7 +50,7 @@ class CommandRegistry:
|
|
|
60
50
|
...
|
|
61
51
|
def get_all(self: object) -> List[Command]:
|
|
62
52
|
"""
|
|
63
|
-
|
|
53
|
+
获取所有命令
|
|
64
54
|
|
|
65
55
|
:return: 所有命令列表
|
|
66
56
|
"""
|
|
@@ -79,13 +69,6 @@ class CommandRegistry:
|
|
|
79
69
|
:return: 内置命令名称列表
|
|
80
70
|
"""
|
|
81
71
|
...
|
|
82
|
-
def list_external(self: object) -> List[str]:
|
|
83
|
-
"""
|
|
84
|
-
列出外部命令名称
|
|
85
|
-
|
|
86
|
-
:return: 外部命令名称列表
|
|
87
|
-
"""
|
|
88
|
-
...
|
|
89
72
|
def exists(self: object, name: str) -> bool:
|
|
90
73
|
"""
|
|
91
74
|
检查命令是否存在
|
|
@@ -94,8 +77,3 @@ class CommandRegistry:
|
|
|
94
77
|
:return: 命令是否存在
|
|
95
78
|
"""
|
|
96
79
|
...
|
|
97
|
-
def clear_external(self: object) -> ...:
|
|
98
|
-
"""
|
|
99
|
-
清空外部命令
|
|
100
|
-
"""
|
|
101
|
-
...
|