spatial-views 0.0.0-stage → 0.2.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 (220) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +245 -2
  3. package/dist/app/assets/abnfDiagram-S7VZAUFO-CFbb_Sz2.js +1 -0
  4. package/dist/app/assets/architecture-WOLXFQ4H-CsBD__5a.js +1 -0
  5. package/dist/app/assets/architectureDiagram-YGSQEFNW-C0ic4ib1.js +36 -0
  6. package/dist/app/assets/blockDiagram-APKKGZFW-BZDPbzAG.js +140 -0
  7. package/dist/app/assets/bpmnIcons-APHXDYXF-C0jbCElo.js +1 -0
  8. package/dist/app/assets/c4Diagram-KJ2TOQU5-BilBWuq5.js +38 -0
  9. package/dist/app/assets/chunk-2Q5K7J3B-C1jixKkw.js +1 -0
  10. package/dist/app/assets/chunk-5VM5RSS4-ZNzvKenW.js +15 -0
  11. package/dist/app/assets/chunk-6MUBBAK2-BBl-4tQr.js +2 -0
  12. package/dist/app/assets/chunk-AXFCVDMN-BhsttQ-k.js +62 -0
  13. package/dist/app/assets/chunk-BG4553SI-mWcPcFZr.js +127 -0
  14. package/dist/app/assets/chunk-DQASFODM-7FKe2gLt.js +10 -0
  15. package/dist/app/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
  16. package/dist/app/assets/chunk-HFQBQIA3-nXrQ08BL.js +1 -0
  17. package/dist/app/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
  18. package/dist/app/assets/chunk-JWPE2WC7-DVXcaiue.js +1 -0
  19. package/dist/app/assets/chunk-KQLB2F66-swukhFmZ.js +2 -0
  20. package/dist/app/assets/chunk-KS47KZWR-DkDkwO82.js +1 -0
  21. package/dist/app/assets/chunk-LEVMRMFU-DXH6iXv3.js +1 -0
  22. package/dist/app/assets/chunk-M57EVK23-B-kEyOJF.js +1 -0
  23. package/dist/app/assets/chunk-NGNAAXSQ-DI_UYJZ4.js +136 -0
  24. package/dist/app/assets/chunk-OY52VR5R-DweG7qYw.js +88 -0
  25. package/dist/app/assets/chunk-QB3YPZ4I-DyozK3lV.js +213 -0
  26. package/dist/app/assets/chunk-R3KSYZAL-BEXCUN6J.js +1 -0
  27. package/dist/app/assets/chunk-STOXU5M4-BaTlty4O.js +72 -0
  28. package/dist/app/assets/chunk-TU62E6Q5-_rcUP1Fh.js +1 -0
  29. package/dist/app/assets/chunk-X3CZISLH-NOpCnvgE.js +1 -0
  30. package/dist/app/assets/chunk-X4PVCEUW-DGxTL3kB.js +1 -0
  31. package/dist/app/assets/chunk-XXDRQBXY-C02Gpej2.js +1 -0
  32. package/dist/app/assets/chunk-Y2CYZVJY-DsF7k-Jl.js +1 -0
  33. package/dist/app/assets/classDiagram-v2-L25IHNXF-DLEBwpvk.js +217 -0
  34. package/dist/app/assets/cose-bilkent-JH36ORCC-kNCXOm8k.js +1 -0
  35. package/dist/app/assets/cynefin-EF2NZ3EQ-6MWNLbuF.js +1 -0
  36. package/dist/app/assets/cynefinDiagram-L36ESFBY-CLFstukD.js +62 -0
  37. package/dist/app/assets/cytoscape.esm-nTrd5EVq.js +321 -0
  38. package/dist/app/assets/d3-scale-CaJQQYkF.js +1 -0
  39. package/dist/app/assets/dagre-SPEB5RXH-BaSAny1T.js +4 -0
  40. package/dist/app/assets/diagram-3B7GL73J-DJNlt5Sg.js +200 -0
  41. package/dist/app/assets/diagram-DNEMPZML-DEHeuILB.js +24 -0
  42. package/dist/app/assets/diagram-L3MUGCDN-ob5Ka2Xc.js +41 -0
  43. package/dist/app/assets/diagram-LA4NIPWU-DNESzFAc.js +24 -0
  44. package/dist/app/assets/diagram-MHCOC4E2-CVi9zKjG.js +3 -0
  45. package/dist/app/assets/diagram-XPFHEONP-DInT4C7e.js +30 -0
  46. package/dist/app/assets/dist-CjvHN74u.js +1 -0
  47. package/dist/app/assets/ebnfDiagram-UZSYDL2S-CRCZNsji.js +1 -0
  48. package/dist/app/assets/elk-XV6XMXQE-D4fsWI2l.js +2 -0
  49. package/dist/app/assets/erDiagram-EYBAPDEH-YQNM5StV.js +99 -0
  50. package/dist/app/assets/eventmodeling-K75KTNOO-Bev08J2F.js +1 -0
  51. package/dist/app/assets/flowDiagram-MALGAFMO-BhJ554DH.js +1 -0
  52. package/dist/app/assets/ganttDiagram-23REXITY-CkaBMYM4.js +292 -0
  53. package/dist/app/assets/gitGraph-VSP46ZUC-CtbZ0sIS.js +1 -0
  54. package/dist/app/assets/gitGraphDiagram-STJD7YCW-D15ZdQ-Z.js +106 -0
  55. package/dist/app/assets/graphlib-DS17s2tU.js +1 -0
  56. package/dist/app/assets/index-Bn6_wHEp.js +98 -0
  57. package/dist/app/assets/index-H-Z7MFhZ.css +1 -0
  58. package/dist/app/assets/info-OHQRW6UA-CfUW1XFR.js +1 -0
  59. package/dist/app/assets/infoDiagram-KBXO4MBG-DT7LbBRQ.js +2 -0
  60. package/dist/app/assets/ishikawaDiagram-M35NCXHK-CF51lhjB.js +70 -0
  61. package/dist/app/assets/journeyDiagram-OPLOXDXO-_36FonKk.js +139 -0
  62. package/dist/app/assets/kanban-definition-BZKZHSQY-tLk_OlQ-.js +89 -0
  63. package/dist/app/assets/katex-MEuSR36T.js +257 -0
  64. package/dist/app/assets/mermaid-parser.core-_3Vo8x6b.js +7 -0
  65. package/dist/app/assets/mermaid.core-y-x1CYxC.js +44 -0
  66. package/dist/app/assets/mindmap-definition-I2QAS2VK-BCI4HRX3.js +98 -0
  67. package/dist/app/assets/packet-JDAUHWVQ-Cco3UoaI.js +1 -0
  68. package/dist/app/assets/pegDiagram-FD4XPPHP-BOzSoNji.js +1 -0
  69. package/dist/app/assets/pie-XZMESJXO-reOB2GXn.js +1 -0
  70. package/dist/app/assets/pieDiagram-J4AKIIQI-PlHpwT_c.js +39 -0
  71. package/dist/app/assets/quadrantDiagram-XTYBLID2-CdxZ0ael.js +7 -0
  72. package/dist/app/assets/radar-ABXABTNO-DfCl8uV2.js +1 -0
  73. package/dist/app/assets/railroad-I3PHUGI6-4s14UyW1.js +1 -0
  74. package/dist/app/assets/railroad-abnf-LNEFI6M7-C49jJE4Y.js +1 -0
  75. package/dist/app/assets/railroad-ebnf-DWYD2UWJ-Bx-pcPc7.js +1 -0
  76. package/dist/app/assets/railroad-peg-JR7BVNR7-DjBPSCKV.js +1 -0
  77. package/dist/app/assets/railroadDiagram-MRQ6NCDL-wGcmIMqq.js +1 -0
  78. package/dist/app/assets/requirementDiagram-Y7LWUY3S-DprFI03z.js +84 -0
  79. package/dist/app/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  80. package/dist/app/assets/rough.esm-Dy-Kn_BL.js +1 -0
  81. package/dist/app/assets/sankeyDiagram-WGJFYUXA-DygYWLTR.js +40 -0
  82. package/dist/app/assets/sequenceDiagram-5NDRBG5M-BzIr2DBO.js +169 -0
  83. package/dist/app/assets/sizeCapture-INFHLROL-3uHXrFqA.js +1 -0
  84. package/dist/app/assets/stateDiagram-v2-FJ4FJNEA-MGCqKnm_.js +291 -0
  85. package/dist/app/assets/swimlanes-UMQ2AFYF-CIEH82Zt.js +1 -0
  86. package/dist/app/assets/swimlanesDiagram-OMPLPG4O-YWNJjl0g.js +8 -0
  87. package/dist/app/assets/timeline-definition-SEUHKTQE-BGYSqup2.js +120 -0
  88. package/dist/app/assets/treeView-D4JQ5SDB-B39o1sJo.js +1 -0
  89. package/dist/app/assets/treemap-SAJKECNS-BoGxrUH4.js +1 -0
  90. package/dist/app/assets/usecaseDiagram-AFA6YXN4-dy6oVOke.js +328 -0
  91. package/dist/app/assets/vennDiagram-NNMJR3RB-CUyuhcAk.js +34 -0
  92. package/dist/app/assets/wardley-7MLQ67FV-sYPAvQ06.js +1 -0
  93. package/dist/app/assets/wardleyDiagram-S7YFUSEH-DYtxYUHe.js +78 -0
  94. package/dist/app/assets/xychartDiagram-GGNKY7IX-ClR06AlB.js +7 -0
  95. package/dist/app/index.html +14 -0
  96. package/dist/cli/index.js +338 -0
  97. package/dist/core/api.js +420 -0
  98. package/dist/core/approvals.js +426 -0
  99. package/dist/core/context.js +259 -0
  100. package/dist/core/diff.js +156 -0
  101. package/dist/core/docs.js +140 -0
  102. package/dist/core/doctor.js +152 -0
  103. package/dist/core/doctypes.js +79 -0
  104. package/dist/core/edit.js +130 -0
  105. package/dist/core/errors.js +3 -0
  106. package/dist/core/flags.js +13 -0
  107. package/dist/core/gaps.js +119 -0
  108. package/dist/core/heading.js +4 -0
  109. package/dist/core/history.js +50 -0
  110. package/dist/core/home.js +345 -0
  111. package/dist/core/lanes.js +134 -0
  112. package/dist/core/launch.js +34 -0
  113. package/dist/core/layout.js +362 -0
  114. package/dist/core/links.js +68 -0
  115. package/dist/core/mermaid.js +175 -0
  116. package/dist/core/newdoc.js +66 -0
  117. package/dist/core/open-folder.js +30 -0
  118. package/dist/core/openspec.js +120 -0
  119. package/dist/core/paths.js +90 -0
  120. package/dist/core/project.js +392 -0
  121. package/dist/core/resolve.js +35 -0
  122. package/dist/core/route.js +420 -0
  123. package/dist/core/scan.js +514 -0
  124. package/dist/core/schema.js +270 -0
  125. package/dist/core/scope.js +126 -0
  126. package/dist/core/setup.js +134 -0
  127. package/dist/core/skills.js +181 -0
  128. package/dist/core/storage/config.js +74 -0
  129. package/dist/core/storage/events.js +54 -0
  130. package/dist/core/storage/folder-watch.js +147 -0
  131. package/dist/core/storage/folder.js +469 -0
  132. package/dist/core/storage/index.js +8 -0
  133. package/dist/core/storage/local.js +22 -0
  134. package/dist/core/storage/migrate.js +48 -0
  135. package/dist/core/storage/postgres.js +290 -0
  136. package/dist/core/storage/types.js +101 -0
  137. package/dist/core/storage.js +589 -0
  138. package/dist/core/suggest.js +283 -0
  139. package/dist/core/tree.js +254 -0
  140. package/dist/core/types.js +583 -0
  141. package/dist/core/version.js +1 -0
  142. package/dist/core/versions.js +245 -0
  143. package/dist/core/watch.js +2 -0
  144. package/dist/core/xml.js +68 -0
  145. package/dist/demo/args.js +58 -0
  146. package/dist/demo/browser.js +301 -0
  147. package/dist/demo/platform.js +147 -0
  148. package/dist/demo/run.js +198 -0
  149. package/dist/demo/steps.js +328 -0
  150. package/dist/mcp/project-tools.js +193 -0
  151. package/dist/mcp/server.js +785 -0
  152. package/examples/platform/README.md +33 -0
  153. package/examples/platform/api/package.json +8 -0
  154. package/examples/platform/api/src/auth-middleware.js +16 -0
  155. package/examples/platform/api/src/proxy.js +7 -0
  156. package/examples/platform/api/src/rate-limit.js +13 -0
  157. package/examples/platform/api/src/server.js +40 -0
  158. package/examples/platform/auth/package.json +9 -0
  159. package/examples/platform/auth/src/server.js +24 -0
  160. package/examples/platform/auth/src/tokens.js +19 -0
  161. package/examples/platform/auth/src/users.js +16 -0
  162. package/examples/platform/docs/api/PRD.md +10 -0
  163. package/examples/platform/docs/api/SDD.md +15 -0
  164. package/examples/platform/docs/auth/PRD.md +10 -0
  165. package/examples/platform/docs/auth/SDD.md +8 -0
  166. package/examples/platform/docs/frontend/PRD.md +18 -0
  167. package/examples/platform/docs/frontend/SDD.md +13 -0
  168. package/examples/platform/docs/pricing/PRD.md +9 -0
  169. package/examples/platform/docs/pricing/SDD.md +8 -0
  170. package/examples/platform/docs/products/PRD.md +9 -0
  171. package/examples/platform/docs/products/SDD.md +8 -0
  172. package/examples/platform/frontend/package.json +8 -0
  173. package/examples/platform/frontend/src/api-client.js +21 -0
  174. package/examples/platform/frontend/src/main.js +21 -0
  175. package/examples/platform/frontend/src/pages/products.js +12 -0
  176. package/examples/platform/frontend/src/pages/sign-in.js +14 -0
  177. package/examples/platform/frontend/src/session.js +11 -0
  178. package/examples/platform/pricing/package.json +9 -0
  179. package/examples/platform/pricing/src/cache.js +19 -0
  180. package/examples/platform/pricing/src/product-events.js +17 -0
  181. package/examples/platform/pricing/src/rules.js +19 -0
  182. package/examples/platform/pricing/src/server.js +32 -0
  183. package/examples/platform/products/package.json +9 -0
  184. package/examples/platform/products/src/catalog.js +20 -0
  185. package/examples/platform/products/src/events.js +11 -0
  186. package/examples/platform/products/src/search.js +9 -0
  187. package/examples/platform/products/src/server.js +31 -0
  188. package/migrations/postgres/001_init.sql +55 -0
  189. package/migrations/postgres/002_view_versions.sql +18 -0
  190. package/package.json +69 -4
  191. package/schema/approval.schema.json +173 -0
  192. package/schema/gap.schema.json +56 -0
  193. package/schema/pins.schema.json +122 -0
  194. package/schema/project.schema.json +93 -0
  195. package/schema/settings.schema.json +86 -0
  196. package/schema/toolbox.schema.json +206 -0
  197. package/schema/type.schema.json +121 -0
  198. package/schema/view.schema.json +240 -0
  199. package/skills/claude/build-gap/SKILL.md +28 -0
  200. package/skills/claude/check-ui/SKILL.md +40 -0
  201. package/skills/claude/draw-system/SKILL.md +38 -0
  202. package/skills/claude/gap-from-view/SKILL.md +29 -0
  203. package/skills/claude/post-audit/SKILL.md +58 -0
  204. package/skills/claude/pre-audit/SKILL.md +82 -0
  205. package/skills/claude/update-state/SKILL.md +56 -0
  206. package/skills/cursor/check-ui.mdc +40 -0
  207. package/skills/cursor/draw-system.mdc +38 -0
  208. package/skills/cursor/post-audit.mdc +44 -0
  209. package/skills/cursor/pre-audit.mdc +49 -0
  210. package/skills/cursor/update-state.mdc +45 -0
  211. package/skills/windsurf/spatial-views.md +212 -0
  212. package/toolboxes/aws.yaml +43 -0
  213. package/toolboxes/azure.yaml +41 -0
  214. package/toolboxes/cloud.yaml +95 -0
  215. package/toolboxes/docs.yaml +111 -0
  216. package/toolboxes/software.yaml +114 -0
  217. package/toolboxes/types/docs/gap.yaml +15 -0
  218. package/toolboxes/types/docs/mdd.yaml +19 -0
  219. package/toolboxes/types/docs/plain.yaml +7 -0
  220. package/toolboxes/types/docs/prd.yaml +17 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 NODEMAX LIMITED
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 CHANGED
@@ -1,3 +1,246 @@
1
- # Temporary Holding Version
1
+ # Spatial Views
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **The picture for spec-driven development.**
4
+
5
+ Specs tell the AI *what* to build. A Spatial View shows *where* it sits in the system and what it touches. Spatial Views is a canvas of your architecture that people and AI edit live. OpenSpec specs and changes and any `.md` doc are pinned to the modules they touch, and the AI reads all of it through MCP.
6
+
7
+ It comes from the [Spatial Context paper](https://spatialthinking.ai/spatial-context-paper.pdf) (January 2025) at [spatialthinking.ai](https://spatialthinking.ai): the Big Picture plus the Little Picture, so the AI stops guessing.
8
+
9
+ ![The System Overview of examples/platform, as pre-audit draws it](docs/shots/platform-system-overview.png)
10
+
11
+ ## Quick start
12
+
13
+ ```bash
14
+ npx spatial-views setup # once: the MCP server for Cursor, Claude Code and Windsurf, globally
15
+ npx spatial-views doctor # check that each editor can start it
16
+ npx spatial-views # the canvas on http://127.0.0.1:4317
17
+ ```
18
+
19
+ Install once, then point the AI at a project, not your whole disk. It starts with no projects. A project lists the folders it may read (its sources), and the server reads nothing else. The exact MCP config for each editor is in [docs/install.md](docs/install.md). To try it, use [examples/platform](examples/platform): five repos (Frontend, API, Auth, Products, Pricing) and a PRD and an SDD for each. For a single repo that uses OpenSpec, see [examples/shop-openspec](examples/shop-openspec).
20
+
21
+ ## Install
22
+
23
+ Node 20 or later. Run `setup` once where Node is, restart the editor, then run `doctor`. It starts each entry exactly as the editor would and prints OK, or what failed and the fix. Every entry uses absolute paths, so run `setup --force` again after you move a clone or change the node version.
24
+
25
+ **Windows (PowerShell).** `npx spatial-views setup`. It writes `"command": "cmd", "args": ["/c", "npx", "-y", "spatial-views", "mcp", "--global"]`, because an editor can't start a bare `npx` (it is a `.cmd`). From a clone, it writes the absolute `node.exe` and CLI path instead. Projects live in `%USERPROFILE%\SpatialViews`.
26
+
27
+ **Windows with WSL.** Run `npx spatial-views setup` inside WSL. Cursor and Windsurf get two entries in `%USERPROFILE%\.cursor\mcp.json` (and Windsurf's):
28
+ - `spatial-views` is for **WSL Remote mode** (a WSL folder). The editor starts the server inside WSL, so the entry is the absolute Linux node path. The `wsl` form fails there with `spawn wsl EACCES`.
29
+ - `spatial-views-win` is for a **plain Windows folder** with Node only in WSL. It runs the same command through `wsl bash -lc`.
30
+
31
+ Cursor also gets `spatial-views` in the WSL-side `~/.cursor/mcp.json`, which it reads in WSL Remote mode. Turn on the one that matches how you open the folder, under Cursor Settings → MCP. Source paths work in either spelling: `c:\git\api` and `/mnt/c/git/api` are the same source. If setup can't find your Windows profile, set `SPATIAL_VIEWS_WIN_HOME=C:\Users\you`. If the repo is not in the default distro, add `"-d", "<distro>"` before `"bash"`.
32
+
33
+ **macOS.** `npx spatial-views setup`. GUI apps don't get your shell's PATH, so the entry is the absolute node path (Homebrew or nvm, as found from the node you ran) and sets `PATH` to that node's folder.
34
+
35
+ **Linux.** `npx spatial-views setup`. It writes the same absolute node path form as macOS.
36
+
37
+ ## Three commands
38
+
39
+ After `setup`, in Cursor, Claude Code or Windsurf:
40
+
41
+ 1. **`pre-audit platform <paths>`**, for example `pre-audit platform c:\platform\frontend c:\platform\api c:\platform\auth c:\platform\products c:\platform\pricing c:\platform\docs`. It creates the project, adds each path as a source, reads them, draws the System Overview (one typed module per repo, connected), creates a Sub View for each, and pins each doc to the module it describes. Nothing else.
42
+ 2. **`update-state platform`**. It re-reads only what changed since the last audit, updates the Views and file pointers, flags new drift, and writes a short changes report.
43
+ 3. **`post-audit platform`**. Did we build what the specs say? It lists every requirement in the pinned specs and docs, finds evidence for each (a file, test or View) or marks it missing, and writes `audit-report.md` with a coverage figure.
44
+
45
+ Every Skill starts with `list_projects`, then `use_project`. Sources are only ever read, and the server refuses any path outside them (symlinks and `..` included), saying which sources are allowed. A doc in a source is pinned as `<source_id>:<path>`, for example `docs:prd.md`.
46
+
47
+ ## Projects
48
+
49
+ A project is a name and its sources: the repos, docs and diagram folders it may read. The AI makes one with `create_project` and `add_source` (`pre-audit` does both), or you make one on the canvas and choose it in the project selector. Opening a project lands on its System Overview.
50
+
51
+ The bar on the right has Settings, Home (the System Overview), **Diagrams** (the project's Views as a tree), **Docs** (its docs as a tree) and Properties. **Settings → Project → Spec format** picks the docs it uses: Spatial Views Spec (PRD, MDD, Gap and plain docs; the default) or OpenSpec (its specs and changes).
52
+
53
+ ## How it works
54
+
55
+ The AI draws the system as Views (System Overview, then Repo and Sub-views), and pins your existing specs and docs to it. You and the AI edit the same picture, live. Double-click a module to drill down; the breadcrumbs take you back up.
56
+
57
+ Connections are drawn orthogonally: straight segments with right-angle bends, leaving each module on the side that faces the other, with one label on the longest clear segment. Drag from a module's handle (any side) to another module to connect them. Select a connection to see its bends: double-click the line to add one, drag a bend or a segment to move it, and double-click a bend to remove it. Bends are saved on the connection (`bends` in the View JSON). Modules snap to a 10px grid; Ctrl+Z undoes and Ctrl+Shift+Z (or Ctrl+Y) redoes.
58
+
59
+ **Toolboxes.** The Toolbox is a slim icon bar on the right of the canvas, one icon per toolbox. Click an icon and a flyout lists its types; drag one onto the canvas to add it where you drop it (a click only shows its description). Five toolboxes are built in, each one YAML file in [`toolboxes/`](toolboxes):
60
+
61
+ | Toolbox | Types |
62
+ |---|---|
63
+ | Software | Service, Frontend, API, Database, Cache, Queue, Worker, Auth, Gateway, External system, User/Actor |
64
+ | Cloud (vendor-neutral) | Compute, Container, Function, Object storage, Block storage, Load balancer, CDN, DNS, VPC/Network, Secrets, Monitoring |
65
+ | AWS | EC2, Lambda, ECS, EKS, S3, RDS, DynamoDB, SQS, SNS, EventBridge, API Gateway, CloudFront, Route 53, Cognito, IAM, CloudWatch, VPC |
66
+ | Azure | Virtual Machine, Functions, App Service, AKS, Container Apps, Blob Storage, Azure SQL, Cosmos DB, Service Bus, Event Grid, API Management, Front Door, Entra ID, Key Vault, Monitor, VNet |
67
+ | Docs | PRD, SDD, MDD, Feature doc, ADR, Runbook, Plain doc |
68
+
69
+ Turn any toolbox on or off for a project in **Settings** (`disabled_toolboxes` in the project's `settings.json`). Modules of a type in a toolbox that is off still draw.
70
+
71
+ A toolbox file holds its module types (a name, an icon, a colour token, a default size, a `tier` (its row in the layout, top to bottom: 0 users, 1 frontend, 2 gateway, 3 API, 4 service, 5 worker or queue, 6 data) or `side: right` (externals), and a properties schema) and its doc types (a markdown template using `{{title}}`, `{{module}}`, `{{view}}`, `{{date}}`; drop one on a module and the doc is made from it in `docs/`, pinned to that module and opened beside the canvas):
72
+
73
+ ```yaml
74
+ # yaml-language-server: $schema=https://raw.githubusercontent.com/Hotchilli-Cloud/spatial-views/main/schema/toolbox.schema.json
75
+ name: Telecoms
76
+ icon: lucide:radio-tower # lucide:<name>, or ./icons/<file>.svg next to this file
77
+ order: 50 # place on the bar (Software 10, Cloud 20, AWS 30, Azure 40, Docs 90; default 100)
78
+ types:
79
+ - id: telecoms-sbc # unique across toolboxes: start it with the toolbox id
80
+ name: SBC
81
+ icon: lucide:shield
82
+ color: teal # slate gray blue indigo violet pink red orange amber green teal cyan
83
+ size: { w: 170, h: 48 }
84
+ tier: 4 # its row: 0 users ... 6 data; or side: right for an external
85
+ properties: # type: string text number boolean enum url
86
+ - { name: vendor, type: enum, options: [Ribbon, Oracle, AudioCodes, Other] }
87
+ - { name: sessions, type: number, default: 1000 }
88
+ docs:
89
+ - { id: telecoms-call-flow, name: Call flow, icon: "lucide:phone", template: "# {{title}}\n\n## Flow\n" }
90
+ ```
91
+
92
+ **Your own toolboxes.** They load in this order, and a later file overrides or extends an earlier one by id (the toolbox's `id`, default the file name, and each type's `id`), changing only the fields it gives:
93
+
94
+ 1. built-in: the package's `toolboxes/*.yaml`
95
+ 2. user: your `SpatialViews/toolboxes/*.yaml` folder, for every project: `C:\Users\<you>\SpatialViews\toolboxes` on Windows, `/Users/<you>/SpatialViews/toolboxes` on a Mac, `~/SpatialViews/toolboxes` on Linux and WSL
96
+ 3. project: `<project>/toolboxes/*.yaml` (`.spatial/toolboxes/` in a repo; commit it to share it with your team)
97
+
98
+ The user folder is made on first run, with a `README.md` and an example toolbox (`my-toolbox.yaml`) to start from. Settings has an **Open toolboxes folder** button. The folder is watched: save a new or changed file and the bar updates live, with no restart. A mistake shows as a toast naming the file and line.
99
+
100
+ `npx spatial-views toolbox new <name>` scaffolds one (`--user` for your home folder, `--out <dir>` for anywhere). `npx spatial-views toolbox check [file...]` checks them, and every problem names the file and line, e.g. `aws-extra.yaml:7:12: types[1].color: Invalid option: expected one of "slate"|"gray"|...`. A bad entry is left out and the rest still loads; the canvas lists problems in Settings. `npx spatial-views toolbox list` shows what loaded and from where. `npx spatial-views schema` writes the JSON Schemas ([`schema/toolbox.schema.json`](schema/toolbox.schema.json), [`schema/type.schema.json`](schema/type.schema.json)); the `yaml-language-server` line above gives you completion and checks in VS Code and Cursor.
101
+
102
+ The AI uses the same toolboxes: `list_toolboxes`, `list_types` (`toolbox: aws` for one), `create_type` and `create_toolbox` (it makes new types for you, in the project's toolboxes, or yours with `scope: user`), `create_doc`, and `type` / `properties` on `add_module` and `update_module`.
103
+
104
+ **Use the official AWS or Azure icons.** The built-in toolboxes use [lucide](https://lucide.dev/icons) icons and the type name. The official AWS and Azure icon sets are not bundled, because their terms limit redistribution. You can download them yourself and point the types at them:
105
+
106
+ 1. Download the [AWS Architecture Icons](https://aws.amazon.com/architecture/icons/) or the [Azure architecture icons](https://learn.microsoft.com/azure/architecture/icons/), and accept their terms.
107
+ 2. Copy the SVGs you want into `~/SpatialViews/toolboxes/icons/` (or a project's `toolboxes/icons/`).
108
+ 3. Add a file next to them that extends the built-in toolbox by id and changes only the icons:
109
+
110
+ ```yaml
111
+ # ~/SpatialViews/toolboxes/aws-icons.yaml
112
+ id: aws
113
+ types:
114
+ - { id: aws-lambda, icon: ./icons/Arch_AWS-Lambda_48.svg }
115
+ - { id: aws-s3, icon: ./icons/Arch_Amazon-Simple-Storage-Service_48.svg }
116
+ - { id: aws-dynamodb, icon: ./icons/Arch_Amazon-DynamoDB_48.svg }
117
+ ```
118
+
119
+ An icon path is relative to the YAML file and stays inside its folder. The SVG is drawn as an image, so nothing in it runs. `list_types` shows every type id (`aws-ec2`, `azure-functions`, ...).
120
+
121
+ **Send a toolbox upstream.** GCP, Kubernetes, Telecoms and more are welcome: see [CONTRIBUTING.md](CONTRIBUTING.md#add-a-toolbox).
122
+
123
+ **Properties.** Select something and the Properties panel slides out from the right, beside the Toolbox bar (it closes when nothing is selected, and never shifts the canvas). It edits what is selected, live: a module's name, type, description, its type's properties, its files and its pinned docs; a connection's label and route (reset it, or delete the connection); with several modules selected, align them. Typing in one field is one undo step, and pins undo too. While dragging, a module lines up with its neighbours' edges and centres (a guide shows the match) or snaps to the grid; Shift-click (or Ctrl/Cmd-click) several modules to move them together.
124
+
125
+ **Layout.** When the AI draws a View, it is laid out as it grows, as an architect draws it: top down, one row per module type's `tier` (users, frontend, gateway, API, services side by side, workers and queues, data at the bottom), externals in a column on the right, evenly spaced, with orthogonal lines that leave from the bottom and enter from the top (MCP `layout: auto`, the default; `layout: keep` moves nothing). Once you move anything, the positions are yours: the AI then only places the modules it adds. **Tidy layout** (in the canvas controls, or `layout_view` when you ask the AI) lays out the whole View; Ctrl+Z puts it back.
126
+
127
+ **Saving and versions.** Your edits on the canvas are a local draft until you press Save (Ctrl/Cmd+S) or Discard. AI changes save at once, or wait in Approvals. Every save writes a version of the View or Doc: look at an old one, compare it, name it or restore it from Version history (click the View's name in the breadcrumb).
128
+
129
+ **Approvals.** Approvals are only for changes to content a person has approved. A new project, or a View or Doc the AI makes (pre-audit drawing a new project, a new Sub View), is written directly with no Approval, and so is every AI change to it until a person approves it (a save on the canvas, or an approved Approval). An audit that changes nothing makes no Approval. By default AI changes to approved content need approval (Settings: "AI changes need approval", or "Apply directly" for the M0 behaviour). Each such MCP write lands at once in **Approvals** as a pending draft of that View or Doc, e.g. "#12 Cursor: amended View Checkout"; there is no send step. A pending Approval is a draft the AI keeps amending: a later write to the same View or Doc, from any agent run, folds into THAT Approval as a new revision instead of opening another. Each holds its base (the last approved version), its head (the latest draft) and its revisions (when, by whom, what changed); the review shows one diff, base to head, with the revisions in a list you can open. If the AI amends it while you have it open, the screen says "Updated since you opened it: reload diff", and Approve, which applies the head you saw as a new version, refuses until you reload. Deny discards the draft and keeps the base. The canvas follows the AI and shows each change as it lands: new in green, amended in amber, deleted in red, faded and struck through. Open an item to see the before and after of each View (side by side or overlaid; click an amber module to see what changed) and each doc as a coloured text diff. Approve or Deny it all at once, or change by change.
130
+
131
+ Badges on each module show its specs (S), docs (D) and history (H). Click one to read it beside the canvas, with Mermaid diagrams drawn. A Mermaid flowchart in any doc becomes a draft View in one click.
132
+
133
+ ## Data
134
+
135
+ Projects live in your `SpatialViews` folder, which is visible and easy to find: `C:\Users\<you>\SpatialViews` on Windows, `/Users/<you>/SpatialViews` on a Mac, `~/SpatialViews` on Linux and WSL. Set `SPATIAL_VIEWS_HOME` to move it. In earlier builds the home folder was the hidden `~/.spatial-views`: on first run it is moved to `~/SpatialViews` automatically, unless `SPATIAL_VIEWS_HOME` is set or a `~/SpatialViews` folder is already there (then the old folder is left alone and a note says so). The data is plain JSON that diffs cleanly:
136
+
137
+ - `toolboxes/*.yaml`: your toolboxes, with a `README.md`.
138
+ - `projects.json`: the projects.
139
+ - `projects/<slug>/project.json`: the project's sources (repos, docs and diagram folders, Windows or POSIX paths) and its audits.
140
+ - `projects/<slug>/views/<id>.json`: one file per View.
141
+ - `projects/<slug>/views/<id>/versions/<n>.json`: every saved version of a View `{n, at, by, note?, name?, restored_from?, data}` (`by` is `human` or the AI client's name).
142
+ - `projects/<slug>/gaps/<id>.json`: one file per Gap.
143
+ - `projects/<slug>/pins.json`: maps doc paths to Views, modules, Features and Gaps. Your docs are never rewritten.
144
+ - `projects/<slug>/reports/<name>.md`: onboarding and audit reports, pinned like any doc.
145
+ - `projects/<slug>/approvals/<id>.json`: a pending AI draft of one View or Doc in this project `{id, n, title, author, created, status: pending | approved | denied, base_version, revisions[{n, at, by, summary, tool}], changes[]}`: its one change holds the base (`before`) and the head (`after`).
146
+ - `projects/<slug>/settings.json`: `ai_changes` (`approval` or `direct`), `follow` and `keep_versions` (unset: keep every version).
147
+ - `projects/<slug>/doc-versions/<path>/<n>.json`: every saved version of a doc the tools wrote.
148
+ - `projects/<slug>/toolboxes/<id>.yaml`: the project's toolboxes.
149
+
150
+ **One repo on its own.** `npx spatial-views init` in a repo makes it a single-repo project, with its data in the repo's `.spatial/` as in 0.1.0.
151
+
152
+ JSON Schemas are in [`schema/`](schema). The AI gets XML by default; pass `format=json` for JSON.
153
+
154
+ ## Storage
155
+
156
+ Storage is a folder: the files above in `~/SpatialViews`, with live updates from the file system. There is nothing to set up.
157
+
158
+ **Optional: Postgres for teams.** It holds the same objects, one row each, in tables `projects`, `views`, `view_versions`, `gaps`, `docs`, `doc_versions`, `approvals`, `pins`, `settings`, `toolboxes` and `reports` (each with `id`, `project_id`, a `data` jsonb column holding exactly what the file holds, `version`, `updated_at` and `updated_by`). Every canvas and MCP server on the same database stays in sync through `LISTEN`/`NOTIFY`, and a save made from a stale version is refused. The schema is plain SQL in [`migrations/postgres/`](migrations/postgres), applied on connect. Pick it in Settings → Storage, or with `SPATIAL_VIEWS_STORAGE=postgres` and `SPATIAL_VIEWS_DATABASE_URL`. The environment wins over Settings. The URL is kept in `~/SpatialViews/config.json` (owner-only) and is never logged or shown; the canvas only sees host and database.
159
+
160
+ To move your projects, run `npx spatial-views migrate --to postgres` (or `--to folder`). It copies every project and checks the counts and a hash of every object. The source is left untouched, and a project the target already has is never overwritten. A single-repo project (`init`) always stays in its repo's `.spatial/`.
161
+
162
+ ## MCP tools
163
+
164
+ - **Read and show:** `list_views`, `get_view`, `open_view`.
165
+ - **Draw:** `create_view` (flow or `kind: sequence`), `add_module`, `connect`, `layout_view`, `list_types`, `create_type`, `create_doc`, `move_module`, `update_module`, `remove`, `link_module`, `unlink_module`, `add_file_pointer`.
166
+ - **Swim lanes and sequences:** `set_lanes`, `assign_lane` (lanes are horizontal bands; a connection across lanes is drawn as a dependency), `add_message` (ordered calls on a sequence View). On the canvas, add or remove a View's lanes in Settings (Lanes on this View); drop a module in a band to put it in that lane.
167
+ - **Pins:** `pin`, `list_pins`, `import_docs`.
168
+ - **Projects:** `list_projects`, `create_project`, `use_project`, `get_project`, `add_source`, `remove_source`, `list_sources`, `scan_source` (read-only, size-capped), `suggest_sources` (the other repos a source points at, with evidence; read-only), `record_audit`, `save_report`. With no project in use, every other tool answers "pick a project: list_projects, then use_project".
169
+ - **Versions:** `list_versions`, `get_version`, `restore_version`, `name_version`, for a View or a doc. Every save (by a person or the AI) writes a version; restore writes the old one as a new version, so nothing is deleted. `name_version` without `n` snapshots the View as it is now ("before pre-audit"). On the canvas: the View's name in the breadcrumb → Version history, or Properties with nothing selected.
170
+ - **Approvals:** `list_approvals`, `get_approval` (its state in words, e.g. "amended pending approval #12 (3 revisions, from v4)", its outcome: pending, approved, approved in part or denied, and its revisions), for the active project. No send step: writes to approved content land in Approvals at once; new and never-approved content is written directly.
171
+
172
+ The Skills [`draw-system`](skills/claude/draw-system/SKILL.md), plus the audit Skills [`pre-audit`](skills/claude/pre-audit/SKILL.md), [`update-state`](skills/claude/update-state/SKILL.md) and [`post-audit`](skills/claude/post-audit/SKILL.md), and [`check-ui`](skills/claude/check-ui/SKILL.md) (open the page being built, screenshot it and compare it with the View or spec it was built from; it reports only), are served as MCP prompts by the server, installed as Claude Code skills by `setup`, and ship as Cursor rules and a Windsurf rules file for `init`. They are designed to work alongside OpenSpec's own commands.
173
+
174
+ ### Check the UI with Playwright MCP
175
+
176
+ `check-ui` drives a browser through Microsoft's [Playwright MCP](https://github.com/microsoft/playwright-mcp) (`@playwright/mcp`, Apache-2.0). It is not bundled with Spatial Views: you add it yourself, next to the `spatial-views` server.
177
+
178
+ - **Claude Code:** `claude mcp add playwright -- npx @playwright/mcp@latest`
179
+ - **Cursor** (`.cursor/mcp.json`) and **Windsurf** (`~/.codeium/windsurf/mcp_config.json`): add to `mcpServers`:
180
+
181
+ ```json
182
+ {"mcpServers": {"playwright": {"command": "npx", "args": ["@playwright/mcp@latest"]}}}
183
+ ```
184
+
185
+ Then ask for `check-ui <url> <view or spec>`, for example `check-ui http://localhost:5173/settings "Settings screen"`. Without the Playwright tools, the Skill stops and points here; it never installs anything.
186
+
187
+ ## Experimental: Gaps and Features
188
+
189
+ Gaps, Features, the lasso (Make Gap, Make Feature) and the work-split and drift-Gap steps in the Skills are kept in the code but hidden. Set `SPATIAL_VIEWS_EXPERIMENTAL=1` (for both `npx spatial-views` and the MCP server) to turn them on. It adds the Lasso and Gaps buttons and Gap badges on the canvas; the tools `create_gap`, `list_gaps`, `update_gap` and `get_context` (everything one Gap needs, as XML with a token count); and the Skills [`gap-from-view`](skills/claude/gap-from-view/SKILL.md) and [`build-gap`](skills/claude/build-gap/SKILL.md). In a SKILL.md, the parts between `<!-- experimental -->` and `<!-- /experimental -->` are served only with the flag.
190
+
191
+ ## Troubleshooting
192
+
193
+ **The tools don't show up.** Run `npx spatial-views doctor`. It exits non-zero on any failure and prints a one-line fix. If the tools still do not show up, the agent should stop and say so. It should not write its own MCP client.
194
+
195
+ ## Recording the demo
196
+
197
+ `spatial-views demo` plays a fixed script in a 1920x1080 browser window, for screen recording. It makes a throwaway home folder (your `~/SpatialViews` is never touched), starts the canvas on it, spawns this package's own MCP server over stdio as the AI, and drives the window with Playwright as the person: a visible cursor, typing at a person's pace, and a caption for each beat. Everything runs on 127.0.0.1. The steps:
198
+
199
+ 1. An empty start: no projects, then a new project, Platform.
200
+ 2. pre-audit (the AI, over MCP) adds the five repos of [examples/platform](examples/platform) and draws the System Overview, module by module, then the connections, then a Sub View per area with its PRD and SDD pinned.
201
+ 3. Drill into the API, and back.
202
+ 4. A person's edit: drag a module, bend a connection, rename a module, Save.
203
+ 5. The AI amends the View over MCP. A person saved it, so the change waits in Approvals: green added, amber amended, red removed. Approve.
204
+ 6. The Docs tree: open the API gateway's PRD.
205
+ 7. Version history: preview the version from before the AI's change, and restore it.
206
+
207
+ It needs Playwright's Chromium, once. In a clone of this repo Playwright is a dev dependency; elsewhere install `playwright` next to `spatial-views`.
208
+
209
+ ```bash
210
+ npm install && npm run build
211
+ npx playwright install chromium
212
+ node dist/cli/index.js demo # or: npx spatial-views demo
213
+ ```
214
+
215
+ | Flag | |
216
+ | --- | --- |
217
+ | *(none)* | wait for the space key before each step: in the browser window, or in the terminal |
218
+ | `--auto` | advance on a timer instead; `--delay <ms>` between steps (default 2500) |
219
+ | `--step <n>` | start at step n, for a retake: the state steps 1 to n-1 leave is set up at once, without animation |
220
+ | `--port <n>` | the canvas port (default: a free one) |
221
+
222
+ `q` or Ctrl+C in the terminal stops it, and closing the window does too; the throwaway folder is deleted either way.
223
+
224
+ **OBS.** Add a *Window Capture* of the Chromium window (its title is the page's, Spatial Views): it is an app window with no tabs, address bar or automation bar, and the page is exactly 1920x1080, so set the canvas (Settings → Video) to 1920x1080 and the capture fills it. On a 1920x1080 screen the window's title bar pushes it past the bottom edge; use a larger screen, or *Display Capture* with a crop. The theme is light (a fresh browser profile). Start recording, click into the window, then press space for each step. For a retake of one step, `--step <n>` gets you back there in seconds.
225
+
226
+ ## Develop
227
+
228
+ ```bash
229
+ npm install
230
+ npm run build # the canvas (Vite) and the CLI / MCP server (tsc)
231
+ npm test # unit tests (vitest); the storage contract runs on both stores, Postgres on a
232
+ # throwaway local database (initdb; SPATIAL_VIEWS_TEST_DATABASE_URL to use your own)
233
+ npm run test:ui # Playwright: the canvas, the examples/platform System Overview screenshot, and the flow on examples/shop-openspec
234
+ ```
235
+
236
+ ## Credits
237
+
238
+ - The [Spatial Context paper](https://spatialthinking.ai/spatial-context-paper.pdf), [spatialthinking.ai](https://spatialthinking.ai).
239
+ - [OpenSpec](https://github.com/Fission-AI/OpenSpec), read as an external tool and not bundled.
240
+ - [React Flow](https://reactflow.dev) (MIT), [Mermaid](https://mermaid.js.org) (MIT), [marked](https://marked.js.org) (MIT), [DOMPurify](https://github.com/cure53/DOMPurify) (Apache-2.0 or MPL-2.0), and the [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk) (MIT).
241
+
242
+ ## License
243
+
244
+ MIT. "Spatial Views" is a trademark of Anthony Turner / NodeMax Limited. Use the code freely, but please don't name a product "Spatial Views".
245
+
246
+ **Third-party: ELK.** Auto-layout uses [elkjs](https://github.com/kieler/elkjs) (the Eclipse Layout Kernel), licensed EPL-2.0 (or GPL-3.0-or-later). It is a separate, unmodified npm dependency, installed from npm and run only by the server in Node. It is never bundled into the canvas: `vite.config.ts` stubs it out of the browser build. EPL-2.0 is file-level copyleft and allows use alongside code under other licences, so Spatial Views stays MIT. If you change elkjs itself, those changes fall under EPL-2.0.
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./chunk-OY52VR5R-DweG7qYw.js";import{t as r}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-y-x1CYxC.js";import"./chunk-BG4553SI-mWcPcFZr.js";import{t as i}from"./chunk-X3CZISLH-NOpCnvgE.js";import{n as a}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as o,t as s}from"./mermaid-parser.core-_3Vo8x6b.js";var c=o().RailroadAbnf.parser.LangiumParser,l=a(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformAlternation`),u=a(e=>{let t=e.elements.map(f);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformConcatenation`),d=a(e=>{if(e.includes(`*`)){let[t,n]=e.split(`*`);return{min:t?parseInt(t,10):0,max:n?parseInt(n,10):1/0}}let t=parseInt(e,10);return{min:t,max:t}},`parseRepeat`),f=a(e=>{let t=p(e.primary);if(!e.repeat)return t;let{min:n,max:r}=d(e.repeat);return n===0&&r===1?{type:`optional`,element:t}:{type:`repetition`,element:t,min:n,max:r}},`transformElement`),p=a(e=>{switch(e.$type){case`AbnfStringLiteral`:return{type:`terminal`,value:e.value};case`AbnfNumVal`:return{type:`terminal`,value:e.value};case`AbnfRuleName`:return{type:`nonterminal`,name:e.name};case`AbnfGroup`:return l(e.element);case`AbnfOptionalGroup`:return{type:`optional`,element:l(e.element)};default:throw Error(`Unsupported ABNF primary node: ${e.$type}`)}},`transformPrimary`),m=a(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=a(e=>{r(e,n),e.title&&n.setTitle(e.title),e.rules.map(e=>n.addRule(m(e)))},`populateDb`),g={parser:{parse:a(e=>{n.clear(),i.debug(`[ABNF Parser] Starting Langium parse`);let t=c.parse(e);if(t.lexerErrors.length>0||t.parserErrors.length>0)throw new s(t);let r=t.value;i.debug(`[ABNF Parser] Parsed rules:`,r.rules.length),h(r),i.debug(`[ABNF Parser] Parse complete`)},`parse`),parser:{yy:n}},db:n,renderer:t,styles:e};export{g as diagram};
@@ -0,0 +1 @@
1
+ export{M as createArchitectureServices}from"./mermaid-parser.core-_3Vo8x6b.js";import"./chunk-NGNAAXSQ-DI_UYJZ4.js";