@eventmodelers/cli 0.0.1

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/README.md +175 -0
  2. package/cli.js +676 -0
  3. package/package.json +35 -0
  4. package/shared/build-kit/code-export.mjs +560 -0
  5. package/shared/build-kit/lib/ollama-agent.js +147 -0
  6. package/shared/build-kit/package.json +11 -0
  7. package/shared/build-kit/ralph-ollama.js +39 -0
  8. package/shared/build-kit/realtime-agent.js +18 -0
  9. package/stacks/axon/templates/.claude/skills/build-automation/SKILL.md +407 -0
  10. package/stacks/axon/templates/.claude/skills/build-automation/references/feature-flag-patterns.md +114 -0
  11. package/stacks/axon/templates/.claude/skills/build-automation-workflow/SKILL.md +496 -0
  12. package/stacks/axon/templates/.claude/skills/build-automation-workflow/references/axon-workflow-api.md +279 -0
  13. package/stacks/axon/templates/.claude/skills/build-automation-workflow/references/feature-flag-patterns.md +114 -0
  14. package/stacks/axon/templates/.claude/skills/build-state-change/SKILL.md +396 -0
  15. package/stacks/axon/templates/.claude/skills/build-state-change/references/axon-test-fixture-patterns.md +162 -0
  16. package/stacks/axon/templates/.claude/skills/build-state-change/references/feature-flag-patterns.md +56 -0
  17. package/stacks/axon/templates/.claude/skills/build-state-change/references/rest-api-patterns.md +115 -0
  18. package/stacks/axon/templates/.claude/skills/build-state-view/SKILL.md +282 -0
  19. package/stacks/axon/templates/.claude/skills/connect/SKILL.md +178 -0
  20. package/stacks/axon/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +611 -0
  21. package/stacks/axon/templates/.claude/skills/load-slice/SKILL.md +141 -0
  22. package/stacks/axon/templates/.claude/skills/update-slice-status/SKILL.md +105 -0
  23. package/stacks/axon/templates/build-kit/lib/AGENT.md +47 -0
  24. package/stacks/axon/templates/build-kit/lib/agent.sh +20 -0
  25. package/stacks/axon/templates/build-kit/lib/backend-prompt.md +158 -0
  26. package/stacks/axon/templates/build-kit/lib/prompt.md +126 -0
  27. package/stacks/axon/templates/build-kit/lib/ralph.js +369 -0
  28. package/stacks/axon/templates/build-kit/ralph-claude.js +44 -0
  29. package/stacks/axon/templates/build-kit/ralph.sh +98 -0
  30. package/stacks/axon/templates/root/.env.example +5 -0
  31. package/stacks/axon/templates/root/CLAUDE.md +60 -0
  32. package/stacks/axon/templates/root/README.md +44 -0
  33. package/stacks/axon/templates/root/docker-compose.yml +64 -0
  34. package/stacks/axon/templates/root/mvnw +259 -0
  35. package/stacks/axon/templates/root/mvnw.cmd +149 -0
  36. package/stacks/axon/templates/root/pom.xml +125 -0
  37. package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/QuickstartApplication.java +128 -0
  38. package/stacks/axon/templates/root/src/main/java/io/axoniq/quickstart/config/WebConfig.java +155 -0
  39. package/stacks/axon/templates/root/src/main/resources/application.properties +2 -0
  40. package/stacks/axon/templates/root/src/main/resources/static/bg-body.png +0 -0
  41. package/stacks/axon/templates/root/src/main/resources/static/bg-header.png +0 -0
  42. package/stacks/axon/templates/root/src/main/resources/static/index.html +596 -0
  43. package/stacks/cratis-csharp/templates/.claude/skills/_shared/cratis-conventions.md +251 -0
  44. package/stacks/cratis-csharp/templates/.claude/skills/build-automation/SKILL.md +99 -0
  45. package/stacks/cratis-csharp/templates/.claude/skills/build-automation/references/patterns.md +115 -0
  46. package/stacks/cratis-csharp/templates/.claude/skills/build-state-change/SKILL.md +163 -0
  47. package/stacks/cratis-csharp/templates/.claude/skills/build-state-change/references/patterns.md +234 -0
  48. package/stacks/cratis-csharp/templates/.claude/skills/build-state-view/SKILL.md +120 -0
  49. package/stacks/cratis-csharp/templates/.claude/skills/build-state-view/references/patterns.md +166 -0
  50. package/stacks/cratis-csharp/templates/.claude/skills/connect/SKILL.md +169 -0
  51. package/stacks/cratis-csharp/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +609 -0
  52. package/stacks/cratis-csharp/templates/.claude/skills/load-slice/SKILL.md +141 -0
  53. package/stacks/cratis-csharp/templates/.claude/skills/update-slice-status/SKILL.md +105 -0
  54. package/stacks/cratis-csharp/templates/build-kit/lib/AGENT.md +58 -0
  55. package/stacks/cratis-csharp/templates/build-kit/lib/agent.sh +20 -0
  56. package/stacks/cratis-csharp/templates/build-kit/lib/backend-prompt.md +129 -0
  57. package/stacks/cratis-csharp/templates/build-kit/lib/prompt.md +124 -0
  58. package/stacks/cratis-csharp/templates/build-kit/lib/ralph.js +302 -0
  59. package/stacks/cratis-csharp/templates/build-kit/ralph-claude.js +37 -0
  60. package/stacks/cratis-csharp/templates/build-kit/ralph.sh +98 -0
  61. package/stacks/cratis-csharp/templates/root/.frontend/index.css +29 -0
  62. package/stacks/cratis-csharp/templates/root/.frontend/index.html +17 -0
  63. package/stacks/cratis-csharp/templates/root/.frontend/main.tsx +18 -0
  64. package/stacks/cratis-csharp/templates/root/.frontend/tsconfig.json +42 -0
  65. package/stacks/cratis-csharp/templates/root/.frontend/tsconfig.node.json +11 -0
  66. package/stacks/cratis-csharp/templates/root/.frontend/vite.config.ts +56 -0
  67. package/stacks/cratis-csharp/templates/root/App.tsx +23 -0
  68. package/stacks/cratis-csharp/templates/root/CLAUDE.md +62 -0
  69. package/stacks/cratis-csharp/templates/root/CratisApp.csproj +25 -0
  70. package/stacks/cratis-csharp/templates/root/CratisApp.sln +18 -0
  71. package/stacks/cratis-csharp/templates/root/GlobalUsings.cs +3 -0
  72. package/stacks/cratis-csharp/templates/root/Home.tsx +102 -0
  73. package/stacks/cratis-csharp/templates/root/Program.cs +26 -0
  74. package/stacks/cratis-csharp/templates/root/README.md +192 -0
  75. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/AllListings.ts +47 -0
  76. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/Listing.cs +11 -0
  77. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/Listing.ts +12 -0
  78. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/ListingDataTable.tsx +17 -0
  79. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Listing/index.ts +1 -0
  80. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/Register.ts +51 -0
  81. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/RegisterDialog.tsx +18 -0
  82. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/Registration.cs +27 -0
  83. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/Registration/index.ts +1 -0
  84. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/SomeFeature.tsx +22 -0
  85. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/SomeName.cs +3 -0
  86. package/stacks/cratis-csharp/templates/root/SomeModule/SomeFeature/index.ts +1 -0
  87. package/stacks/cratis-csharp/templates/root/appsettings.Development.json +9 -0
  88. package/stacks/cratis-csharp/templates/root/appsettings.json +26 -0
  89. package/stacks/cratis-csharp/templates/root/docker-compose.yml +23 -0
  90. package/stacks/cratis-csharp/templates/root/package.json +33 -0
  91. package/stacks/cratis-csharp/templates/root/tsconfig.json +3 -0
  92. package/stacks/modeling-kit/templates/.claude/settings.local.json +13 -0
  93. package/stacks/modeling-kit/templates/.claude/skills/analyze-existing-model/SKILL.md +215 -0
  94. package/stacks/modeling-kit/templates/.claude/skills/attributes/SKILL.md +176 -0
  95. package/stacks/modeling-kit/templates/.claude/skills/connect/SKILL.md +182 -0
  96. package/stacks/modeling-kit/templates/.claude/skills/discover-storyboard/SKILL.md +383 -0
  97. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-applying-conways-law/SKILL.md +465 -0
  98. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/SKILL.md +587 -0
  99. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-brainstorming-events/references/facilitating-event-modeling-workshops.md +626 -0
  100. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-checking-completeness/SKILL.md +542 -0
  101. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-designing-event-models/SKILL.md +497 -0
  102. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-elaborating-scenarios/SKILL.md +783 -0
  103. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-inputs/SKILL.md +604 -0
  104. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-identifying-outputs/SKILL.md +699 -0
  105. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-integrating-legacy-systems/SKILL.md +674 -0
  106. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/SKILL.md +231 -0
  107. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/domain-patterns.md +150 -0
  108. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/patterns.md +329 -0
  109. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-optimizing-stream-design/references/snapshotting.md +204 -0
  110. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/SKILL.md +352 -0
  111. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-orchestrating-event-modeling/references/project-planning-with-event-modeling.md +341 -0
  112. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-plotting-events/SKILL.md +153 -0
  113. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/SKILL.md +136 -0
  114. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/examples.md +78 -0
  115. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-slicing-event-models/references/patterns.md +85 -0
  116. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-storyboarding-events/SKILL.md +655 -0
  117. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-translating-external-events/SKILL.md +479 -0
  118. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models/SKILL.md +234 -0
  119. package/stacks/modeling-kit/templates/.claude/skills/eventmodeling-validating-event-models-checklist/SKILL.md +353 -0
  120. package/stacks/modeling-kit/templates/.claude/skills/examples/SKILL.md +200 -0
  121. package/stacks/modeling-kit/templates/.claude/skills/handle-comment/SKILL.md +94 -0
  122. package/stacks/modeling-kit/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +441 -0
  123. package/stacks/modeling-kit/templates/.claude/skills/place-element/SKILL.md +290 -0
  124. package/stacks/modeling-kit/templates/.claude/skills/storyboard/SKILL.md +212 -0
  125. package/stacks/modeling-kit/templates/.claude/skills/storyboard-screen/SKILL.md +123 -0
  126. package/stacks/modeling-kit/templates/.claude/skills/timeline/SKILL.md +353 -0
  127. package/stacks/modeling-kit/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
  128. package/stacks/modeling-kit/templates/.claude/skills/wdyt/SKILL.md +134 -0
  129. package/stacks/modeling-kit/templates/kit/lib/agent.sh +20 -0
  130. package/stacks/modeling-kit/templates/kit/lib/ollama-agent.js +147 -0
  131. package/stacks/modeling-kit/templates/kit/lib/ralph.js +286 -0
  132. package/stacks/modeling-kit/templates/kit/package.json +12 -0
  133. package/stacks/modeling-kit/templates/kit/ralph-claude.js +50 -0
  134. package/stacks/modeling-kit/templates/kit/ralph-ollama.js +38 -0
  135. package/stacks/modeling-kit/templates/kit/ralph.sh +61 -0
  136. package/stacks/modeling-kit/templates/kit/realtime-agent.js +18 -0
  137. package/stacks/modeling-kit/templates/root/CLAUDE.md +56 -0
  138. package/stacks/node/templates/.claude/skills/build-automation/SKILL.md +266 -0
  139. package/stacks/node/templates/.claude/skills/build-state-change/SKILL.md +344 -0
  140. package/stacks/node/templates/.claude/skills/build-state-view/SKILL.md +412 -0
  141. package/stacks/node/templates/.claude/skills/connect/SKILL.md +178 -0
  142. package/stacks/node/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +628 -0
  143. package/stacks/node/templates/.claude/skills/load-slice/SKILL.md +143 -0
  144. package/stacks/node/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
  145. package/stacks/node/templates/build-kit/README.md +86 -0
  146. package/stacks/node/templates/build-kit/lib/AGENT.md +47 -0
  147. package/stacks/node/templates/build-kit/lib/agent.sh +20 -0
  148. package/stacks/node/templates/build-kit/lib/backend-prompt.md +152 -0
  149. package/stacks/node/templates/build-kit/lib/prompt.md +122 -0
  150. package/stacks/node/templates/build-kit/lib/ralph.js +369 -0
  151. package/stacks/node/templates/build-kit/ralph-claude.js +44 -0
  152. package/stacks/node/templates/build-kit/ralph.sh +98 -0
  153. package/stacks/node/templates/root/.env.example +15 -0
  154. package/stacks/node/templates/root/CLAUDE.md +60 -0
  155. package/stacks/node/templates/root/docker-compose.yml +15 -0
  156. package/stacks/node/templates/root/flyway.conf +17 -0
  157. package/stacks/node/templates/root/migrations/V1__schema.sql.example +12 -0
  158. package/stacks/node/templates/root/package.json +50 -0
  159. package/stacks/node/templates/root/server.ts +130 -0
  160. package/stacks/node/templates/root/setup-env.sh +53 -0
  161. package/stacks/node/templates/root/src/common/assertions.ts +6 -0
  162. package/stacks/node/templates/root/src/common/db.ts +32 -0
  163. package/stacks/node/templates/root/src/common/loadPostgresEventstore.ts +23 -0
  164. package/stacks/node/templates/root/src/common/parseEndpoint.ts +51 -0
  165. package/stacks/node/templates/root/src/common/processorDlq.ts +28 -0
  166. package/stacks/node/templates/root/src/common/realtimeBroadcast.ts +12 -0
  167. package/stacks/node/templates/root/src/common/replay.ts +16 -0
  168. package/stacks/node/templates/root/src/common/routes.ts +19 -0
  169. package/stacks/node/templates/root/src/common/testHelpers.ts +44 -0
  170. package/stacks/node/templates/root/src/swagger.ts +34 -0
  171. package/stacks/node/templates/root/src/util/assertions.ts +6 -0
  172. package/stacks/node/templates/root/src/util/hash.ts +9 -0
  173. package/stacks/node/templates/root/src/util/sanitize.ts +23 -0
  174. package/stacks/node/templates/root/tsconfig.json +32 -0
  175. package/stacks/node/templates/root/vercel.json +8 -0
  176. package/stacks/supabase/templates/.claude/skills/build-automation/SKILL.md +266 -0
  177. package/stacks/supabase/templates/.claude/skills/build-state-change/SKILL.md +344 -0
  178. package/stacks/supabase/templates/.claude/skills/build-state-view/SKILL.md +390 -0
  179. package/stacks/supabase/templates/.claude/skills/build-webhook/SKILL.md +303 -0
  180. package/stacks/supabase/templates/.claude/skills/connect/SKILL.md +178 -0
  181. package/stacks/supabase/templates/.claude/skills/learn-eventmodelers-api/SKILL.md +628 -0
  182. package/stacks/supabase/templates/.claude/skills/load-slice/SKILL.md +143 -0
  183. package/stacks/supabase/templates/.claude/skills/update-slice-status/SKILL.md +110 -0
  184. package/stacks/supabase/templates/build-kit/README.md +86 -0
  185. package/stacks/supabase/templates/build-kit/lib/AGENT.md +47 -0
  186. package/stacks/supabase/templates/build-kit/lib/agent.sh +20 -0
  187. package/stacks/supabase/templates/build-kit/lib/backend-prompt.md +152 -0
  188. package/stacks/supabase/templates/build-kit/lib/prompt.md +123 -0
  189. package/stacks/supabase/templates/build-kit/lib/ralph.js +369 -0
  190. package/stacks/supabase/templates/build-kit/ralph-claude.js +44 -0
  191. package/stacks/supabase/templates/build-kit/ralph.sh +98 -0
  192. package/stacks/supabase/templates/root/.env.example +22 -0
  193. package/stacks/supabase/templates/root/CLAUDE.md +61 -0
  194. package/stacks/supabase/templates/root/flyway.conf +17 -0
  195. package/stacks/supabase/templates/root/package.json +52 -0
  196. package/stacks/supabase/templates/root/server.ts +177 -0
  197. package/stacks/supabase/templates/root/setup-env.sh +53 -0
  198. package/stacks/supabase/templates/root/src/common/assertions.ts +6 -0
  199. package/stacks/supabase/templates/root/src/common/db.ts +32 -0
  200. package/stacks/supabase/templates/root/src/common/loadPostgresEventstore.ts +23 -0
  201. package/stacks/supabase/templates/root/src/common/parseEndpoint.ts +51 -0
  202. package/stacks/supabase/templates/root/src/common/processorDlq.ts +28 -0
  203. package/stacks/supabase/templates/root/src/common/realtimeBroadcast.ts +19 -0
  204. package/stacks/supabase/templates/root/src/common/replay.ts +16 -0
  205. package/stacks/supabase/templates/root/src/common/routes.ts +23 -0
  206. package/stacks/supabase/templates/root/src/common/testHelpers.ts +54 -0
  207. package/stacks/supabase/templates/root/src/supabase/README.md +141 -0
  208. package/stacks/supabase/templates/root/src/supabase/api.ts +56 -0
  209. package/stacks/supabase/templates/root/src/supabase/requireOrgaAdmin.ts +32 -0
  210. package/stacks/supabase/templates/root/src/supabase/requireSysUser.ts +40 -0
  211. package/stacks/supabase/templates/root/src/supabase/requireUser.ts +72 -0
  212. package/stacks/supabase/templates/root/src/swagger.ts +34 -0
  213. package/stacks/supabase/templates/root/src/util/assertions.ts +6 -0
  214. package/stacks/supabase/templates/root/src/util/hash.ts +9 -0
  215. package/stacks/supabase/templates/root/src/util/sanitize.ts +23 -0
  216. package/stacks/supabase/templates/root/supabase/config.toml +295 -0
  217. package/stacks/supabase/templates/root/supabase/migrations/V1__schema.sql.example +12 -0
  218. package/stacks/supabase/templates/root/supabase/seed.sql +1 -0
  219. package/stacks/supabase/templates/root/tsconfig.json +32 -0
  220. package/stacks/supabase/templates/root/vercel.json +8 -0
@@ -0,0 +1,628 @@
1
+ ---
2
+ name: learn-eventmodelers-api
3
+ description: Teaches an agent everything about the eventmodelers platform API — all endpoints, their purpose, request payloads, response shapes, authentication, and element types.
4
+ ---
5
+
6
+ # Eventmodelers Platform API Reference
7
+
8
+ You now have complete knowledge of the eventmodelers platform API. Use this reference whenever you need to call, implement, or reason about any endpoint.
9
+
10
+ ---
11
+
12
+ ## Architecture Overview
13
+
14
+ - **Framework**: Express.js + `@event-driven-io/emmett` (event sourcing)
15
+ - **Adapter**: `@event-driven-io/emmett-expressjs`
16
+ - **Database**: PostgreSQL via Knex
17
+ - **Storage / Auth**: Supabase
18
+ - **Route discovery**: Dynamic glob (`**/routes{,-*}.js`) loaded from `dist/src/slices`
19
+ - **Base URL** (local): `http://localhost:3000`
20
+
21
+ ---
22
+
23
+ ## Authentication & Headers
24
+
25
+ | Header | Required | Purpose |
26
+ |---|---|---|
27
+ | `Authorization` | Some routes | Supabase JWT bearer token |
28
+ | `x-user-id` | Node operations | User identifier |
29
+ | `x-causation-id` | Optional | Event causation tracing |
30
+ | `x-correlation-id` | Optional | Correlation tracing |
31
+
32
+ - CORS allowed origins: `localhost:3000`, `localhost:3001`, `https://app.eventmodelers.ai`
33
+
34
+ ---
35
+
36
+ ## Element Types
37
+
38
+ ```typescript
39
+ MODEL_CONTEXT // Context/domain modeling container
40
+ CHAPTER // Timeline/sequence container
41
+ ACTOR // System participant (swimlane label)
42
+ AUTOMATION // Automated action
43
+ API // External service
44
+ SCREEN // UI screen
45
+ COMMAND // State-changing operation
46
+ EVENT // Domain event
47
+ SPEC_ERROR // Error scenario
48
+ TABLE // Data table
49
+ READMODEL // Query result / materialized view
50
+ SCENARIO // GWT scenario
51
+ LANE // Timeline row
52
+ SLICE_BORDER // Slice boundary marker
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Standard HTTP Status Codes
58
+
59
+ | Code | Meaning |
60
+ |---|---|
61
+ | 200 | OK with data |
62
+ | 201 | Created |
63
+ | 204 | No content |
64
+ | 400 | Validation error / bad input |
65
+ | 401 | Authentication required |
66
+ | 404 | Resource not found |
67
+ | 409 | Conflict (e.g. duplicate) |
68
+ | 500 | Server error |
69
+
70
+ ---
71
+
72
+ ## 1. Boards
73
+
74
+ **File**: `src/slices/change/api-boards/routes.ts`
75
+
76
+ ### POST `/api/org/:orgId/boards/:boardId/events`
77
+ Persist board/timeline row events as an array of mixed event types.
78
+
79
+ **Request body**: Array of node, comment, edge, or board events
80
+ **Response**: `200` — processed results array
81
+
82
+ ---
83
+
84
+ ### GET `/api/boards`
85
+ List all boards.
86
+
87
+ **Response**: `200` — `Board[]`
88
+
89
+ ---
90
+
91
+ ### DELETE `/api/org/:orgId/boards/:boardId`
92
+ Delete a board.
93
+
94
+ **Response**: `204`
95
+
96
+ ---
97
+
98
+ ### GET `/api/org/:orgId/boards/:boardId/events/search`
99
+ Search events by node name.
100
+
101
+ **Query params**: `name` (string)
102
+ **Response**: `200` — matching event array
103
+
104
+ ---
105
+
106
+ ### GET `/api/org/:orgId/boards/:boardId/events`
107
+ Get all board events in sequence.
108
+
109
+ **Response**: `200` — event array
110
+
111
+ ---
112
+
113
+ ### GET `/api/org/:orgId/boards/:boardId/nodes/:nodeId/comments`
114
+ Get all comments for a node.
115
+
116
+ **Response**: `200` — comment array
117
+
118
+ ---
119
+
120
+ ### POST `/api/org/:orgId/boards/:boardId/bucket`
121
+ Create a Supabase storage bucket for the board.
122
+
123
+ **Response**: `200` — `{ ok: boolean, bucket: string, alreadyExisted: boolean }`
124
+
125
+ ---
126
+
127
+ ## 2. Chapters & Timelines
128
+
129
+ **File**: `src/slices/change/api-chapters/routes.ts`
130
+
131
+ ### POST `/api/org/:orgId/boards/:boardId/chapters`
132
+ Create a chapter node.
133
+
134
+ **Request body**: `{ position?: { x: number, y: number } }`
135
+ **Response**: `200` — chapter data
136
+
137
+ ---
138
+
139
+ ### POST `/api/org/:orgId/boards/:boardId/timelines/:timelineId/columns`
140
+ Add a column to a timeline.
141
+
142
+ **Request body**: `{ index?: number }` (integer index, optional)
143
+ **Response**: `200` — `{ columnId: string, index: number, totalColumns: number }`
144
+
145
+ ---
146
+
147
+ ### DELETE `/api/org/:orgId/boards/:boardId/timelines/:timelineId/columns/:columnId`
148
+ Delete a column from a timeline. Removes the column and all its cells. Cannot delete the last column.
149
+
150
+ **Response**:
151
+ - `200` — `{ columnId: string, totalColumns: number }`
152
+ - `400` — validation error (e.g. last column)
153
+ - `404` — timeline or column not found
154
+
155
+ ---
156
+
157
+ ### POST `/api/org/:orgId/boards/:boardId/timelines/:timelineId/lanes`
158
+ Add a lane (row) to a timeline.
159
+
160
+ **Request body**:
161
+ ```typescript
162
+ {
163
+ type: 'actor' | 'interaction' | 'swimlane' | 'spec' | 'feedback'
164
+ label?: string
165
+ index?: number
166
+ height?: number
167
+ }
168
+ ```
169
+ **Response**: `200` — lane data
170
+
171
+ ---
172
+
173
+ ### POST `/api/org/:orgId/boards/:boardId/timelines/:timelineId/cells/:cellId/drop`
174
+ Drop a node into a timeline cell. Validates placement rules.
175
+
176
+ **Request body**: `{ nodeId: string, nodeType: ElementType }`
177
+
178
+ **Placement rules**:
179
+ - `swimlane` lane → accepts `EVENT`
180
+ - `interaction` lane → accepts `COMMAND`, `READMODEL`
181
+ - `actor` lane → accepts `SCREEN`, `AUTOMATION`
182
+ - `feedback` lane → accepts markdown
183
+ - `spec` lane → accepts `SPEC_NODE`
184
+
185
+ **Response**:
186
+ - `200` — drop result
187
+ - `400` — placement violation
188
+ - `404` — cell or node not found
189
+
190
+ ---
191
+
192
+ ## 3. Nodes
193
+
194
+ **File**: `src/slices/change/api-nodes/routes.ts`
195
+
196
+ All node endpoints require header: `x-user-id`
197
+
198
+ ### POST `/api/org/:orgId/boards/:boardId/nodes/events`
199
+ Submit node change events.
200
+
201
+ **Request body**: `NodeChangeEvent[]`
202
+
203
+ ```typescript
204
+ interface NodeChangeEvent {
205
+ id: string // uuid
206
+ eventType: 'node:created' | 'node:changed' | 'node:deleted'
207
+ nodeId: string
208
+ boardId: string
209
+ timestamp: number // unix ms
210
+ userId?: string
211
+ hash?: string // content hash
212
+ changedAttributes?: string[] // dot-paths e.g. 'meta.title'
213
+ node?: {
214
+ id: string
215
+ data: {
216
+ backgroundColor?: string
217
+ title?: string
218
+ url?: string
219
+ // ...other node data fields
220
+ // Do NOT set a "type" here — the server derives the node's render type from
221
+ // meta.type automatically. Setting one yourself risks it being read as the
222
+ // render type itself and breaking rendering.
223
+ }
224
+ }
225
+ meta?: {
226
+ type: ElementType
227
+ title?: string
228
+ description?: string
229
+ fields?: Record<string, unknown>
230
+ // ...
231
+ }
232
+ edges?: Array<{
233
+ id: string
234
+ source: string
235
+ target: string
236
+ sourceHandle?: string
237
+ targetHandle?: string
238
+ }>
239
+ chapterId?: string // for cell placement
240
+ cellName?: string // spreadsheet-style e.g. "B2"
241
+ }
242
+ ```
243
+
244
+ **Response**: `200` — `{ hashes: { [eventId: string]: string } }`
245
+
246
+ ---
247
+
248
+ ### GET `/api/org/:orgId/boards/:boardId/nodes`
249
+ List all nodes on a board.
250
+
251
+ **Query params**: `type?: ElementType`
252
+ **Response**: `200` — node record array
253
+
254
+ ---
255
+
256
+ ### GET `/api/org/:orgId/boards/:boardId/nodes/:nodeId`
257
+ Get a single node.
258
+
259
+ **Response**: `200` — node record OR `404`
260
+
261
+ ---
262
+
263
+ ## 4. Images
264
+
265
+ **File**: `src/slices/change/api-images/routes.ts`
266
+
267
+ ### POST `/api/org/:orgId/boards/:boardId/images/:imageId`
268
+ Update a board image.
269
+
270
+ **Request**: `multipart/form-data` — field `file` (binary)
271
+ **Response**: `204`
272
+
273
+ ---
274
+
275
+ ### POST `/api/org/:orgId/boards/:boardId/imagesnapshots/:imageId`
276
+ Update an image snapshot.
277
+
278
+ **Request**: `multipart/form-data` — field `file` (binary)
279
+ **Response**: `204`
280
+
281
+ ---
282
+
283
+ ### POST `/api/org/:orgId/boards/:boardId/image-nodes/:nodeId`
284
+ Create an image node.
285
+
286
+ **Request**: `multipart/form-data` — fields: `file`, `chapterId`, `cellName`
287
+ **Response**: `204`
288
+
289
+ ---
290
+
291
+ ### POST `/api/org/:orgId/boards/:boardId/images/:imageId/sketch`
292
+ Render a sketch description to WebP and upload.
293
+
294
+ **Request body**:
295
+ ```typescript
296
+ {
297
+ elements: object[] // sketch element descriptors
298
+ semanticDescription?: string // human-readable description stored in metadata
299
+ }
300
+ ```
301
+ **Response**: `204`
302
+
303
+ ---
304
+
305
+ ### POST `/api/org/:orgId/boards/:boardId/image-nodes/:nodeId/sketch`
306
+ Create a SCREEN node from a sketch description.
307
+
308
+ **Request body**:
309
+ ```typescript
310
+ {
311
+ chapterId: string
312
+ cellName: string
313
+ description: { elements: object[] }
314
+ semanticDescription?: string
315
+ }
316
+ ```
317
+ **Response**: `204` OR `400` (validation error)
318
+
319
+ ---
320
+
321
+ ## 5. Slices
322
+
323
+ **File**: `src/slices/change/api-.slices/routes.ts`
324
+
325
+ ### POST `/api/org/:orgId/boards/:boardId/timelines/:timelineId/slices`
326
+ Create a complete slice (1 column + 3 nodes automatically placed).
327
+
328
+ **Request body**:
329
+ ```typescript
330
+ {
331
+ type: 'state-change' | 'state-view' | 'automation'
332
+ index?: number
333
+ nodes?: {
334
+ actor?: Partial<NodeData>
335
+ interaction?: Partial<NodeData>
336
+ swimlane?: Partial<NodeData>
337
+ }
338
+ }
339
+ ```
340
+
341
+ **Slice node mapping**:
342
+ - `state-change` → SCREEN (actor) + COMMAND (interaction) + EVENT (swimlane)
343
+ - `state-view` → SCREEN (actor) + READMODEL (interaction) + EVENT (swimlane)
344
+ - `automation` → AUTOMATION (actor) + COMMAND (interaction) + EVENT (swimlane)
345
+
346
+ **Response**: `200` — slice data
347
+
348
+ ### POST `/api/org/:orgId/boards/:boardId/timelines/:timelineId/slice-definitions`
349
+ Create a standalone SLICE_BORDER node spanning an **existing** column. Unlike the endpoint above, this does not add a column or any actor/interaction/swimlane content nodes — the column must already exist (e.g. created via `POST .../slices` or the column API) and is referenced by `columnId`.
350
+
351
+ **Request body**:
352
+ ```typescript
353
+ {
354
+ columnId: string // id of an existing column on this timeline
355
+ title: string // slice title — always taken from this field, never derived
356
+ data?: Record<string, unknown> // optional node.data payload
357
+ meta?: Record<string, unknown> // optional extra meta fields (type, colId, title are always set explicitly and cannot be overridden here)
358
+ }
359
+ ```
360
+
361
+ **Response**: `200` — `{ nodeId, timelineId, columnId, title }`
362
+ **Errors**: `400` missing `columnId`/`title` or column not found · `404` timeline not found
363
+
364
+ ---
365
+
366
+ ## 6. Specifications (GWT Scenarios)
367
+
368
+ **File**: `src/slices/change/api-specs/routes.ts`
369
+
370
+ ### POST `/api/org/:orgId/boards/:boardId/contexts/:contextName/slices/:sliceName/scenarios`
371
+ Append a Given-When-Then scenario to a spec node.
372
+
373
+ **Request body**:
374
+ ```typescript
375
+ {
376
+ id: string
377
+ title: string
378
+ vertical?: boolean
379
+ examples?: unknown[]
380
+ given: string[] // nodeIds — must be EVENTs from same timeline
381
+ when: string[] // nodeIds — at most one COMMAND; empty if then has READMODEL
382
+ then: string[] // nodeIds — EVENTs only OR exactly one READMODEL (not mixed)
383
+ }
384
+ ```
385
+
386
+ **Validation rules**:
387
+ - `given`: only EVENTs from same timeline
388
+ - `when`: max one COMMAND; must be empty when `then` contains a READMODEL
389
+ - `then`: all EVENTs OR exactly one READMODEL — never mixed
390
+ - All referenced nodes must belong to the same chapter/timeline
391
+
392
+ **Response**:
393
+ - `201` — `{ scenario, scenarios, specNodeId, isNewNode: boolean }`
394
+ - `400` — validation error
395
+ - `404` — context or slice not found
396
+ - `409` — duplicate scenario title
397
+
398
+ ---
399
+
400
+ ### GET `/api/org/:orgId/boards/:boardId/contexts/:contextName/spec-info`
401
+ Get valid elements for a context (by name lookup).
402
+
403
+ **Response**: `200` — `{ chapterId: string, elements: ElementRecord[] }`
404
+
405
+ ---
406
+
407
+ ### GET `/api/org/:orgId/boards/:boardId/contexts/:contextName/slices/:sliceName/spec-info`
408
+ Get valid elements for a specific slice.
409
+
410
+ **Response**: `200` — `{ chapterId: string, elements: ElementRecord[] }`
411
+
412
+ ---
413
+
414
+ ## 7. Config Import
415
+
416
+ **File**: `src/slices/change/config-import/routes.ts`
417
+
418
+ ### POST `/api/org/:orgId/boards/:boardId/import-config`
419
+ Import an EventModelingJson config to populate a board.
420
+
421
+ **Request**: `multipart/form-data` with field `file` OR `application/json` body:
422
+ ```typescript
423
+ { slices: SliceDefinition[] }
424
+ ```
425
+
426
+ **Response**: `200` — transformed canvas with nodes and edges
427
+
428
+ ---
429
+
430
+ ## 8. Slice Data
431
+
432
+ **File**: `src/slices/slicedata/routes.ts`
433
+
434
+ ### GET ` `
435
+ Build structured slice data from board state.
436
+
437
+ **Query params** (one required): `contextId` OR `contextName`; optional: `sliceId`
438
+ **Response**: `200` — slice data matching event modeling schema
439
+
440
+ ---
441
+
442
+ ### GET `/api/org/:orgId/boards/:boardId/slicedata/slices`
443
+ List all slices on a board.
444
+
445
+ **Response**: `200` — `{ slices: Array<{ id: string, title: string, status: string }> }`
446
+
447
+ ---
448
+
449
+ ## 9. Extensions
450
+
451
+ **File**: `src/slices/extensions/routes.ts`
452
+
453
+ ### GET `/api/org/:orgId/boards/:boardId/extensions`
454
+ List extension configs for a board.
455
+
456
+ **Response**: `200` — extension record array
457
+
458
+ ---
459
+
460
+ ### PUT `/api/org/:orgId/boards/:boardId/extensions/:type`
461
+ Enable or disable an extension.
462
+
463
+ **Request body**: `{ enabled: boolean, config?: object }`
464
+ **Response**: `200` — updated extension config
465
+
466
+ ---
467
+
468
+ ## 10. Snapshots
469
+
470
+ **File**: `src/slices/Snapshots/routes.ts`
471
+
472
+ All snapshot endpoints require Supabase JWT authentication.
473
+
474
+ **Constraints**: max 3 snapshots per user, max 30-day retention, max 50 MB file size.
475
+
476
+ ### GET `/api/snapshots`
477
+ List current user's snapshots.
478
+
479
+ **Response**: `200` — `Array<{ id, name, payload_id, expiry, shared }>`
480
+
481
+ ---
482
+
483
+ ### POST `/api/snapshots`
484
+ Create a snapshot.
485
+
486
+ **Request**: `multipart/form-data` — fields: `payloadFile` (binary), `name` (string), `retention?` (days, max 30)
487
+ **Response**: `201` — `{ ok: true, id: string }`
488
+
489
+ ---
490
+
491
+ ### GET `/api/snapshots/:id`
492
+ Load a snapshot's payload.
493
+
494
+ **Response**: `200` — snapshot payload JSON
495
+
496
+ ---
497
+
498
+ ### PATCH `/api/snapshots/:id/share`
499
+ Share a snapshot (makes it publicly accessible).
500
+
501
+ **Response**: `200` — `{ ok: true }`
502
+
503
+ ---
504
+
505
+ ### DELETE `/api/snapshots/:id`
506
+ Delete a snapshot.
507
+
508
+ **Response**: `200` — `{ ok: true }`
509
+
510
+ ---
511
+
512
+ ## 11. User Management — Commands (Event Sourced)
513
+
514
+ All commands respond with:
515
+ ```typescript
516
+ {
517
+ ok: true
518
+ next_expected_stream_version: number
519
+ last_event_global_position: number
520
+ }
521
+ ```
522
+
523
+ Optional headers on all: `correlation_id`, `causation_id`
524
+
525
+ ### POST `/api/creategroup`
526
+ **Body**: `{ groupId: string, name: string }`
527
+ **Event emitted**: `GroupCreated`
528
+
529
+ ---
530
+
531
+ ### POST `/api/inviteuser`
532
+ **Body**: `{ groupId: string, email: string, invitationId: string }`
533
+ **Event emitted**: `UserInvited`
534
+
535
+ ---
536
+
537
+ ### POST `/api/acceptinvite`
538
+ **Body**: `{ userId: string, groupId: string, invitationId: string }`
539
+ **Event emitted**: `InvitationAccepted`
540
+
541
+ ---
542
+
543
+ ### POST `/api/assignrole`
544
+ **Body**: `{ userId: string, groupId: string, role: string }`
545
+ **Event emitted**: `RoleAssigned`
546
+
547
+ ---
548
+
549
+ ## 12. User Management — Read Models (Projections)
550
+
551
+ All require authentication. Optional query param `_id` to filter by ID.
552
+
553
+ ### GET `/api/query/group-details-lookup`
554
+ Group details. Filter: `?_id=groupId`
555
+
556
+ ### GET `/api/query/open-invites`
557
+ Pending invitations. Filter: `?_id=invitationId`
558
+
559
+ ### GET `/api/query/user-group-assignments`
560
+ User-to-group mappings. Filter: `?_id=groupId`
561
+
562
+ ### GET `/api/query/users-to-assign-to-groups`
563
+ Users available for group assignment. Filter: `?_id=userId`
564
+
565
+ ---
566
+
567
+ ## 13. Utility
568
+
569
+ ### GET `/api/user`
570
+ Get current authenticated user info.
571
+
572
+ **Response**: `{ user_id: string, email: string, metadata: object }`
573
+
574
+ ### GET `/api-docs`
575
+ Swagger UI (interactive API explorer)
576
+
577
+ ### GET `/swagger.json`
578
+ OpenAPI specification (JSON)
579
+
580
+ ---
581
+
582
+ ## Domain Events
583
+
584
+ ### Snapshot Events (`src/events/SnapshotsEvents.ts`)
585
+
586
+ ```typescript
587
+ SnapshotStored // { name, id, payloadId, expiry }
588
+ SnapshotDeleted // { id }
589
+ SnapshotCleanedUp // { id }
590
+ PublishedSnapshotDeleted // { id }
591
+ SnapshotShared // { id }
592
+ SnapshotPublished // { id, payloadId, bucket, path }
593
+ ```
594
+
595
+ ### User Management Events (`src/events/UserManagementEvents.ts`)
596
+
597
+ ```typescript
598
+ GroupCreated // { groupId, owner, name }
599
+ UserAssignedToGroup // { groupId, userId }
600
+ UserInvited // { groupId, invitationId, email }
601
+ InvitationAccepted // { invitationId, groupId, userId }
602
+ RoleAssigned // { groupId, userId, role }
603
+ ```
604
+
605
+ All events support optional metadata: `user_id`, `correlation_id`, `causation_id`
606
+
607
+ ---
608
+
609
+ ## Key Source Files
610
+
611
+ | File | Purpose |
612
+ |---|---|
613
+ | `src/slices/change/types.ts` | `ElementType`, `NodeChangeEvent`, `EdgeEvent` |
614
+ | `src/slices/change/api-boards/routes.ts` | Board CRUD + event persistence |
615
+ | `src/slices/change/api-chapters/routes.ts` | Chapters, columns, lanes, cell drops |
616
+ | `src/slices/change/api-nodes/routes.ts` | Node event sourcing |
617
+ | `src/slices/change/api-images/routes.ts` | Image upload + sketch rendering |
618
+ | `src/slices/change/api-.slices/routes.ts` | Slice creation + slice definitions (SLICE_BORDER) |
619
+ | `src/slices/extensions/supabase/slices/CreateSliceDefinition.ts` | Slice definition (SLICE_BORDER) creation logic |
620
+ | `src/slices/change/api-specs/routes.ts` | GWT scenario management |
621
+ | `src/slices/change/config-import/routes.ts` | Config import |
622
+ | `src/slices/slicedata/routes.ts` | Slice data read models |
623
+ | `src/slices/extensions/routes.ts` | Extension management |
624
+ | `src/slices/Snapshots/routes.ts` | Snapshot CRUD |
625
+ | `src/slices/usermanagement/*/routes*.ts` | User management commands + projections |
626
+ | `src/events/SnapshotsEvents.ts` | Snapshot domain events |
627
+ | `src/events/UserManagementEvents.ts` | User management domain events |
628
+ | `backend/src/server.ts` | Route wiring, CORS, `/api/user` |