fix: Handle List[Component] return type from FigmaTokenSource
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
- 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 <noreply@anthropic.com>
This commit is contained in:
@@ -106,7 +106,7 @@ async def main():
|
|||||||
# --- Extraction ---
|
# --- Extraction ---
|
||||||
try:
|
try:
|
||||||
source = FigmaTokenSource(figma_token=token, verbose=args.verbose)
|
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:
|
except Exception as e:
|
||||||
print(f"\n[ERROR] An error occurred during extraction: {e}", file=sys.stderr)
|
print(f"\n[ERROR] An error occurred during extraction: {e}", file=sys.stderr)
|
||||||
# In verbose mode, print more details
|
# In verbose mode, print more details
|
||||||
@@ -120,13 +120,27 @@ async def main():
|
|||||||
print("\n[3/3] Writing output...")
|
print("\n[3/3] Writing output...")
|
||||||
writer = OutputWriter(verbose=args.verbose)
|
writer = OutputWriter(verbose=args.verbose)
|
||||||
writer.write_token_collection(token_collection)
|
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)
|
writer.write_components(component_registry)
|
||||||
|
|
||||||
# --- Summary ---
|
# --- Summary ---
|
||||||
print_summary(
|
print_summary(
|
||||||
file_name=component_registry.get("file_name", "Unknown"),
|
file_name=file_key,
|
||||||
token_count=len(token_collection),
|
token_count=len(token_collection),
|
||||||
component_count=component_registry.get("component_count", 0),
|
component_count=len(components),
|
||||||
)
|
)
|
||||||
|
|
||||||
print("\n[OK] Sync successful!")
|
print("\n[OK] Sync successful!")
|
||||||
|
|||||||
Reference in New Issue
Block a user