Phase 0-2: Schema cleanup, typed relations, event-driven automation

- Phase 0: AGENTS.md cleanup (dedup quotes, renumber sections, merge qmd)
- Phase 1: typed relations (manage-relations.py, graph-search.py, check-staleness.py, detect-conflicts.py)
- Phase 2: frontmatter validator, weekly lint, knowledge promotion, git hooks
- Fix .gitignore to track tools/ and .githooks/
- Fix git remote URL (remove plaintext token)
- New wiki pages: 504 pages, 34 raw sources
This commit is contained in:
hehaiguang1123
2026-07-01 08:05:43 +08:00
parent e544d6e04a
commit a6f05ab2d5
1067 changed files with 522992 additions and 819 deletions
@@ -0,0 +1,47 @@
#!/usr/bin/env python3
"""检查笔记frontmatter属性规范"""
import os
import re
from pathlib import Path
root = Path('.')
issues_date = []
issues_none = []
ok_count = 0
for f in root.rglob('*.md'):
if '.workbuddy' in str(f):
continue
try:
with open(f, 'r', encoding='utf-8') as file:
content = file.read()
if content.startswith('---'):
# 找到frontmatter结束位置
end_match = re.search(r'^---\s*$', content[3:], re.MULTILINE)
if end_match:
fm = content[3:end_match.start() + 3]
if 'created:' in fm:
ok_count += 1
elif 'date:' in fm:
issues_date.append(str(f))
else:
issues_none.append(str(f))
else:
issues_none.append(str(f))
except:
pass
print('[属性检查结果]')
print(f' 使用 created: {ok_count} 个 [OK]')
print(f' 使用 date: {len(issues_date)} 个 [需要修复]')
print(f' 无日期字段: {len(issues_none)} 个 [需要添加]')
if issues_date:
print('\n[使用date的文件](需要改为created')
for f in issues_date[:10]:
print(f' - {f}')
if issues_none:
print('\n[缺少日期字段的文件]')
for f in issues_none[:10]:
print(f' - {f}')