import sys
files = [
    ('c:/NeoZQYY/docs/h5_ui/compare/AGENT-PLAYBOOK.md',
     '*v4.1\uff082026-03-11\uff09',
     '*v4.2\uff082026-03-11\uff09\uff1a\u95f4\u8ddd\u6d4b\u91cf\u4e13\u7528\u5b50\u4ee3\u7406\uff08SPACING-AGENT.md\uff09\uff1b\u901a\u7528\u5de5\u5177 measure_gaps.py\uff1b\u00a70.8 \u65b0\u589e\u95f4\u8ddd\u4ee3\u7406\u8c03\u7528\u63d0\u793a'
    ),
    ('c:/NeoZQYY/docs/h5_ui/compare/ORCHESTRATION-PLAN.md',
     '*v1.9\uff082026-03-11\uff09',
     '*v2.0\uff082026-03-11\uff09\uff1a\u65b0\u589e\u95f4\u8ddd\u6d4b\u91cf\u4ee3\u7406\uff08\u6309\u9700\u8c03\u7528\uff09\uff1b\u4fee\u590d\u6587\u4ef6\u5934\u90e8\u63cf\u8ff0\u4e3a 4 \u79cd\u4e13\u804c\u5b50\u4ee3\u7406\u6a21\u5f0f'
    ),
]
for path, old_stamp, new_stamp in files:
    with open(path, 'rb') as f:
        c = f.read()
    crlf = b'\r\n' in c
    doc = c.decode('utf-8').replace('\r\n', '\n')
    if old_stamp in doc:
        doc2 = doc.replace(old_stamp, new_stamp, 1)
        if crlf: doc2 = doc2.replace('\n', '\r\n')
        with open(path, 'wb') as f: f.write(doc2.encode('utf-8'))
        print(f'OK: {path}')
    else:
        print(f'NOT FOUND in {path}')
        idx = doc.find('v4.')
        if idx >= 0: print(' found v4. at', idx, repr(doc[idx:idx+60]))
