@robotaccomplice/architext 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -36,8 +36,8 @@ Architecture documentation usually fails in one of two ways:
36
36
  Architext takes a different position: the machine-readable architecture model is
37
37
  the source of truth, and the human site is a projection of that model.
38
38
 
39
- The visual direction was inspired by [Dave J's x.com post about interactive
40
- architecture and flow visualization](https://x.com/davej/status/2053867258653339746?s=46&t=e_qP9a_xUWuOJ6eKxFpaAQ).
39
+ The original project idea for Architext was inspired by [Dave J's x.com post
40
+ about interactive architecture and flow visualization](https://x.com/davej/status/2053867258653339746?s=46&t=e_qP9a_xUWuOJ6eKxFpaAQ).
41
41
  Architext turns that kind of engineer-friendly architecture map into a local,
42
42
  JSON-backed workflow that can live inside any project repository without
43
43
  vendoring viewer code into that repository.
@@ -93,6 +93,7 @@ The viewer will use a dense engineering layout:
93
93
  - selected-node and selected-step details on the right
94
94
  - search and filters
95
95
  - pan, zoom, fit, and maximize controls
96
+ - per-view orthogonal or curved route rendering
96
97
  - highlighted ordered paths through flows
97
98
  - scrollable detail sections for architecture, security, data, risks, and tests
98
99
 
@@ -484,13 +485,22 @@ tooling, global CLI lifecycle script, and the self-hosted Architext demo model.
484
485
  Core documents:
485
486
 
486
487
  - [Architecture Plan](docs/architecture/ARCHITECTURE_PLAN.md)
488
+ - [Routing Correctness Plan](docs/architecture/ROUTING_PLAN.md)
489
+ - [Routing Framework Comparison](docs/architecture/ROUTING_FRAMEWORK_COMPARISON.md)
487
490
  - [LLM Architext Contract](docs/architecture/LLM_ARCHITEXT.md)
488
491
  - [Agent Instructions Appendix](docs/architecture/AGENTS_APPENDIX.md)
489
492
 
490
493
  ## Attribution
491
494
 
492
- Architext was inspired by [Dave J's x.com post about interactive architecture
493
- and flow visualization](https://x.com/davej/status/2053867258653339746?s=46&t=e_qP9a_xUWuOJ6eKxFpaAQ).
495
+ The original project idea for Architext was inspired by [Dave J's x.com post
496
+ about interactive architecture and flow visualization](https://x.com/davej/status/2053867258653339746?s=46&t=e_qP9a_xUWuOJ6eKxFpaAQ).
497
+
498
+ Routing work also studies established diagramming and layout systems as
499
+ algorithm references. Architext's router is custom project code; it does not
500
+ copy source code from those projects. See
501
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) and the
502
+ [Routing Framework Comparison](docs/architecture/ROUTING_FRAMEWORK_COMPARISON.md)
503
+ for license posture and attribution.
494
504
 
495
505
  ## License
496
506
 
@@ -0,0 +1,59 @@
1
+ # Third-Party Notices
2
+
3
+ Architext is MIT licensed. This file records third-party software and algorithm
4
+ references that influence the project.
5
+
6
+ This is not legal advice. It is a project-maintained attribution and license
7
+ posture document.
8
+
9
+ ## Packaged Runtime And Build Dependencies
10
+
11
+ Architext's npm package and built viewer use open-source JavaScript packages.
12
+ The package manager remains the source of truth for exact transitive dependency
13
+ versions.
14
+
15
+ Direct runtime/build dependencies:
16
+
17
+ | Project | License | Use |
18
+ | --- | --- | --- |
19
+ | React | MIT | Viewer UI runtime |
20
+ | React DOM | MIT | Viewer UI runtime |
21
+ | Scheduler | MIT | React runtime dependency included through React DOM |
22
+ | AJV | MIT | JSON Schema validation |
23
+ | AJV Formats | MIT | JSON Schema format validation |
24
+ | Vite | MIT | Viewer build tooling |
25
+ | TypeScript | Apache-2.0 | Viewer type checking and build tooling |
26
+ | @vitejs/plugin-react | MIT | Viewer build tooling |
27
+
28
+ ## Routing Algorithm References
29
+
30
+ Architext's router is custom project code. It does not copy source code from
31
+ the projects below. The project studies their public documentation and papers
32
+ for established routing concepts such as fixed-node routing, explicit ports,
33
+ orthogonal routing, monotonic path restrictions, edge crossing costs, bridge
34
+ rendering, and route/label planning.
35
+
36
+ | Project | License / Terms | Architext Use |
37
+ | --- | --- | --- |
38
+ | Eclipse Layout Kernel / elkjs | EPL-2.0 | Algorithm reference only |
39
+ | Adaptagrams / libavoid | LGPL, with commercial dual licensing available | Algorithm reference only |
40
+ | yFiles | Commercial SDK | Capability reference only |
41
+ | JointJS Community | MPL-2.0 | Router behavior reference only |
42
+ | JointJS+ | Commercial product | Capability reference only |
43
+ | Cytoscape.js | MIT | Visualization ergonomics reference only |
44
+ | React Flow | MIT | Edge-style/UI ergonomics reference only |
45
+ | Graphviz | EPL-2.0 for current versions | Export/layout reference only |
46
+ | Sprotty | Eclipse open-source project | Architecture reference only |
47
+ | D2 | MPL-2.0 | Diagram-language reference only |
48
+ | TALA | Proprietary/closed-source | Capability reference only |
49
+
50
+ Any future change that copies, ports, bundles, wraps, or links third-party
51
+ routing code must update this file and include the required license text,
52
+ copyright notices, and distribution obligations before the change ships.
53
+
54
+ ## Product Inspiration
55
+
56
+ The original project idea for Architext was inspired by Dave J's x.com post
57
+ about interactive architecture and flow visualization:
58
+
59
+ https://x.com/davej/status/2053867258653339746?s=46&t=e_qP9a_xUWuOJ6eKxFpaAQ
@@ -0,0 +1,284 @@
1
+ # Routing Framework Comparison
2
+
3
+ Research date: May 14, 2026.
4
+
5
+ ## Context
6
+
7
+ Architext renders architecture maps from committed JSON data. The viewer is not a
8
+ general-purpose diagram editor: target repositories should own architecture
9
+ facts, not viewer implementation or hand-authored coordinates. Routing therefore
10
+ needs to be deterministic, local, testable, and compatible with package-owned
11
+ viewer assets.
12
+
13
+ The key design lesson is that routing cannot be a drawing-time afterthought.
14
+ Architext needs a holistic diagram planning pass that evaluates nodes, lanes,
15
+ labels, edge density, route corridors, and warnings before any SVG paths or HTML
16
+ cards are drawn.
17
+
18
+ Primary drivers:
19
+
20
+ - avoid non-endpoint node bodies
21
+ - keep route output stable for stable data
22
+ - support per-view orthogonal or curved rendering without mixing styles
23
+ - preserve Architext's lane/row architecture layout language
24
+ - keep target repositories data-only
25
+ - keep package installation simple
26
+ - avoid commercial or operational dependencies for core functionality
27
+
28
+ License posture: this document compares public capabilities and documented
29
+ algorithm concepts. Architext does not copy, port, bundle, wrap, or link source
30
+ code from these routing libraries. If that changes, the implementation must be
31
+ reviewed as a dependency decision and
32
+ [Third-Party Notices](../../THIRD_PARTY_NOTICES.md) must be updated before
33
+ release.
34
+
35
+ ## Candidates
36
+
37
+ | Candidate | Type | License / Terms | Strengths | Weaknesses | Fit |
38
+ | --- | --- | --- | --- | --- | --- |
39
+ | ELK / elkjs | layout engine | EPL-2.0 | Mature hierarchical layout, ports, labels, compound graphs, JavaScript package | Wants to own more layout than Architext currently delegates; option surface is large | Algorithm reference |
40
+ | libavoid / Adaptagrams | routing library | LGPL, with commercial dual licensing available | Purpose-built object-avoiding orthogonal/polyline connector routing | C++ library; browser integration likely requires WASM or wrapper work; LGPL obligations are not appropriate for a casual bundled dependency | Good algorithm reference; risky dependency |
41
+ | yFiles | commercial SDK | Commercial | Best-in-class routing: orthogonal, octilinear, curved, labels, bus routing, incremental routing | Commercial licensing and SDK lock-in; unsuitable as default OSS dependency | Reference only |
42
+ | JointJS | diagram framework | MPL-2.0 for Community; JointJS+ is commercial | Built-in Manhattan and metro routers with obstacle avoidance; SVG-based | Framework replacement pressure; some advanced features are commercial JointJS+ | Possible reference, poor default fit |
43
+ | Cytoscape.js | graph visualization framework | MIT | Mature interactive visualization and layout ecosystem | Optimized for network graphs, not architecture lanes; would replace renderer model | Poor default fit |
44
+ | React Flow | React diagram framework | MIT | Excellent interaction model and built-in edge styles | Edge styles are renderers, not a serious obstacle-avoiding router | Poor routing fit |
45
+ | Graphviz / Viz.js | layout engine | EPL-2.0 for current Graphviz versions | Mature graph layout; supports spline, polyline, curved, orthogonal options | Orthogonal routing has documented port/label limitations; output less aligned with interactive Architext layout | Reference or export path |
46
+ | Sprotty + ELK | diagram framework plus layout engine | Eclipse open-source project; commonly paired with EPL-2.0 ELK | Strong model-driven diagram stack with ELK integration | Heavy framework adoption; dependency injection and SModel add complexity | Too large for current viewer |
47
+ | D2 / TALA | diagram tool and layout engine | D2 is MPL-2.0; TALA is proprietary/closed-source | TALA is architecture-diagram-oriented and orthogonal | TALA licensing and closed-source distribution are incompatible with Architext's default runtime | Reference only |
48
+
49
+ ## Source Notes
50
+
51
+ - ELK is a collection of graph drawing algorithms; elkjs is its JavaScript
52
+ cousin and is used in academic and commercial projects.
53
+ - Sprotty integrates ELK by transforming Sprotty models into ELK graph elements
54
+ and transferring computed positions back.
55
+ - libavoid is explicitly about object-avoiding polyline and orthogonal connector
56
+ routing for interactive diagram editors.
57
+ - yFiles EdgeRouter can route fixed-node diagrams as orthogonal, octilinear, or
58
+ curved paths and supports incremental scenarios.
59
+ - JointJS's Manhattan router is a smart orthogonal router that inserts route
60
+ points while avoiding obstacles; its metro router extends that to octilinear
61
+ routing.
62
+ - Cytoscape.js supports rich graph visualization and several edge styles,
63
+ including bezier, taxi, and round-taxi edges, but it is a broader graph
64
+ visualization stack.
65
+ - React Flow has default, straight, step, smoothstep, and simple bezier edge
66
+ renderers, but this is visual edge styling, not obstacle-aware route planning.
67
+ - Graphviz supports spline, polyline, curved, and orthogonal edge styles, but
68
+ its own documentation says orthogonal routing currently does not handle ports
69
+ or edge labels in dot.
70
+ - TALA is positioned as a general orthogonal layout engine for architecture-style
71
+ diagrams, but D2 documents it as proprietary and closed-source.
72
+
73
+ ## Curved Routing Techniques
74
+
75
+ Curved routing is not one algorithm family. The relevant techniques split into
76
+ practical diagram-rendering methods and broader visualization/research methods.
77
+
78
+ | Technique | Usefulness to Architext | Notes |
79
+ | --- | --- | --- |
80
+ | Bézier spline post-processing | High | Smooth an already accepted polyline/orthogonal route. This preserves Architext's lane layout and keeps collision checks tractable. |
81
+ | Geometric control-point modeling | High | Make curve control points explicit, sampled, scored, and debuggable. |
82
+ | Tangent-visibility graph routing | Medium | Useful for computing smooth corridors around inflated node obstacles. More complex than current grid routing, but aligned with fixed-node diagrams. |
83
+ | Force-directed edge bundling | Low by default | Useful for dense network overviews, but can hide individual architecture relationships and introduces iterative/non-obvious behavior. |
84
+ | Differential-equation-based routing | Low | Interesting research path, but too much complexity for the current product constraints. |
85
+ | Curve-based planar graph routing | Low | More relevant to general graph traversal than fixed-node architecture maps. |
86
+
87
+ The strongest near-term curved strategy is post-processing: first compute a
88
+ correct obstacle-aware route, then transform it into a smooth path and sample
89
+ the rendered curve for collision and label checks. This is materially different
90
+ from drawing arbitrary source-to-target Béziers.
91
+
92
+ ## Assessment
93
+
94
+ ### ELK / elkjs
95
+
96
+ ELK has the right conceptual model to study: nodes, edges, ports, labels,
97
+ compound graph structure, and layout options. It could be used in two ways:
98
+
99
+ 1. full layout mode, where ELK places nodes and routes edges
100
+ 2. routing oracle mode, where Architext supplies fixed node positions and asks
101
+ ELK for edge sections
102
+
103
+ Neither mode should be the next step. Architext's lanes and rows are part of the
104
+ product language; even a routing-oracle integration would introduce a second
105
+ layout vocabulary before the current router has exhausted the obvious algorithm
106
+ improvements.
107
+
108
+ Best use: lift concepts, not code. ELK reinforces that ports, labels, compound
109
+ boundaries, and deterministic layout options should be first-class router inputs.
110
+ It should not be adopted as a dependency unless Architext later needs whole-graph
111
+ layout, not just edge routing.
112
+
113
+ ### libavoid
114
+
115
+ libavoid maps very closely to the problem: route connectors around rectangular
116
+ obstacles. Its algorithm lineage is directly relevant to Architext's current
117
+ custom router. The practical problem is packaging. A C++ dependency would need a
118
+ maintained JavaScript/WASM story, browser compatibility checks, and npm package
119
+ integration. That is a lot of surface area for a CLI whose current distribution
120
+ goal is simple global install.
121
+
122
+ Best use: study the algorithm and data model. Do not adopt until a maintained
123
+ WASM package is proven.
124
+
125
+ ### yFiles
126
+
127
+ yFiles is the strongest product capability benchmark. It supports exactly the
128
+ kind of route-style choice Architext is moving toward: orthogonal, octilinear,
129
+ and curved routes over fixed node positions. It also covers labels, grouped
130
+ graphs, incremental routing, bus routing, and advanced layout workflows.
131
+
132
+ It is not a suitable default dependency for Architext because Architext is an
133
+ open-source CLI package. Commercial SDK licensing would materially change usage,
134
+ distribution, and contributor expectations.
135
+
136
+ Best use: capability reference. Do not depend on it.
137
+
138
+ ### JointJS
139
+
140
+ JointJS is close to Architext's current SVG model and its routers are relevant,
141
+ especially Manhattan obstacle avoidance. The drawback is architectural: JointJS
142
+ is a diagramming framework, not just a route function. Adopting it would pressure
143
+ Architext toward an editor-style object model and away from the current
144
+ data-only viewer model.
145
+
146
+ Best use: compare Manhattan router behavior and options. Avoid wholesale
147
+ adoption unless Architext intentionally becomes an editable diagram tool.
148
+
149
+ ### Cytoscape.js
150
+
151
+ Cytoscape.js is excellent for graph visualization and analysis. It has useful
152
+ edge styles and a mature layout ecosystem. It is less aligned with Architext's
153
+ architecture-map semantics: lanes, workflow steps, C4 boundaries, detail panels,
154
+ and package-owned static viewer output.
155
+
156
+ Best use: reference for edge style ergonomics and performance patterns. Not a
157
+ routing dependency.
158
+
159
+ ### React Flow
160
+
161
+ React Flow is a strong interactive diagram UI library, but its built-in edge
162
+ types are mostly path renderers. It does not solve the hard part Architext is
163
+ working on: deterministic obstacle-aware routing with label placement and dense
164
+ fan-out.
165
+
166
+ Best use: reference for UI controls and interaction conventions. Not a routing
167
+ dependency.
168
+
169
+ ### Graphviz / Viz.js
170
+
171
+ Graphviz is mature and useful for generated graph diagrams. The mismatch is
172
+ control. Architext needs predictable integration with its own lane layout and
173
+ interactive details. Graphviz orthogonal routing also has explicit limitations
174
+ around ports and labels, which are central to the problems Architext still has.
175
+
176
+ Best use: possible export format or benchmark. Not the primary viewer router.
177
+
178
+ ### Sprotty + ELK
179
+
180
+ Sprotty is credible for model-driven diagrams and integrates with ELK. It is too
181
+ large for the current step because it would replace much more than edge routing:
182
+ data model, rendering model, action dispatch, dependency injection, and layout
183
+ flow.
184
+
185
+ Best use: reference architecture if Architext ever grows into an editor.
186
+
187
+ ### D2 / TALA
188
+
189
+ D2 and TALA are instructive because TALA targets architecture diagrams and
190
+ orthogonal layout. The licensing constraint is decisive for Architext's default
191
+ runtime: D2 documents TALA as proprietary and closed-source.
192
+
193
+ Best use: benchmark output and design vocabulary. Do not depend on it.
194
+
195
+ ## Recommendation
196
+
197
+ Do not replace the current viewer with a graph framework.
198
+
199
+ Proceed in this order:
200
+
201
+ 1. Keep the pure `routeEdges` API as Architext's routing boundary.
202
+ 2. Add a whole-diagram planning boundary above the router so all geometry is
203
+ evaluated together before rendering.
204
+ 3. Add correctness features inside the current router first:
205
+ - explicit port candidates
206
+ - label bounding boxes and label collision scoring
207
+ - edge-edge intersection counting
208
+ - bridge/hop rendering for accepted perpendicular crossings
209
+ - warnings when the best route is least-bad rather than clean
210
+ 4. Lift proven router concepts from ELK, libavoid, yFiles, and JointJS without
211
+ adding a dependency:
212
+ - explicit source and target port candidates
213
+ - obstacle-expanded visibility graph or grid graph
214
+ - bend count, length, crossing, clearance, and label penalties
215
+ - monotonic path preferences where architecture flow direction is known
216
+ - edge grouping and lane spacing for fan-out/fan-in
217
+ - bridge/hop rendering for accepted perpendicular intersections
218
+ 5. Defer external engine adoption. Revisit only if the pure router cannot meet
219
+ measurable benchmarks on Architext and Roboticus after those concepts are
220
+ implemented.
221
+
222
+ ## Library-Derived Rules To Adopt
223
+
224
+ The existing libraries suggest that Architext should stop treating routing as a
225
+ collection of edge-local penalties. Mature routers expose a clearer model:
226
+
227
+ - **Route against fixed nodes, but plan all relevant edges together.** yFiles
228
+ EdgeRouter and OrthogonalEdgeRouter explicitly keep node positions fixed while
229
+ routing edges around them. Architext's lane layout can stay owned by the
230
+ viewer, but edge planning should see the whole diagram.
231
+ - **Use port candidates, not one anchor point.** ELK and yFiles both model ports
232
+ as explicit edge attachment points. JointJS also exposes perpendicular routing
233
+ behavior so links can connect cleanly to a nearby orthogonal point instead of
234
+ blindly using an anchor.
235
+ - **Treat costs as first-class configuration.** yFiles exposes costs for
236
+ crossings and other routing situations. Architext needs named, inspectable
237
+ costs for node collisions, edge crossings, repeated crossings, bends, long
238
+ corridors, shallow doglegs, label conflicts, and perimeter fallback.
239
+ - **Support monotonic restrictions.** yFiles documents monotonic path
240
+ restrictions: route segments should generally move from source toward target
241
+ instead of turning back. This maps directly to the bad routes we are seeing
242
+ when an edge travels across the canvas, doubles back, or uses a shallow Z
243
+ break.
244
+ - **Balance center-driven and space-driven search.** yFiles exposes a
245
+ center-to-space ratio. Architext currently has an implicit, unstable version
246
+ of this. We need an explicit bias: prefer local, direct routes first; spread
247
+ only when direct routes collide or stack.
248
+ - **Bound search complexity.** JointJS Manhattan routing exposes grid step size
249
+ and maximum loop count with fallback behavior. Architext needs the same kind
250
+ of bounded search contract before adding more flexible ports.
251
+ - **Separate routing from rendering.** JointJS routers transform link vertices
252
+ into route points; yFiles computes routes before drawing. Architext should
253
+ compute route geometry, warnings, and labels in `planDiagram`, then render SVG
254
+ from the planned geometry.
255
+ - **Use fallback warnings.** When the best route is only least-bad, the planner
256
+ should report why: too-close nodes, no clean corridor, repeated crossing, label
257
+ conflict, or search exhausted.
258
+
259
+ ## Decision Bias
260
+
261
+ The current custom router is still justified because Architext has a constrained
262
+ diagram language: lanes, rows, known node rectangles, and a global style choice.
263
+ Those constraints make a small pure router viable. The risk is underestimating
264
+ label placement and edge-edge readability. That risk should be addressed with
265
+ tests and metrics before adopting a broad diagramming framework.
266
+
267
+ ## Sources
268
+
269
+ - [ELK paper](https://arxiv.org/abs/2311.00533)
270
+ - [ELK project license](https://projects.eclipse.org/projects/modeling.elk)
271
+ - [Sprotty ELK integration](https://sprotty.org/docs/sprotty-elk/introduction/)
272
+ - [Adaptagrams libavoid](https://www.adaptagrams.org/documentation/libavoid.html)
273
+ - [Adaptagrams overview](https://www.adaptagrams.org/)
274
+ - [yFiles edge routing](https://docs.yworks.com/yfiles-html/dguide/automatic-layouts-main-chapter/polyline_router.html)
275
+ - [yFiles orthogonal edge router](https://docs.yfiles.com/yfiles/doc/api-svg/y/layout/router/OrthogonalEdgeRouter.html)
276
+ - [JointJS routers](https://docs.jointjs.com/4.0/api/routers/)
277
+ - [JointJS licensing](https://www.jointjs.com/license)
278
+ - [Cytoscape.js documentation](https://js.cytoscape.org/)
279
+ - [React Flow edge types](https://reactflow.dev/examples/edges/edge-types)
280
+ - [React Flow edge API](https://reactflow.dev/api-reference/types/edge)
281
+ - [Graphviz splines](https://graphviz.org/docs/attrs/splines/)
282
+ - [Graphviz license](https://graphviz.org/license/)
283
+ - [D2 TALA](https://d2lang.com/tour/tala/)
284
+ - [TALA license notes](https://terrastruct.com/tala/)