在准备环境前提交次全部更改。
This commit is contained in:
42
scripts/audit/gen_audit_dashboard.py
Normal file
42
scripts/audit/gen_audit_dashboard.py
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
"""审计一览表生成脚本(项目级)
|
||||
|
||||
扫描 docs/audit/changes/ 目录下的审计源记录 Markdown 文件,
|
||||
提取结构化信息并生成 docs/audit/audit_dashboard.md。
|
||||
|
||||
用法(在项目根目录执行):
|
||||
python scripts/audit/gen_audit_dashboard.py
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# 确保项目根目录在 sys.path 中,以便复用 ETL 子项目的解析模块
|
||||
_PROJECT_ROOT = Path(__file__).resolve().parent.parent.parent
|
||||
sys.path.insert(0, str(_PROJECT_ROOT / "apps" / "etl" / "pipelines" / "feiqiu"))
|
||||
|
||||
from scripts.gen_audit_dashboard import (
|
||||
scan_audit_dir,
|
||||
render_dashboard,
|
||||
)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""扫描根目录审计源记录 → 解析 → 渲染 → 写入 audit_dashboard.md。"""
|
||||
audit_dir = _PROJECT_ROOT / "docs" / "audit" / "changes"
|
||||
output_path = _PROJECT_ROOT / "docs" / "audit" / "audit_dashboard.md"
|
||||
|
||||
entries = scan_audit_dir(audit_dir)
|
||||
content = render_dashboard(entries)
|
||||
|
||||
output_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
output_path.write_text(content, encoding="utf-8")
|
||||
|
||||
print(f"已解析 {len(entries)} 条审计记录")
|
||||
print(f"输出文件:{output_path}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user