@r0kshan/cairn 1.0.0-RC11
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/LICENSE +201 -0
- package/README.md +270 -0
- package/THIRD-PARTY-NOTICES.md +31 -0
- package/bin/cairn.mjs +100578 -0
- package/dist/cairn.mjs +99663 -0
- package/package.json +69 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Røkshan
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# Cairn, a specialized Software Architecture Diagram as Code tool
|
|
2
|
+
|
|
3
|
+
*Just as a mountain trail is marked by cairns, software architecture is understood through a series of views, each revealing a different part of the landscape.*
|
|
4
|
+
|
|
5
|
+
## In short,
|
|
6
|
+
|
|
7
|
+
Cairn is an [Elkjs (Eclipse Layout Kernel)](https://github.com/kieler/elkjs) based diagram-as-code tool specialised in these three software architecture views : `logical`, `application` and `infrastructure`, with the aim to follow the requirements of the methodology. This tool comes with a CLI and a [browser playground](https://cairn-psi-five.vercel.app/), both providing template initializing for each type of diagram, validation, live previous, and export to SVG and PNG format.
|
|
8
|
+
|
|
9
|
+
## Status
|
|
10
|
+
|
|
11
|
+
**Ongoing development** - Pre-releases are available. Stable version will be release when all opened issues are resolved.
|
|
12
|
+
|
|
13
|
+
## Table of contents
|
|
14
|
+
|
|
15
|
+
- [Why cairn?](#why-cairn)
|
|
16
|
+
- [Usage](#usage)
|
|
17
|
+
- [Preview](#preview)
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Commands](#commands)
|
|
20
|
+
- [More](#more)
|
|
21
|
+
|
|
22
|
+
## Why cairn?
|
|
23
|
+
|
|
24
|
+
A large majority of the diagrams (logical, application, infrastructure view) in existing Software Architecture Documents I've worked are made with graphical diagramming softwares such as Drawio and the like. However, modifying diagrams manually in a GUI despite providing more control on the display, take time and migrating to diagram as code has proven complicated since most diagrams are rich and it's hard to preserve the same level of information with other solutions like C4.
|
|
25
|
+
|
|
26
|
+
Furthermore, complexe software architecture with many flows and component generated with existing diagram-as-code tools end up very large or with overlapping flow labels making them unreadable and therefore not possible to integrate in a techical architecture document that requires specifically a logical view, application, physical & infrastructure view and Cairn is made specially to answer this need by provided the following features :
|
|
27
|
+
|
|
28
|
+
| Features | Description |
|
|
29
|
+
|---|---|
|
|
30
|
+
| **Readability through overlap-checked layout.** | Label space is reserved during layout; overlaps are measured every build and shipped at 0, with a CI gate. Each flow stays a distinct arrow with its own label. Labels can also be numbered, with the full labels displayed in the legend. |
|
|
31
|
+
| **Configurable dispositions** | `slide` and `page` dispositions available to suit different presentation requirements |
|
|
32
|
+
| **Spacial optimization** | Cairn aims to optimize space as much as possible (Still working on improving this functionnality) |
|
|
33
|
+
| **Typed diagrams with validation.** | Each view defines its element kinds and rules; `cairn validate` reports syntax, schema, and completeness issues as source-located, coded diagnostics, with a JSON mode for CI. |
|
|
34
|
+
| **Infrastructure flow matrix.** | `cairn matrix` exports the flow matrix as CSV, Markdown, or SVG. Columns split protocol from port, annotate each endpoint with its network zone, and localise via `style { lang: fr }`. |
|
|
35
|
+
| **Enterprise-view extras.** | Business objects on flows, an auto-generated legend, and a numbered-flow table via `flow-text: numbered`. |
|
|
36
|
+
| **French or English output.** | `style { lang: fr }` localizes band titles, legend, and matrix headers while keeping keywords English for portable sources (open to adding other languages if you find this usefull) |
|
|
37
|
+
| **In-built themes and customizable colours** | Whether using the default or a chosen in-built theme, element colours can be overriden for all elements of a given kind in the `style` block |
|
|
38
|
+
|
|
39
|
+
> Cairn is not a replacement for general diagram tools; for flowcharts, sequence, or ER diagrams, Mermaid or D2 remain the better fit. For C4-level software-structure modeling, dedicated C4 tools like Structurizr or LikeC4 ([c4model.com](https://c4model.com)) are a mature choice.
|
|
40
|
+
|
|
41
|
+
As a result here's a comparaison of the same diagram done with D2 (ELK Layout) vs Cairn (tuned ELK Layout) :
|
|
42
|
+
|
|
43
|
+
<table>
|
|
44
|
+
<tr>
|
|
45
|
+
<td align="center" width="50%"><strong>D2 (ELK Layout)</strong></td>
|
|
46
|
+
<td align="center" width="50%"><strong>Cairn (ELK)</strong></td>
|
|
47
|
+
</tr>
|
|
48
|
+
<tr>
|
|
49
|
+
<td align="center"><img src="./documentation/research/d2-comparison/logical-arch-d2.png" alt="D2 diagram" width="50%"></td>
|
|
50
|
+
<td align="center"><img src="./documentation/research/d2-comparison/logical-arch-cairn.png" alt="Cairn diagram" width="50%"></td>
|
|
51
|
+
</tr>
|
|
52
|
+
<tr>
|
|
53
|
+
<td align="center"><a href="https://play.d2lang.com/?script=tFfNbiJHF93zFFd8C28-Ox4n2aAoEgNtB8kDFt0ezYyQULn6AqUUVT11q4mdyO-Tzjpv0C8WVXUDRQM2nig7G7vOPffvnEsqDHIrtOqAEfOFba2YoQ780QJIr865VjMxr34FkOxJ5_Yc1Vwo7ADKX_3HdoFLPBdpB76_vGz5j_4H3TR1fyAEypgVTEJmdIbGCiSwGnRmxVL8jmB0boWad1oAz63nVmuPUOvLaBhNe8n4tuIh2QPKDrRvjM4zXKKykCKY8m-JBOfwRSsEjsoaJrHt6IxHt9F09D6eXr7bZlJhdOf1c66V9RAwUR4hM0JxkXkM94IWLMMOZGhIK__JbyK1iw78eOmZr-PcRAfC3CC5jBQTxgWYaeUzVCgBLVjkCyW-5m-MlES9Xw7ESjwaF6gIUqSJMkikc8OR4Jsye647ECfdZDAantSEWFiEVJBlyroocyPSc65lvlTUgXfbrtwdKtcoKwvDLOYGLBrDhJqoJuLpvHuD97fRLuueeHA88dGWhRGYG6QjLO_jaDy9Hgy7t02Sdz6u8q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qBrnauvIPK0N5t_WK5jC0INqY3LTWBarslCeHrVbL23f24qzw2TTNFeocDM9R1PZt9d_6575HSKdL5ioLpMjtNxVcZomBjrcKBFIBlKQN-Zg8mtHctqcorKOB6Q5rMpiIXh1l4Et_7IuH52b4Iu3-9IndFp9EX5JLk5Wc38etoc7nmkNmwkebrGbunz9Jeu_Hqv6Z6r0jMj7OjAizYXvWLhye7pZnU1knyRe6IxxYZ86cNl6bv0TAAD__w%3D%3D&layout=elk">Link to D2 playground</a>
|
|
54
|
+
</td>
|
|
55
|
+
<td align="center"><a href="https://cairn-psi-five.vercel.app/#src=ZGlhZ3JhbSBsb2dpY2FsICJTeXN0w6htZSBkZSBjb250csO0bGUgZCdhZmZpY2hhZ2Ug4oCUIHZ1ZSBsb2dpcXVlIgoKCmFjdG9yLWdyb3VwIFpPTkVfQ1RSTCAiR3JvdXBlbWVudCBkZSByw7RsZXMgLSBab25lIGNlbnRyYWxlIiB7CiAgYWN0b3IgT0JTICAiQWdlbnQgZGUgY29udHLDtGxlIFxuWm9uZSBwcmluY2lwYWxlIgogIGFjdG9yIEdFICAgIkdlc3Rpb25uYWlyZSBcbmZvbmN0aW9ubmVsIGV0IHRlY2huaXF1ZSIKICBhY3RvciBURUNIICJUZWNobmljaWVucyBkZXNcbnJlc3NvdXJjZXMgWm9uZSBwcmluY2lwYWxlIgp9CgphY3Rvci1ncm91cCBaT05FX1NUQVRJT04gIkdyb3VwZW1lbnQgZGUgcsO0bGVzIC0gU2l0ZSBkaXN0YW50IiB7CiAgYWN0b3IgT1BFICJPcMOpcmF0ZXVyIHRlcnJhaW5cblNpdGUgZGlzdGFudCIKfQoKYWN0b3ItZ3JvdXAgWk9ORV9DSUJMRSAiQ2libGVzIGV4dMOpcmlldXJlcyIgewogIGFjdG9yIFVTRVJfRklOQUwgIlBlcnNvbm5lIGNvbmNlcm7DqWUiCiAgYWN0b3IgVVNFUl9DT05EICJBZ2VudCBkZSBzZXJ2aWNlIHBhc3NhZ2VycyIKIC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IG1pc3Npb25zIGV0IGRlc3NlcnRlcyBhc3NvY2nDqXMiCg==">Diagram in Cairn playground</a></td>
|
|
56
|
+
</tr>
|
|
57
|
+
<tr>
|
|
58
|
+
<td>I encountered overlapping issues for which I couldn't find a workaround</td>
|
|
59
|
+
<td>The overlapping issues have been addressed. A caveat remains: the long-distance arrow can affect readability (still working on improvements)</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
|
|
63
|
+
## Known limitations I'm working on
|
|
64
|
+
|
|
65
|
+
* While Cairn ensures 0 label overlap, flows on large diagrams still take a longer than neccessary route to the target element - issue [#26](https://github.com/R0kshan/cairn/issues/26) created to adress this
|
|
66
|
+
* At the moment Cairn doesn't give the user the possibility to control positioning - issue [#8](https://github.com/R0kshan/cairn/issues/8) created to adress this
|
|
67
|
+
|
|
68
|
+
## Usage
|
|
69
|
+
|
|
70
|
+
Either use the cli or the [ playground](https://cairn-psi-five.vercel.app/).
|
|
71
|
+
|
|
72
|
+
## Preview
|
|
73
|
+
|
|
74
|
+
Every image below is rendered by cairn CLI from a `.cairn` source in [`examples/`](examples/) — plain SVG, zero label overlaps.
|
|
75
|
+
|
|
76
|
+
> The example diagrams have been generated with AI and some of them purposely large to showcase how such diagrams are rendered with Cairn to handle overlap.
|
|
77
|
+
|
|
78
|
+
### Logicial view diagram examples from small to large
|
|
79
|
+
|
|
80
|
+
<p align="center"><img src="examples/small.svg" alt="Small logical view" width="760"></p>
|
|
81
|
+
<p align="center"><img src="examples/medium.svg" alt="Medium logical view" width="760"></p>
|
|
82
|
+
<p align="center"><img src="examples/large.svg" alt="Medium logical view" width="760"></p>
|
|
83
|
+
|
|
84
|
+
### Application view diagram examples from small to large
|
|
85
|
+
|
|
86
|
+
<p align="center"><img src="examples/application-small.svg" alt="Small application view" width="760"></p>
|
|
87
|
+
<p align="center"><img src="examples/application-medium.svg" alt="Medium application view" width="760"></p>
|
|
88
|
+
<p align="center"><img src="examples/application-large.svg" alt="Large application view" width="760"></p>
|
|
89
|
+
|
|
90
|
+
### Infrastructure view diagram examples from small to large
|
|
91
|
+
|
|
92
|
+
<p align="center"><img src="examples/infrastructure-small.svg" alt="Small infrastructure view" width="760"></p>
|
|
93
|
+
<p align="center"><img src="examples/infrastructure-medium.svg" alt="Medium infrastructure view" width="760"></p>
|
|
94
|
+
<p align="center"><img src="examples/infrastructure-large.svg" alt="Large infrastructure view" width="760"></p>
|
|
95
|
+
|
|
96
|
+
#### Matrix flow export example (for the small diagram above)
|
|
97
|
+
|
|
98
|
+

|
|
99
|
+
|
|
100
|
+
### Custom colours
|
|
101
|
+
|
|
102
|
+
Colours are resolved at three levels — most specific wins. From lowest to highest priority:
|
|
103
|
+
|
|
104
|
+
1. **Theme defaults** — per-kind colours defined by the selected theme (fill, stroke, text for each element kind).
|
|
105
|
+
2. **Diagram-level per-kind overrides** — override colours for all elements of a given kind in the `style` block:
|
|
106
|
+
```
|
|
107
|
+
style {
|
|
108
|
+
fill actor-group: #eef4fb
|
|
109
|
+
stroke actor-group: #7a9cc4 dashed
|
|
110
|
+
text block: #222233
|
|
111
|
+
background: #fffdf5 # canvas background
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
3. **Inline per-element styles** — override colour for a single element:
|
|
115
|
+
```
|
|
116
|
+
block API "API gateway" { style { fill: #e8f5e9 stroke: #2e7d32 text: #1b5e20 } }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Flows can also be coloured inline:
|
|
120
|
+
```
|
|
121
|
+
COM_CTR -> OBS : "Alerts…" { label: above stroke: dashed #a33 text: #a33 }
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
See [`examples/colors-custom.cairn`](examples/colors-custom.cairn) for a full example:
|
|
125
|
+
|
|
126
|
+
<p align="center"><img src="examples/colors-custom.svg" alt="Custom colours" width="620"></p>
|
|
127
|
+
|
|
128
|
+
### Dispositions
|
|
129
|
+
|
|
130
|
+
Same diagram different disposition :
|
|
131
|
+
- [Slide disposition](https://cairn-psi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ZW1zIiB7CiAgYmxvY2sgU01TICJTTVMgZ2F0ZXdheSIKfQoKIyAtLS0tIGJ1c2luZXNzIG9iamVjdHMgLS0tLQpidXNpbmVzcy1vYmplY3QgQk9fQVBQVCAiQXBwb2ludG1lbnQiICJzbG90IGJvb2tlZCBieSBhIHBhdGllbnQgd2l0aCBhIHByYWN0aXRpb25lciIKYnVzaW5lc3Mtb2JqZWN0IEJPX1NMT1QgIlNsb3QiICJ0aW1lIHdpbmRvdyBvcGVuIGZvciBib29raW5nIgoKUEFUSUVOVCAtPiBQT1JUQUwgOiAiU2VhcmNoIGEgc2xvdFxuYW5kIGJvb2siIFtCT19TTE9UXQpQT1JUQUwgLT4gU0NIRURVTEVSIDogIkJvb2tpbmcgcmVxdWVzdCIgW0JPX0FQUFRdClNDSEVEVUxFUiAtPiBOT1RJRiA6ICJBcHBvaW50bWVudCBjb25maXJtZWQiIFtCT19BUFBUXQpOT1RJRiAtPiBTTVMgOiAiU2VuZCBTTVMgcmVtaW5kZXIiClNFQ1JFVEFSWSAtPiBTQ0hFRFVMRVIgOiAiT3BlbiAvIGJsb2NrXG5zbG90cyIgW0JPX1NMT1RdClNDSEVEVUxFUiAtPiBQQVRJRU5UIDogIkFwcG9pbnRtZW50XG5jb25maXJtYXRpb24iIFtCT19BUFBUXQoKbGVnZW5kIHsKICBub3RlICJIZWFsdGggZGF0YSBpcyBzdG9yZWQgb24gY2VydGlmaWVkIGhlYWx0aC1kYXRhLWhvc3RpbmcgaW5mcmFzdHJ1Y3R1cmUiCn0K)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
### Numbered flows
|
|
136
|
+
|
|
137
|
+
> This example has a large number of flows on purpose in order to showcase how it renders. But in such a case, it's best to consider breaking the diagram into two diagrams : one more general one more zoomed in.
|
|
138
|
+
|
|
139
|
+
<p align="center"><img src="examples/large-numbered.svg" alt="Custom colours" width="620"></p>
|
|
140
|
+
|
|
141
|
+
### Themes
|
|
142
|
+
|
|
143
|
+
Cairn comes with a collection of built-in themes. Choose the one that best fits your presentation or documentation style:
|
|
144
|
+
|
|
145
|
+
<table align="center">
|
|
146
|
+
<tr>
|
|
147
|
+
<td align="center"><strong>Classic</strong><br><img src="examples/themes/classic.svg" alt="Classic theme" width="200"></td>
|
|
148
|
+
<td align="center"><strong>Classic Dark</strong><br><img src="examples/themes/classic-dark.svg" alt="Classic Dark theme" width="200"></td>
|
|
149
|
+
<td align="center"><strong>Light</strong><br><img src="examples/themes/light.svg" alt="Light theme" width="200"></td>
|
|
150
|
+
</tr>
|
|
151
|
+
<tr>
|
|
152
|
+
<td align="center"><strong>Dark</strong><br><img src="examples/themes/dark.svg" alt="Dark theme" width="200"></td>
|
|
153
|
+
<td align="center"><strong>Contrast</strong><br><img src="examples/themes/contrast.svg" alt="Contrast theme" width="200"></td>
|
|
154
|
+
<td align="center"><strong>Nord</strong><br><img src="examples/themes/nord.svg" alt="Nord theme" width="200"></td>
|
|
155
|
+
</tr>
|
|
156
|
+
<tr>
|
|
157
|
+
<td align="center"><strong>Sand</strong><br><img src="examples/themes/sand.svg" alt="Sand theme" width="200"></td>
|
|
158
|
+
<td align="center"><strong>Slate</strong><br><img src="examples/themes/slate.svg" alt="Slate theme" width="200"></td>
|
|
159
|
+
<td align="center"><strong>Solarized</strong><br><img src="examples/themes/solarized.svg" alt="Solarized theme" width="200"></td>
|
|
160
|
+
</tr>
|
|
161
|
+
</table>
|
|
162
|
+
|
|
163
|
+
## Installation
|
|
164
|
+
|
|
165
|
+
Prebuilt, self-contained binaries are published on every `v*` tag (no runtime needed). Pick your platform:
|
|
166
|
+
|
|
167
|
+
```sh
|
|
168
|
+
# macOS / Linux — curl installer
|
|
169
|
+
curl -fsSL https://raw.githubusercontent.com/R0kshan/cairn/main/packaging/install.sh | sh
|
|
170
|
+
|
|
171
|
+
# macOS / Linux — Homebrew
|
|
172
|
+
brew install R0kshan/tap/cairn
|
|
173
|
+
|
|
174
|
+
# Windows — Scoop
|
|
175
|
+
scoop bucket add cairn https://github.com/R0kshan/scoop-bucket
|
|
176
|
+
scoop install cairn
|
|
177
|
+
|
|
178
|
+
# npm (requires Node ≥ 22.6)
|
|
179
|
+
npm i -g @r0kshan/cairn@unstable
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
> `@unstable` is not optional: cairn is pre-stable, so tagged versions publish to
|
|
183
|
+
> that dist-tag and there is no `latest` yet — a bare `npm i -g @r0kshan/cairn`
|
|
184
|
+
> fails with `No matching version found` until the first stable release.
|
|
185
|
+
|
|
186
|
+
From source (no release needed — requires Node ≥ 22.6):
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
git clone https://github.com/R0kshan/cairn && cd cairn
|
|
190
|
+
npm install
|
|
191
|
+
npm run cairn -- --help # or: node bin/cairn.js --help
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Commands
|
|
195
|
+
|
|
196
|
+
Once installed, the command is `cairn`. From a clone, run `npm run cairn -- <command>`.
|
|
197
|
+
|
|
198
|
+
### Scaffold a typed starter file
|
|
199
|
+
|
|
200
|
+
```sh
|
|
201
|
+
cairn new -L my-system.cairn # -L logical · -A application · -I infrastructure
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The chosen view is written into the file header (`diagram logical …`); every other command reads it from there.
|
|
205
|
+
|
|
206
|
+
### Check a diagram (syntax, schema, completeness)
|
|
207
|
+
|
|
208
|
+
```sh
|
|
209
|
+
cairn validate my-system.cairn # --format json for CI/agents · --strict to fail on warnings
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Problems are reported as source-located, coded diagnostics with a suggested fix:
|
|
213
|
+
|
|
214
|
+
```text
|
|
215
|
+
error[E0210]: functional block outside any system (`ORPHAN`)
|
|
216
|
+
--> my-system.cairn:8:7
|
|
217
|
+
|
|
|
218
|
+
8 | block ORPHAN "Floating block"
|
|
219
|
+
| ^^^^^^
|
|
220
|
+
help: move this `block` inside a `layer`, `system` or `external`
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Render to SVG
|
|
224
|
+
|
|
225
|
+
```sh
|
|
226
|
+
cairn build my-system.cairn -o my-system.svg # -o optional; defaults to the same name, .svg
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
On validation errors nothing is written and the exit code is 1; warnings are printed but do not block.
|
|
230
|
+
|
|
231
|
+
### Export the flow matrix
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
cairn matrix my-infra.cairn --format csv # csv (default) | md | svg · -o to set the path
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Rebuild on every save
|
|
238
|
+
|
|
239
|
+
```sh
|
|
240
|
+
cairn watch my-system.cairn
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Rebuilds the SVG on save. On a compile error the SVG becomes an error panel (codes, lines, help), so an open preview never shows a stale diagram. Watch observes only the file it was launched on — run one per file. Pair it with an editor that auto-refreshes an open SVG.
|
|
244
|
+
|
|
245
|
+
### Explain a diagnostic
|
|
246
|
+
|
|
247
|
+
```sh
|
|
248
|
+
cairn explain E0240
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
```text
|
|
252
|
+
E0240 — The infrastructure view requires every flow to carry its protocol (and port if
|
|
253
|
+
relevant): the flow matrix is the primary output of this view. Add `(HTTPS/443)` after the label.
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Check your version
|
|
257
|
+
|
|
258
|
+
```sh
|
|
259
|
+
cairn version # or --version / -v
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Released binaries (the ones from Homebrew, Scoop, or the GitHub Releases page) print the exact tag they were built from. Running from a clone via `npm run cairn` prints `package.json`'s version instead.
|
|
263
|
+
|
|
264
|
+
## More
|
|
265
|
+
|
|
266
|
+
- [`DIAGNOSTICS.md`](documentation/DIAGNOSTICS.md) — every diagnostic code and its meaning.
|
|
267
|
+
- [`DSL_SPEC.md`](documentation/DSL_SPEC.md) — the DSL syntax.
|
|
268
|
+
- [`ARCHITECTURE.md`](documentation/ARCHITECTURE.md) — how the pipeline fits together, for contributors.
|
|
269
|
+
- [`CONTRIBUTING.md`](CONTRIBUTING.md) — how to open a PR, and the gates it must pass.
|
|
270
|
+
- [`documentation/`](documentation/) — architecture, invariants, DSL and internals.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
cairn is Apache-2.0 (`LICENSE`). Its shipped artifacts — the npm tarball's
|
|
4
|
+
`bin/cairn.mjs`, the release binaries, the playground bundles — additionally
|
|
5
|
+
*contain* third-party code, so this notice travels with them.
|
|
6
|
+
|
|
7
|
+
Build-only tools (esbuild, Bun, biome, typescript) are not listed: nothing of
|
|
8
|
+
theirs is distributed.
|
|
9
|
+
|
|
10
|
+
## elkjs
|
|
11
|
+
|
|
12
|
+
Version 0.12.0, inlined unmodified. Upstream: https://github.com/kieler/elkjs
|
|
13
|
+
|
|
14
|
+
Declared license: `EPL-2.0 OR GPL-3.0-or-later`. cairn elects **EPL-2.0** — full
|
|
15
|
+
text at https://www.eclipse.org/legal/epl-2.0/ and in `LICENSE.md` inside the
|
|
16
|
+
elkjs package.
|
|
17
|
+
|
|
18
|
+
Per EPL-2.0 §3.1(a): the source code for elkjs is available under the EPL-2.0,
|
|
19
|
+
and can be obtained from https://github.com/kieler/elkjs or from the published
|
|
20
|
+
package at https://registry.npmjs.org/elkjs/-/elkjs-0.12.0.tgz — the exact
|
|
21
|
+
version is pinned in `package-lock.json`, which each artifact's build provenance
|
|
22
|
+
ties it back to.
|
|
23
|
+
|
|
24
|
+
cairn asserts no ownership over elkjs and does not relicense it. Apache-2.0
|
|
25
|
+
covers cairn's own code only.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
If the set of inlined dependencies changes, update this file in the same commit.
|
|
30
|
+
`files` in `package.json` ships it with the npm package; it lives in the repo for
|
|
31
|
+
every other channel.
|