import csv
import os
import re
CSV_FILE = "api_list_export.csv"
SRC_DIR = "crates/openlark-security/src"
TARGET_BIZ_TAGS = {"auth", "passport", "acs", "security_and_compliance"}
def normalize_resource(resource):
return resource.replace(".", "/")
def check_missing():
if not os.path.exists(CSV_FILE):
print(f"Error: {CSV_FILE} not found")
return
missing_count = 0
total_target = 0
with open(CSV_FILE, 'r', encoding='utf-8') as f:
reader = csv.DictReader(f)
for row in reader:
biz_tag = row['bizTag']
if biz_tag not in TARGET_BIZ_TAGS:
continue
project = row['meta.Project']
version = row['meta.Version']
resource = row['meta.Resource']
name = row['meta.Name']
resource_path = normalize_resource(resource)
rel_path = os.path.join(biz_tag, project, version, resource_path, f"{name}.rs")
full_path = os.path.join(SRC_DIR, rel_path)
total_target += 1
if not os.path.exists(full_path):
print(f"MISSING: {rel_path} | {row['id']} | {row['name']}")
missing_count += 1
print(f"Total Target APIs: {total_target}")
print(f"Missing APIs: {missing_count}")
if __name__ == "__main__":
check_missing()