archidocs 1.0.0 → 1.3.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.
Files changed (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +231 -0
  3. package/dist/cli/commands.d.ts +543 -0
  4. package/dist/cli/commands.js +299 -0
  5. package/dist/cli/format.d.ts +2 -2
  6. package/dist/cli/format.js +9 -5
  7. package/dist/cli/init.d.ts +1 -1
  8. package/dist/cli/init.js +2 -2
  9. package/dist/cli/main.js +27 -73
  10. package/dist/core/compare.d.ts +2 -13
  11. package/dist/core/compare.js +2 -35
  12. package/dist/core/index.d.ts +3 -6
  13. package/dist/core/index.js +3 -6
  14. package/dist/core/query.d.ts +1 -1
  15. package/dist/core/rules.d.ts +30 -0
  16. package/dist/core/rules.js +194 -7
  17. package/dist/core/views/compare.d.ts +12 -0
  18. package/dist/core/views/compare.js +37 -0
  19. package/dist/core/{deployment-views.d.ts → views/deployment.d.ts} +4 -5
  20. package/dist/core/{deployment-views.js → views/deployment.js} +5 -7
  21. package/dist/core/{dynamic-views.d.ts → views/dynamic.d.ts} +1 -3
  22. package/dist/core/{dynamic-views.js → views/dynamic.js} +4 -8
  23. package/dist/core/views/generated.d.ts +18 -0
  24. package/dist/core/views/generated.js +92 -0
  25. package/dist/core/views/ids.d.ts +36 -0
  26. package/dist/core/views/ids.js +51 -0
  27. package/dist/core/views/index.d.ts +13 -0
  28. package/dist/core/views/index.js +12 -0
  29. package/dist/core/views/lens.d.ts +27 -0
  30. package/dist/core/views/lens.js +112 -0
  31. package/dist/core/views/model.d.ts +21 -0
  32. package/dist/core/views/model.js +69 -0
  33. package/dist/core/views/resolve.d.ts +42 -0
  34. package/dist/core/views/resolve.js +81 -0
  35. package/dist/core/{save-as-view.d.ts → views/save-as-view.d.ts} +2 -2
  36. package/dist/core/{save-as-view.js → views/save-as-view.js} +13 -10
  37. package/dist/core/{saved-views.d.ts → views/saved.d.ts} +4 -18
  38. package/dist/core/{saved-views.js → views/saved.js} +8 -103
  39. package/dist/core/views/types.d.ts +91 -0
  40. package/dist/core/views/types.js +2 -0
  41. package/dist/mcp/errors.d.ts +37 -0
  42. package/dist/mcp/errors.js +35 -0
  43. package/dist/mcp/index.d.ts +2 -1
  44. package/dist/mcp/index.js +1 -0
  45. package/dist/mcp/server.d.ts +1 -2
  46. package/dist/mcp/server.js +15 -13
  47. package/dist/mcp/writes.js +2 -1
  48. package/dist/render/font.d.ts +14 -8
  49. package/dist/render/font.js +11 -10
  50. package/dist/render/index.d.ts +1 -0
  51. package/dist/render/index.js +1 -0
  52. package/dist/render/layout.d.ts +20 -3
  53. package/dist/render/layout.js +49 -12
  54. package/dist/render/png.d.ts +1 -1
  55. package/dist/render/png.js +5 -5
  56. package/dist/render/sequence-svg.d.ts +8 -3
  57. package/dist/render/sequence-svg.js +32 -32
  58. package/dist/render/sequence.d.ts +1 -1
  59. package/dist/render/sequence.js +1 -1
  60. package/dist/render/svg.d.ts +19 -6
  61. package/dist/render/svg.js +148 -85
  62. package/dist/render/text.d.ts +6 -4
  63. package/dist/render/text.js +11 -9
  64. package/dist/render/tokens.d.ts +53 -0
  65. package/dist/render/tokens.js +71 -0
  66. package/dist/schema/adr.js +18 -13
  67. package/dist/schema/workspace.js +226 -130
  68. package/dist/viewer/assets/index-BXa5R96a.js +138 -0
  69. package/dist/viewer/assets/index-YFA-pYjQ.css +1 -0
  70. package/dist/viewer/assets/{layout.worker-Bg-OaLVN.js → layout.worker-BRHAGJrD.js} +1 -1
  71. package/dist/viewer/assets/{png-D1zzLB1s.js → png-CAaXWR-k.js} +1 -1
  72. package/dist/viewer/assets/svg-BPVHfD36.js +2 -0
  73. package/dist/viewer/index.html +2 -2
  74. package/guide/SKILL.md +1 -1
  75. package/guide/topics/bootstrap.md +1 -1
  76. package/guide/topics/relationships.md +1 -1
  77. package/package.json +20 -4
  78. package/schemas/adr.schema.json +18 -15
  79. package/schemas/model.schema.json +637 -1144
  80. package/schemas/project.schema.json +8 -4
  81. package/schemas/workspace.schema.json +39 -20
  82. package/dist/core/views.d.ts +0 -126
  83. package/dist/core/views.js +0 -217
  84. package/dist/viewer/assets/index-BwUCSYuf.js +0 -113
  85. package/dist/viewer/assets/index-DvKgCpBr.css +0 -1
  86. package/dist/viewer/assets/svg-Cw4FMsm3.js +0 -2
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Logan Harber
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,231 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="assets/brand/archidocs-mark-light.svg">
4
+ <img src="assets/brand/archidocs-mark-dark.svg" alt="Archidocs" width="72">
5
+ </picture>
6
+ </p>
7
+
8
+ <h1 align="center">Archidocs</h1>
9
+
10
+ <p align="center">Git-native architecture as code. Each Team declares its slice of the architecture as YAML; Archidocs validates it, combines it into one Model, and publishes a diagram viewer for people and an MCP server for agents.</p>
11
+
12
+ ---
13
+
14
+ ## Why
15
+
16
+ - **Diagrams that don't go stale.** Every diagram is generated from the validated Model at a commit, never drawn by hand.
17
+ - **Ownership is first-class.** Every Element has exactly one Owner Team, shown on every node.
18
+ - **One answer, many Teams.** Each Team keeps its own Project folder in one Workspace repo. Archidocs merges them, so nobody has to ask around.
19
+ - **Every screen is a link.** Any view in the viewer can be shared by URL and saved as View YAML.
20
+ - **Same answers for people and agents.** What the viewer shows, the MCP server can answer, and agents can edit the Model through it.
21
+
22
+ The questions it's built to answer:
23
+
24
+ | Who | Question |
25
+ | --- | --- |
26
+ | Enterprise Architect | How are two Services connected? |
27
+ | Solutions Architect | Where is a Service deployed? |
28
+ | Developer | What does my Team own? |
29
+ | Product Owner | What is upstream and downstream of an outage? |
30
+ | QA Tester | What is a Service's URL in a given Environment? |
31
+ | Technical staff | Which decisions sit behind an Element, and how has the system changed? |
32
+
33
+ ## Quick start
34
+
35
+ From an empty repo to your first System in the viewer, in about five minutes. Archidocs needs Node.js 22.18 or later.
36
+
37
+ **1. Install the CLI.** With pnpm, use `pnpm add --global archidocs`. To install nothing, put `npx` before each command, as in `npx archidocs check`.
38
+
39
+ ```bash
40
+ npm install --global archidocs
41
+ ```
42
+
43
+ **2. Create a Workspace.** In the repo that will hold it (a new, empty one is fine):
44
+
45
+ ```bash
46
+ archidocs init
47
+ ```
48
+
49
+ This writes a starter `archidocs/workspace.yaml`, adds the `.archidocs/` cache to `.gitignore`, and installs an authoring skill for coding agents.
50
+
51
+ **3. Add three files.** Replace `archidocs/workspace.yaml`, which defines Teams and Environments, with:
52
+
53
+ ```yaml
54
+ teams:
55
+ storefront:
56
+ name: Storefront
57
+ environments:
58
+ prod:
59
+ name: Production
60
+ ```
61
+
62
+ Give the Team a Project folder, marked by `archidocs/shop/project.yaml`:
63
+
64
+ ```yaml
65
+ id: shop
66
+ name: Shop
67
+ owner: storefront
68
+ ```
69
+
70
+ Declare a Person, and a System that holds two Services, in `archidocs/shop/model.yaml`:
71
+
72
+ ```yaml
73
+ people:
74
+ shopper:
75
+ name: Shopper
76
+ relationships:
77
+ - to: web
78
+ description: Browses and buys using
79
+ systems:
80
+ online-shop:
81
+ name: Online Shop
82
+ services:
83
+ web:
84
+ name: Web
85
+ technology: TypeScript, React
86
+ relationships:
87
+ - to: api
88
+ description: Places orders through
89
+ technology: JSON/HTTPS
90
+ api:
91
+ name: API
92
+ technology: Node.js
93
+ ```
94
+
95
+ **4. Check it.**
96
+
97
+ ```bash
98
+ archidocs check
99
+ ```
100
+
101
+ ```text
102
+ 0 errors, 0 warnings
103
+ ```
104
+
105
+ **5. Open the viewer.**
106
+
107
+ ```bash
108
+ archidocs dev
109
+ ```
110
+
111
+ Open <http://localhost:4321>. The viewer starts on the C2 Landscape, which shows the Shopper and the Online Shop; select the arrow button on the Online Shop box to see the two Services inside it. The viewer reloads as you edit the files.
112
+
113
+ The finished Workspace is in [examples/quick-start](examples/quick-start).
114
+
115
+ ## The Model
116
+
117
+ A Workspace is one repo. `workspace.yaml` defines Teams and Environments; each Project folder, marked by a `project.yaml`, declares one Team's Elements, Relationships, Deployments and Saved Views.
118
+
119
+ ```text
120
+ archidocs/
121
+ ├── workspace.yaml # Teams and Environments
122
+ ├── payments/
123
+ │ ├── project.yaml # id, name, owner Team
124
+ │ ├── model.yaml # Systems, Services, Components, Relationships
125
+ │ ├── deployments.yaml # which Service runs where, and its URL
126
+ │ └── views.yaml # Saved Views
127
+ └── core/
128
+ └── ...
129
+ ```
130
+
131
+ ```yaml
132
+ # payments/model.yaml
133
+ systems:
134
+ payments:
135
+ name: Payments
136
+ services:
137
+ payments-service:
138
+ name: Payments Service
139
+ technology: Java, Spring Boot
140
+ relationships:
141
+ - to: payments-db
142
+ description: Stores payment state in
143
+ - to: core:mainframe # another Project's Element
144
+ description: Posts payments to the ledger in
145
+ payments-db:
146
+ name: Payments DB
147
+ type: datastore
148
+ ```
149
+
150
+ ```yaml
151
+ # payments/deployments.yaml
152
+ deployments:
153
+ - service: payments-service
154
+ environment: prod
155
+ target: platform:eks-prod
156
+ url: https://payments.bigbank.example
157
+ ```
158
+
159
+ The terms (Workspace, Project, Element, Relationship, Team, Environment, Deployment Target and more) are defined in [GLOSSARY.md](GLOSSARY.md). Every check rule is listed in [docs/rules.md](docs/rules.md).
160
+
161
+ ## CLI
162
+
163
+ | Command | What it does |
164
+ | --- | --- |
165
+ | `archidocs init [--skill]` | Set up a Workspace, or with `--skill` install only the agent skill in a code repo. |
166
+ | `archidocs check [--strict]` | Validate the Workspace. Formats: `text`, `json`, `github`. |
167
+ | `archidocs dev` | Serve the viewer locally with live reload. |
168
+ | `archidocs build [--out <dir>]` | Build the static viewer site with past Revisions. `--preview` builds a PR preview. |
169
+ | `archidocs export <view-id>` | Render a View to SVG or PNG, styled like the viewer; `--all-saved` renders every Saved View, `--theme dark` draws it in the viewer's dark palette and `--label <text>` replaces the source line. |
170
+ | `archidocs diff <from> [<to>]` | Show what changed in the Model between two refs. |
171
+ | `archidocs mcp` | Run the MCP server over a Workspace checkout or a published Bundle. |
172
+ | `archidocs guide [topic]` | Print the authoring guide for agents. |
173
+ | `archidocs version` | Print the CLI and Bundle schema versions. |
174
+
175
+ ## Publishing
176
+
177
+ `archidocs build` writes a fully static site with relative URLs and hash routing, so any static host can serve it. The GitHub Action checks, builds and deploys to GitHub Pages:
178
+
179
+ ```yaml
180
+ # .github/workflows/architecture.yml
181
+ on:
182
+ push:
183
+ branches: [main]
184
+ tags: ["*"]
185
+
186
+ permissions:
187
+ contents: read
188
+ pages: write
189
+ id-token: write
190
+
191
+ jobs:
192
+ publish:
193
+ runs-on: ubuntu-latest
194
+ environment:
195
+ name: github-pages
196
+ url: ${{ steps.archidocs.outputs.page-url }}
197
+ steps:
198
+ - uses: actions/checkout@v4
199
+ with:
200
+ fetch-depth: 0
201
+ - uses: chalharb/archidocs@v1
202
+ id: archidocs
203
+ ```
204
+
205
+ A failed check deploys nothing, so the last good site stays up. GitLab Pages, PR previews, Saved View images for wikis, and other hosts are covered in [docs/publishing.md](docs/publishing.md); the GitLab template is in [templates/gitlab](templates/gitlab).
206
+
207
+ ## Agents and MCP
208
+
209
+ `archidocs mcp` serves the Model to AI agents. Read tools answer the same questions as the viewer; write tools (`upsert_element`, `upsert_relationship`, `upsert_deployment`, `upsert_view`, `propose_adr` and more) edit the YAML in place, keep comments and formatting, return a diff, and refuse any change that would fail `archidocs check`.
210
+
211
+ ```bash
212
+ archidocs mcp --workspace ./archidocs
213
+ ```
214
+
215
+ `archidocs init` installs the authoring skill into `.agents/skills`, `.claude/skills` and `.github/skills`. The full guide is in [guide/SKILL.md](guide/SKILL.md) with task topics in [guide/topics](guide/topics).
216
+
217
+ ## Examples
218
+
219
+ | Example | What it shows | Source | Demo |
220
+ | --- | --- | --- | --- |
221
+ | Big Bank plc | A fictional bank with five Teams, two Environments and a history of Revisions to browse and compare. | [examples/big-bank](examples/big-bank) | [big-bank.archidocs.dev](https://big-bank.archidocs.dev) |
222
+ | Kitchen sink | Every feature of the Model in one Workspace. | [examples/kitchen-sink](examples/kitchen-sink) | [kitchen-sink.archidocs.dev](https://kitchen-sink.archidocs.dev) |
223
+
224
+ ## Development
225
+
226
+ Run `pnpm install`, then `pnpm dev` to serve the viewer and `pnpm test` to run the tests.
227
+ To run the other checks, work on the docs site or open a pull request, see [CONTRIBUTING.md](CONTRIBUTING.md).
228
+
229
+ ## License
230
+
231
+ [MIT](LICENSE)