chore: 清理废弃插件与冗余文档,重构项目目录结构

1.  删除旧版xq0031_xq0032插件的冗余UI源码与配置文件
2.  迁移并标准化XQ0001-0100系列需求的插件、文档与工作流目录
3.  清理过期的需求列表、评分文档与流程底稿
4.  更新.gitignore匹配规则,适配新的目录结构
This commit is contained in:
2026-09-21 16:59:05 +08:00
parent b034b51685
commit c7add9574e
192 changed files with 5335 additions and 2694 deletions
@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
"""XQ0011 考勤月报封存检查 插件打包脚本(统一规范版)。
打包产物统一输出到仓库根 dist-plugin/<id>_v<版本>.zip(与 xq0031 一致,目录不入库),
zip 根含 plugin.json,可被 agent_cli publish 直接发布。详见 docs/插件/插件开发规范.md 与 docs/插件/发版规范.md。
用法(任意 cwd 均可):
d:\\work\\code\\37duAutomation\\.venv\\Scripts\\python.exe plugins\\XQ0001-0100\\XQ0011 考勤月报封存检查\\_pack.py
随后发布:
.venv\\Scripts\\python.exe -m controlplane.tools.agent_cli publish \
dist-plugin\\xq0011_v<版本>.zip --id xq0011 --version <版本>
"""
import json
import os
import sys
import zipfile
from pathlib import Path
_HERE = Path(__file__).resolve().parent
# 仓库根 = plugins/XQ0001-0100/<插件目录>/ 的 parents[2],统一出包位置
_REPO_ROOT = _HERE.parents[2]
_OUT_DIR = _REPO_ROOT / "dist-plugin"
# 排除项:打包脚本自身 / 前端源码与依赖 / 缓存 / 调试文件(_ 前缀为私有辅助)
_EXCLUDE_DIRS = {"ui-src", "__pycache__", ".git", ".idea", "debug", ".sessions"}
_EXCLUDE_FILES = {"_pack.py"}
_EXCLUDE_SUFFIXES = (".pyc", ".pyo")
def main():
manifest = json.loads((_HERE / "plugin.json").read_text(encoding="utf-8"))
pid = manifest["id"]
ver = manifest["version"]
# 带 UI 插件必须已构建前端产物(ui/ 由底座 /pui/<id>/ 托管)
if manifest.get("ui") and not (_HERE / "ui" / "index.html").is_file():
sys.exit(f"插件 {pid} 声明 ui=true 但缺少 ui/index.html:请先在 ui-src 下执行 npm install && npm run build")
_OUT_DIR.mkdir(exist_ok=True)
out = _OUT_DIR / f"{pid}_v{ver}.zip"
count = 0
with zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as zf:
for p in sorted(_HERE.rglob("*")):
rel = p.relative_to(_HERE)
if set(rel.parts) & _EXCLUDE_DIRS or p.name in _EXCLUDE_FILES \
or p.suffix in _EXCLUDE_SUFFIXES:
continue
if p.is_file():
zf.write(p, str(rel))
count += 1
print(f"已打包: {out}({count} 个文件,{out.stat().st_size / 1024:.0f} KB)")
if __name__ == "__main__":
main()