chore: add IDAA guardrail to migrate_fa_to_lucide.py (abort if run on src/routes/idaa)

This commit is contained in:
Scott Idem
2026-03-17 13:40:14 -04:00
parent ce09dcd09b
commit 3038be0686

View File

@@ -189,14 +189,13 @@ def parse_fa_class(class_str):
elif p.startswith('fa-'):
if icon_name is None:
icon_name = p # first real icon name wins
else:
extra.append(p)
return icon_name, extra, has_spin
def replace_span(m):
"""Regex sub callback: replace a single FA span with a Lucide component."""
icon_name, extra, has_spin = parse_fa_class(m.group(1))
"""
if icon_name is None:
return m.group(0)
@@ -292,6 +291,13 @@ def main():
print('Usage: migrate_fa_to_lucide.py <directory_or_file ...>')
sys.exit(1)
# IDAA Guardrail: Abort if any target is src/routes/idaa or a subdirectory
for arg in sys.argv[1:]:
if Path(arg).resolve().as_posix().endswith('src/routes/idaa') or '/src/routes/idaa/' in Path(arg).resolve().as_posix():
print('ABORT: This script must not be run against src/routes/idaa or its subdirectories. IDAA content is private and protected.')
sys.exit(1)
targets = []
for arg in sys.argv[1:]:
p = Path(arg)