maintain: wiki stocktake refresh + scheduled-tasks cleanup

This commit is contained in:
Tony0410
2026-08-16 03:08:09 +08:00
parent f518ff7c66
commit f1ea8fd228
5 changed files with 392 additions and 336 deletions
+47
View File
@@ -0,0 +1,47 @@
import sys, re
from pathlib import Path
from datetime import date
wiki = Path(sys.argv[1])
report = Path(sys.argv[2])
threshold = int(sys.argv[3])
today = date.today()
stale, fresh, nodate = [], [], []
for f in sorted(wiki.rglob('*.md')):
rel = f.relative_to(wiki)
if str(rel).startswith('raw/'):
continue
content = f.read_text(errors='ignore')
upd = re.search(r'^updated:\s*(\S+)', content[:800], re.M)
if not upd:
nodate.append(str(rel))
continue
try:
d = date.fromisoformat(upd.group(1))
except ValueError:
nodate.append(str(rel))
continue
age = (today - d).days
(stale if age > threshold else fresh).append((str(rel), age, upd.group(1)))
stale.sort(key=lambda x: -x[1])
lines = [
f"# Wiki freshness audit — {today.isoformat()}",
f"Threshold: >{threshold} days since `updated`",
"",
f"## STALE ({len(stale)})",
"",
]
for rel, age, d in stale:
lines.append(f"- [{age:>3}d] {rel} (updated {d})")
lines += [f"", f"## FRESH ({len(fresh)})", ""]
for rel, age, d in fresh:
lines.append(f"- [{age:>3}d] {rel}")
lines += [f"", f"## NO updated DATE ({len(nodate)})", ""]
for rel in nodate:
lines.append(f"- {rel}")
lines += [
"",
f"TOTAL: {len(stale)} stale, {len(fresh)} fresh, {len(nodate)} no-date of {len(stale)+len(fresh)+len(nodate)} pages",
]
report.parent.mkdir(parents=True, exist_ok=True)
report.write_text('\n'.join(lines))
print(f"[2/3] audit: {len(stale)} stale (>={threshold}d), {len(fresh)} fresh, {len(nodate)} no-date -> {report}")
+4 -3
View File
@@ -40,8 +40,9 @@ Threshold: >21 days since `updated`
- [ 22d] systems/hermes-agent.md (updated 2026-07-25)
- [ 22d] systems/tool-search.md (updated 2026-07-25)
## FRESH (33)
## FRESH (34)
- [ 0d] CONTRIBUTING.md
- [ 1d] agents/hermes-chaos.md
- [ 1d] agents/hermes-production.md
- [ 1d] agents/index.md
@@ -73,7 +74,7 @@ Threshold: >21 days since `updated`
- [ 21d] systems/obsidian.md
- [ 2d] systems/omniroute.md
- [ 18d] systems/opencode-go.md
- [ 6d] systems/scheduled-tasks.md
- [ 0d] systems/scheduled-tasks.md
- [ 0d] systems/skills-index.md
## NO updated DATE (7)
@@ -86,4 +87,4 @@ Threshold: >21 days since `updated`
- log.md
- reports/uber-eats/2026-07.md
TOTAL: 36 stale, 33 fresh, 7 no-date of 76 pages
TOTAL: 36 stale, 34 fresh, 7 no-date of 77 pages