fix(content): argparse --dry-run for generate_corp_stubs.py; populate cross_refs (#828 nits)
- generate_corp_stubs.py: add argparse with --dry-run (prints planned stub creations without writing files) and --help - calloway-distillery.md: cross_refs → [thrds, mercado-travessia] - thrds.md: cross_refs → [calloway-distillery, mercado-travessia] - vins-de-grand-vide.md: cross_refs → [nordmark-skog] - thalassa-resort-group.md: cross_refs → [the-registry, prometheus-labs] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
"""Generate minimal wiki stub pages for corps in brands.toml that don't yet have wiki pages."""
|
"""Generate minimal wiki stub pages for corps in brands.toml that don't yet have wiki pages.
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
python3 tooling/generate_corp_stubs.py [--dry-run]
|
||||||
|
|
||||||
|
In --dry-run mode, prints which stubs would be created without writing any files.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import argparse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
REPO = Path(__file__).parent.parent
|
REPO = Path(__file__).parent.parent
|
||||||
@@ -368,8 +375,20 @@ cross_refs: []
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Generate minimal wiki stub pages for corps in brands.toml."
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--dry-run",
|
||||||
|
action="store_true",
|
||||||
|
help="Print which stubs would be created without writing any files.",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
corps = parse_brands_toml(BRANDS_TOML)
|
corps = parse_brands_toml(BRANDS_TOML)
|
||||||
print(f"Found {len(corps)} unique corp_ids in brands.toml")
|
print(f"Found {len(corps)} unique corp_ids in brands.toml")
|
||||||
|
if args.dry_run:
|
||||||
|
print("(dry-run — no files will be written)\n")
|
||||||
|
|
||||||
created = 0
|
created = 0
|
||||||
skipped = 0
|
skipped = 0
|
||||||
@@ -378,12 +397,17 @@ def main():
|
|||||||
if stub_path.exists():
|
if stub_path.exists():
|
||||||
skipped += 1
|
skipped += 1
|
||||||
continue
|
continue
|
||||||
content = generate_stub(slug, meta["origin_system"], meta["brand_category"])
|
if args.dry_run:
|
||||||
stub_path.write_text(content, encoding="utf-8")
|
print(f" (dry-run) Would create: {slug}.md")
|
||||||
|
else:
|
||||||
|
content = generate_stub(slug, meta["origin_system"], meta["brand_category"])
|
||||||
|
stub_path.write_text(content, encoding="utf-8")
|
||||||
|
print(f" created: {slug}.md")
|
||||||
created += 1
|
created += 1
|
||||||
print(f" created: {slug}.md")
|
|
||||||
|
|
||||||
print(f"\nDone. Created {created} stubs, skipped {skipped} existing.")
|
action = "Would create" if args.dry_run else "Created"
|
||||||
|
print(f"\nDone. {action} {created} stubs, skipped {skipped} existing.")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ faction_type: economic
|
|||||||
headquarters: Calloway Reach (GJ 3325)
|
headquarters: Calloway Reach (GJ 3325)
|
||||||
tags: []
|
tags: []
|
||||||
decision_refs: []
|
decision_refs: []
|
||||||
cross_refs: []
|
cross_refs: [thrds, mercado-travessia]
|
||||||
---
|
---
|
||||||
|
|
||||||
# Calloway Distillery
|
# Calloway Distillery
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ faction_type: economic
|
|||||||
headquarters: Gateway (GJ 244A)
|
headquarters: Gateway (GJ 244A)
|
||||||
tags: [hospitality, fine_dining, entertainment, tractus, assembly, gateway]
|
tags: [hospitality, fine_dining, entertainment, tractus, assembly, gateway]
|
||||||
decision_refs: [D-175]
|
decision_refs: [D-175]
|
||||||
cross_refs: []
|
cross_refs: [the-registry, prometheus-labs]
|
||||||
---
|
---
|
||||||
|
|
||||||
# Thalassa Resort Group
|
# Thalassa Resort Group
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ faction_type: economic
|
|||||||
headquarters: Braemar (GJ 475)
|
headquarters: Braemar (GJ 475)
|
||||||
tags: []
|
tags: []
|
||||||
decision_refs: []
|
decision_refs: []
|
||||||
cross_refs: []
|
cross_refs: [calloway-distillery, mercado-travessia]
|
||||||
---
|
---
|
||||||
|
|
||||||
# thrds
|
# thrds
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ faction_type: economic
|
|||||||
headquarters: Confluent (GJ 395)
|
headquarters: Confluent (GJ 395)
|
||||||
tags: []
|
tags: []
|
||||||
decision_refs: []
|
decision_refs: []
|
||||||
cross_refs: []
|
cross_refs: [nordmark-skog]
|
||||||
---
|
---
|
||||||
|
|
||||||
# Vins de Grand Vide
|
# Vins de Grand Vide
|
||||||
|
|||||||
Reference in New Issue
Block a user