collabmd 0.1.18

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 (430) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +453 -0
  3. package/bin/collabmd.js +241 -0
  4. package/docker-compose.yml +43 -0
  5. package/package.json +93 -0
  6. package/public/assets/css/base.css +1 -0
  7. package/public/assets/css/style.css +1 -0
  8. package/public/assets/js/assets/Assistant-Bold-ZDZZ6JHA.woff2 +0 -0
  9. package/public/assets/js/assets/Assistant-Medium-DZ25RZU3.woff2 +0 -0
  10. package/public/assets/js/assets/Assistant-Regular-PLF2XOGW.woff2 +0 -0
  11. package/public/assets/js/assets/Assistant-SemiBold-CZ5MX6FK.woff2 +0 -0
  12. package/public/assets/js/chunks/CodeMirrorEditor-UCMRAMCV-MAKZFDBE.js +12 -0
  13. package/public/assets/js/chunks/apl-C5P5JBDI.js +1 -0
  14. package/public/assets/js/chunks/ar-SA-NXDWD63E-MF6HMEA4.js +8 -0
  15. package/public/assets/js/chunks/architecture-PBZL5I3N-55LDZ5WS.js +1 -0
  16. package/public/assets/js/chunks/architectureDiagram-2XIMDMQ5-2VP562X7.js +36 -0
  17. package/public/assets/js/chunks/asciiarmor-3NCLLELT.js +1 -0
  18. package/public/assets/js/chunks/asn1-KF4WXU3M.js +1 -0
  19. package/public/assets/js/chunks/asterisk-EA3VIN65.js +1 -0
  20. package/public/assets/js/chunks/az-AZ-MXSORGZV-AIGO4TNU.js +1 -0
  21. package/public/assets/js/chunks/bg-BG-O6MV2KSF-X6AVO2AF.js +5 -0
  22. package/public/assets/js/chunks/blockDiagram-WCTKOSBZ-KM56WWDE.js +132 -0
  23. package/public/assets/js/chunks/bn-BD-T2VJNT7N-7OMHRIGC.js +3 -0
  24. package/public/assets/js/chunks/bn-IN-MMW2ORAC-EPKMNKG7.js +3 -0
  25. package/public/assets/js/chunks/brainfuck-A3CTQVFD.js +1 -0
  26. package/public/assets/js/chunks/c4Diagram-IC4MRINW-KX6UEGQZ.js +10 -0
  27. package/public/assets/js/chunks/ca-ES-MKBCGNOG-U44SUUTN.js +8 -0
  28. package/public/assets/js/chunks/chunk-2NTQWLZD.js +25 -0
  29. package/public/assets/js/chunks/chunk-2YRP2AWD.js +1 -0
  30. package/public/assets/js/chunks/chunk-3BUCGSSJ.js +1 -0
  31. package/public/assets/js/chunks/chunk-47L7JGE3.js +1 -0
  32. package/public/assets/js/chunks/chunk-4BCHPULB.js +1 -0
  33. package/public/assets/js/chunks/chunk-4NKM6YFO.js +161 -0
  34. package/public/assets/js/chunks/chunk-4WGMPBK5.js +1 -0
  35. package/public/assets/js/chunks/chunk-55WF6Y2Q.js +1 -0
  36. package/public/assets/js/chunks/chunk-775E65SU.js +1 -0
  37. package/public/assets/js/chunks/chunk-AJRGTECU.js +70 -0
  38. package/public/assets/js/chunks/chunk-B2J3PHGY.js +1 -0
  39. package/public/assets/js/chunks/chunk-B4JKB3BC.js +1 -0
  40. package/public/assets/js/chunks/chunk-BBHPYU2R.js +1 -0
  41. package/public/assets/js/chunks/chunk-CGVY4PKT.js +13 -0
  42. package/public/assets/js/chunks/chunk-CVTRX3TE.js +220 -0
  43. package/public/assets/js/chunks/chunk-DW6KK6VF.js +1 -0
  44. package/public/assets/js/chunks/chunk-E2HMNOQL.js +189 -0
  45. package/public/assets/js/chunks/chunk-EPTJZP5H.js +7 -0
  46. package/public/assets/js/chunks/chunk-G7NUGGE7.js +13 -0
  47. package/public/assets/js/chunks/chunk-GI7LBIBP.js +1 -0
  48. package/public/assets/js/chunks/chunk-GXRL27M7.js +1 -0
  49. package/public/assets/js/chunks/chunk-H6EYDHRW.js +1 -0
  50. package/public/assets/js/chunks/chunk-HOCBCDA5.js +1 -0
  51. package/public/assets/js/chunks/chunk-HS2CUOC6.js +1 -0
  52. package/public/assets/js/chunks/chunk-HUAS4BYI.js +12 -0
  53. package/public/assets/js/chunks/chunk-HVNNEPP5.js +2 -0
  54. package/public/assets/js/chunks/chunk-I2GVZI7W.js +38 -0
  55. package/public/assets/js/chunks/chunk-I6PVWGBN.js +14 -0
  56. package/public/assets/js/chunks/chunk-IR2DOYV4.js +7 -0
  57. package/public/assets/js/chunks/chunk-IZ3V3F2A.js +1 -0
  58. package/public/assets/js/chunks/chunk-KPAQHIOI.js +1 -0
  59. package/public/assets/js/chunks/chunk-M3EW4V74.js +1 -0
  60. package/public/assets/js/chunks/chunk-MK3AFU3C.js +90 -0
  61. package/public/assets/js/chunks/chunk-NM6J3ND7.js +1 -0
  62. package/public/assets/js/chunks/chunk-NO7UPWTU.js +1 -0
  63. package/public/assets/js/chunks/chunk-OG2TNZEU.js +9 -0
  64. package/public/assets/js/chunks/chunk-OHGDMMWM.js +1 -0
  65. package/public/assets/js/chunks/chunk-OOT2HALX.js +1 -0
  66. package/public/assets/js/chunks/chunk-OQLLZFFN.js +1 -0
  67. package/public/assets/js/chunks/chunk-PF6TP4EI.js +1 -0
  68. package/public/assets/js/chunks/chunk-PMOZMECZ.js +85 -0
  69. package/public/assets/js/chunks/chunk-QBGS6DJR.js +1 -0
  70. package/public/assets/js/chunks/chunk-QF3ZQ6UQ.js +1 -0
  71. package/public/assets/js/chunks/chunk-QFXMAUW4.js +1 -0
  72. package/public/assets/js/chunks/chunk-QSTBGTWJ.js +1 -0
  73. package/public/assets/js/chunks/chunk-QYKIT2IH.js +41 -0
  74. package/public/assets/js/chunks/chunk-S75BI2UQ.js +1 -0
  75. package/public/assets/js/chunks/chunk-SKEZZ3H6.js +1 -0
  76. package/public/assets/js/chunks/chunk-SO6QBCB6.js +1 -0
  77. package/public/assets/js/chunks/chunk-SR3U53EQ.js +1 -0
  78. package/public/assets/js/chunks/chunk-TFP6LRYJ.js +53 -0
  79. package/public/assets/js/chunks/chunk-U6APNHAF.js +15 -0
  80. package/public/assets/js/chunks/chunk-VOODXHXA.js +1 -0
  81. package/public/assets/js/chunks/chunk-W7WJUTSA.js +3 -0
  82. package/public/assets/js/chunks/chunk-WNXFO2F2.js +1 -0
  83. package/public/assets/js/chunks/chunk-X6EEYWV4.js +6 -0
  84. package/public/assets/js/chunks/chunk-YVW3ZETS.js +1 -0
  85. package/public/assets/js/chunks/chunk-ZR2QRTBG.js +339 -0
  86. package/public/assets/js/chunks/chunk-ZZJX4LQ2.js +1 -0
  87. package/public/assets/js/chunks/classDiagram-VBA2DB6C-IYW4O2RM.js +1 -0
  88. package/public/assets/js/chunks/classDiagram-v2-RAHNMMFH-DNKVN2WD.js +1 -0
  89. package/public/assets/js/chunks/clike-RTBH33GE.js +1 -0
  90. package/public/assets/js/chunks/clojure-BR2VJ2JI.js +1 -0
  91. package/public/assets/js/chunks/cmake-2HEWVFEE.js +1 -0
  92. package/public/assets/js/chunks/cobol-V6EIK6DN.js +1 -0
  93. package/public/assets/js/chunks/coffeescript-JW3ZOGMD.js +1 -0
  94. package/public/assets/js/chunks/commonlisp-UCWSIHYK.js +1 -0
  95. package/public/assets/js/chunks/cose-bilkent-S5V4N54A-QVYRFFNC.js +1 -0
  96. package/public/assets/js/chunks/crystal-GR4VLC3M.js +1 -0
  97. package/public/assets/js/chunks/cs-CZ-V77HGUP7-OLBAKFG5.js +7 -0
  98. package/public/assets/js/chunks/css-C5DVWGB4.js +1 -0
  99. package/public/assets/js/chunks/cypher-K7FZM5GC.js +1 -0
  100. package/public/assets/js/chunks/d-CF3QNNH5.js +1 -0
  101. package/public/assets/js/chunks/da-DK-I5RFNTM4-QJIG2SEZ.js +2 -0
  102. package/public/assets/js/chunks/dagre-KLK3FWXG-KVNBUDOY.js +4 -0
  103. package/public/assets/js/chunks/de-CH-WLRDEVBV-4MMJDMVD.js +7 -0
  104. package/public/assets/js/chunks/de-DE-DTI4WUSC-ML7C46TT.js +7 -0
  105. package/public/assets/js/chunks/diagram-E7M64L7V-ZP33VRUC.js +24 -0
  106. package/public/assets/js/chunks/diagram-IFDJBPK2-ZG35YWOD.js +43 -0
  107. package/public/assets/js/chunks/diagram-P4PSJMXO-ZGIGM7D2.js +24 -0
  108. package/public/assets/js/chunks/diff-KOMSZU7O.js +1 -0
  109. package/public/assets/js/chunks/dist-7RQKSOUX.js +7 -0
  110. package/public/assets/js/chunks/dist-ARWGZ6MN.js +1 -0
  111. package/public/assets/js/chunks/dist-DPBSGC3Y.js +2 -0
  112. package/public/assets/js/chunks/dist-E36PJE5M.js +1 -0
  113. package/public/assets/js/chunks/dist-E5NM7OBW.js +1 -0
  114. package/public/assets/js/chunks/dist-ERADYPEK.js +1 -0
  115. package/public/assets/js/chunks/dist-F43RIHBZ.js +1 -0
  116. package/public/assets/js/chunks/dist-HAB5NIXI.js +1 -0
  117. package/public/assets/js/chunks/dist-HG23OLRA.js +1 -0
  118. package/public/assets/js/chunks/dist-IEJXBSDJ.js +1 -0
  119. package/public/assets/js/chunks/dist-IQA4KVJK.js +1 -0
  120. package/public/assets/js/chunks/dist-OIQTNVT2.js +3 -0
  121. package/public/assets/js/chunks/dist-PMZJ734S.js +1 -0
  122. package/public/assets/js/chunks/dist-RCQFQRLD.js +1 -0
  123. package/public/assets/js/chunks/dist-RQLC4GVI.js +1 -0
  124. package/public/assets/js/chunks/dist-RSJGLSKC.js +1 -0
  125. package/public/assets/js/chunks/dist-SGNQZVVX.js +1 -0
  126. package/public/assets/js/chunks/dist-VCFTF7Z6.js +1 -0
  127. package/public/assets/js/chunks/dist-VTO23SHH.js +1 -0
  128. package/public/assets/js/chunks/dist-XOODBV4L.js +1 -0
  129. package/public/assets/js/chunks/dist-ZFZNCRZY.js +1 -0
  130. package/public/assets/js/chunks/dockerfile-XCIKYOSI.js +1 -0
  131. package/public/assets/js/chunks/dtd-3XFH7W6Z.js +1 -0
  132. package/public/assets/js/chunks/dylan-3UWPKVOR.js +1 -0
  133. package/public/assets/js/chunks/ebnf-OLHTL3VN.js +1 -0
  134. package/public/assets/js/chunks/ecl-43LZ3ZRM.js +1 -0
  135. package/public/assets/js/chunks/editor-session-IHFTYG5D.js +22 -0
  136. package/public/assets/js/chunks/eiffel-ISPO2UJF.js +1 -0
  137. package/public/assets/js/chunks/el-GR-ZXDJ2OS4-WSCEIO6J.js +7 -0
  138. package/public/assets/js/chunks/elm-CLK576PK.js +1 -0
  139. package/public/assets/js/chunks/en-CTDJDZ6K-IC3QAUOI.js +1 -0
  140. package/public/assets/js/chunks/erDiagram-INFDFZHY-ZMS6H2TH.js +70 -0
  141. package/public/assets/js/chunks/erlang-AVQXQFOT.js +1 -0
  142. package/public/assets/js/chunks/es-ES-DYQHAD43-XGB5X5IM.js +7 -0
  143. package/public/assets/js/chunks/eu-ES-QDSYU5Y3-LA3JTIJ2.js +7 -0
  144. package/public/assets/js/chunks/excalidraw-mermaid-stub-NYXTOJ4H.js +1 -0
  145. package/public/assets/js/chunks/fa-IR-26LZG4PM-PFALMEDX.js +9 -0
  146. package/public/assets/js/chunks/factor-CRTVBD6Q.js +1 -0
  147. package/public/assets/js/chunks/fcl-FX24LKTH.js +1 -0
  148. package/public/assets/js/chunks/fi-FI-6YS4KDE4-ES5MV6P4.js +6 -0
  149. package/public/assets/js/chunks/flowDiagram-PKNHOUZH-QD4L5IE5.js +162 -0
  150. package/public/assets/js/chunks/forth-YKDKCTVS.js +1 -0
  151. package/public/assets/js/chunks/fortran-UJWC6SLU.js +1 -0
  152. package/public/assets/js/chunks/fr-FR-BRLLPTZC-VMFE22YV.js +12 -0
  153. package/public/assets/js/chunks/ganttDiagram-A5KZAMGK-VTMTQESP.js +292 -0
  154. package/public/assets/js/chunks/gas-MYEMWGRE.js +1 -0
  155. package/public/assets/js/chunks/gherkin-JWHAU2YG.js +1 -0
  156. package/public/assets/js/chunks/gitGraph-HDMCJU4V-YPHS74XX.js +1 -0
  157. package/public/assets/js/chunks/gitGraphDiagram-K3NZZRJ6-Z3EZ634T.js +65 -0
  158. package/public/assets/js/chunks/gl-ES-OKUZTLYG-GPT42ZHV.js +6 -0
  159. package/public/assets/js/chunks/groovy-QZIZQIAK.js +1 -0
  160. package/public/assets/js/chunks/haskell-JR3G7YNW.js +1 -0
  161. package/public/assets/js/chunks/haxe-TVLAIYEN.js +1 -0
  162. package/public/assets/js/chunks/he-IL-26MGYIU7-VQ5XQYYY.js +8 -0
  163. package/public/assets/js/chunks/hi-IN-Q4ZOGTP2-2Z766MXA.js +3 -0
  164. package/public/assets/js/chunks/http-YXQRE77G.js +1 -0
  165. package/public/assets/js/chunks/hu-HU-P2OXPSN5-6XDVPGTE.js +3 -0
  166. package/public/assets/js/chunks/id-ID-2EIKXYN6-J5GWSY2S.js +8 -0
  167. package/public/assets/js/chunks/idl-RAQGJ6LJ.js +1 -0
  168. package/public/assets/js/chunks/image-32MOCVDX-JN2EUMQG.js +1 -0
  169. package/public/assets/js/chunks/image-blob-reduce.esm-K5OWL55S.js +13 -0
  170. package/public/assets/js/chunks/info-3K5VOQVL-CXJSPNNP.js +1 -0
  171. package/public/assets/js/chunks/infoDiagram-LFFYTUFH-WQ34MUJA.js +2 -0
  172. package/public/assets/js/chunks/ishikawaDiagram-PHBUUO56-4IARWKJK.js +70 -0
  173. package/public/assets/js/chunks/it-IT-4CFKVXI2-NMBWUWFF.js +12 -0
  174. package/public/assets/js/chunks/ja-JP-MAND2Z4V-GQZYXXOC.js +7 -0
  175. package/public/assets/js/chunks/javascript-NM7KDJUE.js +1 -0
  176. package/public/assets/js/chunks/journeyDiagram-4ABVD52K-FJ4LF4SX.js +139 -0
  177. package/public/assets/js/chunks/julia-LG3BH25B.js +1 -0
  178. package/public/assets/js/chunks/kaa-HQRTCXTJ-7D6PAKDJ.js +1 -0
  179. package/public/assets/js/chunks/kab-KAB-JKIKKTGH-TNKFXNAX.js +4 -0
  180. package/public/assets/js/chunks/kanban-definition-K7BYSVSG-TY4EVYI3.js +89 -0
  181. package/public/assets/js/chunks/katex-5YJCUCFD.js +261 -0
  182. package/public/assets/js/chunks/kk-KZ-HXQ63ZFC-T4HCMWED.js +1 -0
  183. package/public/assets/js/chunks/km-KH-PKL3LSGX-HTLHEJV6.js +7 -0
  184. package/public/assets/js/chunks/ko-KR-KXLREZX3-QMR52QVI.js +5 -0
  185. package/public/assets/js/chunks/ku-TR-MJ4IER3X-K5CNY4UO.js +6 -0
  186. package/public/assets/js/chunks/livescript-4CVWVI4M.js +1 -0
  187. package/public/assets/js/chunks/lt-LT-H6WFQ6FJ-IW25FAGX.js +3 -0
  188. package/public/assets/js/chunks/lua-VWGE7DQ7.js +1 -0
  189. package/public/assets/js/chunks/lv-LV-GOCK6SJW-KTDFW5OH.js +4 -0
  190. package/public/assets/js/chunks/mathematica-D7APQSEU.js +1 -0
  191. package/public/assets/js/chunks/mbox-BN3XQBYX.js +1 -0
  192. package/public/assets/js/chunks/mermaid-runtime-BIFNJ2CT.js +18 -0
  193. package/public/assets/js/chunks/mindmap-definition-YRQLILUH-5B565RNP.js +68 -0
  194. package/public/assets/js/chunks/mirc-565WBI76.js +1 -0
  195. package/public/assets/js/chunks/mllike-VV3KS46B.js +1 -0
  196. package/public/assets/js/chunks/modelica-EGX44FZV.js +1 -0
  197. package/public/assets/js/chunks/mr-IN-IXVLDMEQ-PHM5DT7Q.js +9 -0
  198. package/public/assets/js/chunks/mscgen-GFGTHENT.js +1 -0
  199. package/public/assets/js/chunks/mumps-POZYWSMI.js +1 -0
  200. package/public/assets/js/chunks/my-MM-YG6MYTTD-ZHLCMEVA.js +1 -0
  201. package/public/assets/js/chunks/nb-NO-XGWJISD2-KSDFG6YU.js +8 -0
  202. package/public/assets/js/chunks/nginx-JUBX55EU.js +1 -0
  203. package/public/assets/js/chunks/nl-NL-XVDVCPNC-KVF3ZO2R.js +13 -0
  204. package/public/assets/js/chunks/nn-NO-EMX5MJX5-34QKSHNR.js +4 -0
  205. package/public/assets/js/chunks/nsis-RC4CREGM.js +1 -0
  206. package/public/assets/js/chunks/ntriples-4WK6CNVE.js +1 -0
  207. package/public/assets/js/chunks/oc-FR-ROEINTVO-5GP4AOYO.js +4 -0
  208. package/public/assets/js/chunks/octave-GOKFN2V7.js +1 -0
  209. package/public/assets/js/chunks/oz-OQUMNC63.js +1 -0
  210. package/public/assets/js/chunks/pa-IN-ZYN6SUDY-MVL7O44W.js +4 -0
  211. package/public/assets/js/chunks/packet-RMMSAZCW-D7XTR5TT.js +1 -0
  212. package/public/assets/js/chunks/pascal-BBWQWWWD.js +1 -0
  213. package/public/assets/js/chunks/percentages-5DKR754L-DG7W23CV.js +1 -0
  214. package/public/assets/js/chunks/perl-KTPJTTAM.js +1 -0
  215. package/public/assets/js/chunks/pica-6G3NROWT.js +17 -0
  216. package/public/assets/js/chunks/pie-UPGHQEXC-KGC3O6LN.js +1 -0
  217. package/public/assets/js/chunks/pieDiagram-SKSYHLDU-KWKRDEZS.js +30 -0
  218. package/public/assets/js/chunks/pig-IJMBS4FZ.js +1 -0
  219. package/public/assets/js/chunks/pl-PL-6VTG7PHC-VADRWSX4.js +12 -0
  220. package/public/assets/js/chunks/powershell-6YGCBHDP.js +1 -0
  221. package/public/assets/js/chunks/preview-render-compiler-WD3A76I6.js +25 -0
  222. package/public/assets/js/chunks/properties-5QTD3364.js +1 -0
  223. package/public/assets/js/chunks/protobuf-LTRWBIK3.js +1 -0
  224. package/public/assets/js/chunks/pt-BR-5YFKRR5G-HHF4UPO4.js +6 -0
  225. package/public/assets/js/chunks/pt-PT-GEIXXZ67-TUTAUZJK.js +8 -0
  226. package/public/assets/js/chunks/pug-U4PV3WLG.js +1 -0
  227. package/public/assets/js/chunks/puppet-WGYJPR3Y.js +1 -0
  228. package/public/assets/js/chunks/python-6YGH4S47.js +1 -0
  229. package/public/assets/js/chunks/q-VIG4IJLI.js +1 -0
  230. package/public/assets/js/chunks/quadrantDiagram-337W2JSQ-GWQRUFHQ.js +7 -0
  231. package/public/assets/js/chunks/quick-switcher-controller-JYDIJVAJ.js +5 -0
  232. package/public/assets/js/chunks/r-NVPCXGTR.js +1 -0
  233. package/public/assets/js/chunks/radar-KQ55EAFF-OPO64DRI.js +1 -0
  234. package/public/assets/js/chunks/requirementDiagram-Z7DCOOCP-ASW7IPJL.js +73 -0
  235. package/public/assets/js/chunks/ro-RO-E2P6TFZI-RJFCULYF.js +12 -0
  236. package/public/assets/js/chunks/roundRect-Z3DX3W5S.js +1 -0
  237. package/public/assets/js/chunks/rpm-UEA257HD.js +1 -0
  238. package/public/assets/js/chunks/ru-RU-YBIIY43T-BF27TNVK.js +10 -0
  239. package/public/assets/js/chunks/ruby-KPQRAJGE.js +1 -0
  240. package/public/assets/js/chunks/sankeyDiagram-WA2Y5GQK-W6BBWCLW.js +10 -0
  241. package/public/assets/js/chunks/sas-L7VATVH5.js +1 -0
  242. package/public/assets/js/chunks/scheme-T2NOWR3P.js +1 -0
  243. package/public/assets/js/chunks/sequenceDiagram-2WXFIKYE-H4G3ISLN.js +145 -0
  244. package/public/assets/js/chunks/shell-DLVDUNFA.js +1 -0
  245. package/public/assets/js/chunks/si-LK-673C2CI2-IOFGU4U2.js +1 -0
  246. package/public/assets/js/chunks/sieve-BKBZYDBU.js +1 -0
  247. package/public/assets/js/chunks/sk-SK-CKZHQ4AP-6O5JGN26.js +7 -0
  248. package/public/assets/js/chunks/sl-SI-557H2GWM-2NEHLV7W.js +6 -0
  249. package/public/assets/js/chunks/smalltalk-WRJQKJSD.js +1 -0
  250. package/public/assets/js/chunks/solr-66B3BIDL.js +1 -0
  251. package/public/assets/js/chunks/sparql-S25Z47JG.js +1 -0
  252. package/public/assets/js/chunks/spreadsheet-B272EF7Y.js +1 -0
  253. package/public/assets/js/chunks/sql-BPLIIUYC.js +1 -0
  254. package/public/assets/js/chunks/stateDiagram-RAJIS63D-OF5XXRUS.js +1 -0
  255. package/public/assets/js/chunks/stateDiagram-v2-FVOUBMTO-IV2CSQSQ.js +1 -0
  256. package/public/assets/js/chunks/stex-4IJY64QX.js +1 -0
  257. package/public/assets/js/chunks/stylus-PJUHLGPT.js +1 -0
  258. package/public/assets/js/chunks/subset-shared.chunk-4NMWHS4D.js +1 -0
  259. package/public/assets/js/chunks/subset-worker.chunk-NTLP7Y66.js +1 -0
  260. package/public/assets/js/chunks/sv-SE-XOPKKDWS-Q2L6KGFV.js +8 -0
  261. package/public/assets/js/chunks/swift-UYHTO4SX.js +1 -0
  262. package/public/assets/js/chunks/ta-IN-XBH7DQI3-ISSUGZAK.js +6 -0
  263. package/public/assets/js/chunks/tcl-OQ5J3VO2.js +1 -0
  264. package/public/assets/js/chunks/textile-NOGVBEYF.js +1 -0
  265. package/public/assets/js/chunks/th-TH-TOCWH3R4-TABEAMJA.js +1 -0
  266. package/public/assets/js/chunks/tiddlywiki-SYTK4QUE.js +1 -0
  267. package/public/assets/js/chunks/tiki-P7K4ZLOM.js +1 -0
  268. package/public/assets/js/chunks/timeline-definition-YZTLITO2-HBCANIUC.js +61 -0
  269. package/public/assets/js/chunks/toml-AUZYRP36.js +1 -0
  270. package/public/assets/js/chunks/tr-TR-GXW6CYY5-5NQRN52Y.js +4 -0
  271. package/public/assets/js/chunks/treemap-KZPCXAKY-WYMCT5F7.js +1 -0
  272. package/public/assets/js/chunks/troff-XFYJNQOJ.js +1 -0
  273. package/public/assets/js/chunks/ttcn-AK2IXWU6.js +1 -0
  274. package/public/assets/js/chunks/ttcn-cfg-3IDPIYPU.js +1 -0
  275. package/public/assets/js/chunks/turtle-OIDMF46P.js +1 -0
  276. package/public/assets/js/chunks/uk-UA-IJKTNUDG-2IIL3TO5.js +6 -0
  277. package/public/assets/js/chunks/uz-UZ-TBZZEA4V-X22KVKBP.js +1 -0
  278. package/public/assets/js/chunks/vb-J6K4XVA2.js +1 -0
  279. package/public/assets/js/chunks/vbscript-FM7DDZZE.js +1 -0
  280. package/public/assets/js/chunks/velocity-6KZFEOFD.js +1 -0
  281. package/public/assets/js/chunks/vennDiagram-LZ73GAT5-EBRF3MZR.js +34 -0
  282. package/public/assets/js/chunks/verilog-EWWQPMNN.js +1 -0
  283. package/public/assets/js/chunks/vhdl-CJ3M4IHI.js +1 -0
  284. package/public/assets/js/chunks/vi-VN-MULSGNVB-TENM65C7.js +7 -0
  285. package/public/assets/js/chunks/webidl-XVBHXCRV.js +1 -0
  286. package/public/assets/js/chunks/xquery-7WZOZ4UK.js +1 -0
  287. package/public/assets/js/chunks/xychartDiagram-JWTSCODW-WIFVRQPR.js +7 -0
  288. package/public/assets/js/chunks/yacas-MZ2ZZPF3.js +1 -0
  289. package/public/assets/js/chunks/z80-I447CBF7.js +1 -0
  290. package/public/assets/js/chunks/zh-CN-MVX3E32U-S5VA2BA5.js +11 -0
  291. package/public/assets/js/chunks/zh-HK-JNU5RLIE-A4VUKZFV.js +1 -0
  292. package/public/assets/js/chunks/zh-TW-LENVCA6T-KFB6KHMM.js +9 -0
  293. package/public/assets/js/excalidraw-editor-7ORML5YA.css +1 -0
  294. package/public/assets/js/excalidraw-editor-LKW2AZBU.js +347 -0
  295. package/public/assets/js/excalidraw-editor.css +1 -0
  296. package/public/assets/js/excalidraw-editor.js +1 -0
  297. package/public/assets/js/main.js +354 -0
  298. package/public/assets/js/preview-render-worker.js +30 -0
  299. package/public/assets/vendor/highlight/github-dark.min.css +10 -0
  300. package/public/assets/vendor/highlight/github.min.css +10 -0
  301. package/public/excalidraw-editor.html +31 -0
  302. package/public/index.html +549 -0
  303. package/scripts/cloudflare-tunnel.mjs +145 -0
  304. package/scripts/local-plantuml-compose.mjs +92 -0
  305. package/server.js +1 -0
  306. package/src/client/application/app-shell/chat-feature.js +363 -0
  307. package/src/client/application/app-shell/comments-feature.js +33 -0
  308. package/src/client/application/app-shell/git-feature.js +394 -0
  309. package/src/client/application/app-shell/presence-feature.js +229 -0
  310. package/src/client/application/app-shell/ui-feature.js +535 -0
  311. package/src/client/application/app-shell/workspace-feature.js +132 -0
  312. package/src/client/application/app-shell-elements.js +78 -0
  313. package/src/client/application/diagram-preview-hydrator.js +382 -0
  314. package/src/client/application/file-open-lifecycle.js +26 -0
  315. package/src/client/application/mermaid-preview-hydrator.js +570 -0
  316. package/src/client/application/plantuml-preview-hydrator.js +563 -0
  317. package/src/client/application/preview-diagram-utils.js +223 -0
  318. package/src/client/application/preview-render-compiler.js +426 -0
  319. package/src/client/application/preview-render-executor.js +153 -0
  320. package/src/client/application/preview-render-profile.js +63 -0
  321. package/src/client/application/preview-render-scheduler.js +73 -0
  322. package/src/client/application/preview-render-worker.js +19 -0
  323. package/src/client/application/preview-renderer.js +452 -0
  324. package/src/client/application/wiki-link-file-controller.js +58 -0
  325. package/src/client/application/workspace-chrome-controller.js +84 -0
  326. package/src/client/application/workspace-coordinator.js +238 -0
  327. package/src/client/application/workspace-preview-controller.js +237 -0
  328. package/src/client/application/workspace-route-controller.js +170 -0
  329. package/src/client/application/workspace-state-store.js +46 -0
  330. package/src/client/bootstrap/collabmd-app-shell.js +479 -0
  331. package/src/client/domain/diagram-action-icons.js +41 -0
  332. package/src/client/domain/excalidraw-collaboration.js +153 -0
  333. package/src/client/domain/excalidraw-scene.js +87 -0
  334. package/src/client/domain/markdown-formatting.js +370 -0
  335. package/src/client/domain/plantuml-language.js +226 -0
  336. package/src/client/domain/room.js +49 -0
  337. package/src/client/domain/runtime-paths.js +136 -0
  338. package/src/client/domain/vault-api-client.js +1 -0
  339. package/src/client/domain/vault-paths.js +80 -0
  340. package/src/client/domain/vault-utils.js +49 -0
  341. package/src/client/domain/wiki-link-completions.js +78 -0
  342. package/src/client/excalidraw-editor.js +630 -0
  343. package/src/client/excalidraw-mermaid-stub.js +7 -0
  344. package/src/client/infrastructure/auth-client.js +383 -0
  345. package/src/client/infrastructure/browser-navigation-port.js +19 -0
  346. package/src/client/infrastructure/browser-notification-port.js +40 -0
  347. package/src/client/infrastructure/browser-preferences-port.js +79 -0
  348. package/src/client/infrastructure/comment-thread-store.js +293 -0
  349. package/src/client/infrastructure/editor-collaboration-client.js +240 -0
  350. package/src/client/infrastructure/editor-session.js +255 -0
  351. package/src/client/infrastructure/editor-view-adapter.js +578 -0
  352. package/src/client/infrastructure/excalidraw-room-client.js +651 -0
  353. package/src/client/infrastructure/lobby-presence.js +304 -0
  354. package/src/client/infrastructure/runtime-config.js +65 -0
  355. package/src/client/infrastructure/tab-activity-lock.js +193 -0
  356. package/src/client/infrastructure/vault-api-client.js +61 -0
  357. package/src/client/infrastructure/yjs-provider-reset-guard.js +19 -0
  358. package/src/client/main.js +16 -0
  359. package/src/client/mermaid-runtime.js +3 -0
  360. package/src/client/presentation/backlinks-panel.js +188 -0
  361. package/src/client/presentation/comment-ui-controller.js +1235 -0
  362. package/src/client/presentation/comments-panel.js +531 -0
  363. package/src/client/presentation/excalidraw-embed-controller.js +968 -0
  364. package/src/client/presentation/excalidraw-embed-reconciler.js +37 -0
  365. package/src/client/presentation/file-action-controller.js +596 -0
  366. package/src/client/presentation/file-explorer-controller.js +81 -0
  367. package/src/client/presentation/file-explorer-view.js +256 -0
  368. package/src/client/presentation/file-tree-state.js +77 -0
  369. package/src/client/presentation/git-diff-view-controller.js +656 -0
  370. package/src/client/presentation/git-panel-controller.js +516 -0
  371. package/src/client/presentation/layout-controller.js +222 -0
  372. package/src/client/presentation/outline-controller.js +239 -0
  373. package/src/client/presentation/quick-switcher-controller.js +300 -0
  374. package/src/client/presentation/scroll-sync-controller.js +500 -0
  375. package/src/client/presentation/theme-controller.js +64 -0
  376. package/src/client/presentation/toast-controller.js +21 -0
  377. package/src/client/presentation/video-embed-controller.js +264 -0
  378. package/src/client/styles/base.css +58 -0
  379. package/src/client/styles/style.css +4245 -0
  380. package/src/domain/comment-threads.js +233 -0
  381. package/src/domain/excalidraw-room-codec.js +427 -0
  382. package/src/domain/file-kind.js +104 -0
  383. package/src/domain/wiki-link-resolver.js +75 -0
  384. package/src/server/auth/create-auth-service.js +272 -0
  385. package/src/server/auth/session-cookie.js +125 -0
  386. package/src/server/config/env.js +186 -0
  387. package/src/server/create-app-server.js +143 -0
  388. package/src/server/domain/backlink-index.js +291 -0
  389. package/src/server/domain/collaboration/collaboration-document-store.js +155 -0
  390. package/src/server/domain/collaboration/collaboration-room.js +603 -0
  391. package/src/server/domain/collaboration/protocol.js +2 -0
  392. package/src/server/domain/collaboration/room-client-state-store.js +28 -0
  393. package/src/server/domain/collaboration/room-persistence-controller.js +80 -0
  394. package/src/server/domain/collaboration/room-registry.js +94 -0
  395. package/src/server/domain/git-service.js +1 -0
  396. package/src/server/domain/plantuml-encoder.js +49 -0
  397. package/src/server/domain/plantuml-renderer.js +1 -0
  398. package/src/server/index.js +72 -0
  399. package/src/server/infrastructure/git/command-runner.js +48 -0
  400. package/src/server/infrastructure/git/concurrency.js +19 -0
  401. package/src/server/infrastructure/git/diff-service.js +389 -0
  402. package/src/server/infrastructure/git/errors.js +5 -0
  403. package/src/server/infrastructure/git/git-service.js +216 -0
  404. package/src/server/infrastructure/git/parsers.js +401 -0
  405. package/src/server/infrastructure/git/path-utils.js +65 -0
  406. package/src/server/infrastructure/git/responses.js +108 -0
  407. package/src/server/infrastructure/git/status-service.js +99 -0
  408. package/src/server/infrastructure/git/untracked-files.js +101 -0
  409. package/src/server/infrastructure/http/create-auth-api-handler.js +48 -0
  410. package/src/server/infrastructure/http/create-esm-proxy-handler.js +130 -0
  411. package/src/server/infrastructure/http/create-git-api-command-handler.js +170 -0
  412. package/src/server/infrastructure/http/create-git-api-handler.js +40 -0
  413. package/src/server/infrastructure/http/create-git-api-query-handler.js +62 -0
  414. package/src/server/infrastructure/http/create-plantuml-api-handler.js +43 -0
  415. package/src/server/infrastructure/http/create-request-handler.js +138 -0
  416. package/src/server/infrastructure/http/create-static-handler.js +167 -0
  417. package/src/server/infrastructure/http/create-vault-api-command-handler.js +161 -0
  418. package/src/server/infrastructure/http/create-vault-api-handler.js +43 -0
  419. package/src/server/infrastructure/http/create-vault-api-query-handler.js +82 -0
  420. package/src/server/infrastructure/http/http-errors.js +13 -0
  421. package/src/server/infrastructure/http/http-response.js +167 -0
  422. package/src/server/infrastructure/http/request-body.js +56 -0
  423. package/src/server/infrastructure/persistence/path-utils.js +90 -0
  424. package/src/server/infrastructure/persistence/sidecar-store.js +150 -0
  425. package/src/server/infrastructure/persistence/vault-content-adapter.js +49 -0
  426. package/src/server/infrastructure/persistence/vault-file-store.js +435 -0
  427. package/src/server/infrastructure/plantuml/plantuml-renderer.js +56 -0
  428. package/src/server/infrastructure/websocket/attach-collaboration-gateway.js +194 -0
  429. package/src/server/infrastructure/websocket/client-socket-session.js +151 -0
  430. package/src/server/startup/git-remote-bootstrap.js +435 -0
@@ -0,0 +1,108 @@
1
+ const STATUS_MAP = {
2
+ A: { code: 'A', label: 'added', status: 'added' },
3
+ C: { code: 'C', label: 'copied', status: 'copied' },
4
+ D: { code: 'D', label: 'deleted', status: 'deleted' },
5
+ M: { code: 'M', label: 'modified', status: 'modified' },
6
+ R: { code: 'R', label: 'renamed', status: 'renamed' },
7
+ T: { code: 'T', label: 'type change', status: 'type-changed' },
8
+ U: { code: 'U', label: 'conflicted', status: 'conflicted' },
9
+ '?': { code: 'U', label: 'untracked', status: 'untracked' },
10
+ };
11
+
12
+ export function createStatusInfo(symbol) {
13
+ return STATUS_MAP[symbol] ?? { code: symbol || 'M', label: 'modified', status: 'modified' };
14
+ }
15
+
16
+ export function createEmptyStats() {
17
+ return {
18
+ additions: 0,
19
+ deletions: 0,
20
+ };
21
+ }
22
+
23
+ export function createEmptySummary() {
24
+ return {
25
+ additions: 0,
26
+ changedFiles: 0,
27
+ deletions: 0,
28
+ staged: 0,
29
+ untracked: 0,
30
+ workingTree: 0,
31
+ };
32
+ }
33
+
34
+ export function createEmptyBranchStatus() {
35
+ return {
36
+ ahead: 0,
37
+ behind: 0,
38
+ detached: false,
39
+ hasCommits: false,
40
+ name: null,
41
+ upstream: null,
42
+ };
43
+ }
44
+
45
+ export function createEmptyWorkspaceChange() {
46
+ return {
47
+ changedPaths: [],
48
+ deletedPaths: [],
49
+ refreshExplorer: true,
50
+ renamedPaths: [],
51
+ };
52
+ }
53
+
54
+ export function createEmptyStatusResponse() {
55
+ return {
56
+ branch: createEmptyBranchStatus(),
57
+ isGitRepo: false,
58
+ sections: [
59
+ { files: [], key: 'staged', label: 'Staged Changes' },
60
+ { files: [], key: 'working-tree', label: 'Changes' },
61
+ { files: [], key: 'untracked', label: 'Untracked' },
62
+ ],
63
+ summary: createEmptySummary(),
64
+ };
65
+ }
66
+
67
+ export function createDiffResponse({
68
+ files = [],
69
+ isGitRepo = true,
70
+ metaOnly = false,
71
+ path = null,
72
+ scope = 'working-tree',
73
+ summary = {
74
+ additions: 0,
75
+ deletions: 0,
76
+ filesChanged: 0,
77
+ },
78
+ } = {}) {
79
+ return {
80
+ files,
81
+ isGitRepo,
82
+ metaOnly,
83
+ path,
84
+ scope,
85
+ summary,
86
+ };
87
+ }
88
+
89
+ export function createWorkspaceChange({
90
+ changedPaths = [],
91
+ deletedPaths = [],
92
+ refreshExplorer = true,
93
+ renamedPaths = [],
94
+ } = {}) {
95
+ return {
96
+ changedPaths: Array.from(new Set((changedPaths ?? []).filter(Boolean))),
97
+ deletedPaths: Array.from(new Set((deletedPaths ?? []).filter(Boolean))),
98
+ refreshExplorer: Boolean(refreshExplorer),
99
+ renamedPaths: Array.from(new Map(
100
+ (renamedPaths ?? [])
101
+ .filter((entry) => entry?.oldPath && entry?.newPath && entry.oldPath !== entry.newPath)
102
+ .map((entry) => [`${entry.oldPath}:${entry.newPath}`, {
103
+ newPath: entry.newPath,
104
+ oldPath: entry.oldPath,
105
+ }]),
106
+ ).values()),
107
+ };
108
+ }
@@ -0,0 +1,99 @@
1
+ import { parseNumstatOutput, parseStatusOutput } from './parsers.js';
2
+ import { createEmptyStatusResponse } from './responses.js';
3
+
4
+ export class GitStatusService {
5
+ constructor({
6
+ commandRunner,
7
+ statusCacheTtlMs = 2_000,
8
+ untrackedFileService,
9
+ }) {
10
+ this.commandRunner = commandRunner;
11
+ this.statusCacheTtlMs = statusCacheTtlMs;
12
+ this.untrackedFileService = untrackedFileService;
13
+ this.statusCache = {
14
+ expiresAt: 0,
15
+ value: null,
16
+ };
17
+ this.pendingStatusPromise = null;
18
+ }
19
+
20
+ invalidate() {
21
+ this.statusCache = {
22
+ expiresAt: 0,
23
+ value: null,
24
+ };
25
+ this.pendingStatusPromise = null;
26
+ }
27
+
28
+ async getStatus({ force = false } = {}) {
29
+ const isGitRepo = await this.commandRunner.isGitRepo();
30
+ if (!isGitRepo) {
31
+ return createEmptyStatusResponse();
32
+ }
33
+
34
+ const now = Date.now();
35
+ if (!force && this.statusCache.value && now < this.statusCache.expiresAt) {
36
+ return this.statusCache.value;
37
+ }
38
+
39
+ if (this.pendingStatusPromise) {
40
+ return this.pendingStatusPromise;
41
+ }
42
+
43
+ const statusPromise = (async () => {
44
+ const parsed = parseStatusOutput(
45
+ await this.commandRunner.execGit(['status', '--porcelain=v1', '--branch', '--untracked-files=all']),
46
+ );
47
+ const sections = [
48
+ { files: parsed.sections.staged, key: 'staged', label: 'Staged Changes' },
49
+ { files: parsed.sections['working-tree'], key: 'working-tree', label: 'Changes' },
50
+ { files: parsed.sections.untracked, key: 'untracked', label: 'Untracked' },
51
+ ];
52
+ const localSummary = await this.getLocalChangeSummary({
53
+ hasHeadCommit: parsed.branch.hasCommits,
54
+ untrackedFiles: parsed.sections.untracked,
55
+ });
56
+ const response = {
57
+ branch: parsed.branch,
58
+ isGitRepo: true,
59
+ sections,
60
+ summary: {
61
+ ...parsed.summary,
62
+ additions: localSummary.additions,
63
+ deletions: localSummary.deletions,
64
+ },
65
+ };
66
+
67
+ this.statusCache = {
68
+ expiresAt: Date.now() + this.statusCacheTtlMs,
69
+ value: response,
70
+ };
71
+
72
+ return response;
73
+ })();
74
+
75
+ this.pendingStatusPromise = statusPromise;
76
+
77
+ try {
78
+ return await statusPromise;
79
+ } finally {
80
+ if (this.pendingStatusPromise === statusPromise) {
81
+ this.pendingStatusPromise = null;
82
+ }
83
+ }
84
+ }
85
+
86
+ async getLocalChangeSummary({ hasHeadCommit = false, untrackedFiles = [] } = {}) {
87
+ const trackedSummary = parseNumstatOutput(
88
+ await this.commandRunner.execGit(hasHeadCommit
89
+ ? ['diff', '--numstat', 'HEAD']
90
+ : ['diff', '--cached', '--numstat']),
91
+ );
92
+ const untrackedAdditions = await this.untrackedFileService.countAdditions(untrackedFiles);
93
+
94
+ return {
95
+ additions: trackedSummary.additions + untrackedAdditions,
96
+ deletions: trackedSummary.deletions,
97
+ };
98
+ }
99
+ }
@@ -0,0 +1,101 @@
1
+ import { createReadStream } from 'node:fs';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+
5
+ import { mapWithConcurrency } from './concurrency.js';
6
+ import { createEmptyStats } from './responses.js';
7
+ import { splitContentLines } from './parsers.js';
8
+
9
+ async function countFileLines(filePath) {
10
+ return new Promise((resolve, reject) => {
11
+ const stream = createReadStream(filePath, { encoding: 'utf8' });
12
+ let lineCount = 0;
13
+ let sawData = false;
14
+ let lastCharacter = '\n';
15
+
16
+ stream.on('data', (chunk) => {
17
+ if (!chunk) {
18
+ return;
19
+ }
20
+
21
+ sawData = true;
22
+ lastCharacter = chunk[chunk.length - 1];
23
+ lineCount += chunk.match(/\n/gu)?.length ?? 0;
24
+ });
25
+ stream.on('error', reject);
26
+ stream.on('end', () => {
27
+ if (sawData && lastCharacter !== '\n') {
28
+ lineCount += 1;
29
+ }
30
+ resolve(lineCount);
31
+ });
32
+ });
33
+ }
34
+
35
+ function buildSyntheticAddedFileDiff(pathValue, content) {
36
+ const normalizedContent = String(content ?? '').replace(/\r\n/g, '\n');
37
+ const file = {
38
+ code: 'U',
39
+ hunks: [],
40
+ isBinary: false,
41
+ oldPath: null,
42
+ path: pathValue,
43
+ stats: createEmptyStats(),
44
+ status: 'untracked',
45
+ synthetic: true,
46
+ };
47
+ const lines = splitContentLines(normalizedContent);
48
+
49
+ if (lines.length === 0) {
50
+ return file;
51
+ }
52
+
53
+ file.stats.additions = lines.length;
54
+ file.hunks.push({
55
+ header: `@@ -0,0 +1,${lines.length} @@`,
56
+ lines: lines.map((line, index) => ({
57
+ content: line,
58
+ newLine: index + 1,
59
+ oldLine: null,
60
+ type: 'addition',
61
+ })),
62
+ newLines: lines.length,
63
+ newStart: 1,
64
+ oldLines: 0,
65
+ oldStart: 0,
66
+ section: '',
67
+ });
68
+
69
+ return file;
70
+ }
71
+
72
+ export class GitUntrackedFileService {
73
+ constructor({ vaultDir }) {
74
+ this.vaultDir = vaultDir;
75
+ }
76
+
77
+ async countAdditions(files = []) {
78
+ const counts = await mapWithConcurrency(files, 4, async (file) => {
79
+ try {
80
+ return await countFileLines(join(this.vaultDir, file.path));
81
+ } catch {
82
+ return 0;
83
+ }
84
+ });
85
+
86
+ return counts.reduce((total, count) => total + count, 0);
87
+ }
88
+
89
+ async buildSyntheticDiffs(files = []) {
90
+ const results = await mapWithConcurrency(files, 2, async (file) => {
91
+ try {
92
+ const content = await readFile(join(this.vaultDir, file.path), 'utf8');
93
+ return buildSyntheticAddedFileDiff(file.path, content);
94
+ } catch {
95
+ return null;
96
+ }
97
+ });
98
+
99
+ return results.filter(Boolean);
100
+ }
101
+ }
@@ -0,0 +1,48 @@
1
+ import { getRequestErrorStatusCode } from './http-errors.js';
2
+ import { jsonResponse } from './http-response.js';
3
+ import { parseJsonBody } from './request-body.js';
4
+
5
+ function applyAuthResponse(req, res, result) {
6
+ if (result?.setCookie) {
7
+ res.setHeader('Set-Cookie', result.setCookie);
8
+ }
9
+
10
+ jsonResponse(req, res, result?.statusCode ?? 200, result?.body ?? { ok: true });
11
+ return true;
12
+ }
13
+
14
+ export function createAuthApiHandler({ authService }) {
15
+ return async function handleAuthApi(req, res, requestUrl) {
16
+ if (!(requestUrl.pathname === '/api/auth' || requestUrl.pathname.startsWith('/api/auth/'))) {
17
+ return false;
18
+ }
19
+
20
+ if (requestUrl.pathname === '/api/auth/status' && req.method === 'GET') {
21
+ return applyAuthResponse(req, res, authService.getStatus(req));
22
+ }
23
+
24
+ if (requestUrl.pathname === '/api/auth/session' && req.method === 'POST') {
25
+ try {
26
+ const body = await parseJsonBody(req);
27
+ return applyAuthResponse(req, res, authService.createSession(req, body));
28
+ } catch (error) {
29
+ const statusCode = getRequestErrorStatusCode(error);
30
+ if (statusCode) {
31
+ jsonResponse(req, res, statusCode, { error: error.message });
32
+ return true;
33
+ }
34
+
35
+ console.error('[api] Failed to create auth session:', error.message);
36
+ jsonResponse(req, res, 500, { error: 'Failed to create auth session' });
37
+ return true;
38
+ }
39
+ }
40
+
41
+ if (requestUrl.pathname === '/api/auth/session' && req.method === 'DELETE') {
42
+ return applyAuthResponse(req, res, authService.clearSession(req));
43
+ }
44
+
45
+ jsonResponse(req, res, 404, { error: 'Auth endpoint not found' });
46
+ return true;
47
+ };
48
+ }
@@ -0,0 +1,130 @@
1
+ import { createRequestError } from './http-errors.js';
2
+ import { sendResponse, textResponse } from './http-response.js';
3
+
4
+ const ESM_PROXY_PREFIX = '/_esm/';
5
+ const ESM_UPSTREAM_ORIGIN = 'https://esm.sh';
6
+ const ESM_TEXT_CONTENT_TYPE_PATTERN = /\b(?:javascript|ecmascript|css|json|text\/plain|text\/css)\b/i;
7
+
8
+ function rewriteEsmText(body) {
9
+ return body
10
+ .replace(/((?:from|import)\s*(?:\(\s*)?["'])\/(?!_esm\/)/g, '$1/_esm/')
11
+ .replace(/((?:import|url)\(\s*["']?)\/(?!_esm\/)/g, '$1/_esm/')
12
+ .replace(/(@import\s+["'])\/(?!_esm\/)/g, '$1/_esm/');
13
+ }
14
+
15
+ function looksLikeHtmlDocument(body) {
16
+ const trimmed = body.trimStart();
17
+ return trimmed.startsWith('<!DOCTYPE html')
18
+ || trimmed.startsWith('<!doctype html')
19
+ || trimmed.startsWith('<html')
20
+ || trimmed.startsWith('<HTML')
21
+ || trimmed.startsWith('<?xml');
22
+ }
23
+
24
+ function isEsmProxyPath(pathname) {
25
+ return pathname === '/_esm' || pathname.startsWith(ESM_PROXY_PREFIX);
26
+ }
27
+
28
+ function resolveEsmUpstreamUrl(requestUrl) {
29
+ const proxiedPath = requestUrl.pathname === '/_esm'
30
+ ? ''
31
+ : requestUrl.pathname.slice(ESM_PROXY_PREFIX.length);
32
+
33
+ if (!proxiedPath) {
34
+ throw createRequestError(400, 'Missing esm.sh module path');
35
+ }
36
+
37
+ return new URL(`${proxiedPath}${requestUrl.search}`, `${ESM_UPSTREAM_ORIGIN}/`).toString();
38
+ }
39
+
40
+ export function createEsmProxyHandler() {
41
+ const esmAssetCache = new Map();
42
+
43
+ async function fetchEsmAsset(upstreamUrl) {
44
+ if (!globalThis.fetch) {
45
+ throw createRequestError(500, 'Global fetch is unavailable for esm proxy');
46
+ }
47
+
48
+ if (!esmAssetCache.has(upstreamUrl)) {
49
+ esmAssetCache.set(upstreamUrl, (async () => {
50
+ let lastError = null;
51
+
52
+ for (let attempt = 1; attempt <= 3; attempt += 1) {
53
+ try {
54
+ const response = await globalThis.fetch(upstreamUrl, {
55
+ headers: {
56
+ Accept: 'text/javascript, application/javascript, text/css;q=0.9, */*;q=0.5',
57
+ },
58
+ redirect: 'follow',
59
+ });
60
+
61
+ if (!response.ok) {
62
+ throw createRequestError(502, `esm.sh responded with ${response.status}`);
63
+ }
64
+
65
+ const contentType = response.headers.get('content-type') || 'application/octet-stream';
66
+ const cacheControl = response.headers.get('cache-control') || 'public, max-age=300';
67
+
68
+ if (ESM_TEXT_CONTENT_TYPE_PATTERN.test(contentType)) {
69
+ const text = await response.text();
70
+ if (looksLikeHtmlDocument(text)) {
71
+ throw createRequestError(502, 'esm.sh returned HTML for a module asset');
72
+ }
73
+
74
+ return {
75
+ body: rewriteEsmText(text),
76
+ cacheControl,
77
+ contentType,
78
+ };
79
+ }
80
+
81
+ return {
82
+ body: Buffer.from(await response.arrayBuffer()),
83
+ cacheControl,
84
+ contentType,
85
+ };
86
+ } catch (error) {
87
+ lastError = error;
88
+ }
89
+ }
90
+
91
+ throw lastError || createRequestError(502, 'Failed to fetch esm.sh asset');
92
+ })().catch((error) => {
93
+ esmAssetCache.delete(upstreamUrl);
94
+ throw error;
95
+ }));
96
+ }
97
+
98
+ return esmAssetCache.get(upstreamUrl);
99
+ }
100
+
101
+ return async function handleEsmProxy(req, res, requestUrl) {
102
+ if (!isEsmProxyPath(requestUrl.pathname)) {
103
+ return false;
104
+ }
105
+
106
+ if (req.method !== 'GET' && req.method !== 'HEAD') {
107
+ textResponse(req, res, 405, 'Method Not Allowed');
108
+ return true;
109
+ }
110
+
111
+ try {
112
+ const upstreamUrl = resolveEsmUpstreamUrl(requestUrl);
113
+ const asset = await fetchEsmAsset(upstreamUrl);
114
+ sendResponse(req, res, {
115
+ body: asset.body,
116
+ headers: {
117
+ 'Cache-Control': asset.cacheControl,
118
+ 'Content-Type': asset.contentType,
119
+ },
120
+ statusCode: 200,
121
+ });
122
+ } catch (error) {
123
+ const statusCode = Number.isInteger(error?.statusCode) ? error.statusCode : 502;
124
+ console.error(`[http] Failed to proxy "${requestUrl.pathname}":`, error.message);
125
+ textResponse(req, res, statusCode, 'Bad Gateway', { 'Cache-Control': 'no-store' });
126
+ }
127
+
128
+ return true;
129
+ };
130
+ }
@@ -0,0 +1,170 @@
1
+ import { getRequestErrorStatusCode } from './http-errors.js';
2
+ import { jsonResponse } from './http-response.js';
3
+ import { parseJsonBody } from './request-body.js';
4
+ import { createEmptyWorkspaceChange } from '../git/responses.js';
5
+
6
+ async function parseRequiredBody(req, res, fieldName) {
7
+ const body = await parseJsonBody(req);
8
+ if (!body?.[fieldName]) {
9
+ jsonResponse(req, res, 400, { error: `Missing ${fieldName}` });
10
+ return null;
11
+ }
12
+
13
+ return body;
14
+ }
15
+
16
+ function handleGitError(req, res, error, logMessage, fallbackMessage) {
17
+ const statusCode = getRequestErrorStatusCode(error);
18
+ if (statusCode) {
19
+ jsonResponse(req, res, statusCode, { error: error.message });
20
+ return true;
21
+ }
22
+
23
+ console.error(logMessage, error.message);
24
+ jsonResponse(req, res, 500, { error: fallbackMessage });
25
+ return true;
26
+ }
27
+
28
+ function hasWorkspaceMutation(workspaceChange = {}) {
29
+ return Boolean(
30
+ (workspaceChange.changedPaths?.length ?? 0) > 0
31
+ || (workspaceChange.deletedPaths?.length ?? 0) > 0
32
+ || (workspaceChange.renamedPaths?.length ?? 0) > 0,
33
+ );
34
+ }
35
+
36
+ async function applyWorkspaceMutationEffects({
37
+ backlinkIndex,
38
+ responsePayload,
39
+ roomRegistry,
40
+ vaultFileStore,
41
+ }) {
42
+ const workspaceChange = responsePayload?.workspaceChange ?? createEmptyWorkspaceChange();
43
+ responsePayload.workspaceChange = workspaceChange;
44
+
45
+ if (!hasWorkspaceMutation(workspaceChange)) {
46
+ return responsePayload;
47
+ }
48
+
49
+ await vaultFileStore?.reconcileSidecars?.(workspaceChange);
50
+ await backlinkIndex?.build?.();
51
+ await roomRegistry?.reconcileWorkspaceChange?.(workspaceChange);
52
+ return responsePayload;
53
+ }
54
+
55
+ export function createGitApiCommandHandler({
56
+ backlinkIndex = null,
57
+ gitService,
58
+ roomRegistry = null,
59
+ vaultFileStore = null,
60
+ }) {
61
+ return async function handleGitApiCommand(req, res, requestUrl) {
62
+ if (requestUrl.pathname === '/api/git/stage' && req.method === 'POST') {
63
+ try {
64
+ const body = await parseRequiredBody(req, res, 'path');
65
+ if (!body) {
66
+ return true;
67
+ }
68
+
69
+ jsonResponse(req, res, 200, await applyWorkspaceMutationEffects({
70
+ backlinkIndex,
71
+ responsePayload: await gitService.stageFile(body.path),
72
+ roomRegistry,
73
+ vaultFileStore,
74
+ }));
75
+ } catch (error) {
76
+ handleGitError(req, res, error, '[api] Failed to stage git file:', 'Failed to stage git file');
77
+ }
78
+ return true;
79
+ }
80
+
81
+ if (requestUrl.pathname === '/api/git/unstage' && req.method === 'POST') {
82
+ try {
83
+ const body = await parseRequiredBody(req, res, 'path');
84
+ if (!body) {
85
+ return true;
86
+ }
87
+
88
+ jsonResponse(req, res, 200, await applyWorkspaceMutationEffects({
89
+ backlinkIndex,
90
+ responsePayload: await gitService.unstageFile(body.path),
91
+ roomRegistry,
92
+ vaultFileStore,
93
+ }));
94
+ } catch (error) {
95
+ handleGitError(req, res, error, '[api] Failed to unstage git file:', 'Failed to unstage git file');
96
+ }
97
+ return true;
98
+ }
99
+
100
+ if (requestUrl.pathname === '/api/git/commit' && req.method === 'POST') {
101
+ try {
102
+ const body = await parseRequiredBody(req, res, 'message');
103
+ if (!body) {
104
+ return true;
105
+ }
106
+
107
+ jsonResponse(req, res, 200, await applyWorkspaceMutationEffects({
108
+ backlinkIndex,
109
+ responsePayload: await gitService.commitStaged({
110
+ message: body.message,
111
+ }),
112
+ roomRegistry,
113
+ vaultFileStore,
114
+ }));
115
+ } catch (error) {
116
+ handleGitError(req, res, error, '[api] Failed to commit staged changes:', 'Failed to commit staged changes');
117
+ }
118
+ return true;
119
+ }
120
+
121
+ if (requestUrl.pathname === '/api/git/push' && req.method === 'POST') {
122
+ try {
123
+ jsonResponse(req, res, 200, await applyWorkspaceMutationEffects({
124
+ backlinkIndex,
125
+ responsePayload: await gitService.pushBranch(),
126
+ roomRegistry,
127
+ vaultFileStore,
128
+ }));
129
+ } catch (error) {
130
+ handleGitError(req, res, error, '[api] Failed to push git branch:', 'Failed to push git branch');
131
+ }
132
+ return true;
133
+ }
134
+
135
+ if (requestUrl.pathname === '/api/git/pull' && req.method === 'POST') {
136
+ try {
137
+ jsonResponse(req, res, 200, await applyWorkspaceMutationEffects({
138
+ backlinkIndex,
139
+ responsePayload: await gitService.pullBranch(),
140
+ roomRegistry,
141
+ vaultFileStore,
142
+ }));
143
+ } catch (error) {
144
+ handleGitError(req, res, error, '[api] Failed to pull git branch:', 'Failed to pull git branch');
145
+ }
146
+ return true;
147
+ }
148
+
149
+ if (requestUrl.pathname === '/api/git/reset-file' && req.method === 'POST') {
150
+ try {
151
+ const body = await parseRequiredBody(req, res, 'path');
152
+ if (!body) {
153
+ return true;
154
+ }
155
+
156
+ jsonResponse(req, res, 200, await applyWorkspaceMutationEffects({
157
+ backlinkIndex,
158
+ responsePayload: await gitService.resetFileToHead(body.path),
159
+ roomRegistry,
160
+ vaultFileStore,
161
+ }));
162
+ } catch (error) {
163
+ handleGitError(req, res, error, '[api] Failed to reset git file:', 'Failed to reset git file');
164
+ }
165
+ return true;
166
+ }
167
+
168
+ return false;
169
+ };
170
+ }
@@ -0,0 +1,40 @@
1
+ import { jsonResponse } from './http-response.js';
2
+ import { createGitApiCommandHandler } from './create-git-api-command-handler.js';
3
+ import { createGitApiQueryHandler } from './create-git-api-query-handler.js';
4
+
5
+ export function createGitApiHandler({
6
+ backlinkIndex = null,
7
+ gitService = null,
8
+ roomRegistry = null,
9
+ vaultFileStore = null,
10
+ }) {
11
+ const handleGitApiQuery = createGitApiQueryHandler({ gitService });
12
+ const handleGitApiCommand = createGitApiCommandHandler({
13
+ backlinkIndex,
14
+ gitService,
15
+ roomRegistry,
16
+ vaultFileStore,
17
+ });
18
+
19
+ return async function handleGitApi(req, res, requestUrl) {
20
+ if (!requestUrl.pathname.startsWith('/api/git')) {
21
+ return false;
22
+ }
23
+
24
+ if (!gitService) {
25
+ jsonResponse(req, res, 503, { error: 'Git integration is not configured' });
26
+ return true;
27
+ }
28
+
29
+ if (await handleGitApiQuery(req, res, requestUrl)) {
30
+ return true;
31
+ }
32
+
33
+ if (await handleGitApiCommand(req, res, requestUrl)) {
34
+ return true;
35
+ }
36
+
37
+ jsonResponse(req, res, 404, { error: 'Git API endpoint not found' });
38
+ return true;
39
+ };
40
+ }