wip: 2026-08-11 工作树快照(docs/memory/h5.py/scripts 等 447 项未评审改动,安全提交到 feat 分支)
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""第二遍:仅修正 2 个高置信单匹配残留引用(其余交人工审阅)。"""
|
||||
import os, sys
|
||||
|
||||
ROOT = "docs"
|
||||
DRY = "--go" not in sys.argv
|
||||
|
||||
# (旧路径片段, 新路径片段) —— 仅替换路径中段,保留 ../ 前缀
|
||||
FIX = {
|
||||
"03-技术架构/00-系统架构设计文档-v1.3.md":
|
||||
"02-技术文档/技术架构/IT智能服务台-系统架构设计文档v2.md",
|
||||
"02-产品需求/02-产品需求文档PRD-v1.2-20260704.md":
|
||||
"01-产品文档/IT智能服务台-产品需求文档PRD-v2.md",
|
||||
}
|
||||
|
||||
md_files = []
|
||||
for root, _, fs in os.walk(ROOT):
|
||||
for f in fs:
|
||||
if f.endswith('.md'):
|
||||
md_files.append(os.path.join(root, f))
|
||||
|
||||
changed = 0
|
||||
for fp in md_files:
|
||||
with open(fp, encoding='utf-8') as fh:
|
||||
text = fh.read()
|
||||
new = text
|
||||
for old, nw in FIX.items():
|
||||
for variant in (old, old.replace('/', '\\')):
|
||||
if variant in new:
|
||||
new = new.replace(variant, nw)
|
||||
if new != text:
|
||||
changed += 1
|
||||
if DRY:
|
||||
print("将改:", fp)
|
||||
else:
|
||||
with open(fp, 'w', encoding='utf-8') as fh:
|
||||
fh.write(new)
|
||||
print("已改:", fp)
|
||||
|
||||
print("修改文件数:", changed)
|
||||
if DRY:
|
||||
print("[DRY] 未写入")
|
||||
Reference in New Issue
Block a user