upfynai-code 2.5.1 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/README.md +123 -88
  2. package/bin/cli.js +63 -0
  3. package/package.json +48 -112
  4. package/src/auth.js +115 -0
  5. package/src/config.js +33 -0
  6. package/src/connect.js +314 -0
  7. package/src/launch.js +54 -0
  8. package/src/mcp.js +57 -0
  9. package/src/server.js +54 -0
  10. package/client/dist/api-docs.html +0 -879
  11. package/client/dist/assets/AppContent-C0CyP3g5.js +0 -513
  12. package/client/dist/assets/CanvasPanel-0u9QR7U-.js +0 -34
  13. package/client/dist/assets/CanvasPanel-WhZulBJw.css +0 -1
  14. package/client/dist/assets/DashboardPanel-Dgqw1yZk.js +0 -1
  15. package/client/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  16. package/client/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  17. package/client/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  18. package/client/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  19. package/client/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  20. package/client/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  21. package/client/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  22. package/client/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  23. package/client/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  24. package/client/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  25. package/client/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  26. package/client/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  27. package/client/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  28. package/client/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  29. package/client/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  30. package/client/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  31. package/client/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  32. package/client/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  33. package/client/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  34. package/client/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  35. package/client/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  36. package/client/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  37. package/client/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  38. package/client/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  39. package/client/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  40. package/client/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  41. package/client/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  42. package/client/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  43. package/client/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  44. package/client/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  45. package/client/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  46. package/client/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  47. package/client/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  48. package/client/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  49. package/client/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  50. package/client/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  51. package/client/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  52. package/client/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  53. package/client/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  54. package/client/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  55. package/client/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  56. package/client/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  57. package/client/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  58. package/client/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  59. package/client/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  60. package/client/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  61. package/client/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  62. package/client/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  63. package/client/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  64. package/client/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  65. package/client/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  66. package/client/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  67. package/client/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  68. package/client/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  69. package/client/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  70. package/client/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  71. package/client/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  72. package/client/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  73. package/client/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  74. package/client/dist/assets/LoginModal-CZDEzqjK.js +0 -19
  75. package/client/dist/assets/MarkdownPreview-CYdvwJaV.js +0 -1
  76. package/client/dist/assets/Onboarding-DR6NZ4Vz.js +0 -1
  77. package/client/dist/assets/SetupForm-D49gtWY4.js +0 -1
  78. package/client/dist/assets/Tableau10-B-NsZVaP.js +0 -1
  79. package/client/dist/assets/WorkflowsPanel-CqlbEJA_.js +0 -1
  80. package/client/dist/assets/_commonjs-dynamic-modules-TDtrdbi3.js +0 -1
  81. package/client/dist/assets/ar-SA-G6X2FPQ2-BWqa1yBH.js +0 -10
  82. package/client/dist/assets/arc-BegSKqEW.js +0 -1
  83. package/client/dist/assets/array-BKyUJesY.js +0 -1
  84. package/client/dist/assets/az-AZ-76LH7QW2-DrVlbZDP.js +0 -1
  85. package/client/dist/assets/bg-BG-XCXSNQG7-DdunjBgT.js +0 -5
  86. package/client/dist/assets/blockDiagram-38ab4fdb-BKMbwGHu.js +0 -118
  87. package/client/dist/assets/bn-BD-2XOGV67Q-_7DtmvwO.js +0 -5
  88. package/client/dist/assets/c4Diagram-3d4e48cf-hJuiHhSn.js +0 -10
  89. package/client/dist/assets/ca-ES-6MX7JW3Y-BFIrmojG.js +0 -8
  90. package/client/dist/assets/channel-Bur-rRTp.js +0 -1
  91. package/client/dist/assets/classDiagram-70f12bd4-BjiAf9cM.js +0 -2
  92. package/client/dist/assets/classDiagram-v2-f2320105-pwBewejc.js +0 -2
  93. package/client/dist/assets/clone-BtqXeoBJ.js +0 -1
  94. package/client/dist/assets/createText-2e5e7dd3-Dq_acOWe.js +0 -5
  95. package/client/dist/assets/cs-CZ-2BRQDIVT-B-x4F6TJ.js +0 -11
  96. package/client/dist/assets/da-DK-5WZEPLOC-Btlc8Dgn.js +0 -5
  97. package/client/dist/assets/de-DE-XR44H4JA-BVu3ZIoD.js +0 -8
  98. package/client/dist/assets/directory-open-01563666-DWU9wJ6I.js +0 -1
  99. package/client/dist/assets/directory-open-4ed118d0-CunoC1EB.js +0 -1
  100. package/client/dist/assets/edges-e0da2a9e-DH0wVTXR.js +0 -4
  101. package/client/dist/assets/el-GR-BZB4AONW-h2ll8_ZC.js +0 -10
  102. package/client/dist/assets/erDiagram-9861fffd-BYezLIR7.js +0 -51
  103. package/client/dist/assets/es-ES-U4NZUMDT-Cveiulwt.js +0 -9
  104. package/client/dist/assets/eu-ES-A7QVB2H4-DQluL2PY.js +0 -11
  105. package/client/dist/assets/fa-IR-HGAKTJCU-BJtcMBSv.js +0 -8
  106. package/client/dist/assets/fi-FI-Z5N7JZ37-D8NfbVXV.js +0 -6
  107. package/client/dist/assets/file-open-002ab408-DIuFHtCF.js +0 -1
  108. package/client/dist/assets/file-open-7c801643-684qeFg4.js +0 -1
  109. package/client/dist/assets/file-save-3189631c-C1wFhQhH.js +0 -1
  110. package/client/dist/assets/file-save-745eba88-Bb9F9Kg7.js +0 -1
  111. package/client/dist/assets/flowDb-956e92f1-scnUykhM.js +0 -10
  112. package/client/dist/assets/flowDiagram-66a62f08-jVyWsfyU.js +0 -4
  113. package/client/dist/assets/flowDiagram-v2-96b9c2cf-N6xgi25h.js +0 -1
  114. package/client/dist/assets/flowchart-elk-definition-4a651766-gKGX3HqR.js +0 -139
  115. package/client/dist/assets/fr-FR-RHASNOE6-vdj42kC6.js +0 -9
  116. package/client/dist/assets/ganttDiagram-c361ad54-C2CiWFUP.js +0 -257
  117. package/client/dist/assets/gitGraphDiagram-72cf32ee-C59Yz2LK.js +0 -70
  118. package/client/dist/assets/gl-ES-HMX3MZ6V-DQo0TzoP.js +0 -10
  119. package/client/dist/assets/graph-Dx_H43Kv.js +0 -1
  120. package/client/dist/assets/he-IL-6SHJWFNN-DKXK5e33.js +0 -10
  121. package/client/dist/assets/hi-IN-IWLTKZ5I-C2Qgqc0R.js +0 -4
  122. package/client/dist/assets/hu-HU-A5ZG7DT2-Ss-6vX0m.js +0 -7
  123. package/client/dist/assets/id-ID-SAP4L64H-D7Wsg1S2.js +0 -10
  124. package/client/dist/assets/image-blob-reduce.esm-D6s-rqMO.js +0 -7
  125. package/client/dist/assets/index-3862675e-u8Nv7hHC.js +0 -1
  126. package/client/dist/assets/index-BVowJdZF.js +0 -97
  127. package/client/dist/assets/index-ce18TYkg.js +0 -27
  128. package/client/dist/assets/index-kQoJx-bc.css +0 -1
  129. package/client/dist/assets/infoDiagram-f8f76790-LmoJYsxo.js +0 -7
  130. package/client/dist/assets/init-Gi6I4Gst.js +0 -1
  131. package/client/dist/assets/it-IT-JPQ66NNP-CAPTVl7M.js +0 -11
  132. package/client/dist/assets/ja-JP-DBVTYXUO-eNVPawR2.js +0 -8
  133. package/client/dist/assets/journeyDiagram-49397b02-BaJqehpR.js +0 -139
  134. package/client/dist/assets/kaa-6HZHGXH3-tpuNkKhS.js +0 -1
  135. package/client/dist/assets/kab-KAB-ZGHBKWFO-Dp83kx4x.js +0 -8
  136. package/client/dist/assets/kk-KZ-P5N5QNE5-B9IlC6YN.js +0 -1
  137. package/client/dist/assets/km-KH-HSX4SM5Z-B_KMYaMj.js +0 -11
  138. package/client/dist/assets/ko-KR-MTYHY66A-yebnUNdb.js +0 -9
  139. package/client/dist/assets/ku-TR-6OUDTVRD-BR6fh6-5.js +0 -9
  140. package/client/dist/assets/layout-DLl5Jwcl.js +0 -1
  141. package/client/dist/assets/line-FpB7omSK.js +0 -1
  142. package/client/dist/assets/linear-CkXqUFJ8.js +0 -1
  143. package/client/dist/assets/lt-LT-XHIRWOB4-SutZSWtR.js +0 -3
  144. package/client/dist/assets/lv-LV-5QDEKY6T-DuAxdcZL.js +0 -7
  145. package/client/dist/assets/mindmap-definition-fc14e90a-DyxXOExh.js +0 -425
  146. package/client/dist/assets/mr-IN-CRQNXWMA-DqDUWM_8.js +0 -13
  147. package/client/dist/assets/my-MM-5M5IBNSE-C40kMFMR.js +0 -1
  148. package/client/dist/assets/nb-NO-T6EIAALU-DVij32Ju.js +0 -10
  149. package/client/dist/assets/nl-NL-IS3SIHDZ-rT84mDYq.js +0 -8
  150. package/client/dist/assets/nn-NO-6E72VCQL-BBZXBW8V.js +0 -8
  151. package/client/dist/assets/oc-FR-POXYY2M6-DzjOugOf.js +0 -8
  152. package/client/dist/assets/ordinal-Cboi1Yqb.js +0 -1
  153. package/client/dist/assets/pa-IN-N4M65BXN-DD1iU8_F.js +0 -4
  154. package/client/dist/assets/path-CbwjOpE9.js +0 -1
  155. package/client/dist/assets/pdf-CE_K4jFx.js +0 -12
  156. package/client/dist/assets/pdf.worker-BA9kU3Pw.mjs +0 -61080
  157. package/client/dist/assets/percentages-BXMCSKIN-WVlHS4wx.js +0 -207
  158. package/client/dist/assets/pica-CQIY57Tf.js +0 -7
  159. package/client/dist/assets/pieDiagram-8a3498a8-Dd_85qBH.js +0 -35
  160. package/client/dist/assets/pl-PL-T2D74RX3-ukVXa48G.js +0 -9
  161. package/client/dist/assets/pt-BR-5N22H2LF-BibawarT.js +0 -9
  162. package/client/dist/assets/pt-PT-UZXXM6DQ-So3i9l9w.js +0 -9
  163. package/client/dist/assets/quadrantDiagram-120e2f19-C4dFVDEx.js +0 -7
  164. package/client/dist/assets/requirementDiagram-deff3bca-DrTO7yFl.js +0 -52
  165. package/client/dist/assets/ro-RO-JPDTUUEW-DY0Xq_Hd.js +0 -11
  166. package/client/dist/assets/roundRect-0PYZxl1G.js +0 -1
  167. package/client/dist/assets/ru-RU-B4JR7IUQ-B7u_Zvkd.js +0 -9
  168. package/client/dist/assets/sankeyDiagram-04a897e0-D24gfzuS.js +0 -8
  169. package/client/dist/assets/sequenceDiagram-704730f1-Dgji2XLQ.js +0 -122
  170. package/client/dist/assets/si-LK-N5RQ5JYF-OejsLzQ_.js +0 -1
  171. package/client/dist/assets/sk-SK-C5VTKIMK-_vy2Bt-M.js +0 -6
  172. package/client/dist/assets/sl-SI-NN7IZMDC-DKOl_u2M.js +0 -6
  173. package/client/dist/assets/stateDiagram-587899a1-CJ8eBaiU.js +0 -1
  174. package/client/dist/assets/stateDiagram-v2-d93cdb3a-C5K3l-Nt.js +0 -1
  175. package/client/dist/assets/styles-6aaf32cf-DAKE0jbx.js +0 -207
  176. package/client/dist/assets/styles-9a916d00-LFAJCgEy.js +0 -160
  177. package/client/dist/assets/styles-c10674c1-CllKO8NG.js +0 -116
  178. package/client/dist/assets/subset-shared.chunk-Uy-J87FQ.js +0 -84
  179. package/client/dist/assets/subset-worker.chunk-dvgDvqt9.js +0 -1
  180. package/client/dist/assets/sv-SE-XGPEYMSR-CDCB2ZV5.js +0 -10
  181. package/client/dist/assets/svgDrawCommon-08f97a94-CObOzbFQ.js +0 -1
  182. package/client/dist/assets/ta-IN-2NMHFXQM-DHUNdO69.js +0 -9
  183. package/client/dist/assets/th-TH-HPSO5L25-zI2hnBq3.js +0 -2
  184. package/client/dist/assets/timeline-definition-85554ec2-C2XHRmxK.js +0 -61
  185. package/client/dist/assets/tr-TR-DEFEU3FU-l-6Hu4-D.js +0 -7
  186. package/client/dist/assets/uk-UA-QMV73CPH-CqSOwrl7.js +0 -6
  187. package/client/dist/assets/vendor-codemirror-D_s0aGBu.js +0 -35
  188. package/client/dist/assets/vendor-i18n-DCFGyhQR.js +0 -1
  189. package/client/dist/assets/vendor-icons-Lb69KSFJ.js +0 -646
  190. package/client/dist/assets/vendor-markdown-BXEi_H3G.js +0 -298
  191. package/client/dist/assets/vendor-react-9mUTKBHH.js +0 -67
  192. package/client/dist/assets/vendor-syntax-DnmwQQJF.js +0 -16
  193. package/client/dist/assets/vendor-xterm-CZq1hqo1.js +0 -66
  194. package/client/dist/assets/vendor-xterm-qxJ8_QYu.css +0 -32
  195. package/client/dist/assets/vi-VN-M7AON7JQ-CUL8-mBZ.js +0 -5
  196. package/client/dist/assets/xychartDiagram-e933f94c-1fmf6slj.js +0 -7
  197. package/client/dist/assets/zh-CN-LNUGB5OW-CB5y5VVU.js +0 -10
  198. package/client/dist/assets/zh-HK-E62DVLB3-BHcrrEeJ.js +0 -1
  199. package/client/dist/assets/zh-TW-RAJ6MFWO-DoDUdkaJ.js +0 -9
  200. package/client/dist/clear-cache.html +0 -85
  201. package/client/dist/convert-icons.md +0 -53
  202. package/client/dist/favicon.png +0 -0
  203. package/client/dist/favicon.svg +0 -9
  204. package/client/dist/generate-icons.js +0 -49
  205. package/client/dist/icons/claude-ai-icon.svg +0 -1
  206. package/client/dist/icons/codex-white.svg +0 -3
  207. package/client/dist/icons/codex.svg +0 -3
  208. package/client/dist/icons/cursor-white.svg +0 -12
  209. package/client/dist/icons/cursor.svg +0 -1
  210. package/client/dist/icons/icon-128x128.png +0 -0
  211. package/client/dist/icons/icon-128x128.svg +0 -12
  212. package/client/dist/icons/icon-144x144.png +0 -0
  213. package/client/dist/icons/icon-144x144.svg +0 -12
  214. package/client/dist/icons/icon-152x152.png +0 -0
  215. package/client/dist/icons/icon-152x152.svg +0 -12
  216. package/client/dist/icons/icon-192x192.png +0 -0
  217. package/client/dist/icons/icon-192x192.svg +0 -12
  218. package/client/dist/icons/icon-384x384.png +0 -0
  219. package/client/dist/icons/icon-384x384.svg +0 -12
  220. package/client/dist/icons/icon-512x512.png +0 -0
  221. package/client/dist/icons/icon-512x512.svg +0 -12
  222. package/client/dist/icons/icon-72x72.png +0 -0
  223. package/client/dist/icons/icon-72x72.svg +0 -12
  224. package/client/dist/icons/icon-96x96.png +0 -0
  225. package/client/dist/icons/icon-96x96.svg +0 -12
  226. package/client/dist/icons/icon-template.svg +0 -12
  227. package/client/dist/index.html +0 -128
  228. package/client/dist/logo-128.png +0 -0
  229. package/client/dist/logo-256.png +0 -0
  230. package/client/dist/logo-32.png +0 -0
  231. package/client/dist/logo-512.png +0 -0
  232. package/client/dist/logo-64.png +0 -0
  233. package/client/dist/logo.svg +0 -17
  234. package/client/dist/manifest.json +0 -61
  235. package/client/dist/mcp-docs.html +0 -119
  236. package/client/dist/screenshots/cli-selection.png +0 -0
  237. package/client/dist/screenshots/desktop-main.png +0 -0
  238. package/client/dist/screenshots/mobile-chat.png +0 -0
  239. package/client/dist/screenshots/tools-modal.png +0 -0
  240. package/client/dist/sw.js +0 -19
  241. package/commands/upfynai-connect.md +0 -59
  242. package/commands/upfynai-disconnect.md +0 -31
  243. package/commands/upfynai-doctor.md +0 -99
  244. package/commands/upfynai-export.md +0 -49
  245. package/commands/upfynai-local.md +0 -82
  246. package/commands/upfynai-status.md +0 -75
  247. package/commands/upfynai-stop.md +0 -49
  248. package/commands/upfynai-uninstall.md +0 -58
  249. package/commands/upfynai.md +0 -69
  250. package/scripts/build-client.js +0 -17
  251. package/scripts/fix-node-pty.js +0 -67
  252. package/scripts/install-commands.js +0 -78
  253. package/server/claude-sdk.js +0 -714
  254. package/server/cli-ui.js +0 -785
  255. package/server/cli.js +0 -596
  256. package/server/constants/config.js +0 -31
  257. package/server/cursor-cli.js +0 -270
  258. package/server/database/auth.db +0 -0
  259. package/server/database/db.js +0 -808
  260. package/server/database/init.sql +0 -70
  261. package/server/index.js +0 -2621
  262. package/server/load-env.js +0 -26
  263. package/server/mcp-server.js +0 -621
  264. package/server/middleware/auth.js +0 -173
  265. package/server/openai-codex.js +0 -403
  266. package/server/openrouter.js +0 -137
  267. package/server/projects.js +0 -1742
  268. package/server/relay-client.js +0 -619
  269. package/server/routes/agent.js +0 -1266
  270. package/server/routes/auth.js +0 -263
  271. package/server/routes/cli-auth.js +0 -263
  272. package/server/routes/codex.js +0 -344
  273. package/server/routes/commands.js +0 -601
  274. package/server/routes/cursor.js +0 -808
  275. package/server/routes/dashboard.js +0 -52
  276. package/server/routes/git.js +0 -1165
  277. package/server/routes/mcp-utils.js +0 -48
  278. package/server/routes/mcp.js +0 -552
  279. package/server/routes/payments.js +0 -172
  280. package/server/routes/projects.js +0 -552
  281. package/server/routes/settings.js +0 -269
  282. package/server/routes/taskmaster.js +0 -1964
  283. package/server/routes/user.js +0 -106
  284. package/server/routes/voice.js +0 -198
  285. package/server/routes/webhooks.js +0 -166
  286. package/server/routes/workflows.js +0 -118
  287. package/server/services/whisperService.js +0 -84
  288. package/server/services/workflowScheduler.js +0 -186
  289. package/server/utils/commandParser.js +0 -303
  290. package/server/utils/gitConfig.js +0 -24
  291. package/server/utils/mcp-detector.js +0 -198
  292. package/server/utils/taskmaster-websocket.js +0 -129
  293. package/shared/modelConstants.js +0 -96
@@ -1,186 +0,0 @@
1
- import cron from 'node-cron';
2
- import { workflowDb, webhookDb } from '../database/db.js';
3
-
4
- const activeJobs = new Map(); // workflowId -> cron task
5
-
6
- /**
7
- * Execute a single workflow's steps (same logic as the /run endpoint).
8
- * Returns { success, results, error }
9
- */
10
- async function executeWorkflow(workflow) {
11
- const steps = typeof workflow.steps === 'string' ? JSON.parse(workflow.steps) : workflow.steps;
12
- if (!steps.length) return { success: false, error: 'No steps' };
13
-
14
- const run = await workflowDb.createRun(workflow.id, workflow.user_id, steps.length);
15
- const results = [];
16
- let lastOutput = null;
17
-
18
- for (let i = 0; i < steps.length; i++) {
19
- const step = steps[i];
20
- try {
21
- let stepResult;
22
-
23
- if (step.type === 'webhook') {
24
- const webhookId = step.config?.webhookId;
25
- if (!webhookId) throw new Error('No webhook configured');
26
-
27
- const webhook = await webhookDb.getById(Number(webhookId), workflow.user_id);
28
- if (!webhook) throw new Error('Webhook not found');
29
-
30
- let parsedHeaders = {};
31
- try { parsedHeaders = JSON.parse(webhook.headers || '{}'); } catch { /* ignore */ }
32
-
33
- const controller = new AbortController();
34
- const timeout = setTimeout(() => controller.abort(), 15000);
35
-
36
- const fetchOptions = {
37
- method: webhook.method,
38
- headers: {
39
- 'Content-Type': 'application/json',
40
- 'User-Agent': 'UpfynAI-Scheduler/1.0',
41
- ...parsedHeaders
42
- },
43
- signal: controller.signal
44
- };
45
-
46
- if (['POST', 'PUT', 'PATCH'].includes(webhook.method)) {
47
- const payload = {
48
- workflow_id: workflow.id,
49
- workflow_name: workflow.name,
50
- step_index: i,
51
- step_label: step.label,
52
- previous_output: lastOutput,
53
- scheduled: true,
54
- timestamp: new Date().toISOString()
55
- };
56
- if (step.config?.payloadTemplate) {
57
- try { Object.assign(payload, JSON.parse(step.config.payloadTemplate)); } catch { /* ignore */ }
58
- }
59
- fetchOptions.body = JSON.stringify(payload);
60
- }
61
-
62
- const response = await fetch(webhook.url, fetchOptions);
63
- clearTimeout(timeout);
64
-
65
- const contentType = response.headers.get('content-type') || '';
66
- let body;
67
- if (contentType.includes('application/json')) {
68
- body = await response.json();
69
- } else {
70
- body = await response.text();
71
- if (body.length > 5000) body = body.slice(0, 5000) + '...';
72
- }
73
-
74
- await webhookDb.updateLastTriggered(webhook.id);
75
- stepResult = { status: response.status, body };
76
- lastOutput = body;
77
-
78
- } else if (step.type === 'ai-prompt') {
79
- stepResult = { type: 'ai-prompt', prompt: step.config?.prompt || '', note: 'Scheduled AI prompts require active session' };
80
- lastOutput = step.config?.prompt;
81
-
82
- } else if (step.type === 'delay') {
83
- const seconds = Math.min(step.config?.seconds || 1, 30);
84
- await new Promise(resolve => setTimeout(resolve, seconds * 1000));
85
- stepResult = { delayed: seconds };
86
-
87
- } else {
88
- stepResult = { type: step.type, note: 'Unknown step type' };
89
- }
90
-
91
- results.push({ step: i, label: step.label, type: step.type, success: true, result: stepResult });
92
- await workflowDb.updateRun(run.id, { status: 'running', stepsCompleted: i + 1 });
93
-
94
- } catch (stepError) {
95
- results.push({ step: i, label: step.label, type: step.type, success: false, error: stepError.message });
96
- await workflowDb.updateRun(run.id, { status: 'failed', stepsCompleted: i, error: `Step ${i + 1} (${step.label}): ${stepError.message}` });
97
- await workflowDb.updateLastRun(workflow.id);
98
- return { success: false, run_id: run.id, results, error: `Step ${i + 1} failed: ${stepError.message}` };
99
- }
100
- }
101
-
102
- await workflowDb.updateRun(run.id, { status: 'completed', stepsCompleted: steps.length, result: results });
103
- await workflowDb.updateLastRun(workflow.id);
104
- return { success: true, run_id: run.id, results };
105
- }
106
-
107
- /**
108
- * Schedule a single workflow's cron job.
109
- */
110
- function scheduleWorkflow(workflow) {
111
- const id = workflow.id;
112
-
113
- // Stop existing job if any
114
- if (activeJobs.has(id)) {
115
- activeJobs.get(id).stop();
116
- activeJobs.delete(id);
117
- }
118
-
119
- if (!workflow.schedule || !workflow.schedule_enabled) return;
120
-
121
- // Validate cron expression
122
- if (!cron.validate(workflow.schedule)) {
123
- console.warn(`[Scheduler] Invalid cron for workflow ${id}: ${workflow.schedule}`);
124
- return;
125
- }
126
-
127
- const task = cron.schedule(workflow.schedule, async () => {
128
- console.log(`[Scheduler] Running workflow ${id}: ${workflow.name}`);
129
- try {
130
- await executeWorkflow(workflow);
131
- } catch (err) {
132
- console.error(`[Scheduler] Workflow ${id} execution error:`, err.message);
133
- }
134
- }, {
135
- timezone: workflow.schedule_timezone || 'UTC'
136
- });
137
-
138
- activeJobs.set(id, task);
139
- console.log(`[Scheduler] Scheduled workflow ${id} (${workflow.name}): ${workflow.schedule}`);
140
- }
141
-
142
- /**
143
- * Load all scheduled workflows from DB and start their cron jobs.
144
- * Call this once at server startup.
145
- */
146
- async function initScheduler() {
147
- try {
148
- const workflows = await workflowDb.getScheduled();
149
- console.log(`[Scheduler] Found ${workflows.length} scheduled workflow(s)`);
150
- for (const wf of workflows) {
151
- scheduleWorkflow(wf);
152
- }
153
- } catch (err) {
154
- console.error('[Scheduler] Init error:', err.message);
155
- }
156
- }
157
-
158
- /**
159
- * Re-sync a specific workflow's schedule (call after create/update).
160
- */
161
- async function refreshWorkflowSchedule(workflowId, userId) {
162
- try {
163
- const wf = await workflowDb.getById(workflowId, userId);
164
- if (wf) {
165
- scheduleWorkflow(wf);
166
- } else {
167
- // Workflow deleted — stop its job
168
- if (activeJobs.has(workflowId)) {
169
- activeJobs.get(workflowId).stop();
170
- activeJobs.delete(workflowId);
171
- }
172
- }
173
- } catch { /* ignore */ }
174
- }
175
-
176
- /**
177
- * Stop a workflow's cron job.
178
- */
179
- function stopWorkflowSchedule(workflowId) {
180
- if (activeJobs.has(workflowId)) {
181
- activeJobs.get(workflowId).stop();
182
- activeJobs.delete(workflowId);
183
- }
184
- }
185
-
186
- export { initScheduler, refreshWorkflowSchedule, stopWorkflowSchedule, executeWorkflow };
@@ -1,303 +0,0 @@
1
- import matter from 'gray-matter';
2
- import { promises as fs } from 'fs';
3
- import path from 'path';
4
- import { execFile } from 'child_process';
5
- import { promisify } from 'util';
6
- import { parse as parseShellCommand } from 'shell-quote';
7
-
8
- const execFileAsync = promisify(execFile);
9
-
10
- // Configuration
11
- const MAX_INCLUDE_DEPTH = 3;
12
- const BASH_TIMEOUT = 30000; // 30 seconds
13
- const BASH_COMMAND_ALLOWLIST = [
14
- 'echo',
15
- 'ls',
16
- 'pwd',
17
- 'date',
18
- 'whoami',
19
- 'git',
20
- 'npm',
21
- 'node',
22
- 'cat',
23
- 'grep',
24
- 'find',
25
- 'task-master'
26
- ];
27
-
28
- /**
29
- * Parse a markdown command file and extract frontmatter and content
30
- * @param {string} content - Raw markdown content
31
- * @returns {object} Parsed command with data (frontmatter) and content
32
- */
33
- export function parseCommand(content) {
34
- try {
35
- const parsed = matter(content);
36
- return {
37
- data: parsed.data || {},
38
- content: parsed.content || '',
39
- raw: content
40
- };
41
- } catch (error) {
42
- throw new Error(`Failed to parse command: ${error.message}`);
43
- }
44
- }
45
-
46
- /**
47
- * Replace argument placeholders in content
48
- * @param {string} content - Content with placeholders
49
- * @param {string|array} args - Arguments to replace (string or array)
50
- * @returns {string} Content with replaced arguments
51
- */
52
- export function replaceArguments(content, args) {
53
- if (!content) return content;
54
-
55
- let result = content;
56
-
57
- // Convert args to array if it's a string
58
- const argsArray = Array.isArray(args) ? args : (args ? [args] : []);
59
-
60
- // Replace $ARGUMENTS with all arguments joined by space
61
- const allArgs = argsArray.join(' ');
62
- result = result.replace(/\$ARGUMENTS/g, allArgs);
63
-
64
- // Replace positional arguments $1-$9
65
- for (let i = 1; i <= 9; i++) {
66
- const regex = new RegExp(`\\$${i}`, 'g');
67
- const value = argsArray[i - 1] || '';
68
- result = result.replace(regex, value);
69
- }
70
-
71
- return result;
72
- }
73
-
74
- /**
75
- * Validate file path to prevent directory traversal
76
- * @param {string} filePath - Path to validate
77
- * @param {string} basePath - Base directory path
78
- * @returns {boolean} True if path is safe
79
- */
80
- export function isPathSafe(filePath, basePath) {
81
- const resolvedPath = path.resolve(basePath, filePath);
82
- const resolvedBase = path.resolve(basePath);
83
- const relative = path.relative(resolvedBase, resolvedPath);
84
- return (
85
- relative !== '' &&
86
- !relative.startsWith('..') &&
87
- !path.isAbsolute(relative)
88
- );
89
- }
90
-
91
- /**
92
- * Process file includes in content (@filename syntax)
93
- * @param {string} content - Content with @filename includes
94
- * @param {string} basePath - Base directory for resolving file paths
95
- * @param {number} depth - Current recursion depth
96
- * @returns {Promise<string>} Content with includes resolved
97
- */
98
- export async function processFileIncludes(content, basePath, depth = 0) {
99
- if (!content) return content;
100
-
101
- // Prevent infinite recursion
102
- if (depth >= MAX_INCLUDE_DEPTH) {
103
- throw new Error(`Maximum include depth (${MAX_INCLUDE_DEPTH}) exceeded`);
104
- }
105
-
106
- // Match @filename patterns (at start of line or after whitespace)
107
- const includePattern = /(?:^|\s)@([^\s]+)/gm;
108
- const matches = [...content.matchAll(includePattern)];
109
-
110
- if (matches.length === 0) {
111
- return content;
112
- }
113
-
114
- let result = content;
115
-
116
- for (const match of matches) {
117
- const fullMatch = match[0];
118
- const filename = match[1];
119
-
120
- // Security: prevent directory traversal
121
- if (!isPathSafe(filename, basePath)) {
122
- throw new Error(`Invalid file path (directory traversal detected): ${filename}`);
123
- }
124
-
125
- try {
126
- const filePath = path.resolve(basePath, filename);
127
- const fileContent = await fs.readFile(filePath, 'utf-8');
128
-
129
- // Recursively process includes in the included file
130
- const processedContent = await processFileIncludes(fileContent, basePath, depth + 1);
131
-
132
- // Replace the @filename with the file content
133
- result = result.replace(fullMatch, fullMatch.startsWith(' ') ? ' ' + processedContent : processedContent);
134
- } catch (error) {
135
- if (error.code === 'ENOENT') {
136
- throw new Error(`File not found: ${filename}`);
137
- }
138
- throw error;
139
- }
140
- }
141
-
142
- return result;
143
- }
144
-
145
- /**
146
- * Validate that a command and its arguments are safe
147
- * @param {string} commandString - Command string to validate
148
- * @returns {{ allowed: boolean, command: string, args: string[], error?: string }} Validation result
149
- */
150
- export function validateCommand(commandString) {
151
- const trimmedCommand = commandString.trim();
152
- if (!trimmedCommand) {
153
- return { allowed: false, command: '', args: [], error: 'Empty command' };
154
- }
155
-
156
- // Parse the command using shell-quote to handle quotes properly
157
- const parsed = parseShellCommand(trimmedCommand);
158
-
159
- // Check for shell operators or control structures
160
- const hasOperators = parsed.some(token =>
161
- typeof token === 'object' && token.op
162
- );
163
-
164
- if (hasOperators) {
165
- return {
166
- allowed: false,
167
- command: '',
168
- args: [],
169
- error: 'Shell operators (&&, ||, |, ;, etc.) are not allowed'
170
- };
171
- }
172
-
173
- // Extract command and args (all should be strings after validation)
174
- const tokens = parsed.filter(token => typeof token === 'string');
175
-
176
- if (tokens.length === 0) {
177
- return { allowed: false, command: '', args: [], error: 'No valid command found' };
178
- }
179
-
180
- const [command, ...args] = tokens;
181
-
182
- // Extract just the command name (remove path if present)
183
- const commandName = path.basename(command);
184
-
185
- // Check if command exactly matches allowlist (no prefix matching)
186
- const isAllowed = BASH_COMMAND_ALLOWLIST.includes(commandName);
187
-
188
- if (!isAllowed) {
189
- return {
190
- allowed: false,
191
- command: commandName,
192
- args,
193
- error: `Command '${commandName}' is not in the allowlist`
194
- };
195
- }
196
-
197
- // Validate arguments don't contain dangerous metacharacters
198
- const dangerousPattern = /[;&|`$()<>{}[\]\\]/;
199
- for (const arg of args) {
200
- if (dangerousPattern.test(arg)) {
201
- return {
202
- allowed: false,
203
- command: commandName,
204
- args,
205
- error: `Argument contains dangerous characters: ${arg}`
206
- };
207
- }
208
- }
209
-
210
- return { allowed: true, command: commandName, args };
211
- }
212
-
213
- /**
214
- * Backward compatibility: Check if command is allowed (deprecated)
215
- * @deprecated Use validateCommand() instead for better security
216
- * @param {string} command - Command to validate
217
- * @returns {boolean} True if command is allowed
218
- */
219
- export function isBashCommandAllowed(command) {
220
- const result = validateCommand(command);
221
- return result.allowed;
222
- }
223
-
224
- /**
225
- * Sanitize bash command output
226
- * @param {string} output - Raw command output
227
- * @returns {string} Sanitized output
228
- */
229
- export function sanitizeOutput(output) {
230
- if (!output) return '';
231
-
232
- // Remove control characters except \t, \n, \r
233
- return [...output]
234
- .filter(ch => {
235
- const code = ch.charCodeAt(0);
236
- return code === 9 // \t
237
- || code === 10 // \n
238
- || code === 13 // \r
239
- || (code >= 32 && code !== 127);
240
- })
241
- .join('');
242
- }
243
-
244
- /**
245
- * Process bash commands in content (!command syntax)
246
- * @param {string} content - Content with !command syntax
247
- * @param {object} options - Options for bash execution
248
- * @returns {Promise<string>} Content with bash commands executed and replaced
249
- */
250
- export async function processBashCommands(content, options = {}) {
251
- if (!content) return content;
252
-
253
- const { cwd = process.cwd(), timeout = BASH_TIMEOUT } = options;
254
-
255
- // Match !command patterns (at start of line or after whitespace)
256
- const commandPattern = /(?:^|\n)!(.+?)(?=\n|$)/g;
257
- const matches = [...content.matchAll(commandPattern)];
258
-
259
- if (matches.length === 0) {
260
- return content;
261
- }
262
-
263
- let result = content;
264
-
265
- for (const match of matches) {
266
- const fullMatch = match[0];
267
- const commandString = match[1].trim();
268
-
269
- // Security: validate command and parse args
270
- const validation = validateCommand(commandString);
271
-
272
- if (!validation.allowed) {
273
- throw new Error(`Command not allowed: ${commandString} - ${validation.error}`);
274
- }
275
-
276
- try {
277
- // Execute without shell using execFile with parsed args
278
- const { stdout, stderr } = await execFileAsync(
279
- validation.command,
280
- validation.args,
281
- {
282
- cwd,
283
- timeout,
284
- maxBuffer: 1024 * 1024, // 1MB max output
285
- shell: false, // IMPORTANT: No shell interpretation
286
- env: { ...process.env, PATH: process.env.PATH } // Inherit PATH for finding commands
287
- }
288
- );
289
-
290
- const output = sanitizeOutput(stdout || stderr || '');
291
-
292
- // Replace the !command with the output
293
- result = result.replace(fullMatch, fullMatch.startsWith('\n') ? '\n' + output : output);
294
- } catch (error) {
295
- if (error.killed) {
296
- throw new Error(`Command timeout: ${commandString}`);
297
- }
298
- throw new Error(`Command failed: ${commandString} - ${error.message}`);
299
- }
300
- }
301
-
302
- return result;
303
- }
@@ -1,24 +0,0 @@
1
- import { exec } from 'child_process';
2
- import { promisify } from 'util';
3
-
4
- const execAsync = promisify(exec);
5
-
6
- /**
7
- * Read git configuration from system's global git config
8
- * @returns {Promise<{git_name: string|null, git_email: string|null}>}
9
- */
10
- export async function getSystemGitConfig() {
11
- try {
12
- const [nameResult, emailResult] = await Promise.all([
13
- execAsync('git config --global user.name').catch(() => ({ stdout: '' })),
14
- execAsync('git config --global user.email').catch(() => ({ stdout: '' }))
15
- ]);
16
-
17
- return {
18
- git_name: nameResult.stdout.trim() || null,
19
- git_email: emailResult.stdout.trim() || null
20
- };
21
- } catch (error) {
22
- return { git_name: null, git_email: null };
23
- }
24
- }
@@ -1,198 +0,0 @@
1
- /**
2
- * MCP SERVER DETECTION UTILITY
3
- * ============================
4
- *
5
- * Centralized utility for detecting MCP server configurations.
6
- * Used across TaskMaster integration and other MCP-dependent features.
7
- */
8
-
9
- import { promises as fsPromises } from 'fs';
10
- import path from 'path';
11
- import os from 'os';
12
-
13
- /**
14
- * Check if task-master-ai MCP server is configured
15
- * Reads directly from Claude configuration files like claude-cli.js does
16
- * @returns {Promise<Object>} MCP detection result
17
- */
18
- export async function detectTaskMasterMCPServer() {
19
- try {
20
- // Read Claude configuration files directly (same logic as mcp.js)
21
- const homeDir = os.homedir();
22
- const configPaths = [
23
- path.join(homeDir, '.claude.json'),
24
- path.join(homeDir, '.claude', 'settings.json')
25
- ];
26
-
27
- let configData = null;
28
- let configPath = null;
29
-
30
- // Try to read from either config file
31
- for (const filepath of configPaths) {
32
- try {
33
- const fileContent = await fsPromises.readFile(filepath, 'utf8');
34
- configData = JSON.parse(fileContent);
35
- configPath = filepath;
36
- break;
37
- } catch (error) {
38
- // File doesn't exist or is not valid JSON, try next
39
- continue;
40
- }
41
- }
42
-
43
- if (!configData) {
44
- return {
45
- hasMCPServer: false,
46
- reason: 'No Claude configuration file found',
47
- hasConfig: false
48
- };
49
- }
50
-
51
- // Look for task-master-ai in user-scoped MCP servers
52
- let taskMasterServer = null;
53
- if (configData.mcpServers && typeof configData.mcpServers === 'object') {
54
- const serverEntry = Object.entries(configData.mcpServers).find(([name, config]) =>
55
- name === 'task-master-ai' ||
56
- name.includes('task-master') ||
57
- (config && config.command && config.command.includes('task-master'))
58
- );
59
-
60
- if (serverEntry) {
61
- const [name, config] = serverEntry;
62
- taskMasterServer = {
63
- name,
64
- scope: 'user',
65
- config,
66
- type: config.command ? 'stdio' : (config.url ? 'http' : 'unknown')
67
- };
68
- }
69
- }
70
-
71
- // Also check project-specific MCP servers if not found globally
72
- if (!taskMasterServer && configData.projects) {
73
- for (const [projectPath, projectConfig] of Object.entries(configData.projects)) {
74
- if (projectConfig.mcpServers && typeof projectConfig.mcpServers === 'object') {
75
- const serverEntry = Object.entries(projectConfig.mcpServers).find(([name, config]) =>
76
- name === 'task-master-ai' ||
77
- name.includes('task-master') ||
78
- (config && config.command && config.command.includes('task-master'))
79
- );
80
-
81
- if (serverEntry) {
82
- const [name, config] = serverEntry;
83
- taskMasterServer = {
84
- name,
85
- scope: 'local',
86
- projectPath,
87
- config,
88
- type: config.command ? 'stdio' : (config.url ? 'http' : 'unknown')
89
- };
90
- break;
91
- }
92
- }
93
- }
94
- }
95
-
96
- if (taskMasterServer) {
97
- const isValid = !!(taskMasterServer.config &&
98
- (taskMasterServer.config.command || taskMasterServer.config.url));
99
- const hasEnvVars = !!(taskMasterServer.config &&
100
- taskMasterServer.config.env &&
101
- Object.keys(taskMasterServer.config.env).length > 0);
102
-
103
- return {
104
- hasMCPServer: true,
105
- isConfigured: isValid,
106
- hasApiKeys: hasEnvVars,
107
- scope: taskMasterServer.scope,
108
- config: {
109
- command: taskMasterServer.config?.command,
110
- args: taskMasterServer.config?.args || [],
111
- url: taskMasterServer.config?.url,
112
- envVars: hasEnvVars ? Object.keys(taskMasterServer.config.env) : [],
113
- type: taskMasterServer.type
114
- }
115
- };
116
- } else {
117
- // Get list of available servers for debugging
118
- const availableServers = [];
119
- if (configData.mcpServers) {
120
- availableServers.push(...Object.keys(configData.mcpServers));
121
- }
122
- if (configData.projects) {
123
- for (const projectConfig of Object.values(configData.projects)) {
124
- if (projectConfig.mcpServers) {
125
- availableServers.push(...Object.keys(projectConfig.mcpServers).map(name => `local:${name}`));
126
- }
127
- }
128
- }
129
-
130
- return {
131
- hasMCPServer: false,
132
- reason: 'task-master-ai not found in configured MCP servers',
133
- hasConfig: true,
134
- configPath,
135
- availableServers
136
- };
137
- }
138
- } catch (error) {
139
- console.error('Error detecting MCP server config:', error);
140
- return {
141
- hasMCPServer: false,
142
- reason: `Error checking MCP config: ${error.message}`,
143
- hasConfig: false
144
- };
145
- }
146
- }
147
-
148
- /**
149
- * Get all configured MCP servers (not just TaskMaster)
150
- * @returns {Promise<Object>} All MCP servers configuration
151
- */
152
- export async function getAllMCPServers() {
153
- try {
154
- const homeDir = os.homedir();
155
- const configPaths = [
156
- path.join(homeDir, '.claude.json'),
157
- path.join(homeDir, '.claude', 'settings.json')
158
- ];
159
-
160
- let configData = null;
161
- let configPath = null;
162
-
163
- // Try to read from either config file
164
- for (const filepath of configPaths) {
165
- try {
166
- const fileContent = await fsPromises.readFile(filepath, 'utf8');
167
- configData = JSON.parse(fileContent);
168
- configPath = filepath;
169
- break;
170
- } catch (error) {
171
- continue;
172
- }
173
- }
174
-
175
- if (!configData) {
176
- return {
177
- hasConfig: false,
178
- servers: {},
179
- projectServers: {}
180
- };
181
- }
182
-
183
- return {
184
- hasConfig: true,
185
- configPath,
186
- servers: configData.mcpServers || {},
187
- projectServers: configData.projects || {}
188
- };
189
- } catch (error) {
190
- console.error('Error getting all MCP servers:', error);
191
- return {
192
- hasConfig: false,
193
- error: error.message,
194
- servers: {},
195
- projectServers: {}
196
- };
197
- }
198
- }