Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/compiler/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,40 @@ def build_points_env(ast: Program) -> Dict[str, PointDef]:
points_env[point_def.name] = point_def
return points_env


def print_compilation_summary(ast: Program, points_env: Dict[str, PointDef]) -> None:
"""Print a summary of the points and panels found during compilation."""
print("\n" + "=" * 50)
print("COMPILATION SUMMARY")
print("=" * 50)

# Print points summary
if points_env:
print(f"\n📍 Points Found: {len(points_env)}")
for name in sorted(points_env.keys()):
print(f" • {name}")
else:
print("\n📍 Points Found: 0")

# Print panels summary
components = ast.components or []
total_panels = 0

if components:
print(f"\n📐 Panels Found:")
for comp in components:
panels = comp.panels or []
panel_names = [p.name for p in panels]
total_panels += len(panel_names)
print(f" Component '{comp.name}':")
for panel_name in panel_names:
print(f" • {panel_name}")
print(f"\n Total: {total_panels} panel(s) in {len(components)} component(s)")
else:
print("\n📐 Panels Found: 0")

print("=" * 50 + "\n")

def mirror_coordinates(point, axis, bbox=None):
"""Mirror a [x, y] coordinate based on axis and optional bounding box."""
x, y = point
Expand Down Expand Up @@ -958,6 +992,9 @@ def compile_program(ast: Program, measurements: dict):
# Build a points environment from the AST so measurement expressions
# that reference points can be evaluated.
points_env = build_points_env(ast)

# Print summary of points and panels found
print_compilation_summary(ast, points_env)

# Start with the provided measurements (usually converted by the CLI
# into the garment units). We'll augment/override these with any
Expand Down