✨ feat(submodule): 添加子模块管理功能,支持子模块的初始化、更新和信息获取
Sequential Lint and Type Check / ruff-call (push) Waiting to run
Sequential Lint and Type Check / pyright-call (push) Blocked by required conditions

This commit is contained in:
HibiKier
2025-08-03 23:57:13 +08:00
parent 6d829bcb02
commit a3142ad065
7 changed files with 1538 additions and 9 deletions
+58
View File
@@ -15,6 +15,62 @@ class RepoType(str, Enum):
ALIYUN = "aliyun"
@dataclass
class SubmoduleConfig:
"""子模块配置"""
# 子模块名称
name: str
# 子模块路径(相对于主仓库)
path: str
# 子模块仓库URL
repo_url: str
# 分支名称
branch: str = "main"
# 是否启用
enabled: bool = True
# 包含的文件模式列表
include_patterns: list[str] | None = None
# 排除的文件模式列表
exclude_patterns: list[str] | None = None
@dataclass
class SubmoduleInfo:
"""子模块信息"""
# 子模块配置
config: SubmoduleConfig
# 当前版本
current_version: str = ""
# 最新版本
latest_version: str = ""
# 最后更新时间
last_update: datetime | None = None
# 更新状态
update_status: str = "unknown" # unknown, up_to_date, outdated, error
@dataclass
class SubmoduleUpdateResult:
"""子模块更新结果"""
# 子模块名称
submodule_name: str
# 子模块路径
submodule_path: str
# 旧版本
old_version: str
# 新版本
new_version: str
# 是否成功
success: bool = False
# 错误消息
error_message: str = ""
# 变更的文件列表
changed_files: list[str] = field(default_factory=list)
@dataclass
class RepoFileInfo:
"""仓库文件信息"""
@@ -67,6 +123,8 @@ class RepoUpdateResult:
error_message: str = ""
# 变更的文件列表
changed_files: list[str] = field(default_factory=list)
# 子模块更新结果
submodule_results: list[SubmoduleUpdateResult] = field(default_factory=list)
@dataclass