开发机迁移

This commit is contained in:
Neo
2026-04-10 06:24:13 +08:00
parent f65c1d038b
commit 79d3c2e97e
50 changed files with 1565 additions and 318 deletions

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env python3
"""PostToolUse hook: 编辑 db/ 下 SQL 文件后提醒同步 docs/database/"""
import json, re, sys
try:
data = json.load(sys.stdin)
except Exception:
sys.exit(0)
fp = (data.get("tool_input") or {}).get("file_path", "")
if not fp:
sys.exit(0)
rel = re.sub(r"^.*?NeoZQYY[/\\]", "", fp.replace("\\", "/"))
# 匹配 db/ 下的 SQL 文件schemas、migrations、脚本等
if re.search(r"^db/.*\.sql$", rel):
print(json.dumps({
"hookSpecificOutput": {
"hookEventName": "PostToolUse",
"additionalContext": (
f"[db-doc-sync] 已编辑数据库文件: {rel}"
"根据 Schema 变更规则,完成后须同步更新 docs/database/(变更说明、兼容性、回滚策略、验证 SQL"
)
}
}))