mirror of
https://github.com/insistence/RuoYi-Vue3-FastAPI.git
synced 2026-09-26 14:23:49 +00:00
* feat: 初始化插件系统 * refactor: 收口插件系统运行时重构 * perf: 优化插件系统类型提示 * fix&perf: 修复和优化插件系统 * fix: 修复gitignore规则误忽略插件文件的问题 * fix: 修复运行时插件根路径算错的问题 * fix: 加强插件发现和路由注册的防护措施 * revert: 回滚定时任务白名单 * fix: 移除未使用的应用路由注册探测 * revert: 恢复部分代码 * perf: 优化插件系统 * docs: 新增插件开发文档 * perf: 优化插件管理模块 * perf: 提升插件系统核心能力 * refactor: 重构生命周期 step runner * fix: 修复lint错误 * test: 清理测试用例 * test: 调整测试目录名称 * fix: 修复前后端目录硬编码的问题 * fix: 修复插件系统安全性缺口 * refactor: 重新设计插件生命周期 Migration 事务与回滚 * perf: 优化插件系统边界问题 * refactor: 重构当前插件系统的依赖体系设计 * perf: 优化代码 * perf: 优化代码 * fix: 修复代码合并问题 * fix: 修复bug * perf: 优化代码 * perf&fix: 优化代码和修复bug * docs: 优化文档格式 * feat: 适配Vue2版本 * docs: 更新README文档 * fix: 修复ruff lint错误 * chore: 更新后端依赖文件
60 lines
2.2 KiB
Python
60 lines
2.2 KiB
Python
from collections.abc import Callable
|
|
from typing import Annotated, Any, Literal
|
|
|
|
import typer
|
|
|
|
from cli.context import AllowProdOption, EnvOption, OutputOption, YesOption
|
|
|
|
PluginConfigAction = Literal['get', 'set', 'export', 'import']
|
|
|
|
|
|
def register_configuration_commands(app: typer.Typer, get_controller: Callable[[], Any]) -> None:
|
|
"""
|
|
注册插件配置命令。
|
|
|
|
:param app: Typer 命令组
|
|
:param get_controller: 插件命令控制器工厂
|
|
:return: None
|
|
"""
|
|
|
|
@app.command('config', help='查看或设置插件配置')
|
|
def config_command(
|
|
plugin_id: Annotated[str, typer.Argument(help='插件ID')],
|
|
action: Annotated[PluginConfigAction, typer.Argument(help='操作类型:get、set、export 或 import')],
|
|
pairs: Annotated[list[str] | None, typer.Argument(help='配置键值,例如 provider=openai')] = None,
|
|
env: EnvOption = 'dev',
|
|
output: OutputOption = 'text',
|
|
allow_prod: AllowProdOption = False,
|
|
yes: YesOption = False,
|
|
reveal_secret: Annotated[bool, typer.Option('--reveal-secret', help='导出敏感配置明文')] = False,
|
|
output_file: Annotated[str, typer.Option('--output-file', help='配置导出 JSON 文件路径')] = '',
|
|
input_file: Annotated[str, typer.Option('--input-file', help='配置导入 JSON 文件路径')] = '',
|
|
) -> None:
|
|
"""
|
|
查看或设置插件配置。
|
|
|
|
:param plugin_id: 插件ID
|
|
:param action: 操作类型
|
|
:param pairs: 配置键值列表
|
|
:param env: 当前命令运行环境
|
|
:param output: 输出格式
|
|
:param allow_prod: 是否允许生产环境危险命令
|
|
:param yes: 是否跳过确认
|
|
:param reveal_secret: 是否导出敏感配置明文
|
|
:param output_file: 配置导出 JSON 文件路径
|
|
:param input_file: 配置导入 JSON 文件路径
|
|
:return: None
|
|
"""
|
|
get_controller().plugin_config(
|
|
plugin_id,
|
|
action,
|
|
pairs or [],
|
|
env,
|
|
output,
|
|
allow_prod=allow_prod,
|
|
yes=yes,
|
|
reveal_secret=reveal_secret,
|
|
output_file=output_file,
|
|
input_file=input_file,
|
|
)
|