#!/usr/bin/env python3
import sys
import os

filepath = 'backend/.roo/audit_ledger_94.md'
with open(filepath, 'r') as f:
    lines = f.readlines()

# find start and end of Workers section
start = None
end = None
for i, line in enumerate(lines):
    if line.strip() == '## Workers (`backend/app/workers/...`)':
        start = i
        # find next ## that is not Workers
        for j in range(i+1, len(lines)):
            if lines[j].startswith('## ') and 'Workers' not in lines[j]:
                end = j
                break
        if end is None:
            end = len(lines)
        break

if start is None or end is None:
    print("Workers section not found")
    sys.exit(1)

# new lines
new_lines = [
    '## Workers (`backend/app/workers/...`)\n',
    '\n',
    '- [ ] `workers/monitor_dashboard.py` - [TÖRÖLHETŐ] Older version; monitor_dashboard2.0.py should be kept.\n',
    '- [ ] `workers/monitor_dashboard2.0.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/ocr/robot_1_ocr_processor.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/py_to_database.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/service/service_robot_0_hunter.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/service/service_robot_1_scout_osm.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/service/service_robot_2_researcher.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/service/service_robot_3_enricher.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/service/service_robot_4_validator_google.py` - [REFAKTORÁL] Contains hardcoded \'ghost\' status; should use ServiceStatus Enum.\n',
    '- [ ] `workers/service/service_robot_5_auditor.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/system/subscription_worker.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/system/system_robot_2_service_auditor.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/R0_brand_hunter.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/R1_model_scout.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/R2_generation_scout.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/R3_engine_scout.py` - [REFAKTORÁL] Uses BeautifulSoup for web scraping; consider modernizing to async HTTP client and structured data extraction.\n',
    '- [ ] `workers/vehicle/R4_final_extractor.py` - [REFAKTORÁL] Uses BeautifulSoup for web scraping; consider modernizing to async HTTP client and structured data extraction.\n',
    '- [ ] `workers/vehicle/bike/bike_R0_brand_hunter.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/bike/bike_R1_model_scout.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/bike/bike_R2_generation_scout.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/bike/bike_R3_engine_scout.py` - [REFAKTORÁL] Uses BeautifulSoup for web scraping; consider modernizing to async HTTP client and structured data extraction.\n',
    '- [ ] `workers/vehicle/bike/bike_R4_final_extractor.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/bike/test_aprilia.py` - [TÖRÖLHETŐ] Test file; not needed in production.\n',
    '- [ ] `workers/vehicle/mapping_dictionary.py` - [MEGTART] Mapping utility used by rdw_enricher; keep.\n',
    '- [ ] `workers/vehicle/mapping_rules.py` - [MEGTART] Mapping utility used by rdw_enricher; keep.\n',
    '- [ ] `workers/vehicle/r5_test.py` - [TÖRÖLHETŐ] Test file; not needed in production.\n',
    '- [ ] `workers/vehicle/r5_ultimate_harvester.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/robot_report.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/ultimatespecs/vehicle_ultimate_r0_spider.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/ultimatespecs/vehicle_ultimate_r1_scraper.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/ultimatespecs/vehicle_ultimate_r2_enricher.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/ultimatespecs/vehicle_ultimate_r3_finalizer.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_data_loader.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_0_discovery_engine.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_0_gb_discovery.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_1_2_nhtsa_fetcher.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_1_4_bike_hunter.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_1_5_heavy_eu.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_1_5_heavy_eu1.0.py` - [TÖRÖLHETŐ] Duplicate of non-1.0 version; remove to avoid confusion.\n',
    '- [ ] `workers/vehicle/vehicle_robot_1_catalog_hunter.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_1_gb_hunter.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_2_1_rdw_enricher.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_2_1_ultima_scout.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_2_1_ultima_scout_1.0.py` - [TÖRÖLHETŐ] Duplicate of non-1.0 version; remove to avoid confusion.\n',
    '- [ ] `workers/vehicle/vehicle_robot_2_auto_data_net.py` - [REFAKTORÁL] Uses BeautifulSoup for web scraping; consider modernizing to async HTTP client and structured data extraction.\n',
    '- [ ] `workers/vehicle/vehicle_robot_2_researcher.py` - [REFAKTORÁL] Uses BeautifulSoup for web scraping; consider modernizing to async HTTP client and structured data extraction.\n',
    '- [ ] `workers/vehicle/vehicle_robot_3_alchemist_pro.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_4_validator.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
    '- [ ] `workers/vehicle/vehicle_robot_4_vin_auditor.py` - [MEGTART] Modern code, part of active robot pipeline.\n',
]

# replace
lines[start:end] = new_lines

# write back
with open(filepath, 'w') as f:
    f.writelines(lines)

print(f"Updated {filepath}")