From 305234d9066aed56bf7192287b74828f2a691ecf Mon Sep 17 00:00:00 2001 From: Bruno Sarlo Date: Fri, 12 Dec 2025 06:44:39 -0300 Subject: [PATCH] fix: Handle List[Component] return type from FigmaTokenSource MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - FigmaTokenSource.extract() returns (TokenCollection, List[Component]) - figma-sync.py was expecting a Dict for component_registry - Build component registry dict from Component objects 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- scripts/figma-sync.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/scripts/figma-sync.py b/scripts/figma-sync.py index c25709e..b16a634 100755 --- a/scripts/figma-sync.py +++ b/scripts/figma-sync.py @@ -106,7 +106,7 @@ async def main(): # --- Extraction --- try: source = FigmaTokenSource(figma_token=token, verbose=args.verbose) - token_collection, component_registry = await source.extract(file_key) + token_collection, components = await source.extract(file_key) except Exception as e: print(f"\n[ERROR] An error occurred during extraction: {e}", file=sys.stderr) # In verbose mode, print more details @@ -120,13 +120,27 @@ async def main(): print("\n[3/3] Writing output...") writer = OutputWriter(verbose=args.verbose) writer.write_token_collection(token_collection) + + # Build component registry dict from List[Component] + component_registry = { + "file_key": file_key, + "component_count": len(components), + "components": [ + { + "name": c.name, + "atomic_type": c.atomic_type.value if hasattr(c.atomic_type, 'value') else str(c.atomic_type), + "variant_count": len(c.variants) if c.variants else 0, + } + for c in components + ] + } writer.write_components(component_registry) # --- Summary --- print_summary( - file_name=component_registry.get("file_name", "Unknown"), + file_name=file_key, token_count=len(token_collection), - component_count=component_registry.get("component_count", 0), + component_count=len(components), ) print("\n[OK] Sync successful!")