@cyberismo/backend 1.2.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 (468) hide show
  1. package/dist/app.d.ts +5 -15
  2. package/dist/app.js +28 -38
  3. package/dist/app.js.map +1 -1
  4. package/dist/auth/index.d.ts +0 -12
  5. package/dist/auth/index.js +2 -12
  6. package/dist/auth/index.js.map +1 -1
  7. package/dist/auth/keycloak.d.ts +0 -12
  8. package/dist/auth/keycloak.js +2 -12
  9. package/dist/auth/keycloak.js.map +1 -1
  10. package/dist/auth/mock.d.ts +0 -12
  11. package/dist/auth/mock.js +2 -12
  12. package/dist/auth/mock.js.map +1 -1
  13. package/dist/auth/types.d.ts +0 -12
  14. package/dist/auth/types.js +2 -12
  15. package/dist/auth/types.js.map +1 -1
  16. package/dist/common/errors.d.ts +12 -0
  17. package/dist/common/errors.js +31 -0
  18. package/dist/common/errors.js.map +1 -0
  19. package/dist/common/validationSchemas.d.ts +0 -12
  20. package/dist/common/validationSchemas.js +2 -12
  21. package/dist/common/validationSchemas.js.map +1 -1
  22. package/dist/domain/auth/index.d.ts +0 -12
  23. package/dist/domain/auth/index.js +2 -12
  24. package/dist/domain/auth/index.js.map +1 -1
  25. package/dist/domain/calculations/index.d.ts +0 -12
  26. package/dist/domain/calculations/index.js +4 -14
  27. package/dist/domain/calculations/index.js.map +1 -1
  28. package/dist/domain/calculations/schema.d.ts +0 -12
  29. package/dist/domain/calculations/schema.js +2 -12
  30. package/dist/domain/calculations/schema.js.map +1 -1
  31. package/dist/domain/calculations/service.d.ts +2 -14
  32. package/dist/domain/calculations/service.js +7 -17
  33. package/dist/domain/calculations/service.js.map +1 -1
  34. package/dist/domain/cardTypes/index.d.ts +0 -12
  35. package/dist/domain/cardTypes/index.js +10 -20
  36. package/dist/domain/cardTypes/index.js.map +1 -1
  37. package/dist/domain/cardTypes/schema.d.ts +0 -12
  38. package/dist/domain/cardTypes/schema.js +2 -12
  39. package/dist/domain/cardTypes/schema.js.map +1 -1
  40. package/dist/domain/cardTypes/service.d.ts +4 -16
  41. package/dist/domain/cardTypes/service.js +17 -25
  42. package/dist/domain/cardTypes/service.js.map +1 -1
  43. package/dist/domain/cards/index.d.ts +0 -12
  44. package/dist/domain/cards/index.js +120 -102
  45. package/dist/domain/cards/index.js.map +1 -1
  46. package/dist/domain/cards/lib.d.ts +6 -23
  47. package/dist/domain/cards/lib.js +7 -126
  48. package/dist/domain/cards/lib.js.map +1 -1
  49. package/dist/domain/cards/mermaid.d.ts +8 -0
  50. package/dist/domain/cards/mermaid.js +23 -0
  51. package/dist/domain/cards/mermaid.js.map +1 -0
  52. package/dist/domain/cards/schema.d.ts +6 -12
  53. package/dist/domain/cards/schema.js +6 -12
  54. package/dist/domain/cards/schema.js.map +1 -1
  55. package/dist/domain/cards/service.d.ts +28 -32
  56. package/dist/domain/cards/service.js +119 -83
  57. package/dist/domain/cards/service.js.map +1 -1
  58. package/dist/domain/connectors/index.d.ts +0 -12
  59. package/dist/domain/connectors/index.js +4 -14
  60. package/dist/domain/connectors/index.js.map +1 -1
  61. package/dist/domain/connectors/service.d.ts +2 -14
  62. package/dist/domain/connectors/service.js +4 -14
  63. package/dist/domain/connectors/service.js.map +1 -1
  64. package/dist/domain/events/events-by-project.d.ts +19 -0
  65. package/dist/domain/events/events-by-project.js +57 -0
  66. package/dist/domain/events/events-by-project.js.map +1 -0
  67. package/dist/domain/events/index.d.ts +0 -12
  68. package/dist/domain/events/index.js +3 -13
  69. package/dist/domain/events/index.js.map +1 -1
  70. package/dist/domain/events/lifetime.d.ts +0 -12
  71. package/dist/domain/events/lifetime.js +2 -12
  72. package/dist/domain/events/lifetime.js.map +1 -1
  73. package/dist/domain/events/project-events.d.ts +10 -14
  74. package/dist/domain/events/project-events.js +22 -18
  75. package/dist/domain/events/project-events.js.map +1 -1
  76. package/dist/domain/events/schema.d.ts +0 -12
  77. package/dist/domain/events/schema.js +2 -12
  78. package/dist/domain/events/schema.js.map +1 -1
  79. package/dist/domain/fieldTypes/index.d.ts +0 -12
  80. package/dist/domain/fieldTypes/index.js +6 -16
  81. package/dist/domain/fieldTypes/index.js.map +1 -1
  82. package/dist/domain/fieldTypes/schema.d.ts +0 -12
  83. package/dist/domain/fieldTypes/schema.js +2 -12
  84. package/dist/domain/fieldTypes/schema.js.map +1 -1
  85. package/dist/domain/fieldTypes/service.d.ts +4 -16
  86. package/dist/domain/fieldTypes/service.js +7 -17
  87. package/dist/domain/fieldTypes/service.js.map +1 -1
  88. package/dist/domain/graphModels/index.d.ts +0 -12
  89. package/dist/domain/graphModels/index.js +4 -14
  90. package/dist/domain/graphModels/index.js.map +1 -1
  91. package/dist/domain/graphModels/schema.d.ts +0 -12
  92. package/dist/domain/graphModels/schema.js +2 -12
  93. package/dist/domain/graphModels/schema.js.map +1 -1
  94. package/dist/domain/graphModels/service.d.ts +2 -14
  95. package/dist/domain/graphModels/service.js +4 -14
  96. package/dist/domain/graphModels/service.js.map +1 -1
  97. package/dist/domain/graphViews/index.d.ts +0 -12
  98. package/dist/domain/graphViews/index.js +4 -14
  99. package/dist/domain/graphViews/index.js.map +1 -1
  100. package/dist/domain/graphViews/schema.js +2 -0
  101. package/dist/domain/graphViews/schema.js.map +1 -1
  102. package/dist/domain/graphViews/service.d.ts +2 -14
  103. package/dist/domain/graphViews/service.js +4 -14
  104. package/dist/domain/graphViews/service.js.map +1 -1
  105. package/dist/domain/labels/index.d.ts +0 -12
  106. package/dist/domain/labels/index.js +4 -14
  107. package/dist/domain/labels/index.js.map +1 -1
  108. package/dist/domain/labels/service.d.ts +3 -15
  109. package/dist/domain/labels/service.js +5 -15
  110. package/dist/domain/labels/service.js.map +1 -1
  111. package/dist/domain/linkTypes/index.d.ts +0 -12
  112. package/dist/domain/linkTypes/index.js +6 -16
  113. package/dist/domain/linkTypes/index.js.map +1 -1
  114. package/dist/domain/linkTypes/schema.d.ts +0 -12
  115. package/dist/domain/linkTypes/schema.js +2 -12
  116. package/dist/domain/linkTypes/schema.js.map +1 -1
  117. package/dist/domain/linkTypes/service.d.ts +3 -15
  118. package/dist/domain/linkTypes/service.js +7 -17
  119. package/dist/domain/linkTypes/service.js.map +1 -1
  120. package/dist/domain/logicPrograms/index.d.ts +0 -12
  121. package/dist/domain/logicPrograms/index.js +4 -14
  122. package/dist/domain/logicPrograms/index.js.map +1 -1
  123. package/dist/domain/logicPrograms/service.d.ts +2 -14
  124. package/dist/domain/logicPrograms/service.js +5 -3
  125. package/dist/domain/logicPrograms/service.js.map +1 -1
  126. package/dist/domain/mcp/index.d.ts +3 -15
  127. package/dist/domain/mcp/index.js +27 -21
  128. package/dist/domain/mcp/index.js.map +1 -1
  129. package/dist/domain/project/index.d.ts +0 -12
  130. package/dist/domain/project/index.js +30 -40
  131. package/dist/domain/project/index.js.map +1 -1
  132. package/dist/domain/project/schema.d.ts +0 -12
  133. package/dist/domain/project/schema.js +2 -12
  134. package/dist/domain/project/schema.js.map +1 -1
  135. package/dist/domain/project/service.d.ts +16 -28
  136. package/dist/domain/project/service.js +48 -58
  137. package/dist/domain/project/service.js.map +1 -1
  138. package/dist/domain/projects/index.d.ts +2 -14
  139. package/dist/domain/projects/index.js +19 -36
  140. package/dist/domain/projects/index.js.map +1 -1
  141. package/dist/domain/projects/schema.d.ts +1 -12
  142. package/dist/domain/projects/schema.js +3 -12
  143. package/dist/domain/projects/schema.js.map +1 -1
  144. package/dist/domain/projects/service.d.ts +9 -35
  145. package/dist/domain/projects/service.js +12 -48
  146. package/dist/domain/projects/service.js.map +1 -1
  147. package/dist/domain/reports/index.d.ts +0 -12
  148. package/dist/domain/reports/index.js +4 -14
  149. package/dist/domain/reports/index.js.map +1 -1
  150. package/dist/domain/reports/schema.d.ts +0 -12
  151. package/dist/domain/reports/schema.js +2 -12
  152. package/dist/domain/reports/schema.js.map +1 -1
  153. package/dist/domain/reports/service.d.ts +2 -14
  154. package/dist/domain/reports/service.js +4 -14
  155. package/dist/domain/reports/service.js.map +1 -1
  156. package/dist/domain/resources/index.d.ts +0 -12
  157. package/dist/domain/resources/index.js +19 -26
  158. package/dist/domain/resources/index.js.map +1 -1
  159. package/dist/domain/resources/schema.js +2 -0
  160. package/dist/domain/resources/schema.js.map +1 -1
  161. package/dist/domain/resources/service.d.ts +11 -23
  162. package/dist/domain/resources/service.js +48 -59
  163. package/dist/domain/resources/service.js.map +1 -1
  164. package/dist/domain/skills/index.d.ts +0 -12
  165. package/dist/domain/skills/index.js +4 -14
  166. package/dist/domain/skills/index.js.map +1 -1
  167. package/dist/domain/skills/schema.d.ts +0 -12
  168. package/dist/domain/skills/schema.js +2 -12
  169. package/dist/domain/skills/schema.js.map +1 -1
  170. package/dist/domain/skills/service.d.ts +2 -14
  171. package/dist/domain/skills/service.js +4 -14
  172. package/dist/domain/skills/service.js.map +1 -1
  173. package/dist/domain/templates/index.d.ts +0 -12
  174. package/dist/domain/templates/index.js +8 -18
  175. package/dist/domain/templates/index.js.map +1 -1
  176. package/dist/domain/templates/schema.d.ts +0 -12
  177. package/dist/domain/templates/schema.js +2 -12
  178. package/dist/domain/templates/schema.js.map +1 -1
  179. package/dist/domain/templates/service.d.ts +4 -16
  180. package/dist/domain/templates/service.js +8 -18
  181. package/dist/domain/templates/service.js.map +1 -1
  182. package/dist/domain/tree/index.d.ts +0 -12
  183. package/dist/domain/tree/index.js +4 -14
  184. package/dist/domain/tree/index.js.map +1 -1
  185. package/dist/domain/tree/service.d.ts +3 -15
  186. package/dist/domain/tree/service.js +8 -15
  187. package/dist/domain/tree/service.js.map +1 -1
  188. package/dist/domain/workflows/index.d.ts +0 -12
  189. package/dist/domain/workflows/index.js +4 -14
  190. package/dist/domain/workflows/index.js.map +1 -1
  191. package/dist/domain/workflows/schema.d.ts +0 -12
  192. package/dist/domain/workflows/schema.js +2 -12
  193. package/dist/domain/workflows/schema.js.map +1 -1
  194. package/dist/domain/workflows/service.d.ts +2 -14
  195. package/dist/domain/workflows/service.js +4 -14
  196. package/dist/domain/workflows/service.js.map +1 -1
  197. package/dist/export.d.ts +6 -20
  198. package/dist/export.js +19 -29
  199. package/dist/export.js.map +1 -1
  200. package/dist/index.d.ts +3 -5
  201. package/dist/index.js +19 -43
  202. package/dist/index.js.map +1 -1
  203. package/dist/main.js +19 -30
  204. package/dist/main.js.map +1 -1
  205. package/dist/middleware/auth.d.ts +0 -12
  206. package/dist/middleware/auth.js +2 -12
  207. package/dist/middleware/auth.js.map +1 -1
  208. package/dist/middleware/commandManager.d.ts +15 -20
  209. package/dist/middleware/commandManager.js +27 -36
  210. package/dist/middleware/commandManager.js.map +1 -1
  211. package/dist/middleware/tree.js +2 -0
  212. package/dist/middleware/tree.js.map +1 -1
  213. package/dist/middleware/zvalidator.js +2 -0
  214. package/dist/middleware/zvalidator.js.map +1 -1
  215. package/dist/overlay.d.ts +4 -16
  216. package/dist/overlay.js +22 -17
  217. package/dist/overlay.js.map +1 -1
  218. package/dist/public/THIRD-PARTY.txt +1397 -286
  219. package/dist/public/assets/__vite-browser-external-DGgK3jMU.js +1 -0
  220. package/dist/public/assets/abnfDiagram-WEYOIA3C-B3qq7PKv.js +1 -0
  221. package/dist/public/assets/architecture-WOLXFQ4H-Bzau2LI0.js +1 -0
  222. package/dist/public/assets/architectureDiagram-ZHVYKT53-Bg0cUwdb.js +36 -0
  223. package/dist/public/assets/blockDiagram-RJAE7QA3-0RJB-ra-.js +140 -0
  224. package/dist/public/assets/c4Diagram-XDPPPE54-BzoQcLvf.js +38 -0
  225. package/dist/public/assets/channel-6BNdw4Ax.js +1 -0
  226. package/dist/public/assets/{chunk-SVP7TREG-CIQMl7hl.js → chunk-2E7WHVMD-6aqPk-Hk.js} +4 -4
  227. package/dist/public/assets/chunk-4EMNKR2T-vovNSAaE.js +1 -0
  228. package/dist/public/assets/{chunk-F27PBJKO-tDfs6zeO.js → chunk-55XCU76K-DXkKnt2y.js} +1 -1
  229. package/dist/public/assets/chunk-7S6XSTFO-B9bfO0l3.js +2 -0
  230. package/dist/public/assets/chunk-AQDTSKZB-ilLy_cYP.js +72 -0
  231. package/dist/public/assets/chunk-DSNLSHJZ-DAudglXu.js +129 -0
  232. package/dist/public/assets/chunk-DUW6YSOI-Dgx8z5s3.js +1 -0
  233. package/dist/public/assets/chunk-HAGFOTED-CSKFgs6b.js +62 -0
  234. package/dist/public/assets/chunk-HNE4Q36P-Cu5gPBVk.js +1 -0
  235. package/dist/public/assets/chunk-J5ZVWO5B-oDCd-gWO.js +1 -0
  236. package/dist/public/assets/chunk-NGNAAXSQ-DI_UYJZ4.js +136 -0
  237. package/dist/public/assets/chunk-NQOKRVIF-Bpcvhq1n.js +213 -0
  238. package/dist/public/assets/chunk-UHW7PFBP-BDjvOaTH.js +1 -0
  239. package/dist/public/assets/chunk-VQ5W62QI-DHTcO93W.js +1 -0
  240. package/dist/public/assets/chunk-WQQL4CDK-H6nAhuck.js +10 -0
  241. package/dist/public/assets/{chunk-XXDRQBXY-B7bWyHjt.js → chunk-XXDRQBXY-BUghdEVl.js} +1 -1
  242. package/dist/public/assets/chunk-YZO67HFG-D13E0_Yh.js +1 -0
  243. package/dist/public/assets/chunk-ZAUX2LTX-Dp5y-2wt.js +1 -0
  244. package/dist/public/assets/chunk-ZCHMQSOR-RJjlln1D.js +2 -0
  245. package/dist/public/assets/classDiagram-v2-4MYWR3UA-CAqiFCSv.js +217 -0
  246. package/dist/public/assets/cose-bilkent-JH36ORCC-C_VOHzoP.js +1 -0
  247. package/dist/public/assets/cynefin-EF2NZ3EQ-Dyk4ZPjK.js +1 -0
  248. package/dist/public/assets/{cynefinDiagram-5FMLGOSQ-_V_nrIhD.js → cynefinDiagram-WF24UDRP-b_Ia8gQX.js} +1 -1
  249. package/dist/public/assets/cytoscape.esm-GRKmfDkD.js +321 -0
  250. package/dist/public/assets/dagre-NK4GIZVX-CH1K1yF8.js +4 -0
  251. package/dist/public/assets/{diagram-VX7I27RA-De_UQv8C.js → diagram-CBK3MWTC-OaKd5avy.js} +13 -13
  252. package/dist/public/assets/diagram-I5XIIV2D-Cmu5z1ad.js +24 -0
  253. package/dist/public/assets/{diagram-S7CK7UJ4-25IjIKyo.js → diagram-ODIL2UCW-Cz1kkDDX.js} +7 -7
  254. package/dist/public/assets/diagram-PFBEJUXE-faMkmqUW.js +3 -0
  255. package/dist/public/assets/{diagram-UQ7AKVKN-C5VvsV7x.js → diagram-RJA3I4VV-nycvfte-.js} +2 -2
  256. package/dist/public/assets/diagram-TYUNFSNR-CjEv5QCm.js +200 -0
  257. package/dist/public/assets/{dist-BDCdLWk4.js → dist-DGs_yUrP.js} +1 -1
  258. package/dist/public/assets/ebnfDiagram-V4P3TTPT-DN-IIxCy.js +1 -0
  259. package/dist/public/assets/elk-QONTBCTQ-Bsam88GP.js +27 -0
  260. package/dist/public/assets/erDiagram-KYQIGQAA-DEU_qqNK.js +99 -0
  261. package/dist/public/assets/eventmodeling-K75KTNOO-Bl6NCM9E.js +1 -0
  262. package/dist/public/assets/flowDiagram-IUGLLWBU-Cl4qZ-36.js +1 -0
  263. package/dist/public/assets/ganttDiagram-R7GPNTJY-BmMd4aGi.js +292 -0
  264. package/dist/public/assets/gitGraph-VSP46ZUC-Q0H2PWek.js +1 -0
  265. package/dist/public/assets/gitGraphDiagram-PDYL7XHY-BlCTBYTj.js +106 -0
  266. package/dist/public/assets/index-CuBJ0hof.css +1 -0
  267. package/dist/public/assets/index-D701BZPh.js +2219 -0
  268. package/dist/public/assets/info-OHQRW6UA-D0TMPJxW.js +1 -0
  269. package/dist/public/assets/infoDiagram-MVDRKAX5-CljbtJXu.js +2 -0
  270. package/dist/public/assets/{ishikawaDiagram-5VMMS53U-KvT4DU1u.js → ishikawaDiagram-HPEHV2GE-_Y3Fr0hu.js} +6 -6
  271. package/dist/public/assets/{journeyDiagram-3NMN7TZE-PhGRkXkq.js → journeyDiagram-BOSHW7O7-Bo55jJ4m.js} +39 -39
  272. package/dist/public/assets/kanban-definition-FNSA4HC5-Cd-10MtF.js +89 -0
  273. package/dist/public/assets/katex-MEuSR36T.js +257 -0
  274. package/dist/public/assets/line-BDmh4sWC.js +1 -0
  275. package/dist/public/assets/linear-Dt7xjMrI.js +1 -0
  276. package/dist/public/assets/mermaid-parser.core-BJ1yyzvV.js +7 -0
  277. package/dist/public/assets/mindmap-definition-6OY57UG3-CRgumPuN.js +98 -0
  278. package/dist/public/assets/packet-JDAUHWVQ-DsTMT3Kw.js +1 -0
  279. package/dist/public/assets/pegDiagram-ECIUJNBX-BEGI5k3m.js +1 -0
  280. package/dist/public/assets/pie-XZMESJXO-COyqzA3N.js +1 -0
  281. package/dist/public/assets/pieDiagram-GNMPY74T-CrLJhZJJ.js +39 -0
  282. package/dist/public/assets/{quadrantDiagram-AXDQQJYC-B9dlNtZl.js → quadrantDiagram-D57K4MC3-Fl7HMHxK.js} +6 -6
  283. package/dist/public/assets/radar-ABXABTNO-DeXHKowk.js +1 -0
  284. package/dist/public/assets/railroad-I3PHUGI6-CUjKUdPz.js +1 -0
  285. package/dist/public/assets/railroad-abnf-LNEFI6M7-B1aEgHE6.js +1 -0
  286. package/dist/public/assets/railroad-ebnf-DWYD2UWJ-DmmI3Voz.js +1 -0
  287. package/dist/public/assets/railroad-peg-JR7BVNR7-BHzi9m7r.js +1 -0
  288. package/dist/public/assets/railroadDiagram-Y72NRBL7-D1oeE5fy.js +1 -0
  289. package/dist/public/assets/requirementDiagram-EQYSW5RA-BJDKK1aS.js +84 -0
  290. package/dist/public/assets/rolldown-runtime-BCiCTKAo.js +1 -0
  291. package/dist/public/assets/{sankeyDiagram-P5KCCOFB-C4rb2pZ9.js → sankeyDiagram-SY24JHO5-C4g0OwZ9.js} +7 -7
  292. package/dist/public/assets/sequenceDiagram-BLEHNHQU-CEvy4P-b.js +169 -0
  293. package/dist/public/assets/src-MPsEqXxq.js +1 -0
  294. package/dist/public/assets/stateDiagram-v2-A6IESKWZ-BFhvw4Gl.js +291 -0
  295. package/dist/public/assets/swimlanes-B3ENRKFQ-BIl_Q-FM.js +1 -0
  296. package/dist/public/assets/swimlanesDiagram-AYQRV4AK-rvDbKEHQ.js +8 -0
  297. package/dist/public/assets/timeline-definition-JXYKGLGB-qAoWTH4N.js +120 -0
  298. package/dist/public/assets/treeView-D4JQ5SDB-vq16JKkJ.js +1 -0
  299. package/dist/public/assets/treemap-SAJKECNS-C0IZTaDk.js +1 -0
  300. package/dist/public/assets/usecaseDiagram-WPOLBNNX-Dq8iz49r.js +328 -0
  301. package/dist/public/assets/vennDiagram-Q3Y3IDCW-Br4JmRjM.js +34 -0
  302. package/dist/public/assets/wardley-7MLQ67FV-CEPlAQ79.js +1 -0
  303. package/dist/public/assets/{wardleyDiagram-VM6X3IG4-BOXpwLCv.js → wardleyDiagram-IVAIDKWA-DURB7Ue6.js} +4 -4
  304. package/dist/public/assets/xychartDiagram-4URNHDU4-BiZywfhy.js +7 -0
  305. package/dist/public/index.html +27 -21
  306. package/dist/public/sbom.cdx.json +1 -1
  307. package/dist/types.d.ts +0 -12
  308. package/dist/types.js +2 -12
  309. package/dist/types.js.map +1 -1
  310. package/dist/utils.d.ts +12 -5
  311. package/dist/utils.js +18 -43
  312. package/dist/utils.js.map +1 -1
  313. package/package.json +13 -12
  314. package/src/app.ts +33 -43
  315. package/src/auth/index.ts +2 -12
  316. package/src/auth/keycloak.ts +2 -12
  317. package/src/auth/mock.ts +2 -12
  318. package/src/auth/types.ts +2 -12
  319. package/src/common/errors.ts +45 -0
  320. package/src/common/validationSchemas.ts +3 -12
  321. package/src/domain/auth/index.ts +2 -12
  322. package/src/domain/calculations/index.ts +4 -14
  323. package/src/domain/calculations/schema.ts +2 -12
  324. package/src/domain/calculations/service.ts +8 -21
  325. package/src/domain/cardTypes/index.ts +10 -20
  326. package/src/domain/cardTypes/schema.ts +3 -12
  327. package/src/domain/cardTypes/service.ts +22 -29
  328. package/src/domain/cards/index.ts +158 -128
  329. package/src/domain/cards/lib.ts +9 -161
  330. package/src/domain/cards/mermaid.ts +25 -0
  331. package/src/domain/cards/schema.ts +8 -12
  332. package/src/domain/cards/service.ts +165 -118
  333. package/src/domain/connectors/index.ts +5 -14
  334. package/src/domain/connectors/service.ts +5 -20
  335. package/src/domain/events/events-by-project.ts +59 -0
  336. package/src/domain/events/index.ts +3 -13
  337. package/src/domain/events/lifetime.ts +2 -12
  338. package/src/domain/events/project-events.ts +30 -18
  339. package/src/domain/events/schema.ts +2 -12
  340. package/src/domain/fieldTypes/index.ts +6 -16
  341. package/src/domain/fieldTypes/schema.ts +3 -12
  342. package/src/domain/fieldTypes/service.ts +9 -21
  343. package/src/domain/graphModels/index.ts +4 -14
  344. package/src/domain/graphModels/schema.ts +3 -12
  345. package/src/domain/graphModels/service.ts +5 -18
  346. package/src/domain/graphViews/index.ts +4 -14
  347. package/src/domain/graphViews/schema.ts +3 -0
  348. package/src/domain/graphViews/service.ts +5 -18
  349. package/src/domain/labels/index.ts +4 -14
  350. package/src/domain/labels/service.ts +6 -16
  351. package/src/domain/linkTypes/index.ts +6 -16
  352. package/src/domain/linkTypes/schema.ts +2 -12
  353. package/src/domain/linkTypes/service.ts +8 -21
  354. package/src/domain/logicPrograms/index.ts +5 -17
  355. package/src/domain/logicPrograms/service.ts +7 -16
  356. package/src/domain/mcp/index.ts +33 -24
  357. package/src/domain/project/index.ts +34 -40
  358. package/src/domain/project/schema.ts +2 -12
  359. package/src/domain/project/service.ts +56 -71
  360. package/src/domain/projects/index.ts +34 -50
  361. package/src/domain/projects/schema.ts +3 -12
  362. package/src/domain/projects/service.ts +18 -88
  363. package/src/domain/reports/index.ts +4 -14
  364. package/src/domain/reports/schema.ts +2 -12
  365. package/src/domain/reports/service.ts +5 -18
  366. package/src/domain/resources/index.ts +19 -30
  367. package/src/domain/resources/schema.ts +3 -0
  368. package/src/domain/resources/service.ts +55 -90
  369. package/src/domain/skills/index.ts +4 -14
  370. package/src/domain/skills/schema.ts +2 -12
  371. package/src/domain/skills/service.ts +5 -15
  372. package/src/domain/templates/index.ts +8 -18
  373. package/src/domain/templates/schema.ts +2 -12
  374. package/src/domain/templates/service.ts +9 -22
  375. package/src/domain/tree/index.ts +4 -14
  376. package/src/domain/tree/service.ts +10 -21
  377. package/src/domain/workflows/index.ts +4 -14
  378. package/src/domain/workflows/schema.ts +2 -12
  379. package/src/domain/workflows/service.ts +5 -18
  380. package/src/export.ts +24 -33
  381. package/src/index.ts +29 -48
  382. package/src/main.ts +25 -35
  383. package/src/middleware/auth.ts +2 -12
  384. package/src/middleware/commandManager.ts +35 -50
  385. package/src/middleware/tree.ts +3 -0
  386. package/src/middleware/zvalidator.ts +3 -0
  387. package/src/overlay.ts +29 -19
  388. package/src/types.ts +2 -12
  389. package/src/utils.ts +26 -46
  390. package/dist/project-errors.d.ts +0 -18
  391. package/dist/project-errors.js +0 -25
  392. package/dist/project-errors.js.map +0 -1
  393. package/dist/project-registry.d.ts +0 -65
  394. package/dist/project-registry.js +0 -121
  395. package/dist/project-registry.js.map +0 -1
  396. package/dist/public/assets/__vite-browser-external-PaJ7c2l8.js +0 -1
  397. package/dist/public/assets/abnfDiagram-VCTEODGH-DB2dfOGe.js +0 -1
  398. package/dist/public/assets/architecture-7GRP2DOG-2V0X8hxt.js +0 -1
  399. package/dist/public/assets/architectureDiagram-5GKGNRK7-CRhUR2Ul.js +0 -36
  400. package/dist/public/assets/blockDiagram-I7D4REHJ-DJKsYF1v.js +0 -129
  401. package/dist/public/assets/c4Diagram-7LVT6UL2-BTwMzoAF.js +0 -38
  402. package/dist/public/assets/channel-C0JtPpMA.js +0 -1
  403. package/dist/public/assets/chunk-4HAMMTFA-DjjgrBsB.js +0 -62
  404. package/dist/public/assets/chunk-75Z2AOVW-CKqXRGJV.js +0 -2
  405. package/dist/public/assets/chunk-DU6HZSFF-iJGdiRt7.js +0 -127
  406. package/dist/public/assets/chunk-FOHPRMQF-DzxwRta7.js +0 -161
  407. package/dist/public/assets/chunk-GMAD6QVW-DxHVEaGj.js +0 -72
  408. package/dist/public/assets/chunk-GVQU2GXP-AMxD4_Ta.js +0 -1
  409. package/dist/public/assets/chunk-IMKFNOWR-0rz8QrYC.js +0 -231
  410. package/dist/public/assets/chunk-L3NEJ4N5-BK3KAKMe.js +0 -1
  411. package/dist/public/assets/chunk-OSK3NFVY-B8MdrI_M.js +0 -10
  412. package/dist/public/assets/chunk-P2QGCYS3-D3J5AcHg.js +0 -1
  413. package/dist/public/assets/chunk-POPQ4Y6H-CsYg_XkK.js +0 -1
  414. package/dist/public/assets/chunk-PWAF6VOD-D9cdEIZp.js +0 -1
  415. package/dist/public/assets/chunk-SHT3W25Y-1jjokCf3.js +0 -168
  416. package/dist/public/assets/chunk-TICWLB2K-Ccsy2PYz.js +0 -206
  417. package/dist/public/assets/classDiagram-ZZMXUADV-mWyXNAXi.js +0 -1
  418. package/dist/public/assets/classDiagram-v2-VYDZK3BY-mWyXNAXi.js +0 -1
  419. package/dist/public/assets/cose-bilkent-JH36ORCC-DPzc3Pv4.js +0 -1
  420. package/dist/public/assets/cynefin-OW5HDTMX-BIVDCYOU.js +0 -1
  421. package/dist/public/assets/cytoscape.esm-NgwPT4ez.js +0 -321
  422. package/dist/public/assets/dagre-C-rnJpZF.js +0 -1
  423. package/dist/public/assets/dagre-GXQ25YYZ-CJc0wc6f.js +0 -4
  424. package/dist/public/assets/diagram-VSXAHHWV-Dw3rKVL_.js +0 -3
  425. package/dist/public/assets/diagram-Z3DM3KII-Bd-65QQW.js +0 -24
  426. package/dist/public/assets/ebnfDiagram-PWID7BFC-CrxdET5U.js +0 -1
  427. package/dist/public/assets/erDiagram-RLTQ6QDP-BKo0Uyna.js +0 -99
  428. package/dist/public/assets/eventmodeling-NTZA5JFV-DKkAdJZd.js +0 -1
  429. package/dist/public/assets/flowDiagram-HODETNUW-CEE2wjdt.js +0 -1
  430. package/dist/public/assets/ganttDiagram-EL5Y4UJY-BHFn8vk0.js +0 -292
  431. package/dist/public/assets/gitGraph-4MIJSDKK-Bpvnb45u.js +0 -1
  432. package/dist/public/assets/gitGraphDiagram-WWUBYQGX-Bw0EoxBY.js +0 -106
  433. package/dist/public/assets/index-D3HS7YxF.js +0 -2228
  434. package/dist/public/assets/index-Sv3WxZ_8.css +0 -1
  435. package/dist/public/assets/info-A6RAGUB7-BvvG_zrk.js +0 -1
  436. package/dist/public/assets/infoDiagram-27XIBGKW-CtpdJmtL.js +0 -2
  437. package/dist/public/assets/kanban-definition-UXKFOSKX-Oyx5QgRq.js +0 -89
  438. package/dist/public/assets/katex-ZlcWpGUi.js +0 -257
  439. package/dist/public/assets/line-Dr41HTk1.js +0 -1
  440. package/dist/public/assets/linear-DDBi9FwZ.js +0 -1
  441. package/dist/public/assets/mermaid-parser.core-DsIAxDBa.js +0 -7
  442. package/dist/public/assets/mindmap-definition-YA3MSWOX-r8hvd6gP.js +0 -96
  443. package/dist/public/assets/packet-AYTQ26CC-B0EpJ2Sc.js +0 -1
  444. package/dist/public/assets/pegDiagram-XKGWAZYB-DaNkQTQF.js +0 -1
  445. package/dist/public/assets/pie-WAS4IAKB-Dt2zttL9.js +0 -1
  446. package/dist/public/assets/pieDiagram-E7YTZNPT-x0XWEGbd.js +0 -39
  447. package/dist/public/assets/radar-RG4KPBEZ-DjbR4-5l.js +0 -1
  448. package/dist/public/assets/railroad-74A4TZTK-Bk3B5r_R.js +0 -1
  449. package/dist/public/assets/railroad-abnf-HS5TGJTU-DxaWfACD.js +0 -1
  450. package/dist/public/assets/railroad-ebnf-LZEXJU2U-DscxXZO0.js +0 -1
  451. package/dist/public/assets/railroad-peg-WCYAUIDC-BCWzRFzw.js +0 -1
  452. package/dist/public/assets/railroadDiagram-O6MQD6OU-DhwsoX6A.js +0 -1
  453. package/dist/public/assets/requirementDiagram-BXWQKSXE-BiqZ6axf.js +0 -84
  454. package/dist/public/assets/rolldown-runtime-B0Z9INg1.js +0 -1
  455. package/dist/public/assets/sequenceDiagram-WJ2MYXX4-DRKTnGD7.js +0 -162
  456. package/dist/public/assets/src-an_qrnIj.js +0 -1
  457. package/dist/public/assets/stateDiagram-D77RDMKH-xxdybg5Z.js +0 -1
  458. package/dist/public/assets/stateDiagram-v2-MP3YSRHH-CXzmJy_a.js +0 -1
  459. package/dist/public/assets/swimlanes-42K2YHIH-DyGI1gI6.js +0 -1
  460. package/dist/public/assets/swimlanesDiagram-VR7AAH4N-7hqb6VoW.js +0 -8
  461. package/dist/public/assets/timeline-definition-24CTP7MA-C2pIp77Q.js +0 -120
  462. package/dist/public/assets/treeView-Q6P3EWNA-CxRtaaB8.js +0 -1
  463. package/dist/public/assets/treemap-WGGIJYW6-G1IHiwTa.js +0 -1
  464. package/dist/public/assets/vennDiagram-4TSXK5OY-CwimQRR9.js +0 -34
  465. package/dist/public/assets/wardley-WFR3VGLG-DkQ3TjZX.js +0 -1
  466. package/dist/public/assets/xychartDiagram-S5SC5T6Z-ChOPYsHc.js +0 -7
  467. package/src/project-errors.ts +0 -33
  468. package/src/project-registry.ts +0 -161
@@ -1,15 +1,5 @@
1
- /**
2
- Cyberismo
3
- Copyright © Cyberismo Ltd and contributors 2025
4
- This program is free software: you can redistribute it and/or modify it under
5
- the terms of the GNU Affero General Public License version 3 as published by
6
- the Free Software Foundation.
7
- This program is distributed in the hope that it will be useful, but WITHOUT
8
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
- details. You should have received a copy of the GNU Affero General Public
11
- License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
- */
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
13
3
 
14
4
  import { z } from 'zod';
15
5
  import { identifierSchema } from '../../common/validationSchemas.js';
@@ -1,21 +1,8 @@
1
- /**
2
- Cyberismo
3
- Copyright © Cyberismo Ltd and contributors 2025
4
- This program is free software: you can redistribute it and/or modify it under
5
- the terms of the GNU Affero General Public License version 3 as published by
6
- the Free Software Foundation.
7
- This program is distributed in the hope that it will be useful, but WITHOUT
8
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
- details. You should have received a copy of the GNU Affero General Public
11
- License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
- */
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
13
3
 
14
- import type { CommandManager } from '@cyberismo/data-handler';
4
+ import type { Workspace } from '@cyberismo/data-handler';
15
5
 
16
- export async function createWorkflow(
17
- commands: CommandManager,
18
- workflowName: string,
19
- ) {
20
- await commands.createCmd.createWorkflow(workflowName, '');
6
+ export async function createWorkflow(ws: Workspace, workflowName: string) {
7
+ await ws.resources.create(workflowName, 'workflows', {});
21
8
  }
package/src/export.ts CHANGED
@@ -1,32 +1,25 @@
1
- /**
2
- Cyberismo
3
- Copyright © Cyberismo Ltd and contributors 2025
4
- This program is free software: you can redistribute it and/or modify it under
5
- the terms of the GNU Affero General Public License version 3 as published by
6
- the Free Software Foundation.
7
- This program is distributed in the hope that it will be useful, but WITHOUT
8
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
- details. You should have received a copy of the GNU Affero General Public
11
- License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
- */
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
13
3
 
14
4
  import fs from 'node:fs/promises';
15
5
 
16
- import type { CommandManager } from '@cyberismo/data-handler';
6
+ import {
7
+ SYSTEM_ACTOR,
8
+ type ProjectDirectory,
9
+ type Workspace,
10
+ } from '@cyberismo/data-handler';
17
11
  import { createApp } from './app.js';
18
12
  import { MockAuthProvider } from './auth/mock.js';
19
- import type { ProjectRegistry } from './project-registry.js';
20
13
  import { cp } from 'node:fs/promises';
21
14
  import { staticFrontendDirRelative } from './utils.js';
22
- import type { QueryResult } from '@cyberismo/data-handler/types/queries';
15
+ import type { QueryResult, ProjectErrors } from '@cyberismo/model';
23
16
  import { toSSG } from 'hono/ssg';
24
17
  import type { TreeOptions } from './types.js';
25
- import type { ProjectErrors } from './project-errors.js';
26
18
  import {
27
19
  findAllCards,
28
20
  findRelevantAttachments,
29
21
  } from './domain/cards/service.js';
22
+ import { CARD_ROUTES_PER_KEY } from './domain/cards/lib.js';
30
23
 
31
24
  export interface ExportSiteOptions extends TreeOptions {
32
25
  defaultProject?: string;
@@ -48,19 +41,19 @@ export function reset() {
48
41
  /**
49
42
  * Get the card query result for a given card key. Should only be called during
50
43
  * static site generation
51
- * @param commands - CommandManager instance for the project.
44
+ * @param ws - Handle of the project.
52
45
  * @param cardKey - Key of the card to get the query result for.
53
46
  * @returns The card query result for the given card key.
54
47
  */
55
48
  export async function getCardQueryResult(
56
- commands: CommandManager,
49
+ ws: Workspace,
57
50
  cardKey?: string,
58
51
  ): Promise<QueryResult<'card'>[]> {
59
- const prefix = commands.project.configuration.cardKeyPrefix;
52
+ const prefix = ws.settings.prefix;
60
53
  if (!_cardQueryCache.has(prefix)) {
61
54
  _cardQueryCache.set(
62
55
  prefix,
63
- commands.calculateCmd.runQuery('card', 'exportedSite', {}),
56
+ ws.queries.runQuery('card', 'exportedSite', {}),
64
57
  );
65
58
  }
66
59
  return _cardQueryCache.get(prefix)!.then((results) => {
@@ -78,7 +71,7 @@ export async function getCardQueryResult(
78
71
  /**
79
72
  * Export the site to a given directory.
80
73
  * Note: Do not call this function in parallel.
81
- * @param registry - ProjectRegistry holding all project CommandManagers.
74
+ * @param directory - Directory the exported projects are opened from.
82
75
  * @param exportDir - Directory to export to.
83
76
  * @param options - Export options.
84
77
  * @param options.recursive - Whether to export cards recursively.
@@ -88,7 +81,7 @@ export async function getCardQueryResult(
88
81
  * @returns Errors that occurred during export, grouped by project.
89
82
  */
90
83
  export async function exportSite(
91
- registry: ProjectRegistry,
84
+ directory: ProjectDirectory,
92
85
  exportDir?: string,
93
86
  options?: ExportSiteOptions,
94
87
  onProgress?: (current: number, total: number) => void,
@@ -100,12 +93,10 @@ export async function exportSite(
100
93
  ...treeOpts,
101
94
  };
102
95
 
103
- if (defaultProject && !registry.has(defaultProject)) {
96
+ const prefixes = (await directory.list()).map((p) => p.prefix);
97
+ if (defaultProject && !prefixes.includes(defaultProject)) {
104
98
  throw new Error(
105
- `Default project '${defaultProject}' is not in the registry. Available: ${registry
106
- .list()
107
- .map((p) => p.prefix)
108
- .join(', ')}`,
99
+ `Default project '${defaultProject}' is not in the registry. Available: ${prefixes.join(', ')}`,
109
100
  );
110
101
  }
111
102
 
@@ -113,7 +104,7 @@ export async function exportSite(
113
104
  process.env.CYBERISMO_DEFAULT_PROJECT = defaultProject;
114
105
  }
115
106
 
116
- const app = createApp(new MockAuthProvider(), registry, opts, true);
107
+ const app = createApp(new MockAuthProvider(), directory, opts, prefixes);
117
108
 
118
109
  // copy whole frontend to the same directory
119
110
  await cp(staticFrontendDirRelative, exportDir, { recursive: true });
@@ -122,16 +113,16 @@ export async function exportSite(
122
113
 
123
114
  // estimate total based on the number of cards to export across all projects
124
115
  let total = OVERHEAD_CALLS;
125
- for (const commands of registry.values()) {
126
- const cards = await findAllCards(commands, opts);
127
- const attachments = await findRelevantAttachments(commands, opts);
128
- total += cards.length + attachments.length;
116
+ for (const prefix of prefixes) {
117
+ const ws = await directory.open(prefix, SYSTEM_ACTOR);
118
+ const cards = await findAllCards(ws, opts);
119
+ const attachments = await findRelevantAttachments(ws, opts);
120
+ total += cards.length * CARD_ROUTES_PER_KEY + attachments.length;
129
121
  }
130
122
 
131
123
  // One pass per project so an error is attributed to the project whose route
132
124
  // produced it (the response itself carries no project). Shared routes get
133
125
  // their own pass so each route is emitted exactly once.
134
- const prefixes = registry.list().map((p) => p.prefix);
135
126
  const projectOf = (pathname: string) =>
136
127
  prefixes.find((p) => {
137
128
  const base = `/api/projects/${p}`;
package/src/index.ts CHANGED
@@ -1,35 +1,23 @@
1
- /**
2
- Cyberismo
3
- Copyright © Cyberismo Ltd and contributors 2025
4
- This program is free software: you can redistribute it and/or modify it under
5
- the terms of the GNU Affero General Public License version 3 as published by
6
- the Free Software Foundation.
7
- This program is distributed in the hope that it will be useful, but WITHOUT
8
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
- details. You should have received a copy of the GNU Affero General Public
11
- License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
- */
13
- import { serve } from '@hono/node-server';
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
14
4
  import type { Env, Schema } from 'hono';
15
5
  import { Hono } from 'hono';
16
6
  import { serveStatic } from '@hono/node-server/serve-static';
17
7
  import path from 'node:path';
18
8
  import { readFile } from 'node:fs/promises';
19
- import { findFreePort } from './utils.js';
9
+ import { listen } from './utils.js';
20
10
  import { startPolicyPolling } from './overlay.js';
21
11
  import { createApp } from './app.js';
22
12
  import type { AuthProvider } from './auth/types.js';
23
- import type { ProjectRegistry } from './project-registry.js';
13
+ import type { ProjectDirectory } from '@cyberismo/data-handler';
24
14
  export { MockAuthProvider } from './auth/mock.js';
25
15
  export type { MockUserConfig } from './auth/mock.js';
26
16
  export type { AuthProvider } from './auth/types.js';
27
17
  export { exportSite, type ExportSiteOptions } from './export.js';
28
- export { ProjectRegistry } from './project-registry.js';
29
- export { formatProjectErrors, type ProjectErrors } from './project-errors.js';
30
18
 
31
19
  const DEFAULT_PORT = 3000;
32
- const DEFAULT_MAX_PORT = DEFAULT_PORT + 100;
20
+ const MAX_PORT_ATTEMPTS = 100;
33
21
 
34
22
  /**
35
23
  * Preview the exported site
@@ -47,60 +35,53 @@ export async function previewSite(dir: string, findPort: boolean = true) {
47
35
  return c.html(file.toString());
48
36
  });
49
37
 
50
- let port = parseInt(process.env.PORT || DEFAULT_PORT.toString(), 10);
51
-
52
- if (findPort) {
53
- port = await findFreePort(port, DEFAULT_MAX_PORT);
54
- }
55
- startApp(app, port);
38
+ const port = parseInt(process.env.PORT || DEFAULT_PORT.toString(), 10);
39
+ await startApp(app, port, findPort);
56
40
  }
57
41
 
58
42
  /**
59
43
  * Start the server
60
44
  * @param authProvider - Authentication provider
61
- * @param registry - ProjectRegistry holding all project CommandManagers
45
+ * @param directory - Directory the projects are opened from
62
46
  * @param findPort - If true, find a free port
63
47
  */
64
48
  export async function startServer(
65
49
  authProvider: AuthProvider,
66
- registry: ProjectRegistry,
50
+ directory: ProjectDirectory,
67
51
  findPort: boolean = true,
68
52
  multiProjectRoot?: string,
69
53
  ) {
70
54
  const useOsAssigned = process.env.CYBERISMO_E2E_OSPORT === 'true';
71
- let port = useOsAssigned
55
+ const port = useOsAssigned
72
56
  ? 0
73
57
  : parseInt(process.env.PORT || DEFAULT_PORT.toString(), 10);
74
- if (findPort && !useOsAssigned) {
75
- port = await findFreePort(port, DEFAULT_MAX_PORT);
76
- }
77
- startPolicyPolling(() => registry.list().map((p) => ({ prefix: p.prefix })));
58
+ startPolicyPolling(async () =>
59
+ (await directory.list()).map((p) => ({ prefix: p.prefix })),
60
+ );
78
61
  const app = createApp(
79
62
  authProvider,
80
- registry,
63
+ directory,
64
+ undefined,
81
65
  undefined,
82
- false,
83
66
  multiProjectRoot,
84
67
  );
85
- startApp(app, port);
68
+ await startApp(app, port, findPort && !useOsAssigned);
86
69
  }
87
70
 
88
- function startApp<E extends Env, S extends Schema, P extends string>(
71
+ async function startApp<E extends Env, S extends Schema, P extends string>(
89
72
  app: Hono<E, S, P>,
90
73
  port: number,
74
+ findPort: boolean,
91
75
  ) {
92
- serve(
93
- {
94
- fetch: app.fetch,
95
- port: port,
96
- hostname: process.env.HOST || '127.0.0.1',
97
- },
98
- (info) => {
99
- console.log(`Running Cyberismo app on http://localhost:${info.port}`);
100
- console.log('Press Control+C to stop.');
101
- // When spawned with stdio: [..., 'ipc'], publish the bound port to the parent.
102
- // No-op in normal startup (process.send is undefined without an IPC channel).
103
- process.send?.({ type: 'listening', port: info.port });
104
- },
76
+ const bound = await listen(
77
+ app.fetch,
78
+ port,
79
+ process.env.HOST || '127.0.0.1',
80
+ findPort ? port + MAX_PORT_ATTEMPTS : port,
105
81
  );
82
+ console.log(`Running Cyberismo app on http://localhost:${bound.port}`);
83
+ console.log('Press Control+C to stop.');
84
+ // When spawned with stdio: [..., 'ipc'], publish the bound port to the parent.
85
+ // No-op in normal startup (process.send is undefined without an IPC channel).
86
+ process.send?.({ type: 'listening', port: bound.port });
106
87
  }
package/src/main.ts CHANGED
@@ -1,23 +1,13 @@
1
- /**
2
- Cyberismo
3
- Copyright © Cyberismo Ltd and contributors 2025
4
- This program is free software: you can redistribute it and/or modify it under
5
- the terms of the GNU Affero General Public License version 3 as published by
6
- the Free Software Foundation.
7
- This program is distributed in the hope that it will be useful, but WITHOUT
8
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
- details. You should have received a copy of the GNU Affero General Public
11
- License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
- */
13
- import { scanForProjects } from '@cyberismo/data-handler';
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
4
+ import { localFolder } from '@cyberismo/data-handler';
14
5
  import { startServer } from './index.js';
15
6
  import { exportSite } from './export.js';
16
7
  import { MockAuthProvider } from './auth/mock.js';
17
8
  import { KeycloakAuthProvider } from './auth/keycloak.js';
18
9
  import type { AuthProvider } from './auth/types.js';
19
- import { ProjectRegistry } from './project-registry.js';
20
- import { formatProjectErrors } from './project-errors.js';
10
+ import { formatProjectErrors } from '@cyberismo/model';
21
11
  import { gitOptionsFromEnv } from './utils.js';
22
12
  import { parseArgs } from 'node:util';
23
13
  import dotenv from 'dotenv';
@@ -60,9 +50,21 @@ function createAuthProvider(): AuthProvider {
60
50
  }
61
51
 
62
52
  const projectPath = process.env.npm_config_project_path || process.cwd();
63
- let projects;
53
+
54
+ const { values: args } = parseArgs({
55
+ options: {
56
+ export: { type: 'boolean', default: false },
57
+ 'default-project': { type: 'string' },
58
+ },
59
+ strict: false,
60
+ });
61
+
62
+ let opened;
64
63
  try {
65
- projects = await scanForProjects(projectPath);
64
+ opened = await localFolder(
65
+ projectPath,
66
+ args.export ? undefined : gitOptionsFromEnv(),
67
+ );
66
68
  } catch (error) {
67
69
  console.error(
68
70
  error instanceof Error
@@ -71,17 +73,11 @@ try {
71
73
  );
72
74
  process.exit(1);
73
75
  }
74
-
75
- const { values: args } = parseArgs({
76
- options: {
77
- export: { type: 'boolean', default: false },
78
- 'default-project': { type: 'string' },
79
- },
80
- strict: false,
81
- });
76
+ const { directory, failed } = opened;
82
77
 
83
78
  if (args.export) {
84
- if (projects.length === 0) {
79
+ const projects = await directory.list();
80
+ if (projects.length === 0 && failed.length === 0) {
85
81
  console.error('No projects found to export.');
86
82
  process.exit(1);
87
83
  }
@@ -89,16 +85,14 @@ if (args.export) {
89
85
  typeof args['default-project'] === 'string'
90
86
  ? args['default-project']
91
87
  : undefined;
92
- const { registry, failed } =
93
- await ProjectRegistry.fromScannedProjects(projects);
94
88
  if (
95
- registry.list().length === 0 ||
89
+ projects.length === 0 ||
96
90
  failed.some((f) => f.prefix === defaultProject)
97
91
  ) {
98
92
  console.error(formatProjectErrors(failed));
99
93
  process.exit(1);
100
94
  }
101
- const { errors: exportErrors } = await exportSite(registry, undefined, {
95
+ const { errors: exportErrors } = await exportSite(directory, undefined, {
102
96
  defaultProject,
103
97
  });
104
98
  const errors = [...failed, ...exportErrors];
@@ -107,13 +101,9 @@ if (args.export) {
107
101
  process.exit(1);
108
102
  }
109
103
  } else {
110
- const { registry, failed } = await ProjectRegistry.fromScannedProjects(
111
- projects,
112
- gitOptionsFromEnv(),
113
- );
114
104
  if (failed.length > 0) {
115
105
  console.error(formatProjectErrors(failed));
116
106
  }
117
107
  const authProvider = createAuthProvider();
118
- await startServer(authProvider, registry, true, projectPath);
108
+ await startServer(authProvider, directory, true, projectPath);
119
109
  }
@@ -1,15 +1,5 @@
1
- /**
2
- Cyberismo
3
- Copyright © Cyberismo Ltd and contributors 2026
4
- This program is free software: you can redistribute it and/or modify it under
5
- the terms of the GNU Affero General Public License version 3 as published by
6
- the Free Software Foundation. This program is distributed in the hope that it
7
- will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
8
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9
- See the GNU Affero General Public License for more details.
10
- You should have received a copy of the GNU Affero General Public
11
- License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
- */
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
13
3
 
14
4
  import type { Context, MiddlewareHandler } from 'hono';
15
5
  import type { UserInfo } from '../types.js';
@@ -1,81 +1,66 @@
1
- /**
2
- Cyberismo
3
- Copyright © Cyberismo Ltd and contributors 2025
4
-
5
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
6
-
7
- This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
-
9
- You should have received a copy of the GNU Affero General Public
10
- License along with this program. If not, see <https://www.gnu.org/licenses/>.
11
- */
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
12
3
 
13
4
  import type { Context, MiddlewareHandler } from 'hono';
14
- import type { CommandManager } from '@cyberismo/data-handler';
5
+ import type { ActorRef } from '@cyberismo/model';
6
+ import type { ProjectDirectory, Workspace } from '@cyberismo/data-handler';
15
7
  import { getCurrentUser } from './auth.js';
16
- import type { ProjectRegistry } from '../project-registry.js';
8
+ import { UserRole, type UserInfo } from '../types.js';
17
9
  import type { ProjectEvents } from '../domain/events/project-events.js';
10
+ import type { EventsByProject } from '../domain/events/events-by-project.js';
18
11
 
19
12
  // Extend Hono Context type to include our custom properties
20
13
  declare module 'hono' {
21
14
  interface ContextVariableMap {
22
- commands: CommandManager;
15
+ ws: Workspace;
23
16
  events: ProjectEvents;
24
17
  projectPath: string;
25
- registry: ProjectRegistry;
18
+ directory: ProjectDirectory;
19
+ eventsByProject: EventsByProject;
26
20
  }
27
21
  }
28
22
 
29
- /**
30
- * Set CommandManager on context and run the next handler as the authenticated user.
31
- */
32
- async function runWithCommands(
33
- c: Context,
34
- commands: CommandManager,
35
- next: () => Promise<void>,
36
- ) {
37
- const user = getCurrentUser(c);
38
- if (!user) {
39
- throw new Error('CommandManager expects a user');
40
- }
41
- c.set('commands', commands);
42
- c.set('projectPath', commands.project.basePath);
43
- await commands.runAsAuthor({ name: user.name, email: user.email }, () =>
44
- next(),
45
- );
23
+ /** The actor a user acts as. */
24
+ export function actorOf(user: UserInfo): ActorRef {
25
+ return {
26
+ kind: user.role === UserRole.Connector ? 'connector' : 'user',
27
+ id: user.id,
28
+ name: user.name,
29
+ };
46
30
  }
47
31
 
48
- // TODO: Remove once MCP is made project-scoped via attachProjectRegistry
49
- export const attachCommandManager = (
50
- commands: CommandManager,
51
- ): MiddlewareHandler => {
52
- return (c, next) => runWithCommands(c, commands, next);
53
- };
54
-
55
32
  /**
56
- * Middleware that resolves the project from the registry and sets the
57
- * CommandManager on context.
33
+ * Middleware that opens the authenticated user's handle over the project
34
+ * and puts it, with the project's events and the directory, on the context.
35
+ * An unknown project is refused with ProjectNotFoundError (404).
58
36
  *
59
- * @param registry - Project registry to look up projects.
37
+ * @param directory - Directory the project is opened from.
38
+ * @param events - Events of the directory's projects.
60
39
  * @param fixedPrefix - When provided, used instead of the `:prefix` route
61
40
  * param. This is needed in export/SSG mode where routes are mounted at
62
41
  * concrete paths (e.g. `/api/projects/decision/...`) with no dynamic param.
63
42
  */
64
- export const attachProjectRegistry = (
65
- registry: ProjectRegistry,
43
+ export const attachProjectDirectory = (
44
+ directory: ProjectDirectory,
45
+ events: EventsByProject,
66
46
  fixedPrefix?: string,
67
47
  ): MiddlewareHandler => {
68
48
  return async (c: Context, next) => {
69
- c.set('registry', registry);
70
49
  const prefix = c.req.param('prefix') ?? fixedPrefix;
71
50
  if (!prefix) {
72
51
  return c.json({ error: 'Project prefix is required' }, 400);
73
52
  }
74
- const commands = registry.get(prefix);
75
- if (!commands) {
76
- return c.json({ error: `Project '${prefix}' not found` }, 404);
53
+ const user = getCurrentUser(c);
54
+ if (!user) {
55
+ throw new Error('A project handle expects a user');
77
56
  }
78
- c.set('events', registry.eventsFor(commands));
79
- return runWithCommands(c, commands, next);
57
+ const identity = { name: user.name, email: user.email };
58
+ const ws = await directory.open(prefix, actorOf(user), identity);
59
+ c.set('directory', directory);
60
+ c.set('eventsByProject', events);
61
+ c.set('events', await events.for(prefix));
62
+ c.set('ws', ws);
63
+ c.set('projectPath', ws.path);
64
+ await next();
80
65
  };
81
66
  };
@@ -1,3 +1,6 @@
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
1
4
  import type { Next } from 'hono';
2
5
  import type { AppContext, TreeOptions } from '../types.js';
3
6
 
@@ -1,3 +1,6 @@
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
3
+
1
4
  import { zValidator as zv } from '@hono/zod-validator';
2
5
  import type { ZodType } from 'zod';
3
6
  import type { ValidationTargets } from 'hono';
package/src/overlay.ts CHANGED
@@ -1,15 +1,5 @@
1
- /**
2
- Cyberismo
3
- Copyright © Cyberismo Ltd and contributors 2026
4
- This program is free software: you can redistribute it and/or modify it under
5
- the terms of the GNU Affero General Public License version 3 as published by
6
- the Free Software Foundation. This program is distributed in the hope that it
7
- will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
8
- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9
- See the GNU Affero General Public License for more details.
10
- You should have received a copy of the GNU Affero General Public
11
- License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
- */
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
13
3
 
14
4
  /**
15
5
  * Which projects, or the whole instance, are read-only.
@@ -20,7 +10,10 @@
20
10
  */
21
11
 
22
12
  import { z } from 'zod';
23
- import type { ProjectProvider } from '@cyberismo/data-handler';
13
+ import {
14
+ ProjectNotFoundError,
15
+ type ProjectDirectory,
16
+ } from '@cyberismo/data-handler';
24
17
 
25
18
  const POLL_INTERVAL_MS = 10_000;
26
19
  const FETCH_TIMEOUT_MS = 2_000;
@@ -91,7 +84,7 @@ async function reportProjects(
91
84
  }
92
85
 
93
86
  export function startPolicyPolling(
94
- projects: () => { prefix: string }[] = () => [],
87
+ projects: () => Promise<{ prefix: string }[]> = async () => [],
95
88
  ): void {
96
89
  const base = process.env.CYBERISMO_OVERLAY_URL;
97
90
  if (!base) return;
@@ -127,7 +120,7 @@ export function startPolicyPolling(
127
120
  // is registered within one interval.
128
121
  let lastReportFailure: string | undefined;
129
122
  const report = async () => {
130
- const current = projects();
123
+ const current = await projects();
131
124
  if (current.length === 0) return;
132
125
  try {
133
126
  await reportProjects(base, token, current);
@@ -166,10 +159,27 @@ export function startPolicyPolling(
166
159
  * cannot see which one a call touches. Making a frozen project unresolvable
167
160
  * fails closed, at the cost of hiding it from reads and from administrators too.
168
161
  */
169
- export function writableProjects(provider: ProjectProvider): ProjectProvider {
162
+ export function writableProjects(
163
+ directory: ProjectDirectory,
164
+ ): ProjectDirectory {
170
165
  return {
171
- get: (prefix) =>
172
- isProjectReadOnly(prefix) ? undefined : provider.get(prefix),
173
- list: () => provider.list().filter((p) => !isProjectReadOnly(p.prefix)),
166
+ open: async (prefix, actor, identity) => {
167
+ if (isProjectReadOnly(prefix)) {
168
+ throw new ProjectNotFoundError(prefix);
169
+ }
170
+ return directory.open(prefix, actor, identity);
171
+ },
172
+ list: async () =>
173
+ (await directory.list()).filter((p) => !isProjectReadOnly(p.prefix)),
174
+ create: (params, actor, identity) =>
175
+ directory.create(params, actor, identity),
176
+ clone: (url) => directory.clone(url),
177
+ rename: async (prefix, newPrefix, actor, identity, options) => {
178
+ if (isProjectReadOnly(prefix)) {
179
+ throw new ProjectNotFoundError(prefix);
180
+ }
181
+ return directory.rename(prefix, newPrefix, actor, identity, options);
182
+ },
183
+ replace: (prefix) => directory.replace(prefix),
174
184
  };
175
185
  }
package/src/types.ts CHANGED
@@ -1,15 +1,5 @@
1
- /**
2
- Cyberismo
3
- Copyright © Cyberismo Ltd and contributors 2025
4
- This program is free software: you can redistribute it and/or modify it under
5
- the terms of the GNU Affero General Public License version 3 as published by
6
- the Free Software Foundation.
7
- This program is distributed in the hope that it will be useful, but WITHOUT
8
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9
- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
10
- details. You should have received a copy of the GNU Affero General Public
11
- License along with this program. If not, see <https://www.gnu.org/licenses/>.
12
- */
1
+ // SPDX-FileCopyrightText: Cyberismo Ltd and contributors
2
+ // SPDX-License-Identifier: AGPL-3.0-only
13
3
 
14
4
  import type { Context } from 'hono';
15
5