import json, re, os
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")
d = json.load(open('todo_upgrade.json', encoding='utf-8'))
html = open('index_main.html', encoding='utf-8').read()
ids = set(re.findall(r'\{id:"([^"]+)"', html))
prog_block = html[html.find('const PROGRAMS'):html.find('const VERIFIED_DETAILS')]
existing_en = set()
for m in re.finditer(r'\{id:"([^"]+)"[^}]*?s:"([^"]+)"[^}]*?n:"([^"]*)"[^}]*?en:"([^"]*)"', prog_block):
    existing_en.add((m.group(2), m.group(4).lower().strip()))
print('total todo:', len(d), 'existing ids:', len(ids))
print('--- next 30 not yet in PROGRAMS ---')
cnt = 0
for x in d:
    en = x.get('en','').strip()
    s = x.get('s','')
    cn = x.get('cn','')
    deg = x.get('deg','')
    det = x.get('det','')
    if (s, en.lower()) in existing_en:
        continue
    print(f"{s:10s} | {deg:4s} | {cn[:30]:30s} | {en[:60]:60s} | {det}")
    cnt += 1
    if cnt >= 30:
        break
