feat(layout): hierarchical auto-layout for draw.io diagrams#378
Merged
Conversation
raifdmueller
approved these changes
May 26, 2026
Collaborator
raifdmueller
left a comment
There was a problem hiding this comment.
Code Review
Clean hierarchical layout algorithm with pinned element preservation and directional support. Isolated internal/layout package, good test coverage. Touches root.go — sequential merge needed.
Implements layout engine for automatic element positioning in draw.io diagrams. Changes: - internal/layout/types.go: Layout algorithm types and configuration - internal/layout/hierarchical.go: Hierarchical layout via longest-path algorithm - Layers elements based on outgoing relationships - Supports top-to-bottom (TB) and left-to-right (LR) ranking - Detects cycles and handles disconnected components - internal/layout/apply.go: Apply computed positions to draw.io XML - Respects pinned elements (bausteinsicht-pinned=true property) - Updates mxGeometry coordinates - internal/layout/hierarchical_test.go: 6 comprehensive tests - Layer assignment validation - Cycle handling (no infinite recursion) - RankDir variations - Edge cases (empty model, single element) - cmd/bausteinsicht/layout.go: CLI command - Usage: bausteinsicht layout [--rank-dir TB|LR] [--preserve-pinned] - Auto-detects model and diagram files - Reports applied layout Implementation Status: - ✅ Hierarchical layout (longest-path algorithm) - ⏳ Force-directed layout (future) - ⏳ Radial layout (future) Fixes #302 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
fcdec4e to
4b28e29
Compare
📊 Test Report (Multi-OS)
💡 Full report: Download artifacts from this workflow run. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds hierarchical layout engine for automatic element positioning in draw.io diagrams.
Changes:
bausteinsicht layout [--rank-dir TB|LR] [--preserve-pinned]Features:
Fixes #302
🤖 Generated with Claude Code